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

#include <TreeMdcCalibDataCnv.h>

+ Inheritance diagram for TreeMdcCalibDataCnv:

Public Member Functions

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

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
 

Friends

class CnvFactory< TreeMdcCalibDataCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
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 20 of file TreeMdcCalibDataCnv.h.

Constructor & Destructor Documentation

◆ TreeMdcCalibDataCnv()

TreeMdcCalibDataCnv::TreeMdcCalibDataCnv ( ISvcLocator *  svc)

Definition at line 32 of file TreeMdcCalibDataCnv.cxx.

32 :
34
35 }
const CLID CLID_Calib_MdcCal
Definition: CalibModel.h:41

◆ ~TreeMdcCalibDataCnv()

virtual TreeMdcCalibDataCnv::~TreeMdcCalibDataCnv ( )
inlinevirtual

Definition at line 29 of file TreeMdcCalibDataCnv.h.

29{};

Member Function Documentation

◆ classID()

const CLID & TreeMdcCalibDataCnv::classID ( )
static

Definition at line 42 of file TreeMdcCalibDataCnv.cxx.

42 {
43 return CLID_Calib_MdcCal;
44}

◆ i_createObj()

StatusCode TreeMdcCalibDataCnv::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 46 of file TreeMdcCalibDataCnv.cxx.

47 {
48
49 MsgStream log(msgSvc(), "TreeMdcCalibDataCnv");
50 log<<MSG::DEBUG<<"SetProperty"<<endreq;
52 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
53 DatabaseRecord *records=add->pp();
54
55 TBufferFile *buf1 = new TBufferFile(TBuffer::kRead);
56 TBufferFile *buf2 = new TBufferFile(TBuffer::kRead);
57 TBufferFile *buf3 = new TBufferFile(TBuffer::kRead);
58 TBufferFile *buf4 = new TBufferFile(TBuffer::kRead);
59 TBufferFile *buf5 = new TBufferFile(TBuffer::kRead);
60 TBufferFile *buf6 = new TBufferFile(TBuffer::kRead);
61
62 buf1->SetBuffer((*records)["XtTree"],512000,kFALSE);
63 buf2->SetBuffer((*records)["QtTree"],512000,kFALSE);
64 buf3->SetBuffer((*records)["T0Tree"],512000,kFALSE);
65 buf4->SetBuffer((*records)["SdTree"],512000,kFALSE);
66 buf5->SetBuffer((*records)["NewXtTrees"],51200000,kFALSE);
67 buf6->SetBuffer((*records)["R2tTrees"],25600000,kFALSE);
68
69 std::cout<<" SftVer is "<<(*records)["SftVer"];
70 std::cout<<"TreeMdcCalibDataCnv: CalVerSft is "<<(*records)["CalParVer"]<<std::endl;
71 std::cout<<"TreeMdcCalibDataCnv: Calib file name is "<<(*records)["FileName"]<<std::endl;
72
73 TTree* xttree = new TTree();
74 xttree->Streamer(*buf1);
75
76 TTree* qttree = new TTree();
77 qttree->Streamer(*buf2);
78
79 TTree* t0tree= new TTree();
80 t0tree->Streamer(*buf3);
81
82 TTree* sdtree = new TTree();
83 sdtree->Streamer(*buf4);
84
85 TObjArray newxttrees;
86 DatabaseRecord::iterator it = (*records).find("NewXtTrees");
87 if(it!=(*records).end()){
88 if((*it).second!=NULL) {
89 newxttrees.Streamer(*buf5);
90 }
91 }
92
93 TObjArray r2ttrees;
94 it = (*records).find("R2tTrees");
95 if(it!=(*records).end()){
96 if((*it).second!=NULL) {
97 r2ttrees.Streamer(*buf6);
98 }
99 }
100
101
102 // Read in the object
103 int i;
104 int nentries;
105
106 //read xttree-----------------------------
107 double xtpar;
108 int xtkey;
109 xttree -> SetBranchAddress("xtpar", &xtpar);
110 xttree -> SetBranchAddress("xtkey", &xtkey);
111 nentries = xttree -> GetEntries();
112 for(i=0; i<nentries; i++){
113 xttree -> GetEntry(i);
114 tmpObject -> setXtpar(xtkey,xtpar);
115 }
116
117 //read newxttrees-----------------------------
118 if((43*18*2)==newxttrees.GetEntries()){
119 tmpObject->setNewXtpar(&newxttrees);
120 for(int i=0;i<43*18*2;i++){
121 TTree* tempTree = (TTree*) newxttrees.At(i);
122 delete tempTree;
123 }
124 }
125 //read r2ttrees-----------------------------
126 if(43==r2ttrees.GetEntries()){
127 tmpObject->setR2tpar(&r2ttrees);
128 for(int i=0;i<43;i++){
129 TTree* tempTree = (TTree*) r2ttrees.At(i);
130 delete tempTree;
131 }
132 }
133
134 // read t0tree ------------------------------------------------------------
135 double t0;
136 double delt0;
137 t0tree -> SetBranchAddress("t0", &t0);
138 t0tree -> SetBranchAddress("delt0", &delt0);
139 nentries = t0tree -> GetEntries();
140 for(i=0; i<nentries; i++){
141 t0tree -> GetEntry(i);
142 tmpObject -> setT0(t0);
143 tmpObject -> setDelT0(delt0);
144 }
145 // read qttree ------------------------------------------------------------
146 double qtpar0;
147 double qtpar1;
148 qttree -> SetBranchAddress("qtpar0", &qtpar0);
149 qttree -> SetBranchAddress("qtpar1", &qtpar1);
150 nentries = qttree -> GetEntries();
151 for(i=0; i<nentries; i++){
152 qttree -> GetEntry(i);
153 tmpObject -> setQtpar0(qtpar0);
154 tmpObject -> setQtpar1(qtpar1);
155 }
156
157 // read Sdtree ---------------------------------------------------------
158 double sdpar;
159 int sdkey;
160 sdtree -> SetBranchAddress("sdpar", &sdpar);
161 sdtree -> SetBranchAddress("sdkey", &sdkey);
162 nentries = sdtree -> GetEntries();
163
164 for(i=0; i<nentries; i++){
165 sdtree -> GetEntry(i);
166 tmpObject -> setSdpar(sdkey,sdpar);
167 }
168
169 refpObject=tmpObject;
170 delete xttree;
171 delete qttree;
172 delete t0tree;
173 delete sdtree;
174
175 delete buf1;
176 delete buf2;
177 delete buf3;
178 delete buf4;
179 delete buf5;
180 delete buf6;
181
182 return StatusCode::SUCCESS;
183
184
185}
IMessageSvc * msgSvc()
void setR2tpar(TObjArray *r2tTrees)
void setNewXtpar(TObjArray *newXtTrees)
virtual DatabaseRecord * pp()
Definition: TreeAddress.h:130
curve GetEntry(0)
curve SetBranchAddress("CurveSize",&CurveSize)

◆ objType()

const CLID & TreeMdcCalibDataCnv::objType ( ) const

Definition at line 38 of file TreeMdcCalibDataCnv.cxx.

38 {
39 return CLID_Calib_MdcCal;
40}

◆ repSvcType()

virtual long TreeMdcCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file TreeMdcCalibDataCnv.h.

34 {
36 }
unsigned const char CALIBTREE_StorageType
Definition: ICalibTreeSvc.h:20

Friends And Related Function Documentation

◆ CnvFactory< TreeMdcCalibDataCnv >

friend class CnvFactory< TreeMdcCalibDataCnv >
friend

Definition at line 1 of file TreeMdcCalibDataCnv.h.


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