BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
TreeTofSimDataCnv Class Reference

#include <TreeTofSimCnv.h>

+ Inheritance diagram for TreeTofSimDataCnv:

Public Member Functions

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

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 TreeTofSimCnv.h.

Constructor & Destructor Documentation

◆ TreeTofSimDataCnv()

TreeTofSimDataCnv::TreeTofSimDataCnv ( ISvcLocator *  svc)

Definition at line 31 of file TreeTofSimCnv.cxx.

31 :
33
34 }
const CLID CLID_Calib_TofSim
Definition: CalibModel.h:59

◆ ~TreeTofSimDataCnv()

virtual TreeTofSimDataCnv::~TreeTofSimDataCnv ( )
inlinevirtual

Definition at line 29 of file TreeTofSimCnv.h.

29{};

Member Function Documentation

◆ classID()

const CLID & TreeTofSimDataCnv::classID ( )
static

Definition at line 41 of file TreeTofSimCnv.cxx.

41 {
42 return CLID_Calib_TofSim;
43}

◆ i_createObj()

StatusCode TreeTofSimDataCnv::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 45 of file TreeTofSimCnv.cxx.

46 {
47
48 MsgStream log(msgSvc(), "TreeTofSimDataCnv");
49 log<<MSG::DEBUG<<"SetProperty"<<endreq;
50
51 TreeAddress* add = dynamic_cast<TreeAddress*>(addr);
52
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
59 buf1->SetBuffer((*records)["BTofSim"],512000,kFALSE);
60 buf2->SetBuffer((*records)["ETofSim"],512000,kFALSE);
61 buf3->SetBuffer((*records)["SimConstants"],512000,kFALSE);
62
63
64 std::cout<<" SftVer is "<<(*records)["SftVer"];
65 std::cout<<" CalVerSft is "<<(*records)["TofSimParVer"];
66 std::cout<<" File name is "<<(*records)["FileName"]<<std::endl;
67
68
69
70 TTree *btoftree= new TTree();
71 TTree *etoftree= new TTree();
72 TTree *btofcommontree = new TTree();
73 btoftree->Streamer(*buf1);
74 etoftree->Streamer(*buf2);
75 btofcommontree->Streamer(*buf3);
76
80 std::vector<CalibData::BTofSimBase> tmpbTof;//; = new vector<CalibData::bTofCalibBase>;
81 std::vector<CalibData::ETofSimBase> tmpeTof;
82 std::vector<CalibData::TofSimConstBase> tofbaseCol;
83 // Read in the object
84 int cnt;
85 // read btoftree ------------------------------------------------------------
86 double AttenLength;
87 double Gain;
88 double Ratio;
89 double NoiseSmear;
90 btoftree -> SetBranchAddress("AttenLength", &AttenLength);
91 btoftree -> SetBranchAddress("Gain", &Gain);
92 btoftree -> SetBranchAddress("Ratio", &Ratio);
93 int entries=btoftree->GetEntries();
94 for(cnt=0; cnt<entries; cnt++){
95 btoftree -> GetEntry(cnt);
96 bTof.setGain(Gain);
97 bTof.setRatio(Ratio);
98 bTof.setAttenLength(AttenLength);
99 tmpbTof.push_back(bTof);
100 }
101 //read etoftree
102 etoftree -> SetBranchAddress("Gain", &Gain);
103 etoftree -> SetBranchAddress("AttenLength", &AttenLength);
104 etoftree -> SetBranchAddress("NoiseSmear", &NoiseSmear );
105 entries=etoftree->GetEntries();
106 for(cnt=0; cnt<entries; cnt++){
107 etoftree->GetEntry(cnt);
108 eTof.setGain(Gain);
109 eTof.setAttenLength(AttenLength);
110 eTof.setNoiseSmear(NoiseSmear);
111 tmpeTof.push_back(eTof);
112 }
113 //read SimConstants
114 double BarConstant,BarPMTGain,BarHighThres,BarLowThres,EndConstant,EndPMTGain,EndHighThres,EndLowThres,EndNoiseSwitch;
115 btofcommontree-> SetBranchAddress("BarConstant", &BarConstant);
116 btofcommontree-> SetBranchAddress("BarPMTGain", &BarPMTGain);
117 btofcommontree-> SetBranchAddress("BarHighThres", &BarHighThres);
118 btofcommontree-> SetBranchAddress("BarLowThres", &BarLowThres);
119 btofcommontree-> SetBranchAddress("EndConstant", &EndConstant);
120 btofcommontree-> SetBranchAddress("EndPMTGain", &EndPMTGain);
121 btofcommontree-> SetBranchAddress("EndHighThres", &EndHighThres);
122 btofcommontree-> SetBranchAddress("EndLowThres", &EndLowThres);
123 btofcommontree-> SetBranchAddress("EndNoiseSwitch", &EndNoiseSwitch);
124 entries = btofcommontree->GetEntries();
125 for(cnt=0;cnt<entries;cnt++){
126 btofcommontree->GetEntry(cnt);
127 tofbase.setBarLowThres(BarLowThres);
128 tofbase.setBarHighThres(BarHighThres);
129 tofbase.setEndLowThres(EndLowThres);
130 tofbase.setEndHighThres(EndHighThres);
131 tofbase.setBarPMTGain(BarPMTGain);
132 tofbase.setEndPMTGain(EndPMTGain);
133 tofbase.setBarConstant(BarConstant);
134 tofbase.setEndConstant(EndConstant);
135 tofbase.setEndNoiseSwitch(EndNoiseSwitch);
136 tofbaseCol.push_back(tofbase);
137 }
138
139 CalibData::TofSimData *tmpObject = new CalibData::TofSimData(&tofbaseCol,&tmpbTof,&tmpeTof);
140 refpObject=tmpObject;
141 delete btoftree;
142 delete etoftree;
143 delete btofcommontree;
144
145 return StatusCode::SUCCESS;
146
147
148}
IMessageSvc * msgSvc()
void setRatio(double ratio)
Definition: BTofSimBase.h:16
void setGain(double gain)
Definition: BTofSimBase.h:15
void setAttenLength(double length)
Definition: BTofSimBase.h:17
void setGain(double gain)
Definition: ETofSimBase.h:14
void setAttenLength(double length)
Definition: ETofSimBase.h:15
void setNoiseSmear(double noisesmear)
Definition: ETofSimBase.h:16
void setBarConstant(const double bc)
void setBarHighThres(const double bhth)
void setEndNoiseSwitch(const double eswitch)
void setEndHighThres(const double ehth)
void setEndConstant(const double ec)
void setBarPMTGain(const double bg)
void setEndPMTGain(const double eg)
void setEndLowThres(const double elth)
void setBarLowThres(const double blth)
virtual DatabaseRecord * pp()
Definition: TreeAddress.h:130
curve GetEntry(0)
curve SetBranchAddress("CurveSize",&CurveSize)

◆ objType()

const CLID & TreeTofSimDataCnv::objType ( ) const

Definition at line 37 of file TreeTofSimCnv.cxx.

37 {
38 return CLID_Calib_TofSim;
39}

◆ repSvcType()

virtual long TreeTofSimDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file TreeTofSimCnv.h.

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

Friends And Related Function Documentation

◆ CnvFactory< TreeTofSimDataCnv >

friend class CnvFactory< TreeTofSimDataCnv >
friend

Definition at line 1 of file TreeTofSimCnv.h.


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