BOSS 7.0.7
BESIII Offline Software System
Loading...
Searching...
No Matches
RootMucCalibDataCnv Class Reference

#include <RootMucCalibDataCnv.h>

+ Inheritance diagram for RootMucCalibDataCnv:

Public Member Functions

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

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
 

Friends

class CnvFactory< RootMucCalibDataCnv >
 

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 26 of file RootMucCalibDataCnv.h.

Constructor & Destructor Documentation

◆ RootMucCalibDataCnv()

RootMucCalibDataCnv::RootMucCalibDataCnv ( ISvcLocator *  svc)

◆ ~RootMucCalibDataCnv()

virtual RootMucCalibDataCnv::~RootMucCalibDataCnv ( )
inlinevirtual

Definition at line 35 of file RootMucCalibDataCnv.h.

35{};

Member Function Documentation

◆ classID()

const CLID & RootMucCalibDataCnv::classID ( )
static

Definition at line 49 of file RootMucCalibDataCnv.cxx.

49 {
50 return CLID_Calib_MucCal;
51}

◆ createRoot()

StatusCode RootMucCalibDataCnv::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 162 of file RootMucCalibDataCnv.cxx.

163 {
164
165 MsgStream log(msgSvc(), "RootMucCalibDataCnv");
166
167 // Open the file, create the branch
168/* StatusCode sc = openWrite(fname);
169 if(!sc)
170 { log<<MSG::ERROR<<"unable to open files"<<endreq;
171 }
172 // write the Data in the TCDS to RootFile
173 CalibData::MucCalibData* tmpObject = dynamic_cast<CalibData::MucCalibData*>(pTDSObj);
174 int tmpNo;
175 double MucCalibConst;
176 double EnCoeff;
177 double PosCoeff;
178 int i;
179
180 //DigiCalibConst------------------------------------------------------------------
181 TTree *Digitree = new TTree("DigiCalibConst", "DigiCalibConst");
182 Digitree -> Branch("DigiCalibConst", &MucCalibConst, "MucCalibConst/D");
183 tmpNo = tmpObject -> getDigiCalibConstNo();
184 for(i=0; i<tmpNo; i++){
185 MucCalibConst = tmpObject -> getDigiCalibConst(i);
186 Digitree -> Fill();
187 }
188
189
190 //EnCoeff-------------------------------------------------------------------------
191 TTree *Entree = new TTree("EnCoeff", "EnCoeff");
192 Entree -> Branch("EnCoeff", &EnCoeff, "EnCoeff/D");
193 tmpNo = tmpObject -> getEnCoeffNo();
194 for(i=0; i<tmpNo; i++){
195 EnCoeff = tmpObject -> getEnCoeff(i);
196 Entree -> Fill();
197 }
198
199 //PosCoeff-------------------------------------------------------------------------
200 TTree *Postree = new TTree("PosCoeff", "PosCoeff");
201 Postree -> Branch("PosCoeff", &PosCoeff, "PosCoeff/D");
202 tmpNo = tmpObject -> getPosCoeffNo();
203 for(i=0; i<tmpNo; i++){
204 PosCoeff = tmpObject -> getPosCoeff(i);
205 Postree -> Fill();
206 }
207
208
209 Digitree -> Write();
210 Entree -> Write();
211 Postree -> Write();
212
213
214 delete Digitree;
215 delete Entree;
216 delete Postree;
217
218 closeWrite();
219 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
220 */
221 return StatusCode::SUCCESS;
222
223}
IMessageSvc * msgSvc()

◆ i_createObj()

StatusCode RootMucCalibDataCnv::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 53 of file RootMucCalibDataCnv.cxx.

54 {
55
56 MsgStream log(msgSvc(), "RootMucCalibDataCnv");
57 log<<MSG::DEBUG<<"SetProperty"<<endreq;
58
59 StatusCode sc = openRead(fname);
60 if(!sc)
61 { log<<MSG::ERROR<<"unable to open files"<<endreq;
62 return StatusCode::FAILURE;
63 }
64
65 MucCalibData *tmpObject = new MucCalibData() ;
66 // Read in our object
67 // int i;
68 // int nentries;
69
70 // read DigiCalibConst ------------------------------------------------------------
71
72 Double_t lay_eff, box_eff, str_eff;
73 Double_t lay_cnt, box_cnt, str_cnt;
74 Double_t lay_nos, box_nos, str_nos;
75 Double_t lay_nos_ratio, box_nos_ratio, str_nos_ratio;
76 lay_eff = box_eff = str_eff = 0.0;
77 lay_cnt = box_cnt = str_cnt = 0.0;
78 lay_nos = box_nos = str_nos = 0.0;
79 lay_nos_ratio = box_nos_ratio = str_nos_ratio = 0.0;
80
81 char name[60];
82
83 TTree* tr_Lvl[3];
84 //TTree* tr_ClstPro[2];
85
86 //TTree *ddgtree = (TTree*)m_inFile -> Get("ddgcalib");
87 tr_Lvl[0] = (TTree*)m_inFile->Get("LayConst");
88 tr_Lvl[0]->SetBranchAddress("layer_eff", &lay_eff);
89 tr_Lvl[0]->SetBranchAddress("layer_cnt", &lay_cnt);
90 tr_Lvl[0]->SetBranchAddress("layer_noise", &lay_nos);
91 tr_Lvl[0]->SetBranchAddress("layer_nosratio", &lay_nos_ratio);
92
93 tr_Lvl[1] = (TTree*)m_inFile->Get("BoxConst");
94 tr_Lvl[1]->SetBranchAddress("box_eff", &box_eff);
95 tr_Lvl[1]->SetBranchAddress("box_cnt", &box_cnt);
96 tr_Lvl[1]->SetBranchAddress("box_noise", &box_nos);
97 tr_Lvl[1]->SetBranchAddress("box_nosratio", &box_nos_ratio);
98
99 tr_Lvl[2] = (TTree*)m_inFile->Get("StrConst");
100 tr_Lvl[2]->SetBranchAddress("strip_eff", &str_eff);
101 tr_Lvl[2]->SetBranchAddress("strip_cnt", &str_cnt);
102 tr_Lvl[2]->SetBranchAddress("strip_noise", &str_nos);
103 tr_Lvl[2]->SetBranchAddress("strip_nosratio", &str_nos_ratio);
104 //tr_ClstPro[0] = (TTree*)m_inFile->Get("LayClstPro");
105 //tr_ClstPro[1] = (TTree*)m_inFile->Get("BoxClstPro");
106
107 int part, segment, layer, strip;
108 part = segment = layer = strip = 0;
109 for(int i=0; i<LAYER_MAX; i++)
110 {
111
112 tr_Lvl[0]->GetEntry(i);
113 tmpObject->setLayerEff(lay_eff, i);
114 tmpObject->setLayerCnt(lay_cnt, i);
115 tmpObject->setLayerNos(lay_nos, i);
116 tmpObject->setLayerNosRatio(lay_nos_ratio, i);
117
118 sprintf(name,"LayClstPro");
119 //tr_ClstPro[0] = (TTree*)m_inFile->Get(name);
120 for(int j=0; j<CLST_MAX; j++) {
121 //if( tr_ClstPro[0] != NULL ) tmpObject->setLayerClstPro(tr_ClstPro[0]->GetBinContent(j),i,j);
122 //else tmpObject->setLayerClstPro(DEFAULT_CLST_PRO[j],i,j);
123 tmpObject->setLayerClstPro(DEFAULT_CLST_PRO[j],i,j);
124 }
125 //log<<MSG::DEBUG<<"layer: " << i << "\t" << lay_eff <<endreq;
126 }
127
128 for(int i=0; i<BOX_MAX; i++)
129 {
130 m_ptrIdTr->SetBoxPos( i, &part, &segment, &layer );
131 tr_Lvl[1]->GetEntry(i);
132 tmpObject->setBoxEff(box_eff, part, segment, layer);
133 tmpObject->setBoxCnt(box_cnt, part, segment, layer);
134 tmpObject->setBoxNos(box_nos, part, segment, layer);
135 tmpObject->setBoxNosRatio(box_nos_ratio, part, segment, layer);
136
137 sprintf(name,"BoxClstPro_B%d",i);
138 //tr_ClstPro[1] = (TTree*)m_inFile->Get(name);
139 for(int j=0; j<CLST_MAX; j++) {
140 //if( tr_ClstPro[1] != NULL ) tmpObject->setBoxClstPro(tr_ClstPro[1]->GetBinContent(j),part,segment,layer,j);
141 //else tmpObject->setBoxClstPro(DEFAULT_CLST_PRO[j],part,segment,layer,j);
142 tmpObject->setBoxClstPro(DEFAULT_CLST_PRO[j],part,segment,layer,j);
143 }
144 //log<<MSG::DEBUG<<"box: " << i << "\t" << box_eff <<endreq;
145 }
146
147 for(int i=0; i<STRIP_MAX; i++)
148 {
149 m_ptrIdTr->SetStripPos( i, &part, &segment, &layer, &strip );
150 tr_Lvl[2]->GetEntry(i);
151 tmpObject->setStripEff(str_eff, part, segment, layer, strip);
152 tmpObject->setStripCnt(str_cnt, part, segment, layer, strip);
153 tmpObject->setStripNos(str_nos, part, segment, layer, strip);
154 tmpObject->setStripNosRatio(str_nos_ratio, part, segment, layer, strip);
155 //log<<MSG::DEBUG<<"strip: " << i << "\t" << str_eff <<endreq;
156 }
157 refpObject=tmpObject;
158
159 return StatusCode::SUCCESS;
160}
const int STRIP_MAX
Definition: MucMappingAlg.h:24
void setLayerClstPro(const double layerpro, int i, int j)
Definition: MucCalibData.h:95
void setLayerNos(const double layernos, int i)
Definition: MucCalibData.h:92
void setLayerCnt(const double layercnt, int i)
Definition: MucCalibData.h:93
void setBoxCnt(const double boxcnt, int i, int j, int k)
Definition: MucCalibData.h:99
void setStripNos(const double stripnos, int i, int j, int k, int l)
Definition: MucCalibData.h:104
void setBoxNosRatio(const double boxratio, int i, int j, int k)
Definition: MucCalibData.h:100
void setStripEff(const double stripeff, int i, int j, int k, int l)
Definition: MucCalibData.h:103
void setStripNosRatio(const double stripnosratio, int i, int j, int k, int l)
Definition: MucCalibData.h:106
void setStripCnt(const double stripcnt, int i, int j, int k, int l)
Definition: MucCalibData.h:105
void setBoxEff(const double boxeff, int i, int j, int k)
Definition: MucCalibData.h:97
void setBoxNos(const double boxnos, int i, int j, int k)
Definition: MucCalibData.h:98
void setLayerEff(const double layereff, int i)
Definition: MucCalibData.h:91
void setLayerNosRatio(const double layernosratio, int i)
Definition: MucCalibData.h:94
void setBoxClstPro(const double boxpro, int i, int j, int k, int l)
Definition: MucCalibData.h:101
bool SetBoxPos(int boxid, int *part, int *segment, int *layer)
bool SetStripPos(int stripid, int *part, int *segment, int *layer, int *subid)
StatusCode openRead(const std::string &fname)
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)

◆ objType()

const CLID & RootMucCalibDataCnv::objType ( ) const

Definition at line 45 of file RootMucCalibDataCnv.cxx.

45 {
46 return CLID_Calib_MucCal;
47}

◆ repSvcType()

virtual long RootMucCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 39 of file RootMucCalibDataCnv.h.

39 {
41 }
unsigned const char CALIBROOT_StorageType
Definition: ICalibRootSvc.h:20

Friends And Related Function Documentation

◆ CnvFactory< RootMucCalibDataCnv >

friend class CnvFactory< RootMucCalibDataCnv >
friend

Definition at line 1 of file RootMucCalibDataCnv.h.


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