BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
RootEsTimeCalibDataCnv Class Reference

#include <RootEsTimeCalibDataCnv.h>

Inheritance diagram for RootEsTimeCalibDataCnv:

Public Member Functions

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

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 23 of file RootEsTimeCalibDataCnv.h.

Constructor & Destructor Documentation

◆ RootEsTimeCalibDataCnv()

RootEsTimeCalibDataCnv::RootEsTimeCalibDataCnv ( ISvcLocator * svc)

Definition at line 27 of file RootEsTimeCalibDataCnv.cxx.

RootCalBaseCnv(ISvcLocator *svc, const CLID &clid)

◆ ~RootEsTimeCalibDataCnv()

virtual RootEsTimeCalibDataCnv::~RootEsTimeCalibDataCnv ( )
inlinevirtual

Definition at line 32 of file RootEsTimeCalibDataCnv.h.

32{};

Member Function Documentation

◆ classID()

const CLID & RootEsTimeCalibDataCnv::classID ( )
static

Definition at line 32 of file RootEsTimeCalibDataCnv.cxx.

32{ return CLID_Calib_EsTimeCal; }

Referenced by CalibRootCnvSvc::createConverter().

◆ createRoot()

StatusCode RootEsTimeCalibDataCnv::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 106 of file RootEsTimeCalibDataCnv.cxx.

107 {
108
109 MsgStream log( msgSvc(), "RootEsTimeCalibDataCnv" );
110
111 // Open the file, create the branch
112 StatusCode sc = openWrite( fname );
113 if ( !sc ) { log << MSG::ERROR << "unable to open files" << endmsg; }
114 // write the Data in the TCDS to RootFile
115 /* CalibData::EsTimeCalibData* tmpObject =
116 dynamic_cast<CalibData::EsTimeCalibData*>(pTDSObj); int tmpNo; double EsTimeCalibConst;
117 int i;
118
119 //TestCalibConst------------------------------------------------------------------
120 TTree *Testtree = new TTree("TestCalibConst", "TestCalibConst");
121 Testtree -> Branch("TestCalibConst", &EsTimeCalibConst, "EsTimeCalibConst/D");
122 tmpNo = tmpObject -> getTestCalibConstNo();
123 for(i=0; i<tmpNo; i++){
124 EsTimeCalibConst = tmpObject -> getTestCalibConst(i);
125 Testtree -> Fill();
126 }
127
128
129 Testtree -> Write();
130
131
132 delete Testtree;
133
134 closeWrite();*/
135 log << MSG::INFO << "successfully create RootFile" << endmsg;
136 return sc;
137}
IMessageSvc * msgSvc()
virtual StatusCode openWrite(const std::string &fname)

◆ i_createObj()

StatusCode RootEsTimeCalibDataCnv::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 34 of file RootEsTimeCalibDataCnv.cxx.

35 {
36
37 MsgStream log( msgSvc(), "RootEsTimeCalibDataCnv" );
38 log << MSG::DEBUG << "SetProperty" << endmsg;
39
40 StatusCode sc = openRead( fname );
41 if ( !sc ) { log << MSG::ERROR << "unable to open files" << endmsg; }
42
43 CalibData::EsTimeCalibData* tmpObject = new CalibData::EsTimeCalibData;
44 // Read in our object
45 int i;
46 int nentries;
47
48 // read TestCalibConst ------------------------------------------------------------
49
50 int no;
51 double EsTimeCalibConst;
52 vector<double> TestCalibConst;
53 if ( m_inFile->Read( "h2" ) )
54 {
55 TTree* Testtree = (TTree*)m_inFile->Get( "h2" );
56 Testtree->SetBranchAddress( "meant0", &EsTimeCalibConst );
57
58 no = Testtree->GetEntries();
59 for ( i = 0; i < no; i++ )
60 {
61 Testtree->GetEntry( i );
62 TestCalibConst.push_back( EsTimeCalibConst );
63 }
64 }
65
66 double t0offsete, t0offsetb;
67 int bunchtime, runFrom, runTo, eventFrom, eventTo;
68 TTree* tree2 = (TTree*)m_inFile->Get( "calibconst" );
69 tree2->SetBranchAddress( "t0offsete", &t0offsete );
70 tree2->SetBranchAddress( "t0offsetb", &t0offsetb );
71 tree2->SetBranchAddress( "bunchtime", &bunchtime );
72 if ( tree2->GetBranchStatus( "runFrom" ) )
73 {
74 tree2->SetBranchAddress( "runFrom", &runFrom );
75 tree2->SetBranchAddress( "runTo", &runTo );
76 tree2->SetBranchAddress( "eventFrom", &eventFrom );
77 tree2->SetBranchAddress( "eventTo", &eventTo );
78 }
79 else
80 {
81 runFrom = -1;
82 runTo = -1;
83 eventFrom = -1;
84 eventTo = -1;
85 }
86
87 no = tree2->GetEntries();
88 for ( i = 0; i < no; i++ )
89 {
90 tree2->GetEntry( i );
91 tmpObject->setToffsetb( t0offsetb );
92 tmpObject->setToffsete( t0offsete );
93 tmpObject->setBunchTime( bunchtime );
94 tmpObject->setRunFrom( runFrom );
95 tmpObject->setRunTo( runTo );
96 tmpObject->setEventFrom( eventFrom );
97 tmpObject->setEventTo( eventTo );
98 }
99
100 tmpObject->setTestCalibConst( &TestCalibConst );
101 refpObject = tmpObject;
102
103 return StatusCode::SUCCESS;
104}
Int_t nentries
void setTestCalibConst(const vector< double > *TestCalibConst)
void setRunFrom(const int runFrom)
void setEventTo(const int eventTo)
void setToffsetb(const double toffsetb)
void setEventFrom(const int eventFrom)
void setBunchTime(const int bunchtime)
void setRunTo(const int runTo)
void setToffsete(const double toffsete)
StatusCode openRead(const std::string &fname)

◆ objType()

const CLID & RootEsTimeCalibDataCnv::objType ( ) const

Definition at line 30 of file RootEsTimeCalibDataCnv.cxx.

30{ return CLID_Calib_EsTimeCal; }

◆ repSvcType()

virtual long RootEsTimeCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 35 of file RootEsTimeCalibDataCnv.h.

◆ CnvFactory< RootEsTimeCalibDataCnv >

friend class CnvFactory< RootEsTimeCalibDataCnv >
friend

Definition at line 1 of file RootEsTimeCalibDataCnv.h.


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