BOSS 8.0.0
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
destinationoperator (const source &) const
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
virtual destinationconvert (const source &) const =0
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
typedef Ty1 source
typedef Ty2 destination
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.

TreeCalBaseCnv(ISvcLocator *svc, const CLID &clid)

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

39{ return CLID_Calib_EstTofCal; }

Referenced by CalibTreeCnvSvc::createConverter().

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

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

◆ objType()

const CLID & TreeEstTofCalibDataCnv::objType ( ) const

Definition at line 37 of file TreeEstTofCalibDataCnv.cxx.

37{ return CLID_Calib_EstTofCal; }

◆ repSvcType()

virtual long TreeEstTofCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file TreeEstTofCalibDataCnv.h.

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