BOSS 7.1.2
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: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}
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 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
int eventNumber() const
Retrieve event number.
Definition EventHeader.h:37
int runNumber() const
Retrieve run number.
Definition EventHeader.h:42
unsigned long etsT2()
Definition EventHeader.h:65
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
unsigned long etsT1()
Retrieve ETS.
Definition EventHeader.h:63
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 setEtsT1(unsigned long value)
Definition TEvtHeader.h:40
void setTime(int value)
Definition TEvtHeader.h:30
void setEtsT2(unsigned long value)
Definition TEvtHeader.h:41
void setFlag1(int value)
Definition TEvtHeader.h:34
static TEvtHeader * m_EvtHeader
Definition commonData.h:113

◆ 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 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}
void setEvtHeaderCnv(EvtHeaderCnv *evtheadercnv)
Definition RootCnvSvc.h:168
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 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 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 setEtsT2(unsigned long value)
Definition EventHeader.h:71
void setEtsT1(unsigned long value)
Update ETS.
Definition EventHeader.h:69
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: