CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeTofCalibDataCnv Class Reference

#include <TreeTofCalibDataCnv.h>

+ Inheritance diagram for TreeTofCalibDataCnv:

Public Member Functions

const CLID & objType () const
 
 TreeTofCalibDataCnv (ISvcLocator *svc)
 
virtual ~TreeTofCalibDataCnv ()
 
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_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< TreeTofCalibDataCnv >
 

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 TreeTofCalibDataCnv.h.

Constructor & Destructor Documentation

◆ TreeTofCalibDataCnv()

TreeTofCalibDataCnv::TreeTofCalibDataCnv ( ISvcLocator * svc)

Definition at line 44 of file TreeTofCalibDataCnv.cxx.

44 :
46
47 }
const CLID CLID_Calib_TofCal
Definition CalibModel.h:43
TreeCalBaseCnv(ISvcLocator *svc, const CLID &clid)

◆ ~TreeTofCalibDataCnv()

virtual TreeTofCalibDataCnv::~TreeTofCalibDataCnv ( )
inlinevirtual

Definition at line 29 of file TreeTofCalibDataCnv.h.

29{};

Member Function Documentation

◆ classID()

const CLID & TreeTofCalibDataCnv::classID ( )
static

Definition at line 54 of file TreeTofCalibDataCnv.cxx.

54 {
55 return CLID_Calib_TofCal;
56}

◆ i_createObj()

StatusCode TreeTofCalibDataCnv::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 58 of file TreeTofCalibDataCnv.cxx.

59 {
60
61 MsgStream log(msgSvc(), "TreeTofCalibDataCnv");
62 log<<MSG::DEBUG<<"SetProperty"<<endreq;
63
64 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
65
66 DatabaseRecord *records=add->pp();
67
68 TBufferFile *buf1 = new TBufferFile(TBuffer::kRead);
69 TBufferFile *buf2 = new TBufferFile(TBuffer::kRead);
70 TBufferFile *buf3 = new TBufferFile(TBuffer::kRead);
71 TBufferFile *buf4 = new TBufferFile(TBuffer::kRead);
72
73 buf1->SetBuffer((*records)["BarTofPar"],512000,kFALSE);
74 buf2->SetBuffer((*records)["EndTofPar"],512000,kFALSE);
75 buf3->SetBuffer((*records)["TofConPar"],512000,kFALSE);
76 buf4->SetBuffer((*records)["BarTof"],512000,kFALSE);
77
78 std::cout<<" SftVer is "<<(*records)["SftVer"];
79 std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
80 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
81
82 TTree *btoftree= new TTree();
83 TTree *etoftree= new TTree();
84 TTree *btofcommontree = new TTree();
85 TTree *CalibInfo = new TTree();
86
87 btoftree->Streamer(*buf1);
88 etoftree->Streamer(*buf2);
89 btofcommontree->Streamer(*buf3);
90 CalibInfo->Streamer(*buf4);
91
92 int nentri = btoftree -> GetEntries();
93 int nentri1 = etoftree -> GetEntries();
94 int nentri2 = btofcommontree->GetEntries();
95 int nentri3 = CalibInfo->GetEntries();
96
101
102 std::vector<CalibData::bTofCalibBase> tmpbTof;
103 std::vector<CalibData::eTofCalibBase> tmpeTof;
104 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
105 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
106
107 // Read in the object
108 int cnt;
109 // read btoftree ------------------------------------------------------------
110 double cnvBarAtten[nBarAtten];
111 double cnvBarSpeed[nBarSpeed];
112 double cnvBarPar1[nBarPar];
113 double cnvBarPar2[nBarPar];
114 double cnvBarParOff1_bunch0[nBarParOff];
115 double cnvBarParOff2_bunch0[nBarParOff];
116 double cnvBarParOff1_bunch1[nBarParOff];
117 double cnvBarParOff2_bunch1[nBarParOff];
118 double cnvBarParOff1_bunch2[nBarParOff];
119 double cnvBarParOff2_bunch2[nBarParOff];
120 double cnvBarParOff1_bunch3[nBarParOff];
121 double cnvBarParOff2_bunch3[nBarParOff];
122 double cnvFLeft[nBarSigma];
123 double cnvFRight[nBarSigma];
124 double cnvFCount[nBarSigCnt];
125
126 char brname[10];
127 for( unsigned int i=0; i<nBarAtten; i++ ) {
128 sprintf( brname, "Atten%i", i );
129 btoftree -> SetBranchAddress( brname, &cnvBarAtten[i] );
130 }
131 for( unsigned int i=0; i<nBarSpeed; i++ ) {
132 sprintf( brname, "Speed%i", i );
133 btoftree -> SetBranchAddress( brname, &cnvBarSpeed[i] );
134 }
135 for( unsigned int i=0; i<nBarPar; i++ ) {
136 sprintf( brname, "P%i", i );
137 btoftree -> SetBranchAddress( brname, &cnvBarPar1[i] );
138 }
139 for( unsigned int i=0; i<nBarPar; i++ ) {
140 sprintf( brname, "P%i", i+nBarPar );
141 btoftree -> SetBranchAddress( brname, &cnvBarPar2[i] );
142 }
143 for( unsigned int i=0; i<nBarParOff; i++ ) {
144 sprintf( brname, "Bunch0_Poff%i", i );
145 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch0[i] );
146 }
147 for( unsigned int i=0; i<nBarParOff; i++ ) {
148 sprintf( brname, "Bunch0_Poff%i", i+nBarParOff );
149 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch0[i] );
150 }
151 for( unsigned int i=0; i<nBarParOff; i++ ) {
152 sprintf( brname, "Bunch1_Poff%i", i );
153 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch1[i] );
154 }
155 for( unsigned int i=0; i<nBarParOff; i++ ) {
156 sprintf( brname, "Bunch1_Poff%i", i+nBarParOff );
157 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch1[i] );
158 }
159 for( unsigned int i=0; i<nBarParOff; i++ ) {
160 sprintf( brname, "Bunch2_Poff%i", i );
161 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch2[i] );
162 }
163 for( unsigned int i=0; i<nBarParOff; i++ ) {
164 sprintf( brname, "Bunch2_Poff%i", i+nBarParOff );
165 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch2[i] );
166 }
167 for( unsigned int i=0; i<nBarParOff; i++ ) {
168 sprintf( brname, "Bunch3_Poff%i", i );
169 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch3[i] );
170 }
171 for( unsigned int i=0; i<nBarParOff; i++ ) {
172 sprintf( brname, "Bunch3_Poff%i", i+nBarParOff );
173 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch3[i] );
174 }
175 for( unsigned int i=0; i<nBarSigma; i++ ) {
176 sprintf( brname, "FLeft%i", i );
177 btoftree -> SetBranchAddress( brname, &cnvFLeft[i] );
178 }
179 for( unsigned int i=0; i<nBarSigma; i++ ) {
180 sprintf( brname, "FRight%i", i );
181 btoftree -> SetBranchAddress( brname, &cnvFRight[i] );
182 }
183 for( unsigned int i=0; i<nBarSigCnt; i++ ) {
184 sprintf( brname, "FCounter%i", i );
185 btoftree -> SetBranchAddress( brname, &cnvFCount[i] );
186 }
187
188 for(cnt=0; cnt<176; cnt++){
189 btoftree -> GetEntry(cnt);
190 bTof.setAtten( cnvBarAtten );
191 bTof.setSpeed( cnvBarSpeed );
192 bTof.setP1( cnvBarPar1 );
193 bTof.setP2( cnvBarPar2 );
194 bTof.setPoff1_bunch0( cnvBarParOff1_bunch0 );
195 bTof.setPoff2_bunch0( cnvBarParOff2_bunch0 );
196 bTof.setPoff1_bunch1( cnvBarParOff1_bunch1 );
197 bTof.setPoff2_bunch1( cnvBarParOff2_bunch1 );
198 bTof.setPoff1_bunch2( cnvBarParOff1_bunch2 );
199 bTof.setPoff2_bunch2( cnvBarParOff2_bunch2 );
200 bTof.setPoff1_bunch3( cnvBarParOff1_bunch3 );
201 bTof.setPoff2_bunch3( cnvBarParOff2_bunch3 );
202 bTof.setFPleft( cnvFLeft );
203 bTof.setFPright( cnvFRight );
204 bTof.setFPcounter( cnvFCount );
205 tmpbTof.push_back(bTof);
206 }
207
208 //read etoftree
209 double cnvEndAtten[nEndAtten];
210 double cnvEndSpeed[nEndSpeed];
211 double cnvEndPar[nEndPar];
212 double cnvEndFPar[nEndSigma];
213
214 char ecname[10];
215 for( unsigned int i=0; i<nEndAtten; i++ ) {
216 sprintf( ecname, "Atten%i", i );
217 etoftree -> SetBranchAddress( ecname, &cnvEndAtten[i] );
218 }
219 for( unsigned int i=0; i<nEndSpeed; i++ ) {
220 sprintf( ecname, "Speed%i", i );
221 etoftree -> SetBranchAddress( ecname, &cnvEndSpeed[i] );
222 }
223 for( unsigned int i=0; i<nEndPar; i++ ) {
224 sprintf( ecname, "P%i", i );
225 etoftree -> SetBranchAddress( ecname, &cnvEndPar[i] );
226 }
227 for( unsigned int i=0; i<nEndSigma; i++ ) {
228 sprintf( ecname, "FCounter%i", i );
229 etoftree -> SetBranchAddress( ecname, &cnvEndFPar[i] );
230 }
231
232 for(cnt=0; cnt<96; cnt++){
233 etoftree -> GetEntry(cnt);
234 eTof.setAtten( cnvEndAtten );
235 eTof.setSpeed( cnvEndSpeed );
236 eTof.setP( cnvEndPar );
237 eTof.setFP( cnvEndFPar );
238 tmpeTof.push_back(eTof);
239 }
240
241 //read bTofCommonCalibBase
242 double cnvBarSigCor[nBarSigCor];
243 double cnvBarOffset[nBarOffset];
244 for( unsigned int i=0; i<nBarSigCor; i++ ) {
245 sprintf( brname, "sigmaCorr%i", i );
246 btofcommontree-> SetBranchAddress( brname, &cnvBarSigCor[i] );
247 }
248 for( unsigned int i=0; i<nBarOffset; i++ ) {
249 sprintf( brname, "t0offset%i", i );
250 btofcommontree-> SetBranchAddress( brname, &cnvBarOffset[i]);
251 }
252
253 int entries = btofcommontree->GetEntries();
254 for(cnt=0;cnt<entries;cnt++){
255 btofcommontree->GetEntry(cnt);
256 bTofCommon.setSigmaCorr( cnvBarSigCor );
257 bTofCommon.setOffset( cnvBarOffset );
258 tmpbTofCommon.push_back(bTofCommon);
259 }
260
261 int m_run1, m_run2, m_version;
262 int m_qCorr, m_qElec, m_misLable;
263 int m_tofidEast[5], m_tofidWest[5], m_tofidEndcap[5];
264
265 // TTree *CalibInfo = (TTree*)m_inFile -> Get("CalibInfo");
266 CalibInfo->SetBranchAddress("Run1",&m_run1);
267 CalibInfo->SetBranchAddress("Run2",&m_run2);
268 CalibInfo->SetBranchAddress("Version",&m_version);
269 CalibInfo->SetBranchAddress("ebrId0",&m_tofidEast[0]);
270 CalibInfo->SetBranchAddress("ebrId1",&m_tofidEast[1]);
271 CalibInfo->SetBranchAddress("ebrId2",&m_tofidEast[2]);
272 CalibInfo->SetBranchAddress("ebrId3",&m_tofidEast[3]);
273 CalibInfo->SetBranchAddress("ebrId4",&m_tofidEast[4]);
274 CalibInfo->SetBranchAddress("ecId0",&m_tofidEndcap[0]);
275 CalibInfo->SetBranchAddress("ecId1",&m_tofidEndcap[1]);
276 CalibInfo->SetBranchAddress("ecId2",&m_tofidEndcap[2]);
277 CalibInfo->SetBranchAddress("ecId3",&m_tofidEndcap[3]);
278 CalibInfo->SetBranchAddress("ecId4",&m_tofidEndcap[4]);
279 CalibInfo->SetBranchAddress("wbrId0",&m_tofidWest[0]);
280 CalibInfo->SetBranchAddress("wbrId1",&m_tofidWest[1]);
281 CalibInfo->SetBranchAddress("wbrId2",&m_tofidWest[2]);
282 CalibInfo->SetBranchAddress("wbrId3",&m_tofidWest[3]);
283 CalibInfo->SetBranchAddress("wbrId4",&m_tofidWest[4]);
284 CalibInfo->SetBranchAddress("misLable",&m_misLable);
285 CalibInfo->SetBranchAddress("qCorr",&m_qCorr);
286 CalibInfo->SetBranchAddress("qElec",&m_qElec);
287
288 entries= CalibInfo->GetEntries();
289 for(cnt=0;cnt<entries;cnt++){
290 CalibInfo->GetEntry(cnt);
291 tofinfo.setRunBegin(m_run1);
292 tofinfo.setRunEnd(m_run2);
293 tofinfo.setVersion(m_version);
294 tofinfo.setQCorr(m_qCorr);
295 tofinfo.setQElec(m_qElec);
296 tofinfo.setMisLable(m_misLable);
297 tofinfo.setBrEast(m_tofidEast);
298 tofinfo.setBrWest(m_tofidWest);
299 tofinfo.setEndcap(m_tofidEndcap);
300 tofinfoCol.push_back(tofinfo);
301 }
302
303 CalibData::TofCalibData *tmpObject = new CalibData::TofCalibData(&tmpbTof,&tmpbTofCommon,&tmpeTof,&tofinfoCol);
304
305 refpObject=tmpObject;
306 delete btoftree;
307 delete etoftree;
308 delete btofcommontree;
309 delete CalibInfo;
310
311 return StatusCode::SUCCESS;
312}
data SetBranchAddress("time",&time)
data GetEntry(0)
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nBarPar
const unsigned int nBarSigma
const unsigned int nEndSigma
const unsigned int nBarSigCor
const unsigned int nEndSpeed
const unsigned int nBarSpeed
const unsigned int nEndAtten
const unsigned int nBarAtten
const unsigned int nBarSigCnt
IMessageSvc * msgSvc()
void setP2(const double *TofP2)
void setPoff1_bunch3(const double *TofPoff1_bunch3)
void setFPleft(const double *FP1)
void setPoff2_bunch1(const double *TofPoff2_bunch1)
void setSpeed(const double *Speed)
void setAtten(const double *Atten)
void setPoff1_bunch0(const double *TofPoff1_bunch0)
void setPoff2_bunch2(const double *TofPoff2_bunch2)
void setPoff1_bunch1(const double *TofPoff1_bunch1)
void setFPcounter(const double *FP3)
void setPoff1_bunch2(const double *TofPoff1_bunch2)
void setPoff2_bunch3(const double *TofPoff2_bunch3)
void setFPright(const double *FP2)
void setPoff2_bunch0(const double *TofPoff2_bunch0)
void setP1(const double *TofP1)
void setSigmaCorr(const double *sigmaCorr)
void setOffset(const double *offset)
void setAtten(const double *Atten)
void setP(const double *TofP)
void setFP(const double *FP)
void setSpeed(const double *Speed)
void setBrWest(const int *tofidWest)
void setRunEnd(const int run2)
void setVersion(const int version)
void setMisLable(const int misLable)
void setRunBegin(const int run1)
void setBrEast(const int *tofidEast)
void setQElec(const int qElec)
void setQCorr(const int qCorr)
void setEndcap(const int *tofidEndcap)
virtual DatabaseRecord * pp()

◆ objType()

const CLID & TreeTofCalibDataCnv::objType ( ) const

Definition at line 50 of file TreeTofCalibDataCnv.cxx.

50 {
51 return CLID_Calib_TofCal;
52}

◆ repSvcType()

virtual long TreeTofCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file TreeTofCalibDataCnv.h.

34 {
36 }
unsigned const char CALIBTREE_StorageType

Friends And Related Symbol Documentation

◆ CnvFactory< TreeTofCalibDataCnv >

friend class CnvFactory< TreeTofCalibDataCnv >
friend

Definition at line 1 of file TreeTofCalibDataCnv.h.


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