BOSS 8.0.0
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
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_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
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
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 20 of file TreeTofSimCnv.h.

Constructor & Destructor Documentation

◆ TreeTofSimDataCnv()

TreeTofSimDataCnv::TreeTofSimDataCnv ( ISvcLocator * svc)

Definition at line 28 of file TreeTofSimCnv.cxx.

TreeCalBaseCnv(ISvcLocator *svc, const CLID &clid)

◆ ~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 33 of file TreeTofSimCnv.cxx.

33{ return CLID_Calib_TofSim; }

Referenced by CalibTreeCnvSvc::createConverter().

◆ 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 35 of file TreeTofSimCnv.cxx.

35 {
36
37 MsgStream log( msgSvc(), "TreeTofSimDataCnv" );
38 log << MSG::DEBUG << "SetProperty" << endmsg;
39
40 TreeAddress* add = dynamic_cast<TreeAddress*>( addr );
41
42 DatabaseRecord* records = add->pp();
43
44 TBufferFile* buf1 = new TBufferFile( TBuffer::kRead );
45 TBufferFile* buf2 = new TBufferFile( TBuffer::kRead );
46 TBufferFile* buf3 = new TBufferFile( TBuffer::kRead );
47
48 buf1->SetBuffer( ( *records )["BTofSim"], 512000, kFALSE );
49 buf2->SetBuffer( ( *records )["ETofSim"], 512000, kFALSE );
50 buf3->SetBuffer( ( *records )["SimConstants"], 512000, kFALSE );
51
52 std::cout << " SftVer is " << ( *records )["SftVer"];
53 std::cout << " CalVerSft is " << ( *records )["TofSimParVer"];
54 std::cout << " File name is " << ( *records )["FileName"] << std::endl;
55
56 TTree* btoftree = new TTree();
57 TTree* etoftree = new TTree();
58 TTree* btofcommontree = new TTree();
59 btoftree->Streamer( *buf1 );
60 etoftree->Streamer( *buf2 );
61 btofcommontree->Streamer( *buf3 );
62
63 CalibData::BTofSimBase bTof;
64 CalibData::ETofSimBase eTof;
65 CalibData::TofSimConstBase tofbase;
66 std::vector<CalibData::BTofSimBase> tmpbTof; //; = new vector<CalibData::bTofCalibBase>;
67 std::vector<CalibData::ETofSimBase> tmpeTof;
68 std::vector<CalibData::TofSimConstBase> tofbaseCol;
69 // Read in the object
70 int cnt;
71 // read btoftree ------------------------------------------------------------
72 double AttenLength;
73 double Gain;
74 double Ratio;
75 double NoiseSmear;
76 btoftree->SetBranchAddress( "AttenLength", &AttenLength );
77 btoftree->SetBranchAddress( "Gain", &Gain );
78 btoftree->SetBranchAddress( "Ratio", &Ratio );
79 int entries = btoftree->GetEntries();
80 for ( cnt = 0; cnt < entries; cnt++ )
81 {
82 btoftree->GetEntry( cnt );
83 bTof.setGain( Gain );
84 bTof.setRatio( Ratio );
85 bTof.setAttenLength( AttenLength );
86 tmpbTof.push_back( bTof );
87 }
88 // read etoftree
89 etoftree->SetBranchAddress( "Gain", &Gain );
90 etoftree->SetBranchAddress( "AttenLength", &AttenLength );
91 etoftree->SetBranchAddress( "NoiseSmear", &NoiseSmear );
92 entries = etoftree->GetEntries();
93 for ( cnt = 0; cnt < entries; cnt++ )
94 {
95 etoftree->GetEntry( cnt );
96 eTof.setGain( Gain );
97 eTof.setAttenLength( AttenLength );
98 eTof.setNoiseSmear( NoiseSmear );
99 tmpeTof.push_back( eTof );
100 }
101 // read SimConstants
102 double BarConstant, BarPMTGain, BarHighThres, BarLowThres, EndConstant, EndPMTGain,
103 EndHighThres, EndLowThres, EndNoiseSwitch;
104 btofcommontree->SetBranchAddress( "BarConstant", &BarConstant );
105 btofcommontree->SetBranchAddress( "BarPMTGain", &BarPMTGain );
106 btofcommontree->SetBranchAddress( "BarHighThres", &BarHighThres );
107 btofcommontree->SetBranchAddress( "BarLowThres", &BarLowThres );
108 btofcommontree->SetBranchAddress( "EndConstant", &EndConstant );
109 btofcommontree->SetBranchAddress( "EndPMTGain", &EndPMTGain );
110 btofcommontree->SetBranchAddress( "EndHighThres", &EndHighThres );
111 btofcommontree->SetBranchAddress( "EndLowThres", &EndLowThres );
112 btofcommontree->SetBranchAddress( "EndNoiseSwitch", &EndNoiseSwitch );
113 entries = btofcommontree->GetEntries();
114 for ( cnt = 0; cnt < entries; cnt++ )
115 {
116 btofcommontree->GetEntry( cnt );
117 tofbase.setBarLowThres( BarLowThres );
118 tofbase.setBarHighThres( BarHighThres );
119 tofbase.setEndLowThres( EndLowThres );
120 tofbase.setEndHighThres( EndHighThres );
121 tofbase.setBarPMTGain( BarPMTGain );
122 tofbase.setEndPMTGain( EndPMTGain );
123 tofbase.setBarConstant( BarConstant );
124 tofbase.setEndConstant( EndConstant );
125 tofbase.setEndNoiseSwitch( EndNoiseSwitch );
126 tofbaseCol.push_back( tofbase );
127 }
128
129 CalibData::TofSimData* tmpObject =
130 new CalibData::TofSimData( &tofbaseCol, &tmpbTof, &tmpeTof );
131 refpObject = tmpObject;
132 delete btoftree;
133 delete etoftree;
134 delete btofcommontree;
135
136 return StatusCode::SUCCESS;
137}
IMessageSvc * msgSvc()

◆ objType()

const CLID & TreeTofSimDataCnv::objType ( ) const

Definition at line 31 of file TreeTofSimCnv.cxx.

31{ return CLID_Calib_TofSim; }

◆ repSvcType()

virtual long TreeTofSimDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file TreeTofSimCnv.h.

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