BOSS 8.0.0
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 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
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
virtual destinationconvert (const source &) const =0
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
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

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

Constructor & Destructor Documentation

◆ RootMucCalibDataCnv()

RootMucCalibDataCnv::RootMucCalibDataCnv ( ISvcLocator * svc)

Definition at line 38 of file RootMucCalibDataCnv.cxx.

40 m_ptrIdTr = new MucIdTransform();
41}
RootCalBaseCnv(ISvcLocator *svc, const CLID &clid)

◆ ~RootMucCalibDataCnv()

virtual RootMucCalibDataCnv::~RootMucCalibDataCnv ( )
inlinevirtual

Definition at line 36 of file RootMucCalibDataCnv.h.

36{};

Member Function Documentation

◆ classID()

const CLID & RootMucCalibDataCnv::classID ( )
static

Definition at line 45 of file RootMucCalibDataCnv.cxx.

45{ return CLID_Calib_MucCal; }

Referenced by CalibRootCnvSvc::createConverter().

◆ 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 161 of file RootMucCalibDataCnv.cxx.

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

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

◆ objType()

const CLID & RootMucCalibDataCnv::objType ( ) const

Definition at line 43 of file RootMucCalibDataCnv.cxx.

43{ return CLID_Calib_MucCal; }

◆ repSvcType()

virtual long RootMucCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 39 of file RootMucCalibDataCnv.h.

◆ 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: