2#include "GaudiKernel/MsgStream.h"
15#include "GaudiKernel/CnvFactory.h"
16#include "GaudiKernel/IOpaqueAddress.h"
17#include "GaudiKernel/DataObject.h"
18#include "GaudiKernel/IAddressCreator.h"
19#include "GaudiKernel/IDataProviderSvc.h"
20#include "GaudiKernel/IConversionSvc.h"
21#include "GaudiKernel/GenericAddress.h"
49 DataObject*& refpObject) {
51 MsgStream log(
msgSvc(),
"RootDedxCalibDataCnv");
52 log<<MSG::DEBUG<<
"SetProperty"<<endreq;
55 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
64 int runno, evtfrom, evtto;
66 TTree *rungtree = (TTree*)
m_inFile -> Get(
"runcalib");
71 if(rungtree->GetBranchStatus(
"evtfrom")){ rungtree ->
SetBranchAddress(
"evtfrom", &evtfrom); rungtree ->
SetBranchAddress(
"evtto", &evtto); }
else{ evtfrom = 0; evtto = 1000000000; }
72 int N = rungtree -> GetEntries();
73 tmpObject -> setrunNO(N);
78 tmpObject -> setrung(rungain,0);
79 tmpObject -> setrung(runmean,1);
80 tmpObject -> setrung(runno,2);
81 tmpObject -> setrung(runresol,3);
82 tmpObject -> setrung(evtfrom,4);
83 tmpObject -> setrung(evtto,5);
94 double iner_chi[1600];
95 double iner_gain[1600];
96 double iner_hits[1600];
97 double ip_eangle[1600];
99 double out_gain[1600];
100 double out_hits[1600];
102 TTree *ddgtree = (TTree*)
m_inFile -> Get(
"ddgcalib");
107 TBranch *bbb = ddgtree->FindBranch(
"Id_doca");
120 tmpObject -> setddg(ddg0[i],0,i);
121 tmpObject -> setddg(ddg1[i],1,i);
122 tmpObject -> setddg(ddg2[i],2,i);
123 tmpObject -> setddg(ddg3[i],3,i);
126 for(i=0; i<1600; i++){
137 tmpObject -> set_id_doca(id_doca[i],i);
138 tmpObject -> set_iner_chi(iner_chi[i],i);
139 tmpObject -> set_iner_gain(iner_gain[i],i);
140 tmpObject -> set_iner_hits(iner_hits[i],i);
141 tmpObject -> set_ip_eangle(ip_eangle[i],i);
142 tmpObject -> set_out_chi(out_chi[i],i);
143 tmpObject -> set_out_gain(out_gain[i],i);
144 tmpObject -> set_out_hits(out_hits[i],i);
154 TTree *entratree = (TTree*)
m_inFile -> Get(
"entracalib");
163 tmpObject -> setenta(entra0[i],0,i);
164 tmpObject -> setenta(entra1[i],1,i);
165 tmpObject -> setenta(entra2[i],2,i);
166 tmpObject -> setenta(entra3[i],3,i);
168 tmpObject -> set_enanglesize(engle_no);
169 for(i=0; i<engle_no; i++){
170 tmpObject -> set_enangle(engle[i],i);
180 double gcostheta[80];
183 TTree *ggstree = (TTree*)
m_inFile -> Get(
"ggscalib");
195 tmpObject -> setggs(ggs0[i],0,i);
196 tmpObject -> setggs(ggs1[i],1,i);
197 tmpObject -> setggs(ggs2[i],2,i);
198 tmpObject -> setggs(ggs3[i],3,i);
202 if(!bbb) gcostheta[i]=0;
207 log<<MSG::FATAL<<
"hadron entry is larger than 20, larger than designed"<<endreq;
208 return StatusCode::FAILURE;
213 for(i=0;i<hadron_entry;i++){
223 TTree *zdeptree = (TTree*)
m_inFile -> Get(
"zdepcalib");
231 tmpObject -> setzdep(zdep0[i],0,i);
232 tmpObject -> setzdep(zdep1[i],1,i);
233 tmpObject -> setzdep(zdep2[i],2,i);
234 tmpObject -> setzdep(zdep3[i],3,i);
239 double gt0[35],gdedx[35];
240 TTree *gaintree = (TTree*)
m_inFile -> Get(
"gaincalib");
247 tmpObject -> setgain(gain);
253 tmpObject->
set_t0(gt0[i],i);
259 TTree *resoltree = (TTree*)
m_inFile -> Get(
"resolcalib");
262 tmpObject -> setresol(resol);
266 TTree *wiregtree = (TTree*)
m_inFile -> Get(
"wiregcalib");
270 tmpObject -> setwireg(wireg[i],i);
275 TTree *layergtree = (TTree*)
m_inFile -> Get(
"layergcalib");
280 tmpObject -> setlayerg(layerg[i],i);
283 refpObject=tmpObject;
290 return StatusCode::SUCCESS;
296 MsgStream log(
msgSvc(),
"RootDedxCalibDataCnv");
301 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
311 TTree *rungcalibtree =
new TTree(
"rungcalib",
"rungCalib");
312 rungcalibtree ->
Branch(
"rungain", &rungain,
"S/D");
313 rungcalibtree ->
Branch(
"runmean", &runmean,
"S/D");
314 rungcalibtree ->
Branch(
"runno", &runno,
"S/D");
315 rungcalibtree ->
Branch(
"runresol", &runresol,
"S/D");
318 rungain = tmpObject->
getrung(0,i);
319 runmean = tmpObject->
getrung(1,i);
320 runno = tmpObject->
getrung(2,i);
321 runresol = tmpObject->
getrung(3,i);
322 rungcalibtree ->
Fill();
332 TTree *ddgcalibtree =
new TTree(
"ddgcalib",
"ddgCalib");
333 ddgcalibtree ->
Branch(
"ddg0", &ddg0,
"S/D");
334 ddgcalibtree ->
Branch(
"ddg1", &ddg1,
"S/D");
335 ddgcalibtree ->
Branch(
"ddg2", &ddg2,
"S/D");
336 ddgcalibtree ->
Branch(
"ddg3", &ddg3,
"S/D");
338 ddg0 = tmpObject->
getddg(0,i);
339 ddg1 = tmpObject->
getddg(1,i);
340 ddg2 = tmpObject->
getddg(2,i);
341 ddg3 = tmpObject->
getddg(3,i);
342 ddgcalibtree ->
Fill();
350 TTree *ggscalibtree =
new TTree(
"ggscalib",
"ggsCalib");
351 ggscalibtree ->
Branch(
"ggs0", &ggs0,
"S/D");
352 ggscalibtree ->
Branch(
"ggs1", &ggs1,
"S/D");
353 ggscalibtree ->
Branch(
"ggs2", &ggs2,
"S/D");
354 ggscalibtree ->
Branch(
"ggs3", &ggs3,
"S/D");
356 ggs0 = tmpObject->
getggs(0,i);
357 ggs1 = tmpObject->
getggs(1,i);
358 ggs2 = tmpObject->
getggs(2,i);
359 ggs3 = tmpObject->
getggs(3,i);
360 ggscalibtree ->
Fill();
368 TTree *zdepcalibtree =
new TTree(
"zdepcalib",
"zdepCalib");
369 zdepcalibtree ->
Branch(
"zdep0", &zdep0,
"S/D");
370 zdepcalibtree ->
Branch(
"zdep1", &zdep1,
"S/D");
371 zdepcalibtree ->
Branch(
"zdep2", &zdep2,
"S/D");
372 zdepcalibtree ->
Branch(
"zdep3", &zdep3,
"S/D");
374 zdep0 = tmpObject->
getzdep(0,i);
375 zdep1 = tmpObject->
getzdep(1,i);
376 zdep2 = tmpObject->
getzdep(2,i);
377 zdep3 = tmpObject->
getzdep(3,i);
378 zdepcalibtree ->
Fill();
386 TTree *entacalibtree =
new TTree(
"entacalib",
"entaCalib");
387 entacalibtree ->
Branch(
"enta0", &enta0,
"S/D");
388 entacalibtree ->
Branch(
"enta1", &enta1,
"S/D");
389 entacalibtree ->
Branch(
"enta2", &enta2,
"S/D");
390 entacalibtree ->
Branch(
"enta3", &enta3,
"S/D");
392 enta0 = tmpObject->
getenta(0,i);
393 enta1 = tmpObject->
getenta(1,i);
394 enta2 = tmpObject->
getenta(2,i);
395 enta3 = tmpObject->
getenta(3,i);
396 entacalibtree ->
Fill();
403 TTree *gaintree =
new TTree(
"gaincalib",
"gainCalib");
404 gaintree ->
Branch(
"gain", &gain,
"S/D");
410 TTree *resoltree =
new TTree(
"resolcalib",
"resolCalib");
411 resoltree ->
Branch(
"resol", &resol,
"S/D");
418 TTree *wiregcalibtree =
new TTree(
"wiregcalib",
"wiregCalib");
419 wiregcalibtree ->
Branch(
"wireg", &wireg,
"S/D");
420 for(i=0; i<6796; i++){
422 wiregcalibtree ->
Fill();
427 TTree *layergcalibtree =
new TTree(
"layergcalib",
"layergCalib");
428 layergcalibtree ->
Branch(
"layerg", &layerg,
"S/D");
431 layergcalibtree ->
Fill();
435 rungcalibtree ->
Write();
436 ddgcalibtree ->
Write();
437 ggscalibtree ->
Write();
438 zdepcalibtree ->
Write();
439 entacalibtree ->
Write();
441 resoltree ->
Write();
442 wiregcalibtree ->
Write();
443 layergcalibtree ->
Write();
445 delete rungcalibtree;
448 delete zdepcalibtree;
449 delete entacalibtree;
452 delete wiregcalibtree;
453 delete layergcalibtree;
455 log<<MSG::INFO<<
"successfully create RootFile"<<endreq;
const CLID CLID_Calib_DedxCal
curve Branch("CurveSize",&CurveSize,"CurveSize/I")
double getenta(int i, int j) const
double getzdep(int i, int j) const
void set_costheta(const double aa, int i)
double getrung(int i, int j) const
void set_hadronNo(int no)
double getlayerg(int i) const
void set_hadron(const double aa, int i)
void set_t0(const double aa, int i)
double getwireg(int i) const
double getddg(int i, int j) const
double getggs(int i, int j) const
void set_dedx(const double aa, int i)
StatusCode openRead(const std::string &fname)
virtual StatusCode openWrite(const std::string &fname)
const CLID & objType() const
static const CLID & classID()
virtual StatusCode createRoot(const std::string &fname, CalibData::CalibBase1 *pTDSObj)
virtual StatusCode i_createObj(const std::string &fname, DataObject *&refpObject)
RootDedxCalibDataCnv(ISvcLocator *svc)
curve SetBranchAddress("CurveSize",&CurveSize)