BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtHeaderCnv Class Reference

Concrete converter for the EvtHeader branch. More...

#include <EvtHeaderCnv.h>

+ Inheritance diagram for EvtHeaderCnv:

Public Member Functions

virtual ~EvtHeaderCnv ()
 
virtual StatusCode initialize ()
 
virtual ~EvtHeaderCnv ()
 
virtual StatusCode initialize ()
 
- Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
 
virtual ~RootEventBaseCnv ()
 
virtual long repSvcType () const
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode DataObjectToTObject (DataObject *dat, RootAddress *addr)=0
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&dat)=0
 Do the concrete conversion from ROOT to TDS.
 
TObject * getReadObject () const
 get the object to be read
 
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
 
virtual ~RootEventBaseCnv ()
 
virtual long repSvcType () const
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void declareObject (const std::string &fullPath, const CLID &clid, const std::string &treename, const std::string &branchname)
 Store TDS path to link a particular converter to an object on the TDS.
 
virtual StatusCode createObj (IOpaqueAddress *addr, DataObject *&dat)
 Convert the persistent object to transient.
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Convert the transient object to the requested representation.
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Resolve the references of the converted object.
 
virtual StatusCode DataObjectToTObject (DataObject *dat, RootAddress *addr)=0
 Do the concrete conversion from TDS to ROOT.
 
virtual StatusCode TObjectToDataObject (DataObject *&dat)=0
 Do the concrete conversion from ROOT to TDS.
 
TObject * getReadObject () const
 get the object to be read
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
static TEvtHeadergetWriteObject ()
 returns object to be written (maintained here for all DIGI-converters)
 
static const CLID & classID ()
 
static TEvtHeadergetWriteObject ()
 returns object to be written (maintained here for all DIGI-converters)
 
- Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
 
static const unsigned char storageType ()
 Storage type and class ID.
 

Protected Member Functions

 EvtHeaderCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation from TDS object to ROOT
 
virtual StatusCode TObjectToDataObject (DataObject *&refpObject)
 do the transformation from ROOT to TDS object
 
 EvtHeaderCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation from TDS object to ROOT
 
virtual StatusCode TObjectToDataObject (DataObject *&refpObject)
 do the transformation from ROOT to TDS object
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< EvtHeaderCnv >
 

Additional Inherited Members

- Public Types inherited from Converter< Ty1, Ty2 >
typedef Ty1 source
 
typedef Ty2 destination
 
typedef Ty1 source
 
typedef Ty2 destination
 
- Protected Attributes inherited from RootEventBaseCnv
RootCnvSvcm_cnvSvc
 
std::vector< RootCnvSvc::Leafm_leaves
 
RootInterfacem_rootInterface
 pointer to the RootInterface
 
IDataProviderSvc * m_eds
 pointer to eventdataservice
 
int m_branchNr
 the branchNr of this converter for writing
 
int m_branchNrDst
 
int m_branchNrMc
 
int m_branchNrRecon
 
int m_branchNrEvtRec
 
int m_branchNrEvtHeader
 
int m_branchNrEvtNavigator
 
TObject * m_objRead
 the object that was read
 
CLID CLID_top
 the CLID of the upper converter if any
 
TArrayS * m_branchNumbers
 array with number of branches for reading
 
std::string m_rootBranchname
 root branchname (may be concatenated of severals)
 
std::string m_rootTreename
 each converter knows it's treename
 
std::string m_currentFileName
 
std::vector< void * > m_adresses
 each converter knows the corresponding adresses
 
RootEvtSelectorm_evtsel
 

Detailed Description

Concrete converter for the EvtHeader branch.

Based on the EvtHeaderCnv of GLAST.

Definition at line 21 of file Event/RootCnvSvc/RootCnvSvc-03-00-06/RootCnvSvc/EvtHeaderCnv.h.

Constructor & Destructor Documentation

◆ ~EvtHeaderCnv() [1/2]

virtual EvtHeaderCnv::~EvtHeaderCnv ( )
inlinevirtual

◆ EvtHeaderCnv() [1/2]

EvtHeaderCnv::EvtHeaderCnv ( ISvcLocator *  svc)
protected

Definition at line 31 of file EvtHeaderCnv.cxx.

33{
34 // Here we associate this converter with the path on the TDS.
35 MsgStream log(msgSvc(), "EvtHeaderCnv");
36 log << MSG::DEBUG << " constructor of EvtHeaderCnv "<<endreq;
37 //m_rootTreename ="Event";
38 m_rootBranchname ="m_runId:m_eventId:m_time:m_eventTag:m_flag1:m_flag2:m_etsT1:m_etsT2";
39 //declareObject(EventModel::Dst::Event, objType(), m_rootTreename, m_rootBranchname);
40 m_adresses.push_back(&m_runId);
41 m_adresses.push_back(&m_eventId);
42 m_adresses.push_back(&m_time);
43 m_adresses.push_back(&m_eventTag);
44 m_adresses.push_back(&m_flag1);
45 m_adresses.push_back(&m_flag2);
46 m_adresses.push_back(&m_etsT1);
47 m_adresses.push_back(&m_etsT2);
48}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~EvtHeaderCnv() [2/2]

virtual EvtHeaderCnv::~EvtHeaderCnv ( )
inlinevirtual

◆ EvtHeaderCnv() [2/2]

EvtHeaderCnv::EvtHeaderCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

static const CLID & EvtHeaderCnv::classID ( )
inlinestatic

Definition at line 26 of file Event/RootCnvSvc/RootCnvSvc-03-00-06/RootCnvSvc/EvtHeaderCnv.h.

27 {
28 return CLID_EventHeader;
29 }
const CLID & CLID_EventHeader
Definition: EventModel.cxx:196

◆ classID() [2/2]

static const CLID & EvtHeaderCnv::classID ( )
inlinestatic

Definition at line 26 of file InstallArea/include/RootCnvSvc/RootCnvSvc/EvtHeaderCnv.h.

27 {
28 return CLID_EventHeader;
29 }

◆ DataObjectToTObject() [1/2]

StatusCode EvtHeaderCnv::DataObjectToTObject ( DataObject *  obj,
RootAddress addr 
)
protectedvirtual

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

Definition at line 95 of file EvtHeaderCnv.cxx.

95 {
96 // transforms TDS event to Dst event in root format
97 MsgStream log(msgSvc(), "EvtHeaderCnv");
98 log << MSG::DEBUG << "EvtHeaderCnv::DataObjectToTObject" << endreq;
99
100
101 Event::EventHeader * devtTds=dynamic_cast<Event::EventHeader *> (obj);
102 if (!devtTds) {
103 log << MSG::ERROR << "Could not downcast to TDS EventHeader" << endreq;
104 return StatusCode::FAILURE;
105 }
106
107 Int_t evtId = devtTds->eventNumber();
108 Int_t runId = devtTds->runNumber();
109 UInt_t time = devtTds->time();
110 UInt_t evtTag=devtTds->eventTag();
111 UInt_t flag1 = devtTds->flag1();
112 UInt_t flag2 = devtTds->flag2();
113 ULong_t etsT1 = devtTds->etsT1();
114 ULong_t etsT2 = devtTds->etsT2();
115
116 if(evtId == -1){
117 //wrong evh
118 return StatusCode::SUCCESS;
119 }
120
121
122 m_objWrite = new TEvtHeader(); //zoujh
123 m_common.m_EvtHeader = m_objWrite; //zoujh
124
125 log << MSG::DEBUG << "EvtHeaderCnv::DataObjectToTObject tree name: " <<rootaddr->getTreename()<<endreq;
126 // create branch if not yet done
127 if (m_branchNrEvtHeader<0) {
128 StatusCode sc = m_rootInterface->createBranch(rootaddr->getTreename(),"TEvtHeader",m_objWrite->ClassName(),&m_objWrite,m_branchNrEvtHeader);
129 //StatusCode sc = m_rootInterface->createBranch("Event","TEvtHeader",m_objWrite->ClassName(),&m_objWrite,m_branchNrEvtHeader);
130 if (sc.isFailure()) {
131 delete m_objWrite;
132 log << MSG::ERROR << "Could not create branch TEvtHeader" << endreq;
133 return StatusCode::SUCCESS;
134 //return sc;
135 }
136 }
137
138 m_eventId = evtId;
139 m_runId = runId;
140 m_time = time;
141 m_eventTag= evtTag;
142 m_flag1 = flag1;
143 m_flag2 = flag2;
144 m_etsT1 = etsT1;
145 m_etsT2 = etsT2;
146 log << MSG::DEBUG << "EvtHeaderCnv::DataObjectToTObject eventid = "<<evtId<<" "<<runId <<" "<<std::hex<<evtTag<<std::dec<< endreq;
147
148 m_objWrite->initialize(evtId, runId, evtTag);
149 m_objWrite->setTime(time);
150 m_objWrite->setFlag1( flag1 );
151 m_objWrite->setFlag2( flag2 );
152 m_objWrite->setEtsT1( etsT1 );
153 m_objWrite->setEtsT2( etsT2 );
154
155 return StatusCode::SUCCESS;
156}
Double_t time
RootInterface * m_rootInterface
pointer to the RootInterface
virtual StatusCode createBranch(const std::string &tree, const std::string &branch, const char *classname, void *addr, int &branchnr)
create a branch in this tree
void initialize(Int_t Id, Int_t runId, UInt_t evenTag)
Definition: TEvtHeader.cxx:24

◆ DataObjectToTObject() [2/2]

virtual StatusCode EvtHeaderCnv::DataObjectToTObject ( DataObject *  obj,
RootAddress addr 
)
protectedvirtual

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

◆ getWriteObject() [1/2]

static TEvtHeader * EvtHeaderCnv::getWriteObject ( )
inlinestatic

returns object to be written (maintained here for all DIGI-converters)

Definition at line 37 of file Event/RootCnvSvc/RootCnvSvc-03-00-06/RootCnvSvc/EvtHeaderCnv.h.

37{ return m_objWrite;}

Referenced by RootCnvSvc::commitOutput().

◆ getWriteObject() [2/2]

static TEvtHeader * EvtHeaderCnv::getWriteObject ( )
inlinestatic

returns object to be written (maintained here for all DIGI-converters)

Definition at line 37 of file InstallArea/include/RootCnvSvc/RootCnvSvc/EvtHeaderCnv.h.

37{ return m_objWrite;}

◆ initialize() [1/2]

StatusCode EvtHeaderCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

Definition at line 82 of file EvtHeaderCnv.cxx.

82 {
83 MsgStream log(msgSvc(), "EvtHeaderCnv");
84 log << MSG::DEBUG << "EvtHeaderCnv::initialize"<< endreq;
85
86 StatusCode status = RootEventBaseCnv::initialize();
87
88 //pass dst converter to the conversion service
90
91 return status;
92
93}
virtual StatusCode initialize()

◆ initialize() [2/2]

virtual StatusCode EvtHeaderCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

◆ TObjectToDataObject() [1/2]

StatusCode EvtHeaderCnv::TObjectToDataObject ( DataObject *&  refpObject)
protectedvirtual

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

Definition at line 50 of file EvtHeaderCnv.cxx.

50 {
51 // fills the TDS object from the persistent one
52 StatusCode sc=StatusCode::SUCCESS;
53
54 MsgStream log(msgSvc(), "EvtHeaderCnv");
55 log << MSG::DEBUG << "TObjectToDataObject" << endreq;
56
57
58
60 evt->setEventNumber(m_eventId);
61 evt->setRunNumber(m_runId);
62 evt->setTime(m_time);
63 evt->setEventTag(m_eventTag);
64 evt->setFlag1( m_flag1 );
65 evt->setFlag2( m_flag2 );
66 evt->setEtsT1( m_etsT1);
67 evt->setEtsT2( m_etsT2);
68
69 refpObject = evt;
70
71 log << MSG::DEBUG << "TObjectToDataObject eventid = "<<m_eventId<<" "<<m_runId
72 << " "<<std::hex<<"0x"<<m_eventTag<<std::dec<<endreq;
73 // cout << MSG::DEBUG << "TObjectToDataObject eventid = "<<m_eventId<<" "<<m_runId
74 // << " "<<std::hex<<"0x"<<m_eventTag<<std::dec<<endl;
75
76 //char dummy;
77 //cin>>dummy;
78
79 return sc;
80}
void setEventTag(unsigned int value)
Update EventTag.

◆ TObjectToDataObject() [2/2]

virtual StatusCode EvtHeaderCnv::TObjectToDataObject ( DataObject *&  refpObject)
protectedvirtual

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< EvtHeaderCnv >


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