BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeEstTofCalibDataCnv Class Reference

#include <TreeEstTofCalibDataCnv.h>

+ Inheritance diagram for TreeEstTofCalibDataCnv:

Public Member Functions

const CLID & objType () const
 
 TreeEstTofCalibDataCnv (ISvcLocator *svc)
 
virtual ~TreeEstTofCalibDataCnv ()
 
virtual long repSvcType () const
 
- Public Member Functions inherited from TreeCalBaseCnv
virtual ~TreeCalBaseCnv ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&refpObject)
 
ICalibTreeSvcgetCalibTreeSvc ()
 
 TreeCalBaseCnv (ISvcLocator *svc, const CLID &clid)
 
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
- Static Public Member Functions inherited from TreeCalBaseCnv
static const unsigned char storageType ()
 

Protected Member Functions

virtual StatusCode i_createObj (IOpaqueAddress *address, DataObject *&refpObject)
 
- Protected Member Functions inherited from TreeCalBaseCnv
virtual StatusCode internalCreateObj (DataObject *&refpObject, IOpaqueAddress *address)
 
virtual StatusCode i_createObj (IOpaqueAddress *address, DataObject *&refpObject)
 
virtual StatusCode i_processObj (DataObject *pObject, IOpaqueAddress *address)
 In case there is additional work to do on the created object.
 
virtual StatusCode fillRoot (CalibData::CalibBase *pTDSObj, TObject *pRootObj)
 
void setBaseInfo (CalibData::CalibBase1 *pObj)
 Another utility for derived classes to use.
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< TreeEstTofCalibDataCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from TreeCalBaseCnv
ICalibTreeSvcm_treeSvc
 
ICalibMetaCnvSvcm_metaSvc
 
IInstrumentNamem_instrSvc
 
int m_serNo
 
int m_runfrm
 
int m_runto
 
TFile * m_outFile
 
TTree * m_ttree
 
TFile * m_inFile
 
TDirectory * m_saveDir
 

Detailed Description

Base class for CAL calibration converters from Ttrees to TCDS. All such converters need to do certain things, which are handled here. Methods common to all calibrations are in the base class TreeCalBaseCnv

Author
huang bin

Definition at line 20 of file TreeEstTofCalibDataCnv.h.

Constructor & Destructor Documentation

◆ TreeEstTofCalibDataCnv()

TreeEstTofCalibDataCnv::TreeEstTofCalibDataCnv ( ISvcLocator *  svc)

Definition at line 35 of file TreeEstTofCalibDataCnv.cxx.

35 :
37
38}
const CLID CLID_Calib_EstTofCal
Definition: CalibModel.h:53

◆ ~TreeEstTofCalibDataCnv()

virtual TreeEstTofCalibDataCnv::~TreeEstTofCalibDataCnv ( )
inlinevirtual

Definition at line 29 of file TreeEstTofCalibDataCnv.h.

29{};

Member Function Documentation

◆ classID()

const CLID & TreeEstTofCalibDataCnv::classID ( )
static

Definition at line 45 of file TreeEstTofCalibDataCnv.cxx.

45 {
47}

◆ i_createObj()

StatusCode TreeEstTofCalibDataCnv::i_createObj ( IOpaqueAddress *  address,
DataObject *&  refpObject 
)
protectedvirtual

This creates the transient representation of an object from the corresponding ROOT object. This actually does the "new" operation and deals with the attributes of the node. This base class implementation does nothing; it should not normally be called because it doesn't correspond to any TCDS class. Instead, i_createObj of some derived class will be called.

Parameters
fnameThe ROOT file to be read in to be used to builds the object
refpObjectthe object to be built
Returns
status depending on the completion of the call

Reimplemented from TreeCalBaseCnv.

Definition at line 49 of file TreeEstTofCalibDataCnv.cxx.

50 {
51
52 MsgStream log(msgSvc(), "TreeEstTofCalibDataCnv");
53 log<<MSG::DEBUG<<"SetProperty"<<endreq;
54
55 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
56 DatabaseRecord *records=add->pp();
57
58 TBufferFile *buf1 = new TBufferFile(TBuffer::kRead);
59 TBufferFile *buf2 = new TBufferFile(TBuffer::kRead);
60 TBufferFile *buf3 = new TBufferFile(TBuffer::kRead);
61 TBufferFile *buf4 = new TBufferFile(TBuffer::kRead);
62 TBufferFile *buf5 = 0;
63
64 buf1->SetBuffer((*records)["BarTofPar"],1024000,kFALSE);
65 buf2->SetBuffer((*records)["EndTofPar"],1024000,kFALSE);
66 buf3->SetBuffer((*records)["TofConPar"],1024000,kFALSE);
67 buf4->SetBuffer((*records)["BarTof"], 1024000,kFALSE);
68
69 if( (*records)["EtfTofPar"]!=0 ) {
70 buf5 = new TBufferFile(TBuffer::kRead);
71 buf5->SetBuffer((*records)["EtfTofPar"],1024000,kFALSE);
72 }
73
74 std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
75 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
76
77 TTree *btoftree = new TTree();
78 TTree *etoftree = new TTree();
79 TTree *etftree = new TTree();
80 TTree *btofcommontree = new TTree();
81 TTree *CalibInfo = new TTree();
82
83 btoftree->Streamer(*buf1);
84 etoftree->Streamer(*buf2);
85 btofcommontree->Streamer(*buf3);
86 CalibInfo->Streamer(*buf4);
87 if( buf5 ) {
88 etftree->Streamer(*buf5);
89 }
90
96
97 std::vector<CalibData::bTofCalibBase> tmpbTof;
98 std::vector<CalibData::eTofCalibBase> tmpeTof;
99 std::vector<CalibData::etfCalibBase> tmpetf;
100 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
101 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
102
103 // Read in the object
104 int cnt;
105 // read btoftree ------------------------------------------------------------
106 double cnvBarPar1[nBarPar];
107 double cnvBarPar2[nBarPar];
108 double cnvBarParOff1_bunch0[nBarParOff];
109 double cnvBarParOff2_bunch0[nBarParOff];
110 double cnvBarParOff1_bunch1[nBarParOff];
111 double cnvBarParOff2_bunch1[nBarParOff];
112 double cnvBarParOff1_bunch2[nBarParOff];
113 double cnvBarParOff2_bunch2[nBarParOff];
114 double cnvBarParOff1_bunch3[nBarParOff];
115 double cnvBarParOff2_bunch3[nBarParOff];
116
117 char brname[10];
118 for( unsigned int i=0; i<nBarPar; i++ ) {
119 sprintf( brname, "P%i", i );
120 btoftree -> SetBranchAddress( brname, &cnvBarPar1[i] );
121 }
122 for( unsigned int i=0; i<nBarPar; i++ ) {
123 sprintf( brname, "P%i", i+nBarPar );
124 btoftree -> SetBranchAddress( brname, &cnvBarPar2[i] );
125 }
126 for( unsigned int i=0; i<nBarParOff; i++ ) {
127 sprintf( brname, "Bunch0_Poff%i", i );
128 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch0[i] );
129 }
130 for( unsigned int i=0; i<nBarParOff; i++ ) {
131 sprintf( brname, "Bunch0_Poff%i", i+nBarParOff );
132 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch0[i] );
133 }
134 for( unsigned int i=0; i<nBarParOff; i++ ) {
135 sprintf( brname, "Bunch1_Poff%i", i );
136 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch1[i] );
137 }
138 for( unsigned int i=0; i<nBarParOff; i++ ) {
139 sprintf( brname, "Bunch1_Poff%i", i+nBarParOff );
140 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch1[i] );
141 }
142 for( unsigned int i=0; i<nBarParOff; i++ ) {
143 sprintf( brname, "Bunch2_Poff%i", i );
144 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch2[i] );
145 }
146 for( unsigned int i=0; i<nBarParOff; i++ ) {
147 sprintf( brname, "Bunch2_Poff%i", i+nBarParOff );
148 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch2[i] );
149 }
150 for( unsigned int i=0; i<nBarParOff; i++ ) {
151 sprintf( brname, "Bunch3_Poff%i", i );
152 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch3[i] );
153 }
154 for( unsigned int i=0; i<nBarParOff; i++ ) {
155 sprintf( brname, "Bunch3_Poff%i", i+nBarParOff );
156 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch3[i] );
157 }
158
159 int entries = btoftree->GetEntries();
160 for(cnt=0; cnt<entries; cnt++){
161 btoftree -> GetEntry( cnt );
162 bTof.setP1( cnvBarPar1 );
163 bTof.setP2( cnvBarPar2 );
164 bTof.setPoff1_bunch0( cnvBarParOff1_bunch0 );
165 bTof.setPoff2_bunch0( cnvBarParOff2_bunch0 );
166 bTof.setPoff1_bunch1( cnvBarParOff1_bunch1 );
167 bTof.setPoff2_bunch1( cnvBarParOff2_bunch1 );
168 bTof.setPoff1_bunch2( cnvBarParOff1_bunch2 );
169 bTof.setPoff2_bunch2( cnvBarParOff2_bunch2 );
170 bTof.setPoff1_bunch3( cnvBarParOff1_bunch3 );
171 bTof.setPoff2_bunch3( cnvBarParOff2_bunch3 );
172 tmpbTof.push_back(bTof);
173 }
174
175
176 //read etoftree
177 double cnvEndPar[nEndPar];
178
179 char ecname[10];
180 for( unsigned int i=0; i<nEndPar; i++ ) {
181 sprintf( ecname, "P%i", i );
182 etoftree -> SetBranchAddress( ecname, &cnvEndPar[i] );
183 }
184
185 entries = etoftree->GetEntries();
186 for( cnt=0; cnt<entries; cnt++ ) {
187 etoftree -> GetEntry( cnt );
188 eTof.setP( cnvEndPar );
189 tmpeTof.push_back( eTof );
190 }
191
192
193 //read etftree
194 if( etftree->GetEntries() != 0 ) {
195
196 double cnvEtfPar[nEtfPar];
197 double cnvEtfPar1[nEtfPar];
198 double cnvEtfPar2[nEtfPar];
199
200 char etfname[10];
201 for( unsigned int i=0; i<nEtfPar; i++ ) {
202 sprintf( etfname, "P%i", i );
203 etftree -> SetBranchAddress( etfname, &cnvEtfPar[i] );
204 sprintf( etfname, "P%i", nEtfPar+i );
205 etftree -> SetBranchAddress( etfname, &cnvEtfPar1[i] );
206 sprintf( etfname, "P%i", 2*nEtfPar+i );
207 etftree -> SetBranchAddress( etfname, &cnvEtfPar2[i] );
208 }
209
210 entries = etftree->GetEntries();
211 for(cnt=0; cnt<entries; cnt++){
212 etftree -> GetEntry(cnt);
213 etf.setP( cnvEtfPar );
214 etf.setP1( cnvEtfPar1 );
215 etf.setP2( cnvEtfPar2 );
216 tmpetf.push_back(etf);
217 }
218
219 }
220
221
222 //read bTofCommonCalibBase
223 double cnvBarOffset[nBarOffset];
224 for( unsigned int i=0; i<nBarOffset; i++ ) {
225 sprintf( brname, "t0offset%i", i );
226 btofcommontree-> SetBranchAddress( brname, &cnvBarOffset[i]);
227 }
228
229 entries = btofcommontree->GetEntries();
230 for(cnt=0;cnt<entries;cnt++){
231 btofcommontree->GetEntry(cnt);
232 bTofCommon.setOffset( cnvBarOffset );
233 tmpbTofCommon.push_back(bTofCommon);
234 }
235
236 int m_runFrom, m_runTo, m_eventFrom, m_eventTo; // Modify for n files, wensp
237 if( CalibInfo->GetBranchStatus( "runFrom" ) ) {
238 CalibInfo->SetBranchAddress("runFrom", &m_runFrom );
239 CalibInfo->SetBranchAddress("runTo", &m_runTo );
240 CalibInfo->SetBranchAddress("eventFrom",&m_eventFrom );
241 CalibInfo->SetBranchAddress("eventTo", &m_eventTo );
242 }
243 else {
244 m_runFrom = -1;
245 m_runTo = -1;
246 m_eventFrom = -1;
247 m_eventTo = -1;
248 }
249
250 entries = CalibInfo->GetEntries();
251 for(cnt=0;cnt<entries;cnt++){
252 CalibInfo->GetEntry(cnt);
253 tofinfo.setRunFrom(m_runFrom);
254 tofinfo.setRunTo(m_runTo);
255 tofinfo.setEventFrom(m_eventFrom);
256 tofinfo.setEventTo(m_eventTo);
257 tofinfoCol.push_back(tofinfo);
258 }
259
260 CalibData::TofCalibData *tmpObject = new CalibData::TofCalibData(&tmpbTof,&tmpbTofCommon,&tmpeTof,&tmpetf,&tofinfoCol);
261
262 refpObject=tmpObject;
263 delete btoftree;
264 delete etoftree;
265 delete etftree;
266 delete btofcommontree;
267 delete CalibInfo;
268
269 return StatusCode::SUCCESS;
270}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
data GetEntry(0)
data SetBranchAddress("time",&time)
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nEtfPar
const unsigned int nBarPar
IMessageSvc * msgSvc()
void setP2(const double *TofP2)
void setPoff1_bunch3(const double *TofPoff1_bunch3)
void setPoff2_bunch1(const double *TofPoff2_bunch1)
void setPoff1_bunch0(const double *TofPoff1_bunch0)
void setPoff2_bunch2(const double *TofPoff2_bunch2)
void setPoff1_bunch1(const double *TofPoff1_bunch1)
void setPoff1_bunch2(const double *TofPoff1_bunch2)
void setPoff2_bunch3(const double *TofPoff2_bunch3)
void setPoff2_bunch0(const double *TofPoff2_bunch0)
void setP1(const double *TofP1)
void setOffset(const double *offset)
void setP(const double *TofP)
void setP(const double *etfP)
void setP1(const double *etfP1)
void setP2(const double *etfP2)
void setRunFrom(const int runFrom)
void setEventTo(const int eventTo)
void setRunTo(const int runTo)
void setEventFrom(const int eventFrom)
virtual DatabaseRecord * pp()
Definition: TreeAddress.h:130

◆ objType()

const CLID & TreeEstTofCalibDataCnv::objType ( ) const

Definition at line 41 of file TreeEstTofCalibDataCnv.cxx.

41 {
43}

◆ repSvcType()

virtual long TreeEstTofCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file TreeEstTofCalibDataCnv.h.

34 {
36 }
unsigned const char CALIBTREE_StorageType
Definition: ICalibTreeSvc.h:20

Friends And Related Function Documentation

◆ CnvFactory< TreeEstTofCalibDataCnv >

friend class CnvFactory< TreeEstTofCalibDataCnv >
friend

Definition at line 1 of file TreeEstTofCalibDataCnv.h.


The documentation for this class was generated from the following files: