BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
RootTofCalibDataCnv Class Reference

#include <RootTofCalibDataCnv.h>

+ Inheritance diagram for RootTofCalibDataCnv:

Public Member Functions

const CLID & objType () const
 
 RootTofCalibDataCnv (ISvcLocator *svc)
 
virtual ~RootTofCalibDataCnv ()
 
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
virtual long repSvcType () const
 
- Public Member Functions inherited from RootCalBaseCnv
virtual ~RootCalBaseCnv ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&refpObject)
 
ICalibRootSvcgetCalibRootSvc ()
 
 RootCalBaseCnv (ISvcLocator *svc, const CLID &clid)
 
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
virtual StatusCode readRootObj (const std::string &treename, const std::string &branch, TObject *&pCalib, unsigned index=0)
 
virtual StatusCode readRootObj (TTree *tree, const std::string &branch, TObject *&pCalib, unsigned index=0)
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 
destinationoperator (const source &) const
 

Static Public Member Functions

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

Protected Member Functions

virtual StatusCode i_createObj (const std::string &fname, DataObject *&refpObject)
 
- Protected Member Functions inherited from RootCalBaseCnv
virtual StatusCode internalCreateObj (const std::string &fname, DataObject *&refpObject, IOpaqueAddress *address)
 
virtual StatusCode i_createObj (const std::string &fname, 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)
 
virtual StatusCode openWrite (const std::string &fname)
 
StatusCode closeWrite ()
 
StatusCode openRead (const std::string &fname)
 
StatusCode closeRead ()
 
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
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< RootTofCalibDataCnv >
 

Additional Inherited Members

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

Detailed Description

Definition at line 20 of file RootTofCalibDataCnv.h.

Constructor & Destructor Documentation

◆ RootTofCalibDataCnv()

RootTofCalibDataCnv::RootTofCalibDataCnv ( ISvcLocator *  svc)

◆ ~RootTofCalibDataCnv()

virtual RootTofCalibDataCnv::~RootTofCalibDataCnv ( )
inlinevirtual

Definition at line 29 of file RootTofCalibDataCnv.h.

29{};

Member Function Documentation

◆ classID()

const CLID & RootTofCalibDataCnv::classID ( )
static

Definition at line 60 of file RootTofCalibDataCnv.cxx.

60 {
61 return CLID_Calib_TofCal;
62}

◆ createRoot()

StatusCode RootTofCalibDataCnv::createRoot ( const std::string &  fname,
CalibData::CalibBase1 pTDSObj 
)
virtual

Create ROOT file corresponding to TDS object input.
Default implementation is to return an error. Must be separately implemented for each calibration type.

Parameters
fnameFilename for output file
pTDSObjPointer to tds object to be converted

Reimplemented from RootCalBaseCnv.

Definition at line 355 of file RootTofCalibDataCnv.cxx.

356 {
357 MsgStream log(msgSvc(), "RootTofCalibDataCnv");
358
359 // Open the file, create the branch
360 StatusCode sc = openWrite(fname);
361 if(!sc)
362 { log<<MSG::ERROR<<"unable to open files"<<endreq;
363 }
364 // write the Data in the TCDS to RootFile
365 int j;
366 CalibData::TofCalibData* btof = dynamic_cast<CalibData::TofCalibData*>(pTDSObj);
367
368 // write btoftree----------------------------------------------------------------
369 double cnvBarAtten[nBarAtten];
370 double cnvBarSpeed[nBarSpeed];
371 double cnvBarPar1[nBarPar];
372 double cnvBarPar2[nBarPar];
373 double cnvBarParOff1_bunch0[nBarParOff];
374 double cnvBarParOff2_bunch0[nBarParOff];
375 double cnvBarParOff1_bunch1[nBarParOff];
376 double cnvBarParOff2_bunch1[nBarParOff];
377 double cnvBarParOff1_bunch2[nBarParOff];
378 double cnvBarParOff2_bunch2[nBarParOff];
379 double cnvBarParOff1_bunch3[nBarParOff];
380 double cnvBarParOff2_bunch3[nBarParOff];
381 double cnvFLeft[nBarSigma];
382 double cnvFRight[nBarSigma];
383 double cnvFCount[nBarSigCnt];
384
385 char brname[8], ibrname[8];
386 TTree *btoftree = new TTree("BarTofPar", "BarTofPar");
387 for( unsigned int i=0; i<nBarAtten; i++ ) {
388 sprintf( brname, "Atten%i", i );
389 sprintf( ibrname, "Atten%i/D", i );
390 btoftree -> Branch( brname, &cnvBarAtten[i], ibrname );
391 }
392 for( unsigned int i=0; i<nBarSpeed; i++ ) {
393 sprintf( brname, "Speed%i", i );
394 sprintf( ibrname, "Speed%i/D", i );
395 btoftree -> Branch( brname, &cnvBarSpeed[i], ibrname );
396 }
397 for( unsigned int i=0; i<nBarPar; i++ ) {
398 sprintf( brname, "P%i", i );
399 sprintf( ibrname, "P%i/D", i );
400 btoftree -> Branch( brname, &cnvBarPar1[i], ibrname );
401 }
402 for( unsigned int i=0; i<nBarPar; i++ ) {
403 sprintf( brname, "P%i", i+nBarPar );
404 sprintf( ibrname, "P%i/D", i+nBarPar );
405 btoftree -> Branch( brname, &cnvBarPar2[i], ibrname );
406 }
407 for( unsigned int i=0; i<nBarParOff; i++ ) {
408 sprintf( brname, "Bunch0_Poff%i", i );
409 sprintf( ibrname, "Bunch0_Poff%i/D", i );
410 btoftree -> Branch( brname, &cnvBarParOff1_bunch0[i], ibrname );
411 }
412 for( unsigned int i=0; i<nBarParOff; i++ ) {
413 sprintf( brname, "Bunch0_Poff%i", i+nBarParOff );
414 sprintf( ibrname, "Bunch0_Poff%i/D", i+nBarParOff );
415 btoftree -> Branch( brname, &cnvBarParOff2_bunch0[i], ibrname );
416 }
417 for( unsigned int i=0; i<nBarParOff; i++ ) {
418 sprintf( brname, "Bunch1_Poff%i", i );
419 sprintf( ibrname, "Bunch1_Poff%i/D", i );
420 btoftree -> Branch( brname, &cnvBarParOff1_bunch1[i], ibrname );
421 }
422 for( unsigned int i=0; i<nBarParOff; i++ ) {
423 sprintf( brname, "Bunch1_Poff%i", i+nBarParOff );
424 sprintf( ibrname, "Bunch1_Poff%i/D", i+nBarParOff );
425 btoftree -> Branch( brname, &cnvBarParOff2_bunch1[i], ibrname );
426 }
427 for( unsigned int i=0; i<nBarParOff; i++ ) {
428 sprintf( brname, "Bunch2_Poff%i", i );
429 sprintf( ibrname, "Bunch2_Poff%i/D", i );
430 btoftree -> Branch( brname, &cnvBarParOff1_bunch2[i], ibrname );
431 }
432 for( unsigned int i=0; i<nBarParOff; i++ ) {
433 sprintf( brname, "Bunch2_Poff%i", i+nBarParOff );
434 sprintf( ibrname, "Bunch2_Poff%i/D", i+nBarParOff );
435 btoftree -> Branch( brname, &cnvBarParOff2_bunch2[i], ibrname );
436 }
437 for( unsigned int i=0; i<nBarParOff; i++ ) {
438 sprintf( brname, "Bunch3_Poff%i", i );
439 sprintf( ibrname, "Bunch3_Poff%i/D", i );
440 btoftree -> Branch( brname, &cnvBarParOff1_bunch3[i], ibrname );
441 }
442 for( unsigned int i=0; i<nBarParOff; i++ ) {
443 sprintf( brname, "Bunch3_Poff%i", i+nBarParOff );
444 sprintf( ibrname, "Bunch3_Poff%i/D", i+nBarParOff );
445 btoftree -> Branch( brname, &cnvBarParOff2_bunch3[i], ibrname );
446 }
447 for( unsigned int i=0; i<nBarSigma; i++ ) {
448 sprintf( brname, "FLeft%i", i );
449 sprintf( ibrname, "FLeft%i/D", i );
450 btoftree -> Branch( brname, &cnvFLeft[i], ibrname );
451 }
452 for( unsigned int i=0; i<nBarSigma; i++ ) {
453 sprintf( brname, "FRight%i", i );
454 sprintf( ibrname, "FRight%i/D", i );
455 btoftree -> Branch( brname, &cnvFRight[i], ibrname );
456 }
457 for( unsigned int i=0; i<nBarSigCnt; i++ ) {
458 sprintf( brname, "FCounter%i", i );
459 sprintf( ibrname, "FCounter%i/D", i );
460 btoftree -> Branch( brname, &cnvFCount[i], ibrname );
461 }
462
463 for( int i=0; i<176; i++ ) {
464 for(j=0;j<static_cast<int>(nBarAtten);j++) {
465 cnvBarAtten[j] = btof->getBTofAtten(i,j);
466 }
467 for(j=0;j<static_cast<int>(nBarSpeed);j++) {
468 cnvBarSpeed[j] = btof->getBTofSpeed(i,j);
469 }
470 for(j=0;j<static_cast<int>(nBarPar);j++){
471 cnvBarPar1[j] = btof->getBTofPleft(i,j);
472 cnvBarPar2[j] = btof->getBTofPright(i,j);
473 }
474 for(j=0;j<static_cast<int>(nBarParOff);j++){
475 cnvBarParOff1_bunch0[j] = btof->getBTofPoffleft_bunch0(i,j);
476 cnvBarParOff2_bunch0[j] = btof->getBTofPoffright_bunch0(i,j);
477 }
478 for(j=0;j<static_cast<int>(nBarParOff);j++){
479 cnvBarParOff1_bunch1[j] = btof->getBTofPoffleft_bunch1(i,j);
480 cnvBarParOff2_bunch1[j] = btof->getBTofPoffright_bunch1(i,j);
481 }
482 for(j=0;j<static_cast<int>(nBarParOff);j++){
483 cnvBarParOff1_bunch2[j] = btof->getBTofPoffleft_bunch2(i,j);
484 cnvBarParOff2_bunch2[j] = btof->getBTofPoffright_bunch2(i,j);
485 }
486 for(j=0;j<static_cast<int>(nBarParOff);j++){
487 cnvBarParOff1_bunch3[j] = btof->getBTofPoffleft_bunch3(i,j);
488 cnvBarParOff2_bunch3[j] = btof->getBTofPoffright_bunch3(i,j);
489 }
490 for(j=0;j<static_cast<int>(nBarSigma);j++){
491 cnvFLeft[j] = btof->getBTofFleft(i,j);
492 cnvFRight[j] = btof->getBTofFright(i,j);
493 }
494 for(j=0;j<static_cast<int>(nBarSigCnt);j++){
495 cnvFCount[j] = btof->getBTofFcounter(i,j);
496 }
497 btoftree -> Fill();
498 }
499
500 //write etoftree----------------------------------------------------------------
501 double cnvEndAtten[nEndAtten];
502 double cnvEndSpeed[nEndSpeed];
503 double cnvEndPar[nEndPar];
504 double cnvEndFPar[nEndSigma];
505
506 char ecname[8], iecname[8];
507 TTree *etoftree = new TTree("EndTofPar", "EndTofPar");
508 for( unsigned int i=0; i<nEndAtten; i++ ) {
509 sprintf( ecname, "Atten%i", i );
510 sprintf( iecname, "Atten%i/D", i );
511 etoftree -> Branch( ecname, &cnvEndAtten[i], iecname );
512 }
513 for( unsigned int i=0; i<nEndSpeed; i++ ) {
514 sprintf( ecname, "Speed%i", i );
515 sprintf( iecname, "Speed%i/D", i );
516 etoftree -> Branch( ecname, &cnvEndSpeed[i], iecname );
517 }
518 for( unsigned int i=0; i<nEndPar; i++ ) {
519 sprintf( ecname, "P%i", i );
520 sprintf( iecname, "P%i/D", i );
521 etoftree -> Branch( ecname, &cnvEndPar[i], iecname );
522 }
523 for( unsigned int i=0; i<nEndSigma; i++ ) {
524 sprintf( ecname, "FCounter%i", i );
525 sprintf( iecname, "FCounter%i/D", i );
526 etoftree -> Branch( ecname, &cnvEndFPar[i], iecname );
527 }
528
529 for(int i=0; i<96; i++){
530 for(j=0;j<static_cast<int>(nEndAtten);j++) {
531 cnvEndAtten[j] = btof->getETofAtten(i,j);
532 }
533 for(j=0;j<static_cast<int>(nEndSpeed);j++) {
534 cnvEndSpeed[j] = btof->getETofSpeed(i,j);
535 }
536 for(j=0;j<static_cast<int>(nEndPar);j++){
537 cnvEndPar[j] = btof->getETofP(i,j);
538 }
539 for(j=0;j<static_cast<int>(nEndSigma);j++){
540 cnvEndFPar[j] = btof->getETofFP(i,j);
541 }
542 etoftree -> Fill();
543 }
544
545 //write etftree----------------------------------------------------------------
546 double cnvEtfSpeed[nEtfSpeed];
547 double cnvEtfPar[nEtfPar];
548 double cnvEtfPar1[nEtfPar];
549 double cnvEtfPar2[nEtfPar];
550
551 char etfname[8], ietfname[8];
552 TTree *etftree = new TTree("EtfTofPar", "EtfTofPar");
553 for( unsigned int i=0; i<nEtfSpeed; i++ ) {
554 sprintf( etfname, "Speed%i", i );
555 sprintf( ietfname, "Speed%i/D", i );
556 etftree -> Branch( etfname, &cnvEtfSpeed[i], ietfname );
557 }
558 for( unsigned int i=0; i<nEtfPar; i++ ) {
559 sprintf( etfname, "P%i", i );
560 sprintf( ietfname, "P%i/D", i );
561 etftree -> Branch( etfname, &cnvEtfPar[i], ietfname );
562 }
563 for( unsigned int i=0; i<nEtfPar; i++ ) {
564 sprintf( etfname, "P%i", i+nEtfPar );
565 sprintf( ietfname, "P%i/D", i+nEtfPar );
566 etftree -> Branch( etfname, &cnvEtfPar1[i], ietfname );
567 }
568 for( unsigned int i=0; i<nEtfPar; i++ ) {
569 sprintf( etfname, "P%i", i+2*nEtfPar );
570 sprintf( ietfname, "P%i/D", i+2*nEtfPar );
571 etftree -> Branch( etfname, &cnvEtfPar2[i], ietfname );
572 }
573
574 for( int i=0; i<72; i++ ) {
575 for( int k=0; k<12; k++ ) {
576 for(j=0;j<static_cast<int>(nEtfSpeed);j++) {
577 cnvEtfSpeed[j] = btof->getEtfSpeed(i,k,j);
578 }
579 for(j=0;j<static_cast<int>(nEtfPar);j++){
580 cnvEtfPar[j] = btof->getEtfPcombine(i,k,j);
581 cnvEtfPar1[j] = btof->getEtfPleft(i,k,j);
582 cnvEtfPar2[j] = btof->getEtfPright(i,k,j);
583 }
584 etftree -> Fill();
585 }
586 }
587
588 //write etftree----------------------------------------------------------------
589 double cnvEtfBunchP[nEtfBunch];
590
591 char etfbunchname[8], ietfbunchname[8];
592 TTree *etfbunchtree = new TTree("EtfTofBunch", "EtfTofBunch");
593 for( unsigned int i=0; i<nEtfBunch; i++ ) {
594 sprintf( etfbunchname, "pbunch%i", i );
595 sprintf( ietfbunchname, "pbunch%i/D", i );
596 etfbunchtree -> Branch( etfbunchname, &cnvEtfBunchP[i], ietfbunchname );
597 }
598
599 for(j=0;j<static_cast<int>(nEtfBunch);j++) {
600 cnvEtfBunchP[j] = btof->getEtfPBunch(j);
601 }
602 etfbunchtree -> Fill();
603
604
605 // write all the trees
606 btoftree -> Write();
607 etoftree -> Write();
608 etftree -> Write();
609 etfbunchtree -> Write();
610 delete btoftree;
611 delete etoftree;
612 delete etftree;
613 delete etfbunchtree;
614 closeWrite();
615 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
616
617 return sc;
618}
const unsigned int nBarParOff
const unsigned int nEndPar
const unsigned int nEtfPar
const unsigned int nBarPar
const unsigned int nBarSigma
const unsigned int nEndSigma
const unsigned int nEndSpeed
const unsigned int nEtfSpeed
const unsigned int nEtfBunch
const unsigned int nBarSpeed
const unsigned int nEndAtten
const unsigned int nBarAtten
const unsigned int nBarSigCnt
double getETofFP(int index, int pardex)
double getBTofPoffleft_bunch1(int index, int pardex)
double getBTofPoffleft_bunch3(int index, int pardex)
double getBTofSpeed(int index, int pardex)
double getETofP(int index, int pardex)
double getBTofPoffright_bunch3(int index, int pardex)
double getBTofPoffright_bunch2(int index, int pardex)
double getBTofFleft(int index, int pardex)
double getBTofPoffright_bunch0(int index, int pardex)
double getBTofPoffright_bunch1(int index, int pardex)
double getEtfSpeed(int index, int strip, int pardex)
double getBTofFright(int index, int pardex)
double getBTofFcounter(int index, int pardex)
double getBTofPoffleft_bunch2(int index, int pardex)
double getEtfPleft(int index, int strip, int pardex)
double getEtfPcombine(int index, int strip, int pardex)
double getETofAtten(int index, int pardex)
double getBTofAtten(int index, int pardex)
double getEtfPBunch(int pardex)
double getBTofPoffleft_bunch0(int index, int pardex)
double getEtfPright(int index, int strip, int pardex)
double getBTofPleft(int index, int pardex)
double getETofSpeed(int index, int pardex)
double getBTofPright(int index, int pardex)
StatusCode closeWrite()
virtual StatusCode openWrite(const std::string &fname)
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)

◆ i_createObj()

StatusCode RootTofCalibDataCnv::i_createObj ( const std::string &  fname,
DataObject *&  refpObject 
)
protectedvirtual

Create the transient representation of an object, given an opaque address. This and the following update method comprise the core functionality of calibration converters. Convenience routine used by most CAL calibration types, which have a <dimension> element describing how the remainder of the Data is laid out. Read from TDS; store information internally in protected members.
Given a pointer to a TDS object which can be cast to "our" type, fill in corresponding information in the corresponding root class

Parameters
pTDSObjPointer to tds object to be converted
pRootObjPointer to destination root object Read in object from specified branch. Don't need tree name; it's always Calib

Reimplemented from RootCalBaseCnv.

Definition at line 64 of file RootTofCalibDataCnv.cxx.

65 {
66
67 MsgStream log(msgSvc(), "RootTofCalibDataCnv");
68 log<<MSG::DEBUG<<"SetProperty"<<endreq;
69
70 // open the file
71 StatusCode sc = openRead(fname);
72 if(!sc)
73 { log<<MSG::ERROR<<"unable to open files"<<endreq;
74 }
75
82
83 std::vector<CalibData::bTofCalibBase> tmpbTof;
84 std::vector<CalibData::eTofCalibBase> tmpeTof;
85 std::vector<CalibData::etfCalibBase> tmpetf;
86 std::vector<CalibData::etfBunchCalibBase> tmpetfBunch;
87 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
88 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
89 // Read in the object
90 int cnt;
91 // read btoftree ------------------------------------------------------------
92
93 double cnvBarAtten[nBarAtten];
94 double cnvBarSpeed[nBarSpeed];
95 double cnvBarPar1[nBarPar];
96 double cnvBarPar2[nBarPar];
97 double cnvBarParOff1_bunch0[nBarParOff];
98 double cnvBarParOff2_bunch0[nBarParOff];
99 double cnvBarParOff1_bunch1[nBarParOff];
100 double cnvBarParOff2_bunch1[nBarParOff];
101 double cnvBarParOff1_bunch2[nBarParOff];
102 double cnvBarParOff2_bunch2[nBarParOff];
103 double cnvBarParOff1_bunch3[nBarParOff];
104 double cnvBarParOff2_bunch3[nBarParOff];
105 double cnvFLeft[nBarSigma];
106 double cnvFRight[nBarSigma];
107 double cnvFCount[nBarSigCnt];
108
109 TTree *btoftree = (TTree*)m_inFile -> Get("BarTofPar");
110
111 char brname[10];
112 for( unsigned int i=0; i<nBarAtten; i++ ) {
113 sprintf( brname, "Atten%i", i );
114 btoftree -> SetBranchAddress( brname, &cnvBarAtten[i] );
115 }
116 for( unsigned int i=0; i<nBarSpeed; i++ ) {
117 sprintf( brname, "Speed%i", i );
118 btoftree -> SetBranchAddress( brname, &cnvBarSpeed[i] );
119 }
120 for( unsigned int i=0; i<nBarPar; i++ ) {
121 sprintf( brname, "P%i", i );
122 btoftree -> SetBranchAddress( brname, &cnvBarPar1[i] );
123 }
124 for( unsigned int i=0; i<nBarPar; i++ ) {
125 sprintf( brname, "P%i", i+nBarPar );
126 btoftree -> SetBranchAddress( brname, &cnvBarPar2[i] );
127 }
128 for( unsigned int i=0; i<nBarParOff; i++ ) {
129 sprintf( brname, "Bunch0_Poff%i", i );
130 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch0[i] );
131 }
132 for( unsigned int i=0; i<nBarParOff; i++ ) {
133 sprintf( brname, "Bunch0_Poff%i", i+nBarParOff );
134 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch0[i] );
135 }
136 for( unsigned int i=0; i<nBarParOff; i++ ) {
137 sprintf( brname, "Bunch1_Poff%i", i );
138 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch1[i] );
139 }
140 for( unsigned int i=0; i<nBarParOff; i++ ) {
141 sprintf( brname, "Bunch1_Poff%i", i+nBarParOff );
142 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch1[i] );
143 }
144 for( unsigned int i=0; i<nBarParOff; i++ ) {
145 sprintf( brname, "Bunch2_Poff%i", i );
146 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch2[i] );
147 }
148 for( unsigned int i=0; i<nBarParOff; i++ ) {
149 sprintf( brname, "Bunch2_Poff%i", i+nBarParOff );
150 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch2[i] );
151 }
152 for( unsigned int i=0; i<nBarParOff; i++ ) {
153 sprintf( brname, "Bunch3_Poff%i", i );
154 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch3[i] );
155 }
156 for( unsigned int i=0; i<nBarParOff; i++ ) {
157 sprintf( brname, "Bunch3_Poff%i", i+nBarParOff );
158 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch3[i] );
159 }
160 for( unsigned int i=0; i<nBarSigma; i++ ) {
161 sprintf( brname, "FLeft%i", i );
162 btoftree -> SetBranchAddress( brname, &cnvFLeft[i] );
163 }
164 for( unsigned int i=0; i<nBarSigma; i++ ) {
165 sprintf( brname, "FRight%i", i );
166 btoftree -> SetBranchAddress( brname, &cnvFRight[i] );
167 }
168 for( unsigned int i=0; i<nBarSigCnt; i++ ) {
169 sprintf( brname, "FCounter%i", i );
170 btoftree -> SetBranchAddress( brname, &cnvFCount[i] );
171 }
172
173 for(cnt=0; cnt<176; cnt++){
174 btoftree -> GetEntry(cnt);
175 bTof.setAtten( cnvBarAtten );
176 bTof.setSpeed( cnvBarSpeed );
177 bTof.setP1( cnvBarPar1 );
178 bTof.setP2( cnvBarPar2 );
179 bTof.setPoff1_bunch0( cnvBarParOff1_bunch0 );
180 bTof.setPoff2_bunch0( cnvBarParOff2_bunch0 );
181 bTof.setPoff1_bunch1( cnvBarParOff1_bunch1 );
182 bTof.setPoff2_bunch1( cnvBarParOff2_bunch1 );
183 bTof.setPoff1_bunch2( cnvBarParOff1_bunch2 );
184 bTof.setPoff2_bunch2( cnvBarParOff2_bunch2 );
185 bTof.setPoff1_bunch3( cnvBarParOff1_bunch3 );
186 bTof.setPoff2_bunch3( cnvBarParOff2_bunch3 );
187 bTof.setFPleft( cnvFLeft );
188 bTof.setFPright( cnvFRight );
189 bTof.setFPcounter( cnvFCount );
190 tmpbTof.push_back(bTof);
191 }
192
193 //read etoftree
194 double cnvEndAtten[nEndAtten];
195 double cnvEndSpeed[nEndSpeed];
196 double cnvEndPar[nEndPar];
197 double cnvEndFPar[nEndSigma];
198
199 TTree *etoftree = (TTree*)m_inFile -> Get("EndTofPar");
200
201 char ecname[10];
202 for( unsigned int i=0; i<nEndAtten; i++ ) {
203 sprintf( ecname, "Atten%i", i );
204 etoftree -> SetBranchAddress( ecname, &cnvEndAtten[i] );
205 }
206 for( unsigned int i=0; i<nEndSpeed; i++ ) {
207 sprintf( ecname, "Speed%i", i );
208 etoftree -> SetBranchAddress( ecname, &cnvEndSpeed[i] );
209 }
210 for( unsigned int i=0; i<nEndPar; i++ ) {
211 sprintf( ecname, "P%i", i );
212 etoftree -> SetBranchAddress( ecname, &cnvEndPar[i] );
213 }
214 for( unsigned int i=0; i<nEndSigma; i++ ) {
215 sprintf( ecname, "FCounter%i", i );
216 etoftree -> SetBranchAddress( ecname, &cnvEndFPar[i] );
217 }
218
219 for(cnt=0; cnt<96; cnt++){
220 etoftree -> GetEntry(cnt);
221 eTof.setAtten( cnvEndAtten );
222 eTof.setSpeed( cnvEndSpeed );
223 eTof.setP( cnvEndPar );
224 eTof.setFP( cnvEndFPar );
225 tmpeTof.push_back(eTof);
226 }
227
228 //read etftree
229 double cnvEtfSpeed[nEtfSpeed];
230 double cnvEtfPar[nEtfPar];
231 double cnvEtfPar1[nEtfPar];
232 double cnvEtfPar2[nEtfPar];
233
234 if( NULL!=m_inFile->Get("EtfTofPar") ) {
235 TTree *etftree = (TTree*)m_inFile -> Get("EtfTofPar");
236
237 char etfname[10];
238 for( unsigned int i=0; i<nEtfSpeed; i++ ) {
239 sprintf( etfname, "Speed%i", i );
240 etftree -> SetBranchAddress( etfname, &cnvEtfSpeed[i] );
241 }
242 for( unsigned int i=0; i<nEtfPar; i++ ) {
243 sprintf( etfname, "P%i", i );
244 etftree -> SetBranchAddress( etfname, &cnvEtfPar[i] );
245 }
246 for( unsigned int i=0; i<nEtfPar; i++ ) {
247 sprintf( etfname, "P%i", i+nEtfPar );
248 etftree -> SetBranchAddress( etfname, &cnvEtfPar1[i] );
249 }
250 for( unsigned int i=0; i<nEtfPar; i++ ) {
251 sprintf( etfname, "P%i", i+2*nEtfPar );
252 etftree -> SetBranchAddress( etfname, &cnvEtfPar2[i] );
253 }
254
255 for(cnt=0; cnt<(72*12); cnt++){
256 etftree -> GetEntry(cnt);
257 etf.setSpeed( cnvEtfSpeed );
258 etf.setP( cnvEtfPar );
259 etf.setP1( cnvEtfPar1 );
260 etf.setP2( cnvEtfPar2 );
261 tmpetf.push_back(etf);
262 }
263 }
264
265 //read etfbunchtree
266 double cnvEtfBunchP[nEtfBunch];
267
268 if( NULL!=m_inFile->Get("EtfTofBunch") ) {
269 TTree *etfbunchtree = (TTree*)m_inFile -> Get("EtfTofBunch");
270
271 char etfbunchname[10];
272 for( unsigned int i=0; i<nEtfBunch; i++ ) {
273 sprintf( etfbunchname, "pbunch%i", i );
274 etfbunchtree -> SetBranchAddress( etfbunchname, &cnvEtfBunchP[i] );
275 }
276
277 int entries= etfbunchtree->GetEntries();
278 for(cnt=0;cnt<entries;cnt++){
279 etfbunchtree -> GetEntry(cnt);
280 etfBunch.setPBunch( cnvEtfBunchP );
281 tmpetfBunch.push_back( etfBunch );
282 }
283 }
284
285 //read bTofCommonCalibBase
286 double cnvBarSigCor[nBarSigCor];
287 double cnvBarOffset[nBarOffset];
288 TTree *btofcommontree = (TTree*)m_inFile -> Get("BarTofParCommon");
289 for( unsigned int i=0; i<nBarSigCor; i++ ) {
290 sprintf( brname, "sigmaCorr%i", i );
291 btofcommontree-> SetBranchAddress( brname, &cnvBarSigCor[i] );
292 }
293 for( unsigned int i=0; i<nBarOffset; i++ ) {
294 sprintf( brname, "t0offset%i", i );
295 btofcommontree-> SetBranchAddress( brname, &cnvBarOffset[i]);
296 }
297
298 int entries = btofcommontree->GetEntries();
299 for(cnt=0;cnt<entries;cnt++){
300 btofcommontree->GetEntry(cnt);
301 bTofCommon.setSigmaCorr( cnvBarSigCor );
302 bTofCommon.setOffset( cnvBarOffset );
303 tmpbTofCommon.push_back(bTofCommon);
304 }
305
306 int m_run1, m_run2, m_version;
307 int m_qCorr, m_qElec, m_misLable;
308 int m_tofidEast[5], m_tofidWest[5], m_tofidEndcap[5];
309
310 TTree *CalibInfo = (TTree*)m_inFile -> Get("CalibInfo");
311 CalibInfo->SetBranchAddress("Run1", &m_run1 );
312 CalibInfo->SetBranchAddress("Run2", &m_run2 );
313 CalibInfo->SetBranchAddress("Version", &m_version );
314 CalibInfo->SetBranchAddress("ebrId0", &m_tofidEast[0] );
315 CalibInfo->SetBranchAddress("ebrId1", &m_tofidEast[1] );
316 CalibInfo->SetBranchAddress("ebrId2", &m_tofidEast[2] );
317 CalibInfo->SetBranchAddress("ebrId3", &m_tofidEast[3] );
318 CalibInfo->SetBranchAddress("ebrId4", &m_tofidEast[4] );
319 CalibInfo->SetBranchAddress("ecId0", &m_tofidEndcap[0] );
320 CalibInfo->SetBranchAddress("ecId1", &m_tofidEndcap[1] );
321 CalibInfo->SetBranchAddress("ecId2", &m_tofidEndcap[2] );
322 CalibInfo->SetBranchAddress("ecId3", &m_tofidEndcap[3] );
323 CalibInfo->SetBranchAddress("ecId4", &m_tofidEndcap[4] );
324 CalibInfo->SetBranchAddress("wbrId0", &m_tofidWest[0] );
325 CalibInfo->SetBranchAddress("wbrId1", &m_tofidWest[1] );
326 CalibInfo->SetBranchAddress("wbrId2", &m_tofidWest[2] );
327 CalibInfo->SetBranchAddress("wbrId3", &m_tofidWest[3] );
328 CalibInfo->SetBranchAddress("wbrId4", &m_tofidWest[4] );
329 CalibInfo->SetBranchAddress("misLable",&m_misLable );
330 CalibInfo->SetBranchAddress("qCorr", &m_qCorr );
331 CalibInfo->SetBranchAddress("qElec", &m_qElec );
332
333 entries= CalibInfo->GetEntries();
334 for(cnt=0;cnt<entries;cnt++){
335 CalibInfo->GetEntry(cnt);
336 tofinfo.setRunBegin(m_run1);
337 tofinfo.setRunEnd(m_run2);
338 tofinfo.setVersion(m_version);
339 tofinfo.setQCorr(m_qCorr);
340 tofinfo.setQElec(m_qElec);
341 tofinfo.setMisLable(m_misLable);
342 tofinfo.setBrEast(m_tofidEast);
343 tofinfo.setBrWest(m_tofidWest);
344 tofinfo.setEndcap(m_tofidEndcap);
345 tofinfoCol.push_back(tofinfo);
346 }
347
348 CalibData::TofCalibData *tmpObject = new CalibData::TofCalibData(&tmpbTof,&tmpbTofCommon,&tmpeTof,&tmpetf,&tmpetfBunch,&tofinfoCol);
349
350 refpObject=tmpObject;
351
352 return StatusCode::SUCCESS;
353}
data SetBranchAddress("time",&time)
data GetEntry(0)
const unsigned int nBarOffset
const unsigned int nBarSigCor
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 setPBunch(const double *etfBunchP)
void setSpeed(const double *Speed)
Definition: etfCalibBase.cxx:6
void setP(const double *etfP)
void setP1(const double *etfP1)
void setP2(const double *etfP2)
void setBrWest(const int *tofidWest)
void setBrEast(const int *tofidEast)
void setEndcap(const int *tofidEndcap)
StatusCode openRead(const std::string &fname)

◆ objType()

const CLID & RootTofCalibDataCnv::objType ( ) const

Definition at line 56 of file RootTofCalibDataCnv.cxx.

56 {
57 return CLID_Calib_TofCal;
58}

◆ repSvcType()

virtual long RootTofCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file RootTofCalibDataCnv.h.

Friends And Related Function Documentation

◆ CnvFactory< RootTofCalibDataCnv >

friend class CnvFactory< RootTofCalibDataCnv >
friend

Definition at line 1 of file RootTofCalibDataCnv.h.


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