1#include "GaudiKernel/MsgStream.h"
3#include "CalibData/Dedx/DedxCalibData.h"
4#include "CalibDataSvc/IInstrumentName.h"
5#include "CalibMySQLCnv/TreeAddress.h"
11#include "TBufferFile.h"
13#include "GaudiKernel/CnvFactory.h"
14#include "GaudiKernel/IOpaqueAddress.h"
15#include "GaudiKernel/DataObject.h"
16#include "GaudiKernel/IAddressCreator.h"
17#include "GaudiKernel/IDataProviderSvc.h"
18#include "GaudiKernel/IConversionSvc.h"
19#include "GaudiKernel/GenericAddress.h"
21#include "CalibDataSvc/ICalibTreeSvc.h"
22#include "CalibDataSvc/ICalibMetaCnvSvc.h"
25#include "CalibData/CalibModel.h"
47 DataObject*& refpObject) {
49 MsgStream log(
msgSvc(),
"TreeDedxCalibDataCnv");
50 log<<MSG::DEBUG<<
"SetProperty"<<endreq;
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);
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);
88 std::cout<<
" SftVer is "<<(*records)[
"SftVer"];
89 std::cout<<
" CalVerSft is "<<(*records)[
"CalParVer"];
90 std::cout<<
" File name is "<<(*records)[
"FileName"]<<std::endl;
94 TTree* ddgtree =
new TTree();
95 ddgtree->Streamer(*buf1);
97 TTree* entratree =
new TTree();
98 entratree->Streamer(*buf2);
100 TTree* gaintree=
new TTree();
101 gaintree->Streamer(*buf3);
103 TTree* ggstree =
new TTree();
104 ggstree->Streamer(*buf4);
106 TTree* layergtree =
new TTree();
107 layergtree->Streamer(*buf5);
109 TTree* resoltree =
new TTree();
110 resoltree->Streamer(*buf6);
112 TTree* wiregtree =
new TTree();
113 wiregtree->Streamer(*buf7);
115 TTree* zdeptree =
new TTree();
116 zdeptree->Streamer(*buf8);
118 TTree *rungtree =
new TTree();
119 rungtree->Streamer(*buf9);
130 int N = rungtree -> GetEntries();
131 tmpObject -> setrunNO(N);
132 for(
int i=0; i<N; 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);
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];
158 TBranch *bbb = ddgtree->FindBranch(
"Id_doca");
171 for(
int i=0; i<43; i++){
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);
179 for(
int i=0; i<1600; i++){
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);
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);
221 tmpObject -> set_enanglesize(engle_no);
222 for(
int i=0; i<engle_no; i++){
223 tmpObject -> set_enangle(engle[i],i);
234 double gcostheta[80];
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);
252 for(
int i=0; i<80;i++){
253 if(!bbb) gcostheta[i]=0;
257 log<<MSG::FATAL<<
"hadron entry is larger than 20, larger than designed"<<endreq;
258 return StatusCode::FAILURE;
261 for(
int i=0;i<hadron_entry;i++){
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);
285 double gt0[35],gdedx[35];
291 tmpObject -> setgain(gain);
292 for(
int i=0; i<35;i++){
297 tmpObject->
set_t0(gt0[i],i);
305 tmpObject -> setresol(resol);
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);
321 for(
int i=0;i<43;i++){
322 tmpObject -> setlayerg(layerg[i],i);
330 refpObject=tmpObject;
342 return StatusCode::SUCCESS;
const CLID CLID_Calib_DedxCal
data SetBranchAddress("time",&time)
void set_costheta(const double aa, int i)
void set_hadronNo(int no)
void set_hadron(const double aa, int i)
void set_t0(const double aa, int i)
void set_dedx(const double aa, int i)
virtual DatabaseRecord * pp()
static const CLID & classID()
virtual StatusCode i_createObj(IOpaqueAddress *address, DataObject *&refpObject)
TreeDedxCalibDataCnv(ISvcLocator *svc)
const CLID & objType() const