BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RootInjSigTimeCnv.cxx
Go to the documentation of this file.
1#include "RootInjSigTimeCnv.h"
2#include "CalibData/Ets/InjSigTimeCal.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 RootInjSigTimeCnv::i_createObj( const std::string& fname,
33 DataObject*& refpObject ) {
34
35 MsgStream log( msgSvc(), "RootInjSigTimeCnv" );
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 IST;
51 int flag;
52
53 if ( m_inFile->Read( "ist" ) )
54 {
55 TTree* tree = (TTree*)m_inFile->Get( "ist" );
56 tree->SetBranchAddress( "IST", &IST );
57 tree->SetBranchAddress( "flag", &flag );
58 }
59 TTree* tree = (TTree*)m_inFile->Get( "ist" );
60 no = tree->GetEntries();
61 tmpObject->setNpar( no );
62 for ( i = 0; i < no; i++ )
63 {
64 tree->GetEntry( i );
65 tmpObject->setFlag( flag );
66 tmpObject->setIST( IST );
67 }
68
69 refpObject = tmpObject;
70
71 return StatusCode::SUCCESS;
72}
73
74StatusCode RootInjSigTimeCnv::createRoot( const std::string& fname,
75 CalibData::CalibBase1* pTDSObj ) {
76
77 MsgStream log( msgSvc(), "RootInjSigTimeCnv" );
78
79 // Open the file, create the branch
80 StatusCode sc = openWrite( fname );
81 if ( !sc ) { log << MSG::ERROR << "unable to open files" << endmsg; }
82
83 log << MSG::INFO << "successfully create RootFile" << endmsg;
84 return sc;
85}
Int_t nentries
IMessageSvc * msgSvc()
void setIST(const ULong64_t Ist)
void setFlag(const int flag)
StatusCode openRead(const std::string &fname)
RootCalBaseCnv(ISvcLocator *svc, const CLID &clid)
virtual StatusCode openWrite(const std::string &fname)
virtual StatusCode i_createObj(const std::string &fname, DataObject *&refpObject)
static const CLID & classID()
virtual StatusCode createRoot(const std::string &fname, CalibData::CalibBase1 *pTDSObj)
RootInjSigTimeCnv(ISvcLocator *svc)
const CLID & objType() const