BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
RootDedxSimDataCnv Class Reference

#include <RootDedxSimDataCnv.h>

+ Inheritance diagram for RootDedxSimDataCnv:

Public Member Functions

const CLID & objType () const
 
 RootDedxSimDataCnv (ISvcLocator *svc)
 
virtual ~RootDedxSimDataCnv ()
 
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
virtual long repSvcType () const
 
- Public Member Functions inherited from RootCalBaseCnv
virtual ~RootCalBaseCnv ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&refpObject)
 
ICalibRootSvcgetCalibRootSvc ()
 
 RootCalBaseCnv (ISvcLocator *svc, const CLID &clid)
 
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
virtual StatusCode readRootObj (const std::string &treename, const std::string &branch, TObject *&pCalib, unsigned index=0)
 
virtual StatusCode readRootObj (TTree *tree, const std::string &branch, TObject *&pCalib, unsigned index=0)
 
- 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 RootCalBaseCnv
static const unsigned char storageType ()
 

Protected Member Functions

virtual StatusCode i_createObj (const std::string &fname, DataObject *&refpObject)
 
- Protected Member Functions inherited from RootCalBaseCnv
virtual StatusCode internalCreateObj (const std::string &fname, DataObject *&refpObject, IOpaqueAddress *address)
 
virtual StatusCode i_createObj (const std::string &fname, 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)
 
virtual StatusCode openWrite (const std::string &fname)
 
StatusCode closeWrite ()
 
StatusCode openRead (const std::string &fname)
 
StatusCode closeRead ()
 
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< RootDedxSimDataCnv >
 

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 RootCalBaseCnv
ICalibRootSvcm_rootSvc
 
ICalibMetaCnvSvcm_metaSvc
 
IInstrumentNamem_instrSvc
 
int m_serNo
 
ITime * m_vstart
 
ITime * m_vend
 
int m_runfrm
 
int m_runto
 
TFile * m_outFile
 
TTree * m_ttree
 
TFile * m_inFile
 
TDirectory * m_saveDir
 

Detailed Description

Definition at line 17 of file RootDedxSimDataCnv.h.

Constructor & Destructor Documentation

◆ RootDedxSimDataCnv()

RootDedxSimDataCnv::RootDedxSimDataCnv ( ISvcLocator *  svc)

◆ ~RootDedxSimDataCnv()

virtual RootDedxSimDataCnv::~RootDedxSimDataCnv ( )
inlinevirtual

Definition at line 26 of file RootDedxSimDataCnv.h.

26{};

Member Function Documentation

◆ classID()

const CLID & RootDedxSimDataCnv::classID ( )
static

Definition at line 44 of file RootDedxSimDataCnv.cxx.

44 {
45 return CLID_Dedx_Sim;
46}

◆ createRoot()

StatusCode RootDedxSimDataCnv::createRoot ( const std::string &  fname,
CalibData::CalibBase1 pTDSObj 
)
virtual

Create ROOT file corresponding to TDS object input.
Default implementation is to return an error. Must be separately implemented for each calibration type.

Parameters
fnameFilename for output file
pTDSObjPointer to tds object to be converted

Reimplemented from RootCalBaseCnv.

Definition at line 110 of file RootDedxSimDataCnv.cxx.

111 {
112 MsgStream log(msgSvc(), "RootDedxSimDataCnv");
113
114 // Open the file, create the branch
115 StatusCode sc = openWrite(fname);
116 if(!sc)
117 { log<<MSG::ERROR<<"unable to open files"<<endreq;
118 }
119 // write the Data in the TCDS to RootFile
120 /* int i;
121 int j;
122 CalibData::TofCalibData* btof = dynamic_cast<CalibData::TofCalibData*>(pTDSObj);
123
124 // write btoftree----------------------------------------------------------------
125 double cnvP1[10];
126 double cnvP2[10];
127 double cnvW[4];
128 double cnvAtten[8];
129 double cnvQ;
130 double cnvSpeed[2];
131 TTree *btoftree = new TTree("BarTofPar", "BarTofPar");
132 btoftree -> Branch("Atten0",&cnvAtten[0], "Atten0/D");
133 btoftree -> Branch("Atten1",&cnvAtten[1], "Atten1/D");
134 btoftree -> Branch("Atten2",&cnvAtten[2], "Atten2/D");
135 btoftree -> Branch("Atten3",&cnvAtten[3], "Atten3/D");
136 btoftree -> Branch("Atten4",&cnvAtten[4], "Atten4/D");
137 btoftree -> Branch("Atten5",&cnvAtten[5], "Atten5/D");
138 btoftree -> Branch("Atten6",&cnvAtten[6], "Atten6/D");
139 btoftree -> Branch("Atten7",&cnvAtten[7], "Atten7/D");
140 btoftree -> Branch("Q0",&cnvQ, "Q0/D");
141 btoftree -> Branch("Speed0",&cnvSpeed[0], "Speed0/D");
142 btoftree -> Branch("Speed1",&cnvSpeed[1], "Speed1/D");
143 btoftree -> Branch("P0",&cnvP1[0], "P0/D");
144 btoftree -> Branch("P1",&cnvP1[1], "P1/D");
145 btoftree -> Branch("P2",&cnvP1[2], "P2/D");
146 btoftree -> Branch("P3",&cnvP1[3], "P3/D");
147 btoftree -> Branch("P4",&cnvP1[4], "P4/D");
148 btoftree -> Branch("P5",&cnvP1[5], "P5/D");
149 btoftree -> Branch("P6",&cnvP1[6], "P6/D");
150 btoftree -> Branch("P7",&cnvP1[7], "P7/D");
151 btoftree -> Branch("P8",&cnvP1[8], "P8/D");
152 btoftree -> Branch("P9",&cnvP1[9], "P9/D");
153 btoftree -> Branch("P10",&cnvP2[0], "P10/D");
154 btoftree -> Branch("P11",&cnvP2[1], "P11/D");
155 btoftree -> Branch("P12",&cnvP2[2], "P12/D");
156 btoftree -> Branch("P13",&cnvP2[3], "P13/D");
157 btoftree -> Branch("P14",&cnvP2[4], "P14/D");
158 btoftree -> Branch("P15",&cnvP2[5], "P15/D");
159 btoftree -> Branch("P16",&cnvP2[6], "P16/D");
160 btoftree -> Branch("P17",&cnvP2[7], "P17/D");
161 btoftree -> Branch("P18",&cnvP2[8], "P17/D");
162 btoftree -> Branch("P19",&cnvP2[9], "P17/D");
163 btoftree -> Branch("W0",&cnvW[0], "W0/D");
164 btoftree -> Branch("W1",&cnvW[1], "W1/D");
165 btoftree -> Branch("W2",&cnvW[2], "W2/D");
166 btoftree -> Branch("W3",&cnvW[3], "W3/D");
167
168 for(i=0; i<176; i++){
169 cnvAtten[0] = btof->getBTofAtten(i,0);
170 cnvAtten[1] = btof->getBTofAtten(i,1);
171 cnvAtten[2] = btof->getBTofAtten(i,2);
172 cnvQ = btof->getBTofQ(i);
173 cnvSpeed[0] = btof->getBTofSpeed(i,0);
174 cnvSpeed[1] = btof->getBTofSpeed(i,1);
175 for(j=0;j<10;j++){
176 cnvP1[j] = btof->getBTofPleft(i,j);
177 cnvP2[j] = btof->getBTofPright(i,j);
178 }
179 for(j=0;j<4;j++){
180 cnvW[j]=btof->getBTofW(i,j);
181 }
182 btoftree -> Fill();
183 }
184
185 //write etoftree----------------------------------------------------------------
186 double ecnvP[8];
187 double ecnvAtten[5];
188 double ecnvSpeed[3];
189 TTree *etoftree = new TTree("EndTofPar", "EndTofPar");
190 etoftree -> Branch("Atten0",&ecnvAtten[0], "Atten0/D");
191 etoftree -> Branch("Atten1",&ecnvAtten[1], "Atten1/D");
192 etoftree -> Branch("Atten2",&ecnvAtten[2], "Atten2/D");
193 etoftree -> Branch("Atten3",&ecnvAtten[3], "Atten3/D");
194 etoftree -> Branch("Atten4",&ecnvAtten[4], "Atten4/D");
195 etoftree -> Branch("Speed0",&ecnvSpeed[0], "Speed0/D");
196 etoftree -> Branch("Speed1",&ecnvSpeed[1], "Speed1/D");
197 etoftree -> Branch("P0",&ecnvP[0], "P0/D");
198 etoftree -> Branch("P1",&ecnvP[1], "P1/D");
199 etoftree -> Branch("P2",&ecnvP[2], "P2/D");
200 etoftree -> Branch("P3",&ecnvP[3], "P3/D");
201 etoftree -> Branch("P4",&ecnvP[4], "P4/D");
202 etoftree -> Branch("P5",&ecnvP[5], "P5/D");
203 etoftree -> Branch("P6",&ecnvP[6], "P6/D");
204 etoftree -> Branch("P7",&ecnvP[7], "P7/D");
205
206 for(i=0; i<96; i++){
207 ecnvAtten[0] = btof->getETofAtten(i,0);
208 ecnvAtten[1] = btof->getETofAtten(i,1);
209 ecnvAtten[2] = btof->getETofAtten(i,2);
210 ecnvSpeed[0] = btof->getETofSpeed(i,0);
211 ecnvSpeed[1] = btof->getETofSpeed(i,1);
212 for(j=0;j<8;j++){
213 ecnvP[j] = btof->getETofP(i,j);
214 }
215 etoftree -> Fill();
216 }
217// write all the trees
218 btoftree -> Write();
219 etoftree -> Write();
220 delete btoftree;
221 delete etoftree;
222 closeWrite();
223 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
224*/
225 return sc;
226
227}
virtual StatusCode openWrite(const std::string &fname)

◆ i_createObj()

StatusCode RootDedxSimDataCnv::i_createObj ( const std::string &  fname,
DataObject *&  refpObject 
)
protectedvirtual

Create the transient representation of an object, given an opaque address. This and the following update method comprise the core functionality of calibration converters. Convenience routine used by most CAL calibration types, which have a <dimension> element describing how the remainder of the Data is laid out. Read from TDS; store information internally in protected members.
Given a pointer to a TDS object which can be cast to "our" type, fill in corresponding information in the corresponding root class

Parameters
pTDSObjPointer to tds object to be converted
pRootObjPointer to destination root object Read in object from specified branch. Don't need tree name; it's always Calib

Reimplemented from RootCalBaseCnv.

Definition at line 48 of file RootDedxSimDataCnv.cxx.

49 {
50
51 MsgStream log(msgSvc(), "RootDedxSimDataCnv");
52 log<<MSG::DEBUG<<"SetProperty"<<endreq;
53
55
56 TH1F *h1=new TH1F();
57 // open the file
58 StatusCode sc = openRead(fname);
59 if(!sc)
60 {
61 log<<MSG::ERROR<<"unable to open files"<<endreq;
62 }
63
64 std::vector<TH1F> hist;
65 std::vector<double> hRange;
66 // Read in the object
67 int cnt;
68 TTree *tree=(TTree*)m_inFile->Get("TH1F_Col");
69 tree->SetBranchAddress("TH1F_Col", &h1);
70 int entries=tree->GetEntries();
71 for (cnt = 0; cnt < entries; cnt++) {
72 tree -> GetEntry(cnt);
73 gROOT->cd();
74 TH1F *h2=new TH1F();
75 h2=(TH1F*)h1->Clone();
76 hist.push_back(*h2);
77 }
78// tmpObject->setHist(&hist);
79 int ver;
80 double betagamma[5000];
81 int totalNum;
82 int bgNum;
83 int thetaNum;
84 TTree* bin = (TTree*)m_inFile->Get("bin");
85 if (bin->FindBranch("version")) bin->SetBranchAddress("version", &ver);
86 else ver = 0;
87 if (bin->FindBranch("thetaNum")) bin->SetBranchAddress("thetaNum", &thetaNum);
88 else thetaNum = 16;
89 bin->SetBranchAddress("totalNum", &totalNum);
90 bin->SetBranchAddress("betagamma", betagamma);
91 bin->SetBranchAddress("betagammaBounds", &bgNum);
92 bin->GetEntry(0);
93
94 //int tot=totalNum*2;
95 for (cnt = 0; cnt < bgNum; cnt++) {
96 hRange.push_back(betagamma[cnt]);
97 }
98
99 tmpObject->setVersion(ver);
100 tmpObject->setRangeNo(bgNum);
101 tmpObject->setRange(&hRange);
102 tmpObject->setThetaNo(thetaNum);
103 tmpObject->setHistNo(totalNum);
104 tmpObject->setHist(&hist);
105 refpObject = tmpObject;
106
107 return StatusCode::SUCCESS;
108}
data GetEntry(0)
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
Definition: FoamA.h:85
void setRange(const vector< double > *hRange)
Definition: DedxSimData.cxx:43
void setHist(const vector< TH1F > *hist)
Definition: DedxSimData.cxx:38
StatusCode openRead(const std::string &fname)

◆ objType()

const CLID & RootDedxSimDataCnv::objType ( ) const

Definition at line 40 of file RootDedxSimDataCnv.cxx.

40 {
41 return CLID_Dedx_Sim;
42}

◆ repSvcType()

virtual long RootDedxSimDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 31 of file RootDedxSimDataCnv.h.

Friends And Related Function Documentation

◆ CnvFactory< RootDedxSimDataCnv >

friend class CnvFactory< RootDedxSimDataCnv >
friend

Definition at line 1 of file RootDedxSimDataCnv.h.


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