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

#include <EvtRecPi0Cnv.h>

+ Inheritance diagram for EvtRecPi0Cnv:

Public Member Functions

virtual ~EvtRecPi0Cnv ()
 
- 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
 
- Public Member Functions inherited from Converter< Ty1, Ty2 >
destinationoperator (const source &) const
 

Static Public Member Functions

static const CLID & classID ()
 
- Static Public Member Functions inherited from RootEventBaseCnv
static const unsigned char storageType ()
 Storage type and class ID.
 

Protected Member Functions

 EvtRecPi0Cnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
- Protected Member Functions inherited from Converter< Ty1, Ty2 >
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< EvtRecPi0Cnv >
 

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

Definition at line 14 of file EvtRecPi0Cnv.h.

Constructor & Destructor Documentation

◆ ~EvtRecPi0Cnv()

virtual EvtRecPi0Cnv::~EvtRecPi0Cnv ( )
inlinevirtual

Definition at line 21 of file EvtRecPi0Cnv.h.

21{}

◆ EvtRecPi0Cnv()

EvtRecPi0Cnv::EvtRecPi0Cnv ( ISvcLocator *  svc)
protected

Definition at line 24 of file EvtRecPi0Cnv.cxx.

26{
27 m_rootBranchname = "m_evtRecPi0Col";
28 m_adresses.push_back(&m_evtRecPi0Col);
29 m_evtRecPi0Col = 0;
30}
static const CLID & classID()
Definition: EvtRecPi0Cnv.h:19
Base class for all Root Converters.
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

Member Function Documentation

◆ classID()

static const CLID & EvtRecPi0Cnv::classID ( )
inlinestatic

Definition at line 19 of file EvtRecPi0Cnv.h.

19{ return CLID_EvtRecPi0Col; }
const CLID & CLID_EvtRecPi0Col
Definition: EventModel.cxx:382

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 90 of file EvtRecPi0Cnv.cxx.

90 {
91 MsgStream log(msgSvc(), "EvtRecPi0Cnv");
92 log << MSG::DEBUG << "EvtRecPi0Cnv::DataObjectToTObject" << endreq;
93
94 EvtRecPi0Col* evtRecPi0Col = dynamic_cast<EvtRecPi0Col*> (obj);
95 if ( ! evtRecPi0Col ) {
96 log << MSG::ERROR << "Could not downcast to EvtRecPi0Col" << endreq;
97 return StatusCode::FAILURE;
98 }
99
100 DataObject* evt;
101 m_eds->findObject(EventModel::EvtRec::Event, evt);
102 if ( evt == NULL ) {
103 log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endreq;
104 return StatusCode::FAILURE;
105 }
106 EvtRecObject* devtTds = dynamic_cast<EvtRecObject*> (evt);
107 if ( ! devtTds ) {
108 log << MSG::ERROR << "EvtRecPi0Cnv: Could not downcast to TDS EvtRecObject" << endreq;
109 }
110
111 IOpaqueAddress *addr;
112 m_cnvSvc->getEvtRecCnv()->createRep(evt, addr);
114
115 const TObjArray* m_evtRecPi0Col = recEvt->getEvtRecPi0Col();
116 if ( ! m_evtRecPi0Col ) return StatusCode::SUCCESS;
117
118 IDataProviderSvc* dataSvc = 0;
119 StatusCode sc = serviceLocator()->getService("EventDataSvc",
120 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
121 if ( sc.isFailure() ) {
122 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecPi0Cnv" << endreq;
123 return sc;
124 }
125
126 EvtRecTrackCol::iterator evtRecTrackColbegin, evtRecTrackColend;
127
128 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol(dataSvc, EventModel::EvtRec::EvtRecTrackCol);
129 if ( ! evtRecTrackCol) {
130 log << MSG::INFO << "Could not find EvtRecTrackCol" << endreq;
131 }
132 else {
133 evtRecTrackColbegin = evtRecTrackCol->begin();
134 evtRecTrackColend = evtRecTrackCol->end();
135 }
136
137 // convert
138 recEvt->clearEvtRecPi0Col();
139 EvtRecPi0Col::const_iterator evtRecPi0 = evtRecPi0Col->begin();
140
141 for ( ; evtRecPi0 != evtRecPi0Col->end(); evtRecPi0++) {
142 EvtRecPi0* ptr = *evtRecPi0;
143 TEvtRecPi0* evtRecPi0Root = new TEvtRecPi0();
144
145 // set ...
146 evtRecPi0Root->setUnconMass( ptr->unconMass() );
147 evtRecPi0Root->setChisq( ptr->chisq() );
148
149
150 HepLorentzVector hiP4=ptr->hiPfit();
151 HepLorentzVector loP4=ptr->loPfit();
152 evtRecPi0Root->setHiPxfit(hiP4.x());
153 evtRecPi0Root->setHiPyfit(hiP4.y());
154 evtRecPi0Root->setHiPzfit(hiP4.z());
155 evtRecPi0Root->setHiPefit(hiP4.t());
156
157 evtRecPi0Root->setLoPxfit(loP4.x());
158 evtRecPi0Root->setLoPyfit(loP4.y());
159 evtRecPi0Root->setLoPzfit(loP4.z());
160 evtRecPi0Root->setLoPefit(loP4.t());
161
162
163 // assert(evtRecTrackColbegin != evtRecTrackColend);
164 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
165 evtRecTrackColend, ptr->hiEnGamma());
166 //assert(it != evtRecTrackColend);
167 evtRecPi0Root->setHiEnGamma(it - evtRecTrackColbegin );
168
169 // assert(evtRecTrackColbegin != evtRecTrackColend);
170 it = find(evtRecTrackColbegin,
171 evtRecTrackColend, ptr->loEnGamma() );
172 //assert(it != evtRecTrackColend);
173 evtRecPi0Root->setLoEnGamma(it - evtRecTrackColbegin );
174
175
176
177 recEvt->addEvtRecPi0(evtRecPi0Root);
178 }
179
180 return StatusCode::SUCCESS;
181}
ObjectVector< EvtRecPi0 > EvtRecPi0Col
Definition: EvtRecPi0.h:58
IMessageSvc * msgSvc()
#define NULL
static TEvtRecObject * getWriteObject()
Definition: EvtRecCnv.h:26
double unconMass() const
Definition: EvtRecPi0.h:24
const EvtRecTrack * loEnGamma() const
Definition: EvtRecPi0.h:31
double chisq() const
Definition: EvtRecPi0.h:25
HepLorentzVector hiPfit() const
Definition: EvtRecPi0.h:27
HepLorentzVector loPfit() const
Definition: EvtRecPi0.h:28
const EvtRecTrack * hiEnGamma() const
Definition: EvtRecPi0.h:30
EvtRecCnv * getEvtRecCnv()
Definition: RootCnvSvc.h:159
RootCnvSvc * m_cnvSvc
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void addEvtRecPi0(TEvtRecPi0 *pi0)
void clearEvtRecPi0Col()
Definition: TEvtRecObject.h:54
const TObjArray * getEvtRecPi0Col() const
Definition: TEvtRecObject.h:51
void setLoPxfit(Double_t loPx)
Definition: TEvtRecPi0.h:41
void setLoPyfit(Double_t loPy)
Definition: TEvtRecPi0.h:42
void setUnconMass(Double_t unconMass)
Definition: TEvtRecPi0.h:33
void setLoEnGamma(Int_t loEnGamma)
Definition: TEvtRecPi0.h:47
void setLoPzfit(Double_t loPz)
Definition: TEvtRecPi0.h:43
void setHiPyfit(Double_t hiPy)
Definition: TEvtRecPi0.h:37
void setLoPefit(Double_t loPe)
Definition: TEvtRecPi0.h:44
void setHiPxfit(Double_t hiPx)
Definition: TEvtRecPi0.h:36
void setHiPzfit(Double_t hiPz)
Definition: TEvtRecPi0.h:38
void setChisq(Double_t chisq)
Definition: TEvtRecPi0.h:34
void setHiEnGamma(Int_t hiEnGamma)
Definition: TEvtRecPi0.h:46
void setHiPefit(Double_t hiPe)
Definition: TEvtRecPi0.h:39
_EXTERN_ std::string Event
Definition: EventModel.h:115
_EXTERN_ std::string EvtRecTrackCol
Definition: EventModel.h:117

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 32 of file EvtRecPi0Cnv.cxx.

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

Friends And Related Function Documentation

◆ CnvFactory< EvtRecPi0Cnv >

friend class CnvFactory< EvtRecPi0Cnv >
friend

Definition at line 9 of file EvtRecPi0Cnv.h.


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