BOSS 7.0.9
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 113 of file RootEsTimeCalibDataCnv.cxx.

114 {
115
116 MsgStream log(msgSvc(), "RootEsTimeCalibDataCnv");
117
118 // Open the file, create the branch
119 StatusCode sc = openWrite(fname);
120 if(!sc)
121 { log<<MSG::ERROR<<"unable to open files"<<endreq;
122 }
123 // write the Data in the TCDS to RootFile
124 /* CalibData::EsTimeCalibData* tmpObject = dynamic_cast<CalibData::EsTimeCalibData*>(pTDSObj);
125 int tmpNo;
126 double EsTimeCalibConst;
127 int i;
128
129 //TestCalibConst------------------------------------------------------------------
130 TTree *Testtree = new TTree("TestCalibConst", "TestCalibConst");
131 Testtree -> Branch("TestCalibConst", &EsTimeCalibConst, "EsTimeCalibConst/D");
132 tmpNo = tmpObject -> getTestCalibConstNo();
133 for(i=0; i<tmpNo; i++){
134 EsTimeCalibConst = tmpObject -> getTestCalibConst(i);
135 Testtree -> Fill();
136 }
137
138
139 Testtree -> Write();
140
141
142 delete Testtree;
143
144 closeWrite();*/
145 log<<MSG::INFO<<"successfully create RootFile"<<endreq;
146 return sc;
147
148}
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
62 int no;
63 double EsTimeCalibConst;
64 vector<double> TestCalibConst;
65 if( m_inFile->Read("h2") ) {
66 TTree *Testtree = (TTree*)m_inFile -> Get("h2");
67 Testtree -> SetBranchAddress("meant0", &EsTimeCalibConst);
68
69 no= Testtree -> GetEntries();
70 for(i=0; i<no; i++){
71 Testtree->GetEntry(i);
72 TestCalibConst.push_back(EsTimeCalibConst);
73 }
74 }
75
76 double t0offsete,t0offsetb;
77 int bunchtime, runFrom, runTo, eventFrom, eventTo;
78 TTree *tree2 = (TTree*)m_inFile -> Get("calibconst");
79 tree2->SetBranchAddress("t0offsete", &t0offsete);
80 tree2->SetBranchAddress("t0offsetb", &t0offsetb);
81 tree2->SetBranchAddress("bunchtime", &bunchtime);
82 if( tree2->GetBranchStatus( "runFrom" ) ) {
83 tree2->SetBranchAddress("runFrom", &runFrom );
84 tree2->SetBranchAddress("runTo", &runTo );
85 tree2->SetBranchAddress("eventFrom", &eventFrom );
86 tree2->SetBranchAddress("eventTo", &eventTo );
87 }
88 else {
89 runFrom = -1;
90 runTo = -1;
91 eventFrom = -1;
92 eventTo = -1;
93 }
94
95 no = tree2->GetEntries();
96 for(i=0; i<no; i++){
97 tree2->GetEntry(i);
98 tmpObject ->setToffsetb(t0offsetb);
99 tmpObject ->setToffsete(t0offsete);
100 tmpObject ->setBunchTime(bunchtime);
101 tmpObject ->setRunFrom(runFrom);
102 tmpObject ->setRunTo(runTo);
103 tmpObject ->setEventFrom(eventFrom);
104 tmpObject ->setEventTo(eventTo);
105 }
106
107 tmpObject -> setTestCalibConst(&TestCalibConst);
108 refpObject=tmpObject;
109
110 return StatusCode::SUCCESS;
111}
const int no
data SetBranchAddress("time",&time)
Int_t nentries
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 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: