2#include "GaudiKernel/MsgStream.h"
4#include "CalibData/Dedx/DedxCalibData.h"
5#include "CalibDataSvc/IInstrumentName.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"
23#include "CalibDataSvc/ICalibRootSvc.h"
24#include "CalibDataSvc/ICalibMetaCnvSvc.h"
25#include "CalibData/CalibBase1.h"
28#include "CalibData/CalibModel.h"
49 DataObject*& refpObject) {
51 MsgStream log(
msgSvc(),
"RootDedxCalibDataCnv");
52 log<<MSG::DEBUG<<
"SetProperty"<<endreq;
55 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
66 TTree *rungtree = (TTree*)
m_inFile -> Get(
"runcalib");
71 int N = rungtree -> GetEntries();
72 tmpObject -> setrunNO(N);
77 tmpObject -> setrung(rungain,0,i);
78 tmpObject -> setrung(runmean,1,i);
79 tmpObject -> setrung(runno,2,i);
80 tmpObject -> setrung(runresol,3,i);
91 double iner_chi[1600];
92 double iner_gain[1600];
93 double iner_hits[1600];
94 double ip_eangle[1600];
96 double out_gain[1600];
97 double out_hits[1600];
99 TTree *ddgtree = (TTree*)
m_inFile -> Get(
"ddgcalib");
104 TBranch *bbb = ddgtree->FindBranch(
"Id_doca");
117 tmpObject -> setddg(ddg0[i],0,i);
118 tmpObject -> setddg(ddg1[i],1,i);
119 tmpObject -> setddg(ddg2[i],2,i);
120 tmpObject -> setddg(ddg3[i],3,i);
123 for(i=0; i<1600; i++){
134 tmpObject -> set_id_doca(id_doca[i],i);
135 tmpObject -> set_iner_chi(iner_chi[i],i);
136 tmpObject -> set_iner_gain(iner_gain[i],i);
137 tmpObject -> set_iner_hits(iner_hits[i],i);
138 tmpObject -> set_ip_eangle(ip_eangle[i],i);
139 tmpObject -> set_out_chi(out_chi[i],i);
140 tmpObject -> set_out_gain(out_gain[i],i);
141 tmpObject -> set_out_hits(out_hits[i],i);
151 TTree *entratree = (TTree*)
m_inFile -> Get(
"entracalib");
160 tmpObject -> setenta(entra0[i],0,i);
161 tmpObject -> setenta(entra1[i],1,i);
162 tmpObject -> setenta(entra2[i],2,i);
163 tmpObject -> setenta(entra3[i],3,i);
165 tmpObject -> set_enanglesize(engle_no);
166 for(i=0; i<engle_no; i++){
167 tmpObject -> set_enangle(engle[i],i);
177 double gcostheta[80];
180 TTree *ggstree = (TTree*)
m_inFile -> Get(
"ggscalib");
192 tmpObject -> setggs(ggs0[i],0,i);
193 tmpObject -> setggs(ggs1[i],1,i);
194 tmpObject -> setggs(ggs2[i],2,i);
195 tmpObject -> setggs(ggs3[i],3,i);
199 if(!bbb) gcostheta[i]=0;
204 log<<MSG::FATAL<<
"hadron entry is larger than 20, larger than designed"<<endreq;
205 return StatusCode::FAILURE;
210 for(i=0;i<hadron_entry;i++){
220 TTree *zdeptree = (TTree*)
m_inFile -> Get(
"zdepcalib");
228 tmpObject -> setzdep(zdep0[i],0,i);
229 tmpObject -> setzdep(zdep1[i],1,i);
230 tmpObject -> setzdep(zdep2[i],2,i);
231 tmpObject -> setzdep(zdep3[i],3,i);
236 double gt0[35],gdedx[35];
237 TTree *gaintree = (TTree*)
m_inFile -> Get(
"gaincalib");
244 tmpObject -> setgain(gain);
250 tmpObject->
set_t0(gt0[i],i);
256 TTree *resoltree = (TTree*)
m_inFile -> Get(
"resolcalib");
259 tmpObject -> setresol(resol);
263 TTree *wiregtree = (TTree*)
m_inFile -> Get(
"wiregcalib");
267 tmpObject -> setwireg(wireg[i],i);
272 TTree *layergtree = (TTree*)
m_inFile -> Get(
"layergcalib");
277 tmpObject -> setlayerg(layerg[i],i);
280 refpObject=tmpObject;
287 return StatusCode::SUCCESS;
293 MsgStream log(
msgSvc(),
"RootDedxCalibDataCnv");
298 { log<<MSG::ERROR<<
"unable to open files"<<endreq;
308 TTree *rungcalibtree =
new TTree(
"rungcalib",
"rungCalib");
309 rungcalibtree -> Branch(
"rungain", &rungain,
"S/D");
310 rungcalibtree -> Branch(
"runmean", &runmean,
"S/D");
311 rungcalibtree -> Branch(
"runno", &runno,
"S/D");
312 rungcalibtree -> Branch(
"runresol", &runresol,
"S/D");
315 rungain = tmpObject->
getrung(0,i);
316 runmean = tmpObject->
getrung(1,i);
317 runno = tmpObject->
getrung(2,i);
318 runresol = tmpObject->
getrung(3,i);
319 rungcalibtree -> Fill();
329 TTree *ddgcalibtree =
new TTree(
"ddgcalib",
"ddgCalib");
330 ddgcalibtree -> Branch(
"ddg0", &ddg0,
"S/D");
331 ddgcalibtree -> Branch(
"ddg1", &ddg1,
"S/D");
332 ddgcalibtree -> Branch(
"ddg2", &ddg2,
"S/D");
333 ddgcalibtree -> Branch(
"ddg3", &ddg3,
"S/D");
335 ddg0 = tmpObject->
getddg(0,i);
336 ddg1 = tmpObject->
getddg(1,i);
337 ddg2 = tmpObject->
getddg(2,i);
338 ddg3 = tmpObject->
getddg(3,i);
339 ddgcalibtree -> Fill();
347 TTree *ggscalibtree =
new TTree(
"ggscalib",
"ggsCalib");
348 ggscalibtree -> Branch(
"ggs0", &ggs0,
"S/D");
349 ggscalibtree -> Branch(
"ggs1", &ggs1,
"S/D");
350 ggscalibtree -> Branch(
"ggs2", &ggs2,
"S/D");
351 ggscalibtree -> Branch(
"ggs3", &ggs3,
"S/D");
353 ggs0 = tmpObject->
getggs(0,i);
354 ggs1 = tmpObject->
getggs(1,i);
355 ggs2 = tmpObject->
getggs(2,i);
356 ggs3 = tmpObject->
getggs(3,i);
357 ggscalibtree -> Fill();
365 TTree *zdepcalibtree =
new TTree(
"zdepcalib",
"zdepCalib");
366 zdepcalibtree -> Branch(
"zdep0", &zdep0,
"S/D");
367 zdepcalibtree -> Branch(
"zdep1", &zdep1,
"S/D");
368 zdepcalibtree -> Branch(
"zdep2", &zdep2,
"S/D");
369 zdepcalibtree -> Branch(
"zdep3", &zdep3,
"S/D");
371 zdep0 = tmpObject->
getzdep(0,i);
372 zdep1 = tmpObject->
getzdep(1,i);
373 zdep2 = tmpObject->
getzdep(2,i);
374 zdep3 = tmpObject->
getzdep(3,i);
375 zdepcalibtree -> Fill();
383 TTree *entacalibtree =
new TTree(
"entacalib",
"entaCalib");
384 entacalibtree -> Branch(
"enta0", &enta0,
"S/D");
385 entacalibtree -> Branch(
"enta1", &enta1,
"S/D");
386 entacalibtree -> Branch(
"enta2", &enta2,
"S/D");
387 entacalibtree -> Branch(
"enta3", &enta3,
"S/D");
389 enta0 = tmpObject->
getenta(0,i);
390 enta1 = tmpObject->
getenta(1,i);
391 enta2 = tmpObject->
getenta(2,i);
392 enta3 = tmpObject->
getenta(3,i);
393 entacalibtree -> Fill();
400 TTree *gaintree =
new TTree(
"gaincalib",
"gainCalib");
401 gaintree -> Branch(
"gain", &gain,
"S/D");
407 TTree *resoltree =
new TTree(
"resolcalib",
"resolCalib");
408 resoltree -> Branch(
"resol", &resol,
"S/D");
415 TTree *wiregcalibtree =
new TTree(
"wiregcalib",
"wiregCalib");
416 wiregcalibtree -> Branch(
"wireg", &wireg,
"S/D");
417 for(i=0; i<6796; i++){
419 wiregcalibtree -> Fill();
424 TTree *layergcalibtree =
new TTree(
"layergcalib",
"layergCalib");
425 layergcalibtree -> Branch(
"layerg", &layerg,
"S/D");
428 layergcalibtree -> Fill();
432 rungcalibtree -> Write();
433 ddgcalibtree -> Write();
434 ggscalibtree -> Write();
435 zdepcalibtree -> Write();
436 entacalibtree -> Write();
438 resoltree -> Write();
439 wiregcalibtree -> Write();
440 layergcalibtree -> Write();
442 delete rungcalibtree;
445 delete zdepcalibtree;
446 delete entacalibtree;
449 delete wiregcalibtree;
450 delete layergcalibtree;
452 log<<MSG::INFO<<
"successfully create RootFile"<<endreq;
const CLID CLID_Calib_DedxCal
data SetBranchAddress("time",&time)
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)