BOSS 8.0.0
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 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< RootOffEvtFilterCnv >

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

Constructor & Destructor Documentation

◆ RootOffEvtFilterCnv()

RootOffEvtFilterCnv::RootOffEvtFilterCnv ( ISvcLocator * svc)

Definition at line 25 of file RootOffEvtFilterCnv.cxx.

RootCalBaseCnv(ISvcLocator *svc, const CLID &clid)

◆ ~RootOffEvtFilterCnv()

virtual RootOffEvtFilterCnv::~RootOffEvtFilterCnv ( )
inlinevirtual

Definition at line 32 of file RootOffEvtFilterCnv.h.

32{};

Member Function Documentation

◆ classID()

const CLID & RootOffEvtFilterCnv::classID ( )
static

Definition at line 30 of file RootOffEvtFilterCnv.cxx.

Referenced by CalibRootCnvSvc::createConverter().

◆ 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 88 of file RootOffEvtFilterCnv.cxx.

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

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

◆ objType()

const CLID & RootOffEvtFilterCnv::objType ( ) const

Definition at line 28 of file RootOffEvtFilterCnv.cxx.

◆ repSvcType()

virtual long RootOffEvtFilterCnv::repSvcType ( ) const
inlinevirtual

Definition at line 35 of file RootOffEvtFilterCnv.h.

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