BOSS 8.0.0
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 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
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_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
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
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 22 of file RootTofCalibDataCnv.h.

Constructor & Destructor Documentation

◆ RootTofCalibDataCnv()

RootTofCalibDataCnv::RootTofCalibDataCnv ( ISvcLocator * svc)

Definition at line 51 of file RootTofCalibDataCnv.cxx.

RootCalBaseCnv(ISvcLocator *svc, const CLID &clid)

◆ ~RootTofCalibDataCnv()

virtual RootTofCalibDataCnv::~RootTofCalibDataCnv ( )
inlinevirtual

Definition at line 31 of file RootTofCalibDataCnv.h.

31{};

Member Function Documentation

◆ classID()

const CLID & RootTofCalibDataCnv::classID ( )
static

Definition at line 56 of file RootTofCalibDataCnv.cxx.

56{ return CLID_Calib_TofCal; }

Referenced by CalibRootCnvSvc::createConverter().

◆ 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 401 of file RootTofCalibDataCnv.cxx.

402 {
403 MsgStream log( msgSvc(), "RootTofCalibDataCnv" );
404
405 // Open the file, create the branch
406 StatusCode sc = openWrite( fname );
407 if ( !sc ) { log << MSG::ERROR << "unable to open files" << endmsg; }
408 // write the Data in the TCDS to RootFile
409 int j;
410 CalibData::TofCalibData* btof = dynamic_cast<CalibData::TofCalibData*>( pTDSObj );
411
412 // write btoftree----------------------------------------------------------------
413 double cnvBarAtten[nBarAtten];
414 double cnvBarSpeed[nBarSpeed];
415 double cnvBarPar1[nBarPar];
416 double cnvBarPar2[nBarPar];
417 double cnvBarParOff1_bunch0[nBarParOff];
418 double cnvBarParOff2_bunch0[nBarParOff];
419 double cnvBarParOff1_bunch1[nBarParOff];
420 double cnvBarParOff2_bunch1[nBarParOff];
421 double cnvBarParOff1_bunch2[nBarParOff];
422 double cnvBarParOff2_bunch2[nBarParOff];
423 double cnvBarParOff1_bunch3[nBarParOff];
424 double cnvBarParOff2_bunch3[nBarParOff];
425 double cnvFLeft[nBarSigma];
426 double cnvFRight[nBarSigma];
427 double cnvFCount[nBarSigCnt];
428
429 char brname[8], ibrname[8];
430 TTree* btoftree = new TTree( "BarTofPar", "BarTofPar" );
431 for ( unsigned int i = 0; i < nBarAtten; i++ )
432 {
433 sprintf( brname, "Atten%i", i );
434 sprintf( ibrname, "Atten%i/D", i );
435 btoftree->Branch( brname, &cnvBarAtten[i], ibrname );
436 }
437 for ( unsigned int i = 0; i < nBarSpeed; i++ )
438 {
439 sprintf( brname, "Speed%i", i );
440 sprintf( ibrname, "Speed%i/D", i );
441 btoftree->Branch( brname, &cnvBarSpeed[i], ibrname );
442 }
443 for ( unsigned int i = 0; i < nBarPar; i++ )
444 {
445 sprintf( brname, "P%i", i );
446 sprintf( ibrname, "P%i/D", i );
447 btoftree->Branch( brname, &cnvBarPar1[i], ibrname );
448 }
449 for ( unsigned int i = 0; i < nBarPar; i++ )
450 {
451 sprintf( brname, "P%i", i + nBarPar );
452 sprintf( ibrname, "P%i/D", i + nBarPar );
453 btoftree->Branch( brname, &cnvBarPar2[i], ibrname );
454 }
455 for ( unsigned int i = 0; i < nBarParOff; i++ )
456 {
457 sprintf( brname, "Bunch0_Poff%i", i );
458 sprintf( ibrname, "Bunch0_Poff%i/D", i );
459 btoftree->Branch( brname, &cnvBarParOff1_bunch0[i], ibrname );
460 }
461 for ( unsigned int i = 0; i < nBarParOff; i++ )
462 {
463 sprintf( brname, "Bunch0_Poff%i", i + nBarParOff );
464 sprintf( ibrname, "Bunch0_Poff%i/D", i + nBarParOff );
465 btoftree->Branch( brname, &cnvBarParOff2_bunch0[i], ibrname );
466 }
467 for ( unsigned int i = 0; i < nBarParOff; i++ )
468 {
469 sprintf( brname, "Bunch1_Poff%i", i );
470 sprintf( ibrname, "Bunch1_Poff%i/D", i );
471 btoftree->Branch( brname, &cnvBarParOff1_bunch1[i], ibrname );
472 }
473 for ( unsigned int i = 0; i < nBarParOff; i++ )
474 {
475 sprintf( brname, "Bunch1_Poff%i", i + nBarParOff );
476 sprintf( ibrname, "Bunch1_Poff%i/D", i + nBarParOff );
477 btoftree->Branch( brname, &cnvBarParOff2_bunch1[i], ibrname );
478 }
479 for ( unsigned int i = 0; i < nBarParOff; i++ )
480 {
481 sprintf( brname, "Bunch2_Poff%i", i );
482 sprintf( ibrname, "Bunch2_Poff%i/D", i );
483 btoftree->Branch( brname, &cnvBarParOff1_bunch2[i], ibrname );
484 }
485 for ( unsigned int i = 0; i < nBarParOff; i++ )
486 {
487 sprintf( brname, "Bunch2_Poff%i", i + nBarParOff );
488 sprintf( ibrname, "Bunch2_Poff%i/D", i + nBarParOff );
489 btoftree->Branch( brname, &cnvBarParOff2_bunch2[i], ibrname );
490 }
491 for ( unsigned int i = 0; i < nBarParOff; i++ )
492 {
493 sprintf( brname, "Bunch3_Poff%i", i );
494 sprintf( ibrname, "Bunch3_Poff%i/D", i );
495 btoftree->Branch( brname, &cnvBarParOff1_bunch3[i], ibrname );
496 }
497 for ( unsigned int i = 0; i < nBarParOff; i++ )
498 {
499 sprintf( brname, "Bunch3_Poff%i", i + nBarParOff );
500 sprintf( ibrname, "Bunch3_Poff%i/D", i + nBarParOff );
501 btoftree->Branch( brname, &cnvBarParOff2_bunch3[i], ibrname );
502 }
503 for ( unsigned int i = 0; i < nBarSigma; i++ )
504 {
505 sprintf( brname, "FLeft%i", i );
506 sprintf( ibrname, "FLeft%i/D", i );
507 btoftree->Branch( brname, &cnvFLeft[i], ibrname );
508 }
509 for ( unsigned int i = 0; i < nBarSigma; i++ )
510 {
511 sprintf( brname, "FRight%i", i );
512 sprintf( ibrname, "FRight%i/D", i );
513 btoftree->Branch( brname, &cnvFRight[i], ibrname );
514 }
515 for ( unsigned int i = 0; i < nBarSigCnt; i++ )
516 {
517 sprintf( brname, "FCounter%i", i );
518 sprintf( ibrname, "FCounter%i/D", i );
519 btoftree->Branch( brname, &cnvFCount[i], ibrname );
520 }
521
522 for ( int i = 0; i < 176; i++ )
523 {
524 for ( j = 0; j < static_cast<int>( nBarAtten ); j++ )
525 { cnvBarAtten[j] = btof->getBTofAtten( i, j ); }
526 for ( j = 0; j < static_cast<int>( nBarSpeed ); j++ )
527 { cnvBarSpeed[j] = btof->getBTofSpeed( i, j ); }
528 for ( j = 0; j < static_cast<int>( nBarPar ); j++ )
529 {
530 cnvBarPar1[j] = btof->getBTofPleft( i, j );
531 cnvBarPar2[j] = btof->getBTofPright( i, j );
532 }
533 for ( j = 0; j < static_cast<int>( nBarParOff ); j++ )
534 {
535 cnvBarParOff1_bunch0[j] = btof->getBTofPoffleft_bunch0( i, j );
536 cnvBarParOff2_bunch0[j] = btof->getBTofPoffright_bunch0( i, j );
537 }
538 for ( j = 0; j < static_cast<int>( nBarParOff ); j++ )
539 {
540 cnvBarParOff1_bunch1[j] = btof->getBTofPoffleft_bunch1( i, j );
541 cnvBarParOff2_bunch1[j] = btof->getBTofPoffright_bunch1( i, j );
542 }
543 for ( j = 0; j < static_cast<int>( nBarParOff ); j++ )
544 {
545 cnvBarParOff1_bunch2[j] = btof->getBTofPoffleft_bunch2( i, j );
546 cnvBarParOff2_bunch2[j] = btof->getBTofPoffright_bunch2( i, j );
547 }
548 for ( j = 0; j < static_cast<int>( nBarParOff ); j++ )
549 {
550 cnvBarParOff1_bunch3[j] = btof->getBTofPoffleft_bunch3( i, j );
551 cnvBarParOff2_bunch3[j] = btof->getBTofPoffright_bunch3( i, j );
552 }
553 for ( j = 0; j < static_cast<int>( nBarSigma ); j++ )
554 {
555 cnvFLeft[j] = btof->getBTofFleft( i, j );
556 cnvFRight[j] = btof->getBTofFright( i, j );
557 }
558 for ( j = 0; j < static_cast<int>( nBarSigCnt ); j++ )
559 { cnvFCount[j] = btof->getBTofFcounter( i, j ); }
560 btoftree->Fill();
561 }
562
563 // write etoftree----------------------------------------------------------------
564 double cnvEndAtten[nEndAtten];
565 double cnvEndSpeed[nEndSpeed];
566 double cnvEndPar[nEndPar];
567 double cnvEndFPar[nEndSigma];
568
569 char ecname[8], iecname[8];
570 TTree* etoftree = new TTree( "EndTofPar", "EndTofPar" );
571 for ( unsigned int i = 0; i < nEndAtten; i++ )
572 {
573 sprintf( ecname, "Atten%i", i );
574 sprintf( iecname, "Atten%i/D", i );
575 etoftree->Branch( ecname, &cnvEndAtten[i], iecname );
576 }
577 for ( unsigned int i = 0; i < nEndSpeed; i++ )
578 {
579 sprintf( ecname, "Speed%i", i );
580 sprintf( iecname, "Speed%i/D", i );
581 etoftree->Branch( ecname, &cnvEndSpeed[i], iecname );
582 }
583 for ( unsigned int i = 0; i < nEndPar; i++ )
584 {
585 sprintf( ecname, "P%i", i );
586 sprintf( iecname, "P%i/D", i );
587 etoftree->Branch( ecname, &cnvEndPar[i], iecname );
588 }
589 for ( unsigned int i = 0; i < nEndSigma; i++ )
590 {
591 sprintf( ecname, "FCounter%i", i );
592 sprintf( iecname, "FCounter%i/D", i );
593 etoftree->Branch( ecname, &cnvEndFPar[i], iecname );
594 }
595
596 for ( int i = 0; i < 96; i++ )
597 {
598 for ( j = 0; j < static_cast<int>( nEndAtten ); j++ )
599 { cnvEndAtten[j] = btof->getETofAtten( i, j ); }
600 for ( j = 0; j < static_cast<int>( nEndSpeed ); j++ )
601 { cnvEndSpeed[j] = btof->getETofSpeed( i, j ); }
602 for ( j = 0; j < static_cast<int>( nEndPar ); j++ )
603 { cnvEndPar[j] = btof->getETofP( i, j ); }
604 for ( j = 0; j < static_cast<int>( nEndSigma ); j++ )
605 { cnvEndFPar[j] = btof->getETofFP( i, j ); }
606 etoftree->Fill();
607 }
608
609 // write etftree----------------------------------------------------------------
610 double cnvEtfSpeed[nEtfSpeed];
611 double cnvEtfPar[nEtfPar];
612 double cnvEtfPar1[nEtfPar];
613 double cnvEtfPar2[nEtfPar];
614
615 char etfname[8], ietfname[8];
616 TTree* etftree = new TTree( "EtfTofPar", "EtfTofPar" );
617 for ( unsigned int i = 0; i < nEtfSpeed; i++ )
618 {
619 sprintf( etfname, "Speed%i", i );
620 sprintf( ietfname, "Speed%i/D", i );
621 etftree->Branch( etfname, &cnvEtfSpeed[i], ietfname );
622 }
623 for ( unsigned int i = 0; i < nEtfPar; i++ )
624 {
625 sprintf( etfname, "P%i", i );
626 sprintf( ietfname, "P%i/D", i );
627 etftree->Branch( etfname, &cnvEtfPar[i], ietfname );
628 }
629 for ( unsigned int i = 0; i < nEtfPar; i++ )
630 {
631 sprintf( etfname, "P%i", i + nEtfPar );
632 sprintf( ietfname, "P%i/D", i + nEtfPar );
633 etftree->Branch( etfname, &cnvEtfPar1[i], ietfname );
634 }
635 for ( unsigned int i = 0; i < nEtfPar; i++ )
636 {
637 sprintf( etfname, "P%i", i + 2 * nEtfPar );
638 sprintf( ietfname, "P%i/D", i + 2 * nEtfPar );
639 etftree->Branch( etfname, &cnvEtfPar2[i], ietfname );
640 }
641
642 for ( int i = 0; i < 72; i++ )
643 {
644 for ( int k = 0; k < 12; k++ )
645 {
646 for ( j = 0; j < static_cast<int>( nEtfSpeed ); j++ )
647 { cnvEtfSpeed[j] = btof->getEtfSpeed( i, k, j ); }
648 for ( j = 0; j < static_cast<int>( nEtfPar ); j++ )
649 {
650 cnvEtfPar[j] = btof->getEtfPcombine( i, k, j );
651 cnvEtfPar1[j] = btof->getEtfPleft( i, k, j );
652 cnvEtfPar2[j] = btof->getEtfPright( i, k, j );
653 }
654 etftree->Fill();
655 }
656 }
657
658 // write etftree----------------------------------------------------------------
659 double cnvEtfBunchP[nEtfBunch];
660
661 char etfbunchname[8], ietfbunchname[8];
662 TTree* etfbunchtree = new TTree( "EtfTofBunch", "EtfTofBunch" );
663 for ( unsigned int i = 0; i < nEtfBunch; i++ )
664 {
665 sprintf( etfbunchname, "pbunch%i", i );
666 sprintf( ietfbunchname, "pbunch%i/D", i );
667 etfbunchtree->Branch( etfbunchname, &cnvEtfBunchP[i], ietfbunchname );
668 }
669
670 for ( j = 0; j < static_cast<int>( nEtfBunch ); j++ )
671 { cnvEtfBunchP[j] = btof->getEtfPBunch( 0, j ); }
672 etfbunchtree->Fill();
673
674 // write all the trees
675 btoftree->Write();
676 etoftree->Write();
677 etftree->Write();
678 etfbunchtree->Write();
679 delete btoftree;
680 delete etoftree;
681 delete etftree;
682 delete etfbunchtree;
683 closeWrite();
684 log << MSG::INFO << "successfully create RootFile" << endmsg;
685
686 return sc;
687}
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)
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
IMessageSvc * msgSvc()
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 getEtfPBunch(int cnx, 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 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)

◆ 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 58 of file RootTofCalibDataCnv.cxx.

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

54{ return CLID_Calib_TofCal; }

◆ repSvcType()

virtual long RootTofCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 35 of file RootTofCalibDataCnv.h.

◆ 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: