BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
RootMdcCalibDataCnv Class Reference

#include <RootMdcCalibDataCnv.h>

+ Inheritance diagram for RootMdcCalibDataCnv:

Public Member Functions

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

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_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
 

Friends

class CnvFactory< RootMdcCalibDataCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
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

Base class for CAL calibration converters from ROOT files to TCDS. All such converters need to do certain things, which are handled here. Methods common to all calibrations are in the base class RootCalBaseCnv

Author
J. Bogart

Definition at line 21 of file RootMdcCalibDataCnv.h.

Constructor & Destructor Documentation

◆ RootMdcCalibDataCnv()

RootMdcCalibDataCnv::RootMdcCalibDataCnv ( ISvcLocator * svc)

Definition at line 34 of file RootMdcCalibDataCnv.cxx.

34 :
36
37}
const CLID CLID_Calib_MdcCal
Definition CalibModel.h:41
RootCalBaseCnv(ISvcLocator *svc, const CLID &clid)

◆ ~RootMdcCalibDataCnv()

virtual RootMdcCalibDataCnv::~RootMdcCalibDataCnv ( )
inlinevirtual

Definition at line 30 of file RootMdcCalibDataCnv.h.

30{};

Member Function Documentation

◆ classID()

const CLID & RootMdcCalibDataCnv::classID ( )
static

Definition at line 44 of file RootMdcCalibDataCnv.cxx.

44 {
45 return CLID_Calib_MdcCal;
46}

◆ createRoot()

StatusCode RootMdcCalibDataCnv::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 151 of file RootMdcCalibDataCnv.cxx.

152 {
153
154 MsgStream log(msgSvc(), "RootMdcCalibDataCnv");
155 // Open the file, create the branch
156 StatusCode sc = openWrite(fname);
157 if(!sc)
158 { log<<MSG::ERROR<<"unable to open files"<<endreq;
159 }
160 // write the Data in the TCDS to RootFile
161 CalibData::MdcCalibData* tmpObject = dynamic_cast<CalibData::MdcCalibData*>(pTDSObj);
162 int tmpNo;
163 int key;
164 double xtpar;
165 double t0;
166 double delt0;
167 double qtpar[2];
168 double sdpar;
169 int i;
170
171 //xttree------------------------------------------------------------------
172 TTree *xttree = new TTree("XtTree", "XtTree");
173 xttree -> Branch("xtkey", &key, "key/I");
174 xttree -> Branch("xtpar", &xtpar, "xtpar/D");
175 tmpObject -> setXtBegin();
176 while( tmpObject -> getNextXtpar(key, xtpar) ){
177 xttree -> Fill();
178 }
179 //newxttree------------------------------------------------------------------
180 //FIXME
181 /*
182 TObjArray newxttrees_1;
183 //TBufferFile newxttrees_buf(TBuffer::kWrite);
184 int nTree=0;
185 for(int t_layer=0; t_layer<43; t_layer++){
186 for(int t_bin=0; t_bin<18; t_bin++){
187 for(int t_lr=0; t_lr<2; t_lr++){
188 char newXtTreeName[20];
189 sprintf(newXtTreeName,"trNewXt%02d_%02d_%d",t_layer,t_bin,t_lr);
190 TTree *newXttree = ((TTree*)f->Get(newXtTreeName))->CloneTree();
191 newxttrees_1.Add(newXttree);
192 nTree++;
193 }
194 }
195 }
196 newxttrees_1.Streamer(newxttrees_buf);
197 */
198
199
200 //t0tree-------------------------------------------------------------------
201 TTree *t0tree = new TTree("T0Tree", "T0Tree");
202 t0tree -> Branch("t0", &t0, "t0/D");
203 t0tree -> Branch("delt0", &delt0, "delt0/D");
204 tmpNo = tmpObject -> gett0No();
205 for(i=0; i<tmpNo; i++){
206 t0 = tmpObject -> getT0(i);
207 delt0 = tmpObject -> getDelT0(i);
208 t0tree -> Fill();
209 }
210
211 //qttree--------------------------------------------------------------------
212 TTree *qttree = new TTree("QtTree", "QtTree");
213 qttree -> Branch("qtpar0", &(qtpar[0]), "qtpar0/D");
214 qttree -> Branch("qtpar1", &(qtpar[1]), "qtpar1/D");
215 tmpNo = tmpObject -> getqtparNo();
216 for(i=0; i<tmpNo; i++){
217 qtpar[0] = tmpObject -> getQtpar0(i);
218 qtpar[1] = tmpObject -> getQtpar1(i);
219 qttree -> Fill();
220 }
221
222 //sdtree--------------------------------------------------------------------
223 TTree *sdtree = new TTree("SdTree", "SdTree");
224 sdtree -> Branch("sdkey", &key, "key/I");
225 sdtree -> Branch("sdpar", &sdpar, "sdpar/D");
226 tmpObject -> setSdBegin();
227 while( tmpObject -> getNextSdpar(key, sdpar) ){
228 sdtree -> Fill();
229 }
230
231 xttree -> Write();
232 t0tree -> Write();
233 qttree -> Write();
234 sdtree -> Write();
235
236 delete xttree;
237 delete t0tree;
238 delete qttree;
239 delete sdtree;
240
241 closeWrite();
242 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
243 return sc;
244}
curve Branch("CurveSize",&CurveSize,"CurveSize/I")
curve Fill()
curve Write()
IMessageSvc * msgSvc()
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition Taupair.h:42
StatusCode closeWrite()
virtual StatusCode openWrite(const std::string &fname)

◆ i_createObj()

StatusCode RootMdcCalibDataCnv::i_createObj ( const std::string & fname,
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 RootCalBaseCnv.

Definition at line 48 of file RootMdcCalibDataCnv.cxx.

49 {
50
51 MsgStream log(msgSvc(), "RootMdcCalibDataCnv");
52 log<<MSG::DEBUG<<"SetProperty"<<endreq;
53
54 StatusCode sc = openRead(fname);
55 if(!sc)
56 { log<<MSG::ERROR<<"unable to open files"<<endreq;
57 }
58
60 // Read in our object
61 int i;
62 int nentries;
63 // read xttree ------------------------------------------------------------
64 double xtpar;
65 int xtkey;
66 TTree *xttree = (TTree*)m_inFile -> Get("XtTree");
67 xttree -> SetBranchAddress("xtpar", &xtpar);
68 xttree -> SetBranchAddress("xtkey", &xtkey);
69 nentries = xttree -> GetEntries();
70 for(i=0; i<nentries; i++){
71 xttree -> GetEntry(i);
72 tmpObject -> setXtpar(xtkey,xtpar);
73 }
74
75 // read newxttree ------------------------------------------------------------
76 TObjArray newXtTrees;
77 if(NULL!=m_inFile->Get("trNewXt00_00_0")){
78 for(int layid=0; layid<43; layid++){
79 for(int entr=0; entr<18; entr++){
80 for(int lr=0; lr<2; lr++){
81 char newXtTreeName[20];
82 sprintf(newXtTreeName,"trNewXt%02d_%02d_%d",layid,entr,lr);
83 TTree* newXtTree = ((TTree*)m_inFile->Get(newXtTreeName));
84 if(!newXtTree) break;
85 newXtTrees.Add(newXtTree->CloneTree());
86 }//end lr
87 }//end entr
88 }//end layid
89 if((43*18*2)==newXtTrees.GetEntries())tmpObject->setNewXtpar(&newXtTrees);
90 }
91
92
93 // read r2ttree ------------------------------------------------------------
94 TObjArray r2tTrees;
95 if(NULL!=m_inFile->Get("r2t00")){
96 for(int layid=0; layid<43; layid++){
97 char r2tTreeName[20];
98 sprintf(r2tTreeName,"r2t%02d",layid);
99 TTree* r2tTree = ((TTree*)m_inFile->Get(r2tTreeName));
100 if(!r2tTree) break;
101 //reduce Memerey use
102 r2tTree->SetCacheSize(2500);
103 r2tTrees.Add(r2tTree->CloneTree());
104 }
105 if(43==r2tTrees.GetEntries()) tmpObject->setR2tpar(&r2tTrees);
106 }
107
108 // read t0tree ------------------------------------------------------------
109 double t0;
110 double delt0;
111 TTree *t0tree = (TTree*)m_inFile -> Get("T0Tree");
112 t0tree -> SetBranchAddress("t0", &t0);
113 t0tree -> SetBranchAddress("delt0", &delt0);
114 nentries = t0tree -> GetEntries();
115 for(i=0; i<nentries; i++){
116 t0tree -> GetEntry(i);
117 tmpObject -> setT0(t0);
118 tmpObject -> setDelT0(delt0);
119 }
120
121 // read qttree ------------------------------------------------------------
122 double qtpar0;
123 double qtpar1;
124 TTree *qttree = (TTree*)m_inFile -> Get("QtTree");
125 qttree -> SetBranchAddress("qtpar0", &qtpar0);
126 qttree -> SetBranchAddress("qtpar1", &qtpar1);
127 nentries = qttree -> GetEntries();
128 for(i=0; i<nentries; i++){
129 qttree -> GetEntry(i);
130 tmpObject -> setQtpar0(qtpar0);
131 tmpObject -> setQtpar1(qtpar1);
132 }
133
134 // read Sdtree ---------------------------------------------------------
135 double sdpar;
136 int sdkey;
137 TTree *sdtree = (TTree*)m_inFile -> Get("SdTree");
138 sdtree -> SetBranchAddress("sdpar", &sdpar);
139 sdtree -> SetBranchAddress("sdkey", &sdkey);
140 nentries = sdtree -> GetEntries();
141
142 for(i=0; i<nentries; i++){
143 sdtree -> GetEntry(i);
144 tmpObject -> setSdpar(sdkey,sdpar);
145 }
146
147 refpObject=tmpObject;
148 return StatusCode::SUCCESS;
149}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)
data GetEntry(0)
data SetBranchAddress("time",&time)
Int_t nentries
#define NULL
void setR2tpar(TObjArray *r2tTrees)
void setNewXtpar(TObjArray *newXtTrees)
StatusCode openRead(const std::string &fname)

◆ objType()

const CLID & RootMdcCalibDataCnv::objType ( ) const

Definition at line 40 of file RootMdcCalibDataCnv.cxx.

40 {
41 return CLID_Calib_MdcCal;
42}

◆ repSvcType()

virtual long RootMdcCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 35 of file RootMdcCalibDataCnv.h.

35 {
37 }
unsigned const char CALIBROOT_StorageType

Friends And Related Symbol Documentation

◆ CnvFactory< RootMdcCalibDataCnv >

friend class CnvFactory< RootMdcCalibDataCnv >
friend

Definition at line 1 of file RootMdcCalibDataCnv.h.


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