BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeMucCalibDataCnv Class Reference

#include <TreeMucCalibDataCnv.h>

+ Inheritance diagram for TreeMucCalibDataCnv:

Public Member Functions

const CLID & objType () const
 
 TreeMucCalibDataCnv (ISvcLocator *svc)
 
virtual ~TreeMucCalibDataCnv ()
 
virtual long repSvcType () const
 
- Public Member Functions inherited from TreeCalBaseCnv
virtual ~TreeCalBaseCnv ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&refpObject)
 
ICalibTreeSvcgetCalibTreeSvc ()
 
 TreeCalBaseCnv (ISvcLocator *svc, const CLID &clid)
 
virtual StatusCode createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
- 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 TreeCalBaseCnv
static const unsigned char storageType ()
 

Protected Member Functions

virtual StatusCode i_createObj (IOpaqueAddress *address, DataObject *&refpObject)
 
- Protected Member Functions inherited from TreeCalBaseCnv
virtual StatusCode internalCreateObj (DataObject *&refpObject, IOpaqueAddress *address)
 
virtual StatusCode i_createObj (IOpaqueAddress *address, 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)
 
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< TreeMucCalibDataCnv >
 

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 TreeCalBaseCnv
ICalibTreeSvcm_treeSvc
 
ICalibMetaCnvSvcm_metaSvc
 
IInstrumentNamem_instrSvc
 
int m_serNo
 
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 Ttrees to TCDS. All such converters need to do certain things, which are handled here. Methods common to all calibrations are in the base class TreeCalBaseCnv

Author
huang bin

Definition at line 22 of file TreeMucCalibDataCnv.h.

Constructor & Destructor Documentation

◆ TreeMucCalibDataCnv()

TreeMucCalibDataCnv::TreeMucCalibDataCnv ( ISvcLocator *  svc)

◆ ~TreeMucCalibDataCnv()

virtual TreeMucCalibDataCnv::~TreeMucCalibDataCnv ( )
inlinevirtual

Definition at line 31 of file TreeMucCalibDataCnv.h.

31{};

Member Function Documentation

◆ classID()

const CLID & TreeMucCalibDataCnv::classID ( )
static

Definition at line 43 of file TreeMucCalibDataCnv.cxx.

43 {
44 return CLID_Calib_MucCal;
45}

◆ i_createObj()

StatusCode TreeMucCalibDataCnv::i_createObj ( IOpaqueAddress *  address,
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 TreeCalBaseCnv.

Definition at line 47 of file TreeMucCalibDataCnv.cxx.

48 {
49
50 MsgStream log(msgSvc(), "TreeMucCalibDataCnv");
51 log<<MSG::DEBUG<<"SetProperty"<<endreq;
53 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
54 DatabaseRecord *records=add->pp();
55
56 TBufferFile *buf1 = new TBufferFile(TBuffer::kRead);
57 TBufferFile *buf2 = new TBufferFile(TBuffer::kRead);
58 TBufferFile *buf3 = new TBufferFile(TBuffer::kRead);
59 buf1->SetBuffer((*records)["LayTree"],512000,kFALSE);
60 buf2->SetBuffer((*records)["BoxTree"],512000,kFALSE);
61 buf3->SetBuffer((*records)["StrTree"],512000,kFALSE);
62 std::cout<<" SftVer is "<<(*records)["SftVer"];
63 std::cout<<" CalVerSft is "<<(*records)["CalParVer"];
64 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
65
66
67 TTree* laytree = new TTree();
68 laytree->Streamer(*buf1);
69 log<<MSG::DEBUG<< "laytree name:\t" << laytree->GetName() << endreq;
70 TTree* boxtree = new TTree();
71 boxtree->Streamer(*buf2);
72 log<<MSG::DEBUG<< "boxtree name:\t" << boxtree->GetName() << endreq;
73 TTree* strtree= new TTree();
74 strtree->Streamer(*buf3);
75 log<<MSG::DEBUG<< "strtree name:\t" << strtree->GetName() << endreq;
76
77 // Read in the object
78 //read layerConst-----------------------------
79 Double_t lay_eff,box_eff,str_eff;
80 Double_t lay_cnt, box_cnt, str_cnt;
81 Double_t lay_nos, box_nos, str_nos;
82 Double_t lay_nos_ratio, box_nos_ratio, str_nos_ratio;
83 lay_eff = box_eff = str_eff = 0.0;
84 lay_cnt = box_cnt = str_cnt = 0.0;
85 lay_nos = box_nos = str_nos = 0.0;
86 lay_nos_ratio = box_nos_ratio = str_nos_ratio = 0.0;
87
88 char name[60];
89 laytree->SetBranchAddress("layer_eff", &lay_eff);
90 laytree->SetBranchAddress("layer_cnt", &lay_cnt);
91 laytree->SetBranchAddress("layer_noise", &lay_nos);
92 laytree->SetBranchAddress("layer_nosratio",&lay_nos_ratio);
93
94 boxtree->SetBranchAddress("box_eff", &box_eff);
95 boxtree->SetBranchAddress("box_cnt", &box_cnt);
96 boxtree->SetBranchAddress("box_noise", &box_nos);
97 boxtree->SetBranchAddress("box_nosratio", &box_nos_ratio);
98
99 strtree->SetBranchAddress("strip_eff", &str_eff);
100 strtree->SetBranchAddress("strip_cnt", &str_cnt);
101 strtree->SetBranchAddress("strip_noise", &str_nos);
102 strtree->SetBranchAddress("strip_nosratio", &str_nos_ratio);
103
104 int part, segment, layer, strip;
105 part = segment = layer = strip = 0;
106 for(int i=0; i<LAYER_MAX; i++)
107 {
108 laytree->GetEntry(i);
109 tmpObject->setLayerEff(lay_eff,i);
110 tmpObject->setLayerCnt(lay_cnt, i);
111 tmpObject->setLayerNos(lay_nos, i);
112 tmpObject->setLayerNosRatio(lay_nos_ratio, i);
113 sprintf(name,"LayClstPro");
114 for(int j=0; j<CLST_MAX; j++) {
115 // if( ht_Pro[0] != NULL ) tmpObject->setLayerClstPro(ht_Pro[0]->GetBinContent(j),i,j);
116 // else tmpObject->setLayerClstPro(DEFAULT_CLST_PRO[j],i,j);
117 tmpObject->setLayerClstPro(DEFAULT_CLST_PRO[j],i,j);
118 }
119 log<<MSG::DEBUG<<"layer: " << i << "\t" << lay_eff <<endreq;
120 }
121
122 for(int i=0; i<BOX_MAX; i++)
123 {
124 m_ptrIdTr->SetBoxPos( i, &part, &segment, &layer );
125 boxtree->GetEntry(i);
126 tmpObject->setBoxEff(box_eff, part, segment, layer);
127 tmpObject->setBoxCnt(box_cnt, part, segment, layer);
128 tmpObject->setBoxNos(box_nos, part, segment, layer);
129 tmpObject->setBoxNosRatio(box_nos_ratio, part, segment, layer);
130
131 sprintf(name,"BoxClstPro_B%d",i);
132 for(int j=0; j<CLST_MAX; j++) {
133 // if( ht_Pro[1] != NULL ) tmpObject->setBoxClstPro(ht_Pro[1]->GetBinContent(j),part,segment,layer,j);
134 // else
135 tmpObject->setBoxClstPro(DEFAULT_CLST_PRO[j],part,segment,layer,j);
136 }
137 log<<MSG::DEBUG<<"box: " << i << "\t" << box_eff <<endreq;
138 }
139
140 log<<MSG::DEBUG<<"strtree entries:\t" << strtree->GetEntries() << endreq;
141 for(int i=0; i<STRIP_MAX; i++)
142 {
143 m_ptrIdTr->SetStripPos( i, &part, &segment, &layer, &strip );
144 strtree->GetEntry(i);
145 tmpObject->setStripEff(str_eff, part, segment, layer, strip);
146 tmpObject->setStripCnt(str_cnt, part, segment, layer, strip);
147 tmpObject->setStripNos(str_nos, part, segment, layer, strip);
148 tmpObject->setStripNosRatio(str_nos_ratio, part, segment, layer, strip);
149 log<<MSG::DEBUG<<"strip: " << i << "\t" << str_eff <<endreq;
150
151 }
152
153 refpObject=tmpObject;
154 delete laytree;
155 delete boxtree;
156 delete strtree;
157 return StatusCode::SUCCESS;
158
159
160}
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 setBoxClstPro(const double boxpro, int i, int j, int k, int l)
bool SetBoxPos(int boxid, int *part, int *segment, int *layer)
bool SetStripPos(int stripid, int *part, int *segment, int *layer, int *subid)
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 & TreeMucCalibDataCnv::objType ( ) const

Definition at line 39 of file TreeMucCalibDataCnv.cxx.

39 {
40 return CLID_Calib_MucCal;
41}

◆ repSvcType()

virtual long TreeMucCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 36 of file TreeMucCalibDataCnv.h.

Friends And Related Function Documentation

◆ CnvFactory< TreeMucCalibDataCnv >

friend class CnvFactory< TreeMucCalibDataCnv >
friend

Definition at line 1 of file TreeMucCalibDataCnv.h.


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