CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeDedxCalibDataCnv Class Reference

#include <TreeDedxCalibDataCnv.h>

+ Inheritance diagram for TreeDedxCalibDataCnv:

Public Member Functions

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

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
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< TreeDedxCalibDataCnv >
 

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

Constructor & Destructor Documentation

◆ TreeDedxCalibDataCnv()

TreeDedxCalibDataCnv::TreeDedxCalibDataCnv ( ISvcLocator *  svc)

◆ ~TreeDedxCalibDataCnv()

virtual TreeDedxCalibDataCnv::~TreeDedxCalibDataCnv ( )
inlinevirtual

Definition at line 29 of file TreeDedxCalibDataCnv.h.

29{};

Member Function Documentation

◆ classID()

const CLID & TreeDedxCalibDataCnv::classID ( )
static

Definition at line 42 of file TreeDedxCalibDataCnv.cxx.

42 {
43 return CLID_Calib_DedxCal;
44}

◆ i_createObj()

StatusCode TreeDedxCalibDataCnv::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 46 of file TreeDedxCalibDataCnv.cxx.

47 {
48
49 MsgStream log(msgSvc(), "TreeDedxCalibDataCnv");
50 log<<MSG::DEBUG<<"SetProperty"<<endreq;
51
53 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
54 DatabaseRecord *records=add->pp();
55
56 /*TBuffer *buf1 = new TBuffer(TBuffer::kRead);
57 TBuffer *buf2 = new TBuffer(TBuffer::kRead);
58 TBuffer *buf3 = new TBuffer(TBuffer::kRead);
59 TBuffer *buf4 = new TBuffer(TBuffer::kRead);
60 TBuffer *buf5 = new TBuffer(TBuffer::kRead);
61 TBuffer *buf6 = new TBuffer(TBuffer::kRead);
62 TBuffer *buf7 = new TBuffer(TBuffer::kRead);
63 TBuffer *buf8 = new TBuffer(TBuffer::kRead);
64 TBuffer *buf9 = new TBuffer(TBuffer::kRead);*/
65
66TBufferFile *buf1 = new TBufferFile(TBuffer::kRead);
67 TBufferFile *buf2 = new TBufferFile(TBuffer::kRead);
68 TBufferFile *buf3 = new TBufferFile(TBuffer::kRead);
69 TBufferFile *buf4 = new TBufferFile(TBuffer::kRead);
70 TBufferFile *buf5 = new TBufferFile(TBuffer::kRead);
71 TBufferFile *buf6 = new TBufferFile(TBuffer::kRead);
72 TBufferFile *buf7 = new TBufferFile(TBuffer::kRead);
73 TBufferFile *buf8 = new TBufferFile(TBuffer::kRead);
74 TBufferFile *buf9 = new TBufferFile(TBuffer::kRead);
75
76 buf1->SetBuffer((*records)["DriftDist"],512000,kFALSE);
77 buf2->SetBuffer((*records)["EntranceAng"],512000,kFALSE);
78 buf3->SetBuffer((*records)["MeanGain"],512000,kFALSE);
79 buf4->SetBuffer((*records)["GasGain"],512000,kFALSE);
80 buf5->SetBuffer((*records)["LayerGain"],512000,kFALSE);
81 buf6->SetBuffer((*records)["Resolution"],512000,kFALSE);
82 buf7->SetBuffer((*records)["WireGain"],512000,kFALSE);
83 buf8->SetBuffer((*records)["ZDep"],512000,kFALSE);
84 buf9->SetBuffer((*records)["RunGain"],512000,kFALSE);
85
86
87
88 std::cout<<" SftVer is "<<(*records)["SftVer"];
89 std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
90 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
91
92
93
94 TTree* ddgtree = new TTree();
95 ddgtree->Streamer(*buf1);
96
97 TTree* entratree = new TTree();
98 entratree->Streamer(*buf2);
99
100 TTree* gaintree= new TTree();
101 gaintree->Streamer(*buf3);
102
103 TTree* ggstree = new TTree();
104 ggstree->Streamer(*buf4);
105
106 TTree* layergtree = new TTree();
107 layergtree->Streamer(*buf5);
108
109 TTree* resoltree = new TTree();
110 resoltree->Streamer(*buf6);
111
112 TTree* wiregtree = new TTree();
113 wiregtree->Streamer(*buf7);
114
115 TTree* zdeptree = new TTree();
116 zdeptree->Streamer(*buf8);
117
118 TTree *rungtree = new TTree();
119 rungtree->Streamer(*buf9);
120
121 double rungain;
122 double runmean;
123 int runno;
124 double runresol;
125
126 rungtree -> SetBranchAddress("rungain", &rungain);
127 rungtree -> SetBranchAddress("runmean", &runmean);
128 rungtree -> SetBranchAddress("runno", &runno);
129 rungtree -> SetBranchAddress("runresol", &runresol);
130 int N = rungtree -> GetEntries();
131 tmpObject -> setrunNO(N);
132 for(int i=0; i<N; i++){
133 rungtree -> GetEntry(i);
134 tmpObject -> setrung(rungain,0,i);
135 tmpObject -> setrung(runmean,1,i);
136 tmpObject -> setrung(runno,2,i);
137 tmpObject -> setrung(runresol,3,i);
138 }
139
140
141 double ddg0[43];
142 double ddg1[43];
143 double ddg2[43];
144 double ddg3[43];
145 double id_doca[1600];
146 double iner_chi[1600];
147 double iner_gain[1600];
148 double iner_hits[1600];
149 double ip_eangle[1600];
150 double out_chi[1600];
151 double out_gain[1600];
152 double out_hits[1600];
153
154 ddgtree -> SetBranchAddress("ddg0", ddg0);
155 ddgtree -> SetBranchAddress("ddg1", ddg1);
156 ddgtree -> SetBranchAddress("ddg2", ddg2);
157 ddgtree -> SetBranchAddress("ddg3", ddg3);
158 TBranch *bbb = ddgtree->FindBranch("Id_doca");
159 if(bbb){
160 ddgtree -> SetBranchAddress("Id_doca", id_doca);
161 ddgtree -> SetBranchAddress("Iner_chi", iner_chi);
162 ddgtree -> SetBranchAddress("Iner_gain", iner_gain);
163 ddgtree -> SetBranchAddress("Iner_hits", iner_hits);
164 ddgtree -> SetBranchAddress("Ip_eangle", ip_eangle);
165 ddgtree -> SetBranchAddress("Out_chi", out_chi);
166 ddgtree -> SetBranchAddress("Out_gain", out_gain);
167 ddgtree -> SetBranchAddress("Out_hits", out_hits);
168 }
169
170 ddgtree -> GetEntry(0);
171 for(int i=0; i<43; i++){
172
173 tmpObject -> setddg(ddg0[i],0,i);
174 tmpObject -> setddg(ddg1[i],1,i);
175 tmpObject -> setddg(ddg2[i],2,i);
176 tmpObject -> setddg(ddg3[i],3,i);
177 }
178
179 for(int i=0; i<1600; i++){
180 if(!bbb){
181 id_doca[i]=0;
182 iner_chi[i]=0;
183 iner_gain[i]=0;
184 iner_hits[i]=0;
185 ip_eangle[i]=0;
186 out_chi[i]=0;
187 out_gain[i]=0;
188 out_hits[i]=0;
189 }
190 tmpObject -> set_id_doca(id_doca[i],i);
191 tmpObject -> set_iner_chi(iner_chi[i],i);
192 tmpObject -> set_iner_gain(iner_gain[i],i);
193 tmpObject -> set_iner_hits(iner_hits[i],i);
194 tmpObject -> set_ip_eangle(ip_eangle[i],i);
195 tmpObject -> set_out_chi(out_chi[i],i);
196 tmpObject -> set_out_gain(out_gain[i],i);
197 tmpObject -> set_out_hits(out_hits[i],i);
198 }
199
200
201 double entra0[43];
202 double entra1[43];
203 double entra2[43];
204 double entra3[43];
205 double engle[100];
206 int engle_no;
207 entratree -> SetBranchAddress("entra0", entra0);
208 entratree -> SetBranchAddress("entra1", entra1);
209 entratree -> SetBranchAddress("entra2", entra2);
210 entratree -> SetBranchAddress("entra3", entra3);
211 entratree -> SetBranchAddress("1denangle", engle);
212 entratree -> SetBranchAddress("1denangle_entry", &engle_no);
213 entratree -> GetEntry(0);
214 for(int i=0; i<43; i++){
215 tmpObject -> setenta(entra0[i],0,i);
216 tmpObject -> setenta(entra1[i],1,i);
217 tmpObject -> setenta(entra2[i],2,i);
218 tmpObject -> setenta(entra3[i],3,i);
219 }
220
221 tmpObject -> set_enanglesize(engle_no);
222 for(int i=0; i<engle_no; i++){
223 tmpObject -> set_enangle(engle[i],i);
224 }
225
226
227
228
229// read ggscalib ------------------------------------------------------------
230 double ggs0[43];
231 double ggs1[43];
232 double ggs2[43];
233 double ggs3[43];
234 double gcostheta[80];
235 int hadron_entry;
236 double hadron[20];
237 ggstree -> SetBranchAddress("ggs0", ggs0);
238 ggstree -> SetBranchAddress("ggs1", ggs1);
239 ggstree -> SetBranchAddress("ggs2", ggs2);
240 ggstree -> SetBranchAddress("ggs3", ggs3);
241 ggstree -> SetBranchAddress("hadron", hadron);
242 ggstree -> SetBranchAddress("hadronNo", &hadron_entry);
243 if(bbb){
244 ggstree -> SetBranchAddress("costheta", gcostheta);}
245 ggstree -> GetEntry(0);
246 for(int i=0; i<43;i++){
247 tmpObject -> setggs(ggs0[i],0,i);
248 tmpObject -> setggs(ggs1[i],1,i);
249 tmpObject -> setggs(ggs2[i],2,i);
250 tmpObject -> setggs(ggs3[i],3,i);
251 }
252 for(int i=0; i<80;i++){
253 if(!bbb) gcostheta[i]=0;
254 tmpObject ->set_costheta(gcostheta[i],i);
255 }
256 if(hadron_entry>20){
257 log<<MSG::FATAL<<"hadron entry is larger than 20, larger than designed"<<endreq;
258 return StatusCode::FAILURE;
259 }
260 tmpObject->set_hadronNo(hadron_entry);
261 for(int i=0;i<hadron_entry;i++){
262 tmpObject->set_hadron(hadron[i],i);
263 }
264
265
266// read zdepcalib ------------------------------------------------------------
267 double zdep0[43];
268 double zdep1[43];
269 double zdep2[43];
270 double zdep3[43];
271 zdeptree -> SetBranchAddress("zdep0", zdep0);
272 zdeptree -> SetBranchAddress("zdep1", zdep1);
273 zdeptree -> SetBranchAddress("zdep2", zdep2);
274 zdeptree -> SetBranchAddress("zdep3", zdep3);
275 zdeptree -> GetEntry(0);
276
277 for(int i=0; i<43;i++){
278 tmpObject -> setzdep(zdep0[i],0,i);
279 tmpObject -> setzdep(zdep1[i],1,i);
280 tmpObject -> setzdep(zdep2[i],2,i);
281 tmpObject -> setzdep(zdep3[i],3,i);
282 }
283// read gain ------------------------------------------------------------
284 double gain;
285 double gt0[35],gdedx[35];
286 gaintree -> SetBranchAddress("gain", &gain);
287 if(bbb){
288 gaintree -> SetBranchAddress("t0", gt0);
289 gaintree -> SetBranchAddress("dedx", gdedx);}
290 gaintree -> GetEntry(0);
291 tmpObject -> setgain(gain);
292 for(int i=0; i<35;i++){
293 if(!bbb){
294 gt0[i]=0;
295 gdedx[i]=0;
296 }
297 tmpObject->set_t0(gt0[i],i);
298 tmpObject->set_dedx(gdedx[i],i);
299 }
300
301// read resol----------------------------------------------------------------
302 double resol;
303 resoltree -> SetBranchAddress("resol", &resol);
304 resoltree -> GetEntry(0);
305 tmpObject -> setresol(resol);
306
307// read wireg----------------------------------------------------------------
308 double wireg[6796];
309 wiregtree -> SetBranchAddress("wireg",wireg);
310 wiregtree -> GetEntry(0);
311 for(int i=0;i<6796;i++){
312 if(wireg[i]>5||wireg[i]<0.2) wireg[i]=0;
313 tmpObject -> setwireg(wireg[i],i);
314 }
315
316// read layerg----------------------------------------------------------------
317 double layerg[43];
318 layergtree -> SetBranchAddress("layerg",layerg);
319 layergtree -> GetEntry(0);
320
321 for(int i=0;i<43;i++){
322 tmpObject -> setlayerg(layerg[i],i);
323 }
324
325
326
327 // Read in the object
328
329
330 refpObject=tmpObject;
331
332 delete ddgtree;
333 delete entratree;
334 delete gaintree;
335 delete ggstree;
336 delete layergtree;
337 delete resoltree;
338 delete wiregtree;
339 delete zdeptree;
340 delete rungtree;
341
342 return StatusCode::SUCCESS;
343
344
345}
data SetBranchAddress("time",&time)
data GetEntry(0)

◆ objType()

const CLID & TreeDedxCalibDataCnv::objType ( ) const

Definition at line 38 of file TreeDedxCalibDataCnv.cxx.

38 {
39 return CLID_Calib_DedxCal;
40}

◆ repSvcType()

virtual long TreeDedxCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file TreeDedxCalibDataCnv.h.

Friends And Related Function Documentation

◆ CnvFactory< TreeDedxCalibDataCnv >

friend class CnvFactory< TreeDedxCalibDataCnv >
friend

Definition at line 1 of file TreeDedxCalibDataCnv.h.


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