BOSS 6.6.4.p03
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 createRoot (const std::string &fname, CalibData::CalibBase1 *pTDSObj)
 
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
 

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_createObj (const std::string &fname, 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)
 
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
 

Friends

class CnvFactory< RootEsTimeCalibDataCnv >
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ RootEsTimeCalibDataCnv()

RootEsTimeCalibDataCnv::RootEsTimeCalibDataCnv ( ISvcLocator *  svc)

Definition at line 30 of file RootEsTimeCalibDataCnv.cxx.

30 :
32
33}
const CLID CLID_Calib_EsTimeCal
Definition: CalibModel.h:51

◆ ~RootEsTimeCalibDataCnv()

virtual RootEsTimeCalibDataCnv::~RootEsTimeCalibDataCnv ( )
inlinevirtual

Definition at line 30 of file RootEsTimeCalibDataCnv.h.

30{};

Member Function Documentation

◆ classID()

const CLID & RootEsTimeCalibDataCnv::classID ( )
static

Definition at line 40 of file RootEsTimeCalibDataCnv.cxx.

40 {
42}

◆ 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 89 of file RootEsTimeCalibDataCnv.cxx.

90 {
91
92 MsgStream log(msgSvc(), "RootEsTimeCalibDataCnv");
93
94 // Open the file, create the branch
95 StatusCode sc = openWrite(fname);
96 if(!sc)
97 { log<<MSG::ERROR<<"unable to open files"<<endreq;
98 }
99 // write the Data in the TCDS to RootFile
100 /* CalibData::EsTimeCalibData* tmpObject = dynamic_cast<CalibData::EsTimeCalibData*>(pTDSObj);
101 int tmpNo;
102 double EsTimeCalibConst;
103 int i;
104
105 //TestCalibConst------------------------------------------------------------------
106 TTree *Testtree = new TTree("TestCalibConst", "TestCalibConst");
107 Testtree -> Branch("TestCalibConst", &EsTimeCalibConst, "EsTimeCalibConst/D");
108 tmpNo = tmpObject -> getTestCalibConstNo();
109 for(i=0; i<tmpNo; i++){
110 EsTimeCalibConst = tmpObject -> getTestCalibConst(i);
111 Testtree -> Fill();
112 }
113
114
115 Testtree -> Write();
116
117
118 delete Testtree;
119
120 closeWrite();*/
121 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
122 return sc;
123
124}
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 44 of file RootEsTimeCalibDataCnv.cxx.

45 {
46
47 MsgStream log(msgSvc(), "RootEsTimeCalibDataCnv");
48 log<<MSG::DEBUG<<"SetProperty"<<endreq;
49
50 StatusCode sc = openRead(fname);
51 if(!sc)
52 { log<<MSG::ERROR<<"unable to open files"<<endreq;
53 }
54
56 // Read in our object
57 int i;
58 int nentries;
59
60 // read TestCalibConst ------------------------------------------------------------
61 double EsTimeCalibConst;
62 vector<double> TestCalibConst;
63 TTree *Testtree = (TTree*)m_inFile -> Get("h2");
64 Testtree -> SetBranchAddress("meant0", &EsTimeCalibConst);
65 int no= Testtree -> GetEntries();
66 for(i=0; i<no; i++){
67 Testtree->GetEntry(i);
68 TestCalibConst.push_back(EsTimeCalibConst);
69 }
70
71 double t0offsete,t0offsetb;
72 int bunchtime;
73 TTree *tree2 = (TTree*)m_inFile -> Get("calibconst");
74 tree2->SetBranchAddress("t0offsete", &t0offsete);
75 tree2->SetBranchAddress("t0offsetb", &t0offsetb);
76 tree2->SetBranchAddress("bunchtime", &bunchtime);
77 tree2->GetEntry(0);
78 tmpObject ->setToffsetb(t0offsetb);
79 tmpObject ->setToffsete(t0offsete);
80 tmpObject ->setBunchTime(bunchtime);
81
82 tmpObject -> setTestCalibConst(&TestCalibConst);
83
84 refpObject=tmpObject;
85
86 return StatusCode::SUCCESS;
87}
data SetBranchAddress("time",&time)
Int_t nentries
void setToffsetb(const double toffsetb)
void setBunchTime(const int bunchtime)
void setToffsete(const double toffsete)
StatusCode openRead(const std::string &fname)

◆ objType()

const CLID & RootEsTimeCalibDataCnv::objType ( ) const

Definition at line 36 of file RootEsTimeCalibDataCnv.cxx.

36 {
38}

◆ repSvcType()

virtual long RootEsTimeCalibDataCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file RootEsTimeCalibDataCnv.h.

34 {
36 }
unsigned const char CALIBROOT_StorageType
Definition: ICalibRootSvc.h:20

Friends And Related Function Documentation

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