BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
RootCorrectedETSCnv.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.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
31
32
33const CLID& RootCorrectedETSCnv::objType() const {
35}
36
40
41StatusCode RootCorrectedETSCnv::i_createObj(const std::string& fname,
42 DataObject*& refpObject) {
43
44 MsgStream log(msgSvc(), "RootCorrectedETSCnv");
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 ets1,ets2_pre,flag_pre;
62 int trigChannel_9,evt;
63
64 if( m_inFile->Read("event") ) {
65 TTree *tree = (TTree*)m_inFile -> Get("event");
66 tree->SetBranchAddress("ets1", &ets1);
67 tree->SetBranchAddress("ets2_pre", &ets2_pre);
68 tree->SetBranchAddress("flag_pre", &flag_pre);
69 tree->SetBranchAddress("trigChannel_9", &trigChannel_9);
70 tree->SetBranchAddress("evt", &evt);
71 }
72 TTree *tree = (TTree*)m_inFile -> Get("event");
73 no = tree->GetEntries();
74 tmpObject ->setNpar(no);
75 for(i=0; i<no; i++){
76 tree->GetEntry(i);
77 tmpObject ->setEts1(ets1);
78 tmpObject ->setEts2_pre(ets2_pre);
79 tmpObject ->setFlag_pre(flag_pre);
80 tmpObject ->setTrigChannel_9(trigChannel_9);
81 tmpObject ->setEvt(evt);
82 }
83
84 refpObject=tmpObject;
85
86 return StatusCode::SUCCESS;
87}
88
89StatusCode RootCorrectedETSCnv::createRoot(const std::string& fname,
90 CalibData::CalibBase1* pTDSObj) {
91
92 MsgStream log(msgSvc(), "RootCorrectedETSCnv");
93
94 // Open the file, create the branch
95 StatusCode sc = openWrite(fname);
96 if(!sc)
97 { log<<MSG::ERROR<<"unable to open files"<<endreq;
98 }
99
100 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
101 return sc;
102
103}
const CLID CLID_Calib_CorrectedETS
Definition CalibModel.h:71
const int no
Int_t nentries
IMessageSvc * msgSvc()
void setFlag_pre(unsigned long flag_pre)
void setTrigChannel_9(int trigChannel_9)
void setEts1(unsigned long ets1)
void setNpar(const int npar)
void setEts2_pre(unsigned long ets2_pre)
StatusCode openRead(const std::string &fname)
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)