BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RootInjSigTimeCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
2#include "RootInjSigTimeCnv.h"
5
6#include "TFile.h"
7#include "TTree.h"
8#include "TDirectory.h"
9#include "TObject.h"
10
11#include "GaudiKernel/CnvFactory.h"
12#include "GaudiKernel/IOpaqueAddress.h"
13#include "GaudiKernel/DataObject.h"
14#include "GaudiKernel/IAddressCreator.h"
15#include "GaudiKernel/IDataProviderSvc.h"
16#include "GaudiKernel/IConversionSvc.h"
17#include "GaudiKernel/GenericAddress.h"
18
19#include "CalibDataSvc/ICalibRootSvc.h" //maybe
21
22// Temporary. Hope to find a better way to do this
24using namespace CalibData;
25
26
29
30}
31
32
33const CLID& RootInjSigTimeCnv::objType() const {
35}
36
39}
40
41StatusCode RootInjSigTimeCnv::i_createObj(const std::string& fname,
42 DataObject*& refpObject) {
43
44 MsgStream log(msgSvc(), "RootInjSigTimeCnv");
45 log<<MSG::DEBUG<<"SetProperty"<<endreq;
46
47 StatusCode sc = openRead(fname);
48 if(!sc)
49 { log<<MSG::ERROR<<"unable to open files"<<endreq;
50 }
51
53 // Read in our object
54 int i;
55 int nentries;
56
57 // read TestCalibConst ------------------------------------------------------------
58
59 int no;
60 // unsigned long IST;
61 ULong64_t IST;
62 int flag;
63
64 if( m_inFile->Read("ist") ) {
65 TTree *tree = (TTree*)m_inFile -> Get("ist");
66 tree->SetBranchAddress("IST", &IST);
67 tree->SetBranchAddress("flag", &flag);
68 }
69 TTree *tree = (TTree*)m_inFile -> Get("ist");
70 no = tree->GetEntries();
71 tmpObject ->setNpar(no);
72 for(i=0; i<no; i++){
73 tree->GetEntry(i);
74 tmpObject ->setFlag(flag);
75 tmpObject ->setIST(IST);
76 }
77
78 refpObject=tmpObject;
79
80 return StatusCode::SUCCESS;
81}
82
83StatusCode RootInjSigTimeCnv::createRoot(const std::string& fname,
84 CalibData::CalibBase1* pTDSObj) {
85
86 MsgStream log(msgSvc(), "RootInjSigTimeCnv");
87
88 // Open the file, create the branch
89 StatusCode sc = openWrite(fname);
90 if(!sc)
91 { log<<MSG::ERROR<<"unable to open files"<<endreq;
92 }
93
94 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
95 return sc;
96
97}
const CLID CLID_Calib_InjSigTime
Definition: CalibModel.h:67
const int no
Int_t nentries
IMessageSvc * msgSvc()
void setIST(const ULong64_t Ist)
void setFlag(const int flag)
void setNpar(const int npar)
Definition: InjSigTimeCal.h:27
StatusCode openRead(const std::string &fname)
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