BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RootCorrectedETSCnv.cxx
Go to the documentation of this file.
2#include "CalibData/Ets/CorrectedETSCal.h"
3#include "CalibDataSvc/IInstrumentName.h"
4#include "GaudiKernel/MsgStream.h"
5
6#include "TDirectory.h"
7#include "TFile.h"
8#include "TObject.h"
9#include "TTree.h"
10
11#include "GaudiKernel/DataObject.h"
12#include "GaudiKernel/GenericAddress.h"
13#include "GaudiKernel/IAddressCreator.h"
14#include "GaudiKernel/IConversionSvc.h"
15#include "GaudiKernel/IDataProviderSvc.h"
16#include "GaudiKernel/IOpaqueAddress.h"
17
18#include "CalibDataSvc/ICalibMetaCnvSvc.h"
19#include "CalibDataSvc/ICalibRootSvc.h" //maybe
20
21// Temporary. Hope to find a better way to do this
22#include "CalibData/CalibModel.h"
23using namespace CalibData;
24
27
29
31
32StatusCode RootCorrectedETSCnv::i_createObj( const std::string& fname,
33 DataObject*& refpObject ) {
34
35 MsgStream log( msgSvc(), "RootCorrectedETSCnv" );
36 log << MSG::DEBUG << "SetProperty" << endmsg;
37
38 StatusCode sc = openRead( fname );
39 if ( !sc ) { log << MSG::ERROR << "unable to open files" << endmsg; }
40
42 // Read in our object
43 int i;
44 int nentries;
45
46 // read TestCalibConst ------------------------------------------------------------
47
48 int no;
49 // unsigned long IST;
50 ULong64_t ets1, ets2_pre, flag_pre;
51 int trigChannel_9, evt;
52
53 if ( m_inFile->Read( "event" ) )
54 {
55 TTree* tree = (TTree*)m_inFile->Get( "event" );
56 tree->SetBranchAddress( "ets1", &ets1 );
57 tree->SetBranchAddress( "ets2_pre", &ets2_pre );
58 tree->SetBranchAddress( "flag_pre", &flag_pre );
59 tree->SetBranchAddress( "trigChannel_9", &trigChannel_9 );
60 tree->SetBranchAddress( "evt", &evt );
61 }
62 TTree* tree = (TTree*)m_inFile->Get( "event" );
63 no = tree->GetEntries();
64 tmpObject->setNpar( no );
65 for ( i = 0; i < no; i++ )
66 {
67 tree->GetEntry( i );
68 tmpObject->setEts1( ets1 );
69 tmpObject->setEts2_pre( ets2_pre );
70 tmpObject->setFlag_pre( flag_pre );
71 tmpObject->setTrigChannel_9( trigChannel_9 );
72 tmpObject->setEvt( evt );
73 }
74
75 refpObject = tmpObject;
76
77 return StatusCode::SUCCESS;
78}
79
80StatusCode RootCorrectedETSCnv::createRoot( const std::string& fname,
81 CalibData::CalibBase1* pTDSObj ) {
82
83 MsgStream log( msgSvc(), "RootCorrectedETSCnv" );
84
85 // Open the file, create the branch
86 StatusCode sc = openWrite( fname );
87 if ( !sc ) { log << MSG::ERROR << "unable to open files" << endmsg; }
88
89 log << MSG::INFO << "successfully create RootFile" << endmsg;
90 return sc;
91}
Int_t nentries
IMessageSvc * msgSvc()
void setFlag_pre(unsigned long flag_pre)
void setTrigChannel_9(int trigChannel_9)
void setEts1(unsigned long ets1)
void setEts2_pre(unsigned long ets2_pre)
StatusCode openRead(const std::string &fname)
RootCalBaseCnv(ISvcLocator *svc, const CLID &clid)
virtual StatusCode openWrite(const std::string &fname)
RootCorrectedETSCnv(ISvcLocator *svc)
const CLID & objType() const
static const CLID & classID()
virtual StatusCode i_createObj(const std::string &fname, DataObject *&refpObject)
virtual StatusCode createRoot(const std::string &fname, CalibData::CalibBase1 *pTDSObj)