BOSS 7.0.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 ()
 
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-02-01-12/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";
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}
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-02-01-12/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 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
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:23

◆ 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-02-01-12/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 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}
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 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 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: