BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeTofElecDataCnv Class Reference

#include <TreeTofQElecCnv.h>

Inheritance diagram for TreeTofElecDataCnv:

Public Member Functions

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

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

Constructor & Destructor Documentation

◆ TreeTofElecDataCnv()

TreeTofElecDataCnv::TreeTofElecDataCnv ( ISvcLocator * svc)

Definition at line 28 of file TreeTofQElecCnv.cxx.

TreeCalBaseCnv(ISvcLocator *svc, const CLID &clid)

◆ ~TreeTofElecDataCnv()

virtual TreeTofElecDataCnv::~TreeTofElecDataCnv ( )
inlinevirtual

Definition at line 29 of file TreeTofQElecCnv.h.

29{};

Member Function Documentation

◆ classID()

const CLID & TreeTofElecDataCnv::classID ( )
static

Definition at line 33 of file TreeTofQElecCnv.cxx.

33{ return CLID_TofQ_Elec; }

Referenced by CalibTreeCnvSvc::createConverter().

◆ i_createObj()

StatusCode TreeTofElecDataCnv::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 35 of file TreeTofQElecCnv.cxx.

35 {
36
37 MsgStream log( msgSvc(), "TreeTofElecDataCnv" );
38 log << MSG::DEBUG << "SetProperty" << endmsg;
39
40 TreeAddress* add = dynamic_cast<TreeAddress*>( addr );
41 DatabaseRecord* records = add->pp();
42
43 TBufferFile* buf1 = new TBufferFile( TBuffer::kRead );
44 TBufferFile* buf2 = new TBufferFile( TBuffer::kRead );
45 TBufferFile* buf3 = new TBufferFile( TBuffer::kRead );
46 TBufferFile* buf4 = new TBufferFile( TBuffer::kRead );
47 TBufferFile* buf5 = new TBufferFile( TBuffer::kRead );
48 TBufferFile* buf6 = new TBufferFile( TBuffer::kRead );
49 TBufferFile* buf7 = new TBufferFile( TBuffer::kRead );
50 TBufferFile* buf8 = new TBufferFile( TBuffer::kRead );
51
52 buf1->SetBuffer( ( *records )["BarBoardNum"], 512000, kFALSE );
53 buf2->SetBuffer( ( *records )["EndBoardNum"], 512000, kFALSE );
54 buf3->SetBuffer( ( *records )["QELecBarParEast"], 512000, kFALSE );
55 buf4->SetBuffer( ( *records )["QELecBarParWest"], 512000, kFALSE );
56 buf5->SetBuffer( ( *records )["QELecEndPar"], 512000, kFALSE );
57 buf6->SetBuffer( ( *records )["SimQELecBarParEast"], 512000, kFALSE );
58 buf7->SetBuffer( ( *records )["SimQELecBarParWest"], 512000, kFALSE );
59 buf8->SetBuffer( ( *records )["SimQELecEndPar"], 512000, kFALSE );
60
61 std::cout << " SftVer is " << ( *records )["SftVer"];
62 std::cout << " CalVerSft is " << ( *records )["CalParVer"];
63 std::cout << " File name is " << ( *records )["FileName"] << std::endl;
64
65 TTree* BarBoardNum = new TTree();
66 TTree* EndBoardNum = new TTree();
67 TTree* QElecBarParEast = new TTree();
68 TTree* QElecBarParWest = new TTree();
69 TTree* QElecEndPar = new TTree();
70 TTree* SimQElecBarParEast = new TTree();
71 TTree* SimQElecBarParWest = new TTree();
72 TTree* SimQElecEndPar = new TTree();
73 BarBoardNum->Streamer( *buf1 );
74 EndBoardNum->Streamer( *buf2 );
75 QElecBarParEast->Streamer( *buf3 );
76 QElecBarParWest->Streamer( *buf4 );
77 QElecEndPar->Streamer( *buf5 );
78 SimQElecBarParEast->Streamer( *buf6 );
79 SimQElecBarParWest->Streamer( *buf7 );
80 SimQElecEndPar->Streamer( *buf8 );
81
82 CalibData::BarrelElec bTof;
83 CalibData::EndcapElec eTof;
84
85 std::vector<CalibData::BarrelElec> tmpbTof; //; = new vector<CalibData::bTofCalibBase>;
86 std::vector<CalibData::EndcapElec> tmpeTof;
87
88 // Read in the object
89 int cnt;
90 // read btoftree ------------------------------------------------------------
91 unsigned int num[4];
92 double num1[4];
93 BarBoardNum->SetBranchAddress( "Board", &num1[0] );
94 BarBoardNum->SetBranchAddress( "Channel", &num1[1] );
95 BarBoardNum->SetBranchAddress( "Crate", &num1[2] );
96 BarBoardNum->SetBranchAddress( "Fee", &num1[3] );
97 double p[11];
98 QElecBarParEast->SetBranchAddress( "P0", &p[0] );
99 QElecBarParEast->SetBranchAddress( "P1", &p[1] );
100 QElecBarParEast->SetBranchAddress( "P2", &p[2] );
101 QElecBarParEast->SetBranchAddress( "P3", &p[3] );
102 QElecBarParEast->SetBranchAddress( "P4", &p[4] );
103 QElecBarParEast->SetBranchAddress( "P5", &p[5] );
104 QElecBarParEast->SetBranchAddress( "P6", &p[6] );
105 QElecBarParEast->SetBranchAddress( "P7", &p[7] );
106 QElecBarParEast->SetBranchAddress( "P8", &p[8] );
107 QElecBarParEast->SetBranchAddress( "P9", &p[9] );
108 QElecBarParEast->SetBranchAddress( "P10", &p[10] );
109 double p_w[11];
110 QElecBarParWest->SetBranchAddress( "P0", &p_w[0] );
111 QElecBarParWest->SetBranchAddress( "P1", &p_w[1] );
112 QElecBarParWest->SetBranchAddress( "P2", &p_w[2] );
113 QElecBarParWest->SetBranchAddress( "P3", &p_w[3] );
114 QElecBarParWest->SetBranchAddress( "P4", &p_w[4] );
115 QElecBarParWest->SetBranchAddress( "P5", &p_w[5] );
116 QElecBarParWest->SetBranchAddress( "P6", &p_w[6] );
117 QElecBarParWest->SetBranchAddress( "P7", &p_w[7] );
118 QElecBarParWest->SetBranchAddress( "P8", &p_w[8] );
119 QElecBarParWest->SetBranchAddress( "P9", &p_w[9] );
120 QElecBarParWest->SetBranchAddress( "P10", &p_w[10] );
121 double p_se[11];
122 SimQElecBarParEast->SetBranchAddress( "P0", &p_se[0] );
123 SimQElecBarParEast->SetBranchAddress( "P1", &p_se[1] );
124 SimQElecBarParEast->SetBranchAddress( "P2", &p_se[2] );
125 SimQElecBarParEast->SetBranchAddress( "P3", &p_se[3] );
126 SimQElecBarParEast->SetBranchAddress( "P4", &p_se[4] );
127 SimQElecBarParEast->SetBranchAddress( "P5", &p_se[5] );
128 SimQElecBarParEast->SetBranchAddress( "P6", &p_se[6] );
129 SimQElecBarParEast->SetBranchAddress( "P7", &p_se[7] );
130 SimQElecBarParEast->SetBranchAddress( "P8", &p_se[8] );
131 SimQElecBarParEast->SetBranchAddress( "P9", &p_se[9] );
132 SimQElecBarParEast->SetBranchAddress( "P10", &p_se[10] );
133 double p_sw[11];
134 SimQElecBarParWest->SetBranchAddress( "P0", &p_sw[0] );
135 SimQElecBarParWest->SetBranchAddress( "P1", &p_sw[1] );
136 SimQElecBarParWest->SetBranchAddress( "P2", &p_sw[2] );
137 SimQElecBarParWest->SetBranchAddress( "P3", &p_sw[3] );
138 SimQElecBarParWest->SetBranchAddress( "P4", &p_sw[4] );
139 SimQElecBarParWest->SetBranchAddress( "P5", &p_sw[5] );
140 SimQElecBarParWest->SetBranchAddress( "P6", &p_sw[6] );
141 SimQElecBarParWest->SetBranchAddress( "P7", &p_sw[7] );
142 SimQElecBarParWest->SetBranchAddress( "P8", &p_sw[8] );
143 SimQElecBarParWest->SetBranchAddress( "P9", &p_sw[9] );
144 SimQElecBarParWest->SetBranchAddress( "P10", &p_sw[10] );
145
146 for ( cnt = 0; cnt < 352; cnt++ )
147 {
148 BarBoardNum->GetEntry( cnt );
149 num[0] = num1[0];
150 num[1] = num1[1];
151 num[2] = num1[2];
152 num[3] = num1[3];
153 if ( cnt % 2 != 0 ) { bTof.setNumWest( num ); }
154 if ( cnt % 2 == 0 )
155 {
156 bTof.setNumEast( num );
157 int kkk = cnt / 2;
158 QElecBarParEast->GetEntry( kkk );
159 QElecBarParWest->GetEntry( kkk );
160 SimQElecBarParEast->GetEntry( kkk );
161 SimQElecBarParWest->GetEntry( kkk );
162 bTof.setP1( p );
163 bTof.setP2( p_w );
164 bTof.setSimP1( p_se );
165 bTof.setSimP2( p_sw );
166 }
167 if ( cnt % 2 != 0 ) tmpbTof.push_back( bTof );
168 }
169
170 // read etoftree
171 EndBoardNum->SetBranchAddress( "Board", &num1[0] );
172 EndBoardNum->SetBranchAddress( "Channel", &num1[1] );
173 EndBoardNum->SetBranchAddress( "Crate", &num1[2] );
174 EndBoardNum->SetBranchAddress( "Fee", &num1[3] );
175 QElecEndPar->SetBranchAddress( "P0", &p[0] );
176 QElecEndPar->SetBranchAddress( "P1", &p[1] );
177 QElecEndPar->SetBranchAddress( "P2", &p[2] );
178 QElecEndPar->SetBranchAddress( "P3", &p[3] );
179 QElecEndPar->SetBranchAddress( "P4", &p[4] );
180 QElecEndPar->SetBranchAddress( "P5", &p[5] );
181 QElecEndPar->SetBranchAddress( "P6", &p[6] );
182 QElecEndPar->SetBranchAddress( "P7", &p[7] );
183 QElecEndPar->SetBranchAddress( "P8", &p[8] );
184 QElecEndPar->SetBranchAddress( "P9", &p[9] );
185 QElecEndPar->SetBranchAddress( "P10", &p[10] );
186 SimQElecEndPar->SetBranchAddress( "P0", &p_w[0] );
187 SimQElecEndPar->SetBranchAddress( "P1", &p_w[1] );
188 SimQElecEndPar->SetBranchAddress( "P2", &p_w[2] );
189 SimQElecEndPar->SetBranchAddress( "P3", &p_w[3] );
190 SimQElecEndPar->SetBranchAddress( "P4", &p_w[4] );
191 SimQElecEndPar->SetBranchAddress( "P5", &p_w[5] );
192 SimQElecEndPar->SetBranchAddress( "P6", &p_w[6] );
193 SimQElecEndPar->SetBranchAddress( "P7", &p_w[7] );
194 SimQElecEndPar->SetBranchAddress( "P8", &p_w[8] );
195 SimQElecEndPar->SetBranchAddress( "P9", &p_w[9] );
196 SimQElecEndPar->SetBranchAddress( "P10", &p_w[10] );
197 for ( cnt = 0; cnt < 96; cnt++ )
198 {
199 EndBoardNum->GetEntry( cnt );
200 QElecEndPar->GetEntry( cnt );
201 SimQElecEndPar->GetEntry( cnt );
202 num[0] = num1[0];
203 num[1] = num1[1];
204 num[2] = num1[2];
205 num[3] = num1[3];
206
207 eTof.setNum( num );
208 eTof.setP( p );
209 eTof.setSimP( p_w );
210 tmpeTof.push_back( eTof );
211 }
212
213 CalibData::TofElecData* tmpObject = new CalibData::TofElecData( &tmpbTof, &tmpeTof );
214
215 refpObject = tmpObject;
216 delete BarBoardNum;
217 delete EndBoardNum;
218 delete QElecBarParEast;
219 delete QElecBarParWest;
220 delete QElecEndPar;
221 delete SimQElecBarParEast;
222 delete SimQElecBarParWest;
223 delete SimQElecEndPar;
224
225 return StatusCode::SUCCESS;
226}
IMessageSvc * msgSvc()
void setNumEast(unsigned int idx, unsigned int num)
void setNumWest(unsigned int idx, unsigned int num)

◆ objType()

const CLID & TreeTofElecDataCnv::objType ( ) const

Definition at line 31 of file TreeTofQElecCnv.cxx.

31{ return CLID_TofQ_Elec; }

◆ repSvcType()

virtual long TreeTofElecDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file TreeTofQElecCnv.h.

◆ CnvFactory< TreeTofElecDataCnv >

friend class CnvFactory< TreeTofElecDataCnv >
friend

Definition at line 1 of file TreeTofQElecCnv.h.


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