BOSS 6.6.4.p01
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 34 of file TreeEstTofCalibDataCnv.cxx.

34 :
36
37}
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 44 of file TreeEstTofCalibDataCnv.cxx.

44 {
46}

◆ 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 48 of file TreeEstTofCalibDataCnv.cxx.

49 {
50
51 MsgStream log(msgSvc(), "TreeEstTofCalibDataCnv");
52 log<<MSG::DEBUG<<"SetProperty"<<endreq;
53
54 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
55 DatabaseRecord *records=add->pp();
56
57 TBufferFile *buf1 = new TBufferFile(TBuffer::kRead);
58 TBufferFile *buf2 = new TBufferFile(TBuffer::kRead);
59 TBufferFile *buf3 = new TBufferFile(TBuffer::kRead);
60 TBufferFile *buf4 = new TBufferFile(TBuffer::kRead);
61
62 buf1->SetBuffer((*records)["BarTofPar"],512000,kFALSE);
63 buf2->SetBuffer((*records)["EndTofPar"],512000,kFALSE);
64 buf3->SetBuffer((*records)["TofConPar"],512000,kFALSE);
65 buf4->SetBuffer((*records)["BarTof"],512000,kFALSE);
66
67 std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
68 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
69
70 TTree *btoftree= new TTree();
71 TTree *etoftree= new TTree();
72 TTree *btofcommontree = new TTree();
73 TTree *CalibInfo = new TTree();
74
75 btoftree->Streamer(*buf1);
76 etoftree->Streamer(*buf2);
77 btofcommontree->Streamer(*buf3);
78 CalibInfo->Streamer(*buf4);
79
84
85 std::vector<CalibData::bTofCalibBase> tmpbTof;
86 std::vector<CalibData::eTofCalibBase> tmpeTof;
87 std::vector<CalibData::bTofCommonCalibBase> tmpbTofCommon;
88 std::vector<CalibData::tofCalibInfoBase> tofinfoCol;
89
90 // Read in the object
91 int cnt;
92 // read btoftree ------------------------------------------------------------
93 double cnvBarPar1[nBarPar];
94 double cnvBarPar2[nBarPar];
95 double cnvBarParOff1_bunch0[nBarParOff];
96 double cnvBarParOff2_bunch0[nBarParOff];
97 double cnvBarParOff1_bunch1[nBarParOff];
98 double cnvBarParOff2_bunch1[nBarParOff];
99 double cnvBarParOff1_bunch2[nBarParOff];
100 double cnvBarParOff2_bunch2[nBarParOff];
101 double cnvBarParOff1_bunch3[nBarParOff];
102 double cnvBarParOff2_bunch3[nBarParOff];
103
104 char brname[10];
105 for( unsigned int i=0; i<nBarPar; i++ ) {
106 sprintf( brname, "P%i", i );
107 btoftree -> SetBranchAddress( brname, &cnvBarPar1[i] );
108 }
109 for( unsigned int i=0; i<nBarPar; i++ ) {
110 sprintf( brname, "P%i", i+nBarPar );
111 btoftree -> SetBranchAddress( brname, &cnvBarPar2[i] );
112 }
113 for( unsigned int i=0; i<nBarParOff; i++ ) {
114 sprintf( brname, "Bunch0_Poff%i", i );
115 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch0[i] );
116 }
117 for( unsigned int i=0; i<nBarParOff; i++ ) {
118 sprintf( brname, "Bunch0_Poff%i", i+nBarParOff );
119 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch0[i] );
120 }
121 for( unsigned int i=0; i<nBarParOff; i++ ) {
122 sprintf( brname, "Bunch1_Poff%i", i );
123 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch1[i] );
124 }
125 for( unsigned int i=0; i<nBarParOff; i++ ) {
126 sprintf( brname, "Bunch1_Poff%i", i+nBarParOff );
127 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch1[i] );
128 }
129 for( unsigned int i=0; i<nBarParOff; i++ ) {
130 sprintf( brname, "Bunch2_Poff%i", i );
131 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch2[i] );
132 }
133 for( unsigned int i=0; i<nBarParOff; i++ ) {
134 sprintf( brname, "Bunch2_Poff%i", i+nBarParOff );
135 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch2[i] );
136 }
137 for( unsigned int i=0; i<nBarParOff; i++ ) {
138 sprintf( brname, "Bunch3_Poff%i", i );
139 btoftree -> SetBranchAddress( brname, &cnvBarParOff1_bunch3[i] );
140 }
141 for( unsigned int i=0; i<nBarParOff; i++ ) {
142 sprintf( brname, "Bunch3_Poff%i", i+nBarParOff );
143 btoftree -> SetBranchAddress( brname, &cnvBarParOff2_bunch3[i] );
144 }
145
146 for(cnt=0; cnt<176; cnt++){
147 btoftree -> GetEntry( cnt );
148 bTof.setP1( cnvBarPar1 );
149 bTof.setP2( cnvBarPar2 );
150 bTof.setPoff1_bunch0( cnvBarParOff1_bunch0 );
151 bTof.setPoff2_bunch0( cnvBarParOff2_bunch0 );
152 bTof.setPoff1_bunch1( cnvBarParOff1_bunch1 );
153 bTof.setPoff2_bunch1( cnvBarParOff2_bunch1 );
154 bTof.setPoff1_bunch2( cnvBarParOff1_bunch2 );
155 bTof.setPoff2_bunch2( cnvBarParOff2_bunch2 );
156 bTof.setPoff1_bunch3( cnvBarParOff1_bunch3 );
157 bTof.setPoff2_bunch3( cnvBarParOff2_bunch3 );
158 tmpbTof.push_back(bTof);
159 }
160
161 //read etoftree
162 double cnvEndPar[nEndPar];
163
164 char ecname[10];
165 for( unsigned int i=0; i<nEndPar; i++ ) {
166 sprintf( ecname, "P%i", i );
167 etoftree -> SetBranchAddress( ecname, &cnvEndPar[i] );
168 }
169
170 for( cnt=0; cnt<96; cnt++ ) {
171 etoftree -> GetEntry( cnt );
172 eTof.setP( cnvEndPar );
173 tmpeTof.push_back( eTof );
174 }
175
176 //read bTofCommonCalibBase
177 double cnvBarOffset[nBarOffset];
178 for( unsigned int i=0; i<nBarOffset; i++ ) {
179 sprintf( brname, "t0offset%i", i );
180 btofcommontree-> SetBranchAddress( brname, &cnvBarOffset[i]);
181 }
182
183 int entries = btofcommontree->GetEntries();
184 for(cnt=0;cnt<entries;cnt++){
185 btofcommontree->GetEntry(cnt);
186 bTofCommon.setOffset( cnvBarOffset );
187 tmpbTofCommon.push_back(bTofCommon);
188 }
189
190 CalibData::TofCalibData *tmpObject = new CalibData::TofCalibData(&tmpbTof,&tmpbTofCommon,&tmpeTof,&tofinfoCol);
191
192 refpObject=tmpObject;
193 delete btoftree;
194 delete etoftree;
195 delete btofcommontree;
196 delete CalibInfo;
197
198 return StatusCode::SUCCESS;
199}
data SetBranchAddress("time",&time)
data GetEntry(0)
const unsigned int nBarOffset
const unsigned int nBarParOff
const unsigned int nEndPar
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)
virtual DatabaseRecord * pp()
Definition: TreeAddress.h:130

◆ objType()

const CLID & TreeEstTofCalibDataCnv::objType ( ) const

Definition at line 40 of file TreeEstTofCalibDataCnv.cxx.

40 {
42}

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