BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRecPi0Cnv Class Reference

#include <EvtRecPi0Cnv.h>

Inheritance diagram for EvtRecPi0Cnv:

Public Member Functions

virtual ~EvtRecPi0Cnv ()
 EvtRecPi0Cnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~EvtRecPi0Cnv ()
 EvtRecPi0Cnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
virtual ~EvtRecPi0Cnv ()
 EvtRecPi0Cnv (ISvcLocator *svc)
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
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.
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.
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.
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
destinationoperator (const source &) const

Static Public Member Functions

static const CLID & classID ()
static const CLID & classID ()
static const CLID & classID ()
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.
static const unsigned char storageType ()
 Storage type and class ID.

Friends

class CnvFactory< EvtRecPi0Cnv >

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 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
Protected Attributes inherited from RootEventBaseCnv
IRootCnvSvcm_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

Constructor & Destructor Documentation

◆ ~EvtRecPi0Cnv() [1/3]

virtual EvtRecPi0Cnv::~EvtRecPi0Cnv ( )
inlinevirtual

◆ EvtRecPi0Cnv() [1/3]

EvtRecPi0Cnv::EvtRecPi0Cnv ( ISvcLocator * svc)

Definition at line 23 of file EvtRecPi0Cnv.cxx.

23 : RootEventBaseCnv( classID(), svc ) {
24 m_rootBranchname = "m_evtRecPi0Col";
25 m_adresses.push_back( &m_evtRecPi0Col );
26 m_evtRecPi0Col = 0;
27}
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)

◆ ~EvtRecPi0Cnv() [2/3]

virtual EvtRecPi0Cnv::~EvtRecPi0Cnv ( )
inlinevirtual

◆ EvtRecPi0Cnv() [2/3]

EvtRecPi0Cnv::EvtRecPi0Cnv ( ISvcLocator * svc)

◆ ~EvtRecPi0Cnv() [3/3]

virtual EvtRecPi0Cnv::~EvtRecPi0Cnv ( )
inlinevirtual

◆ EvtRecPi0Cnv() [3/3]

EvtRecPi0Cnv::EvtRecPi0Cnv ( ISvcLocator * svc)

Member Function Documentation

◆ classID() [1/3]

const CLID & EvtRecPi0Cnv::classID ( )
inlinestatic

Definition at line 19 of file Event/RootCnvSvc/include/RootCnvSvc/EvtRec/EvtRecPi0Cnv.h.

19{ return CLID_EvtRecPi0Col; }
const CLID & CLID_EvtRecPi0Col

Referenced by RootCnvSvc::createConverter(), and EvtRecPi0Cnv().

◆ classID() [2/3]

const CLID & EvtRecPi0Cnv::classID ( )
inlinestatic

◆ classID() [3/3]

const CLID & EvtRecPi0Cnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 86 of file EvtRecPi0Cnv.cxx.

86 {
87 MsgStream log( msgSvc(), "EvtRecPi0Cnv" );
88 log << MSG::DEBUG << "EvtRecPi0Cnv::DataObjectToTObject" << endmsg;
89
90 EvtRecPi0Col* evtRecPi0Col = dynamic_cast<EvtRecPi0Col*>( obj );
91 if ( !evtRecPi0Col )
92 {
93 log << MSG::ERROR << "Could not downcast to EvtRecPi0Col" << endmsg;
94 return StatusCode::FAILURE;
95 }
96
97 DataObject* evt;
98 m_eds->findObject( EventModel::EvtRec::Event, evt );
99 if ( evt == NULL )
100 {
101 log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endmsg;
102 return StatusCode::FAILURE;
103 }
104 EvtRecObject* devtTds = dynamic_cast<EvtRecObject*>( evt );
105 if ( !devtTds )
106 { log << MSG::ERROR << "EvtRecPi0Cnv: Could not downcast to TDS EvtRecObject" << endmsg; }
107
108 IOpaqueAddress* addr;
109 m_cnvSvc->getEvtRecCnv()->createRep( evt, addr );
110 TEvtRecObject* recEvt = m_cnvSvc->getEvtRecCnv()->getWriteObject();
111
112 const TObjArray* m_evtRecPi0Col = recEvt->getEvtRecPi0Col();
113 if ( !m_evtRecPi0Col ) return StatusCode::SUCCESS;
114
115 IDataProviderSvc* dataSvc = 0;
116 StatusCode sc = serviceLocator()->getService(
117 "EventDataSvc", IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc );
118 if ( sc.isFailure() )
119 {
120 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecPi0Cnv" << endmsg;
121 return sc;
122 }
123
124 EvtRecTrackCol::iterator evtRecTrackColbegin, evtRecTrackColend;
125
126 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol( dataSvc, EventModel::EvtRec::EvtRecTrackCol );
127 if ( !evtRecTrackCol ) { log << MSG::INFO << "Could not find EvtRecTrackCol" << endmsg; }
128 else
129 {
130 evtRecTrackColbegin = evtRecTrackCol->begin();
131 evtRecTrackColend = evtRecTrackCol->end();
132 }
133
134 // convert
135 recEvt->clearEvtRecPi0Col();
136 EvtRecPi0Col::const_iterator evtRecPi0 = evtRecPi0Col->begin();
137
138 for ( ; evtRecPi0 != evtRecPi0Col->end(); evtRecPi0++ )
139 {
140 EvtRecPi0* ptr = *evtRecPi0;
141 TEvtRecPi0* evtRecPi0Root = new TEvtRecPi0();
142
143 // set ...
144 evtRecPi0Root->setUnconMass( ptr->unconMass() );
145 evtRecPi0Root->setChisq( ptr->chisq() );
146
147 HepLorentzVector hiP4 = ptr->hiPfit();
148 HepLorentzVector loP4 = ptr->loPfit();
149 evtRecPi0Root->setHiPxfit( hiP4.x() );
150 evtRecPi0Root->setHiPyfit( hiP4.y() );
151 evtRecPi0Root->setHiPzfit( hiP4.z() );
152 evtRecPi0Root->setHiPefit( hiP4.t() );
153
154 evtRecPi0Root->setLoPxfit( loP4.x() );
155 evtRecPi0Root->setLoPyfit( loP4.y() );
156 evtRecPi0Root->setLoPzfit( loP4.z() );
157 evtRecPi0Root->setLoPefit( loP4.t() );
158
159 // assert(evtRecTrackColbegin != evtRecTrackColend);
160 EvtRecTrackCol::iterator it =
161 find( evtRecTrackColbegin, evtRecTrackColend, ptr->hiEnGamma() );
162 // assert(it != evtRecTrackColend);
163 evtRecPi0Root->setHiEnGamma( it - evtRecTrackColbegin );
164
165 // assert(evtRecTrackColbegin != evtRecTrackColend);
166 it = find( evtRecTrackColbegin, evtRecTrackColend, ptr->loEnGamma() );
167 // assert(it != evtRecTrackColend);
168 evtRecPi0Root->setLoEnGamma( it - evtRecTrackColbegin );
169
170 recEvt->addEvtRecPi0( evtRecPi0Root );
171 }
172
173 return StatusCode::SUCCESS;
174}
ObjectVector< EvtRecPi0 > EvtRecPi0Col
IMessageSvc * msgSvc()
const EvtRecTrack * loEnGamma() const
const EvtRecTrack * hiEnGamma() const
IDataProviderSvc * m_eds
pointer to eventdataservice
void addEvtRecPi0(TEvtRecPi0 *pi0)

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

StatusCode EvtRecPi0Cnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

Definition at line 29 of file EvtRecPi0Cnv.cxx.

29 {
30 // creation of TDS object from root object
31 MsgStream log( msgSvc(), "EvtRecPi0Cnv" );
32 log << MSG::DEBUG << "EvtRecPi0Cnv::TObjectToDataObject" << endmsg;
33
34 // create the TDS location for the EvtRecPi0 Collection
35 EvtRecPi0Col* evtRecPi0Col = new EvtRecPi0Col;
36 refpObject = evtRecPi0Col;
37
38 if ( !m_evtRecPi0Col ) return StatusCode::SUCCESS;
39
40 IDataProviderSvc* dataSvc = 0;
41 StatusCode sc = serviceLocator()->getService(
42 "EventDataSvc", IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc );
43 if ( sc.isFailure() )
44 {
45 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecPi0Cnv" << endmsg;
46 return sc;
47 }
48
49 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol( dataSvc, EventModel::EvtRec::EvtRecTrackCol );
50 if ( !evtRecTrackCol ) { log << MSG::INFO << "Could not find EvtRecTrackCol" << endmsg; }
51
52 // convert
53 TIter evtRecPi0Iter( m_evtRecPi0Col );
54 TEvtRecPi0* evtRecPi0Root = 0;
55 while ( ( evtRecPi0Root = (TEvtRecPi0*)evtRecPi0Iter.Next() ) )
56 {
57 EvtRecPi0* evtRecPi0 = new EvtRecPi0();
58 m_common.m_rootEvtRecPi0Map[evtRecPi0Root] = evtRecPi0;
59
60 // set ....
61 evtRecPi0->setUnconMass( evtRecPi0Root->unconMass() );
62 evtRecPi0->setChisq( evtRecPi0Root->chisq() );
63
64 HepLorentzVector hiP4( evtRecPi0Root->hiPxfit(), evtRecPi0Root->hiPyfit(),
65 evtRecPi0Root->hiPzfit(), evtRecPi0Root->hiPefit() );
66 HepLorentzVector loP4( evtRecPi0Root->loPxfit(), evtRecPi0Root->loPyfit(),
67 evtRecPi0Root->loPzfit(), evtRecPi0Root->loPefit() );
68 evtRecPi0->setHiPfit( hiP4 );
69 evtRecPi0->setLoPfit( loP4 );
70
71 int hiEnGammatrk = evtRecPi0Root->hiEnGamma();
72 int loEnGammatrk = evtRecPi0Root->loEnGamma();
73 evtRecPi0->setHiEnGamma(
74 dynamic_cast<EvtRecTrack*>( evtRecTrackCol->containedObject( hiEnGammatrk ) ) );
75 evtRecPi0->setLoEnGamma(
76 dynamic_cast<EvtRecTrack*>( evtRecTrackCol->containedObject( loEnGammatrk ) ) );
77
78 evtRecPi0Col->push_back( evtRecPi0 );
79 }
80
81 delete m_evtRecPi0Col;
82 m_evtRecPi0Col = 0;
83 return StatusCode::SUCCESS;
84}
void setLoPfit(const HepLorentzVector &loPfit)
void setLoEnGamma(const EvtRecTrack *trk)
void setHiPfit(const HepLorentzVector &hiPfit)
void setUnconMass(const double unconMass)
void setHiEnGamma(const EvtRecTrack *trk)

◆ TObjectToDataObject() [2/3]

virtual StatusCode EvtRecPi0Cnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

virtual StatusCode EvtRecPi0Cnv::TObjectToDataObject ( DataObject *& obj)
virtual

transformation from root

Implements RootEventBaseCnv.

◆ CnvFactory< EvtRecPi0Cnv >

friend class CnvFactory< EvtRecPi0Cnv >
friend

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