CGEM BOSS 6.6.5.h
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 ()
 
- Public Member Functions inherited from RootEventBaseCnv
 RootEventBaseCnv (const CLID &clid, ISvcLocator *svc)
 
virtual ~RootEventBaseCnv ()
 
virtual long repSvcType () const
 
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.
 
TObject * getReadObject () const
 get the object to be read
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
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 Public Member Functions inherited from RootEventBaseCnv
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
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
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
 
- 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 EvtHeaderCnv.h.

Constructor & Destructor Documentation

◆ ~EvtHeaderCnv()

virtual EvtHeaderCnv::~EvtHeaderCnv ( )
inlinevirtual

Definition at line 31 of file EvtHeaderCnv.h.

31{ };

◆ EvtHeaderCnv()

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";
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}
IMessageSvc * msgSvc()
static const CLID & classID()
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)
RootEventBaseCnv(const CLID &clid, ISvcLocator *svc)

Member Function Documentation

◆ classID()

static const CLID & EvtHeaderCnv::classID ( )
inlinestatic

Definition at line 26 of file EvtHeaderCnv.h.

27 {
28 return CLID_EventHeader;
29 }
const CLID & CLID_EventHeader

◆ DataObjectToTObject()

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

transformation from TDS object to ROOT

Implements RootEventBaseCnv.

Definition at line 91 of file EvtHeaderCnv.cxx.

91 {
92 // transforms TDS event to Dst event in root format
93 MsgStream log(msgSvc(), "EvtHeaderCnv");
94 log << MSG::DEBUG << "EvtHeaderCnv::DataObjectToTObject" << endreq;
95
96
97 Event::EventHeader * devtTds=dynamic_cast<Event::EventHeader *> (obj);
98 if (!devtTds) {
99 log << MSG::ERROR << "Could not downcast to TDS EventHeader" << endreq;
100 return StatusCode::FAILURE;
101 }
102
103 Int_t evtId = devtTds->eventNumber();
104 Int_t runId = devtTds->runNumber();
105 UInt_t time = devtTds->time();
106 UInt_t evtTag=devtTds->eventTag();
107 UInt_t flag1 = devtTds->flag1();
108 UInt_t flag2 = devtTds->flag2();
109
110 if(evtId == -1){
111 //wrong evh
112 return StatusCode::SUCCESS;
113 }
114
115
116 m_objWrite = new TEvtHeader(); //zoujh
117 m_common.m_EvtHeader = m_objWrite; //zoujh
118
119 log << MSG::DEBUG << "EvtHeaderCnv::DataObjectToTObject tree name: " <<rootaddr->getTreename()<<endreq;
120 // create branch if not yet done
121 if (m_branchNrEvtHeader<0) {
122 StatusCode sc = m_rootInterface->createBranch(rootaddr->getTreename(),"TEvtHeader",m_objWrite->ClassName(),&m_objWrite,m_branchNrEvtHeader);
123 //StatusCode sc = m_rootInterface->createBranch("Event","TEvtHeader",m_objWrite->ClassName(),&m_objWrite,m_branchNrEvtHeader);
124 if (sc.isFailure()) {
125 delete m_objWrite;
126 log << MSG::ERROR << "Could not create branch TEvtHeader" << endreq;
127 return StatusCode::SUCCESS;
128 //return sc;
129 }
130 }
131
132 m_eventId = evtId;
133 m_runId = runId;
134 m_time = time;
135 m_eventTag= evtTag;
136 m_flag1 = flag1;
137 m_flag2 = flag2;
138 log << MSG::DEBUG << "EvtHeaderCnv::DataObjectToTObject eventid = "<<evtId<<" "<<runId <<" "<<std::hex<<evtTag<<std::dec<< endreq;
139
140 m_objWrite->initialize(evtId, runId, evtTag);
141 m_objWrite->setTime(time);
142 m_objWrite->setFlag1( flag1 );
143 m_objWrite->setFlag2( flag2 );
144
145 return StatusCode::SUCCESS;
146}
Double_t time
int eventNumber() const
Retrieve event number.
Definition EventHeader.h:37
int runNumber() const
Retrieve run number.
Definition EventHeader.h:42
unsigned int flag2()
Definition EventHeader.h:57
unsigned int flag1()
Retrieve flags.
Definition EventHeader.h:56
unsigned int eventTag()
Retrieve EventTag.
Definition EventHeader.h:51
unsigned int time() const
Definition EventHeader.h:46
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 setFlag2(int value)
Definition TEvtHeader.h:35
void initialize(Int_t Id, Int_t runId, UInt_t evenTag)
void setTime(int value)
Definition TEvtHeader.h:30
void setFlag1(int value)
Definition TEvtHeader.h:34
static TEvtHeader * m_EvtHeader
Definition commonData.h:135

◆ getWriteObject()

static TEvtHeader * EvtHeaderCnv::getWriteObject ( )
inlinestatic

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

Definition at line 37 of file EvtHeaderCnv.h.

37{ return m_objWrite;}

Referenced by RootCnvSvc::commitOutput().

◆ initialize()

StatusCode EvtHeaderCnv::initialize ( )
virtual

Reimplemented from RootEventBaseCnv.

Definition at line 78 of file EvtHeaderCnv.cxx.

78 {
79 MsgStream log(msgSvc(), "EvtHeaderCnv");
80 log << MSG::DEBUG << "EvtHeaderCnv::initialize"<< endreq;
81
82 StatusCode status = RootEventBaseCnv::initialize();
83
84 //pass dst converter to the conversion service
86
87 return status;
88
89}
void setEvtHeaderCnv(EvtHeaderCnv *evtheadercnv)
Definition RootCnvSvc.h:161
RootCnvSvc * m_cnvSvc
virtual StatusCode initialize()

◆ TObjectToDataObject()

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

do the transformation from ROOT to TDS object

Implements RootEventBaseCnv.

Definition at line 48 of file EvtHeaderCnv.cxx.

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

Friends And Related Symbol Documentation

◆ CnvFactory< EvtHeaderCnv >

friend class CnvFactory< EvtHeaderCnv >
friend

Definition at line 10 of file EvtHeaderCnv.h.


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