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

#include <RootOffEvtFilterCnv.h>

+ Inheritance diagram for RootOffEvtFilterCnv:

Public Member Functions

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

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

Constructor & Destructor Documentation

◆ RootOffEvtFilterCnv()

RootOffEvtFilterCnv::RootOffEvtFilterCnv ( ISvcLocator *  svc)

Definition at line 26 of file RootOffEvtFilterCnv.cxx.

26 :
28
29}
const CLID CLID_Calib_OffEvtFilter
Definition: CalibModel.h:69

◆ ~RootOffEvtFilterCnv()

virtual RootOffEvtFilterCnv::~RootOffEvtFilterCnv ( )
inlinevirtual

Definition at line 30 of file RootOffEvtFilterCnv.h.

30{};

Member Function Documentation

◆ classID()

const CLID & RootOffEvtFilterCnv::classID ( )
static

Definition at line 36 of file RootOffEvtFilterCnv.cxx.

36 {
38}

◆ createRoot()

StatusCode RootOffEvtFilterCnv::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 97 of file RootOffEvtFilterCnv.cxx.

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

◆ i_createObj()

StatusCode RootOffEvtFilterCnv::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 40 of file RootOffEvtFilterCnv.cxx.

41 {
42
43 MsgStream log(msgSvc(), "RootOffEvtFilterCnv");
44 log<<MSG::DEBUG<<"SetProperty "<<fname<<endreq;
45
46 StatusCode sc = openRead(fname);
47 if(!sc)
48 { log<<MSG::ERROR<<"unable to open files11"<<endreq;
49 }
50
52 // Read in our object
53 int i;
54 int nentries;
55
56 // read TestCalibConst ------------------------------------------------------------
57
58 int no;
59 vector<double> TestCalibConst;
60 int runFrom, runTo, eventFrom, eventTo;
61 if( m_inFile->Read("data") ) {
62 TTree *tree = (TTree*)m_inFile -> Get("data");
63 tree->SetBranchAddress("runFrom", &runFrom );
64 tree->SetBranchAddress("runTo", &runTo );
65 tree->SetBranchAddress("eventFrom", &eventFrom );
66 tree->SetBranchAddress("eventTo", &eventTo );
67
68 tree->GetEntry(0);
69 tmpObject ->setRunFrom(runFrom);
70 tmpObject ->setRunTo(runTo);
71 tmpObject ->setEventFrom(eventFrom);
72 tmpObject ->setEventTo(eventTo);
73 }
74
75 int flag;
76 double tBegin,tEnd;
77 TTree *tree2 = (TTree*)m_inFile -> Get("oef");
78 tree2->SetBranchAddress("flag", &flag);
79 tree2->SetBranchAddress("tbegin", &tBegin);
80 tree2->SetBranchAddress("tend", &tEnd);
81
82
83 no = tree2->GetEntries();
84 tmpObject->setNpar(no);
85 for(i=0; i<no; i++){
86 tree2->GetEntry(i);
87 tmpObject ->setFlag(flag);
88 tmpObject ->setTBegin(tBegin);
89 tmpObject ->setTEnd(tEnd);
90 }
91
92 refpObject=tmpObject;
93
94 return StatusCode::SUCCESS;
95}
const int no
void setTEnd(const double tEnd)
void setTBegin(const double tBegin)
void setRunTo(const int runTo)
void setFlag(const int flag)
void setNpar(const int npar)
void setRunFrom(const int runFrom)
void setEventTo(const int eventTo)
void setEventFrom(const int eventFrom)
StatusCode openRead(const std::string &fname)

◆ objType()

const CLID & RootOffEvtFilterCnv::objType ( ) const

Definition at line 32 of file RootOffEvtFilterCnv.cxx.

32 {
34}

◆ repSvcType()

virtual long RootOffEvtFilterCnv::repSvcType ( ) const
inlinevirtual

Definition at line 34 of file RootOffEvtFilterCnv.h.

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

Friends And Related Function Documentation

◆ CnvFactory< RootOffEvtFilterCnv >

friend class CnvFactory< RootOffEvtFilterCnv >
friend

Definition at line 1 of file RootOffEvtFilterCnv.h.


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