BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtRecDTagCnv Class Reference

#include <EvtRecDTagCnv.h>

+ Inheritance diagram for EvtRecDTagCnv:

Public Member Functions

virtual ~EvtRecDTagCnv ()
 
virtual ~EvtRecDTagCnv ()
 
- 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 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.
 

Protected Member Functions

 EvtRecDTagCnv (ISvcLocator *svc)
 
virtual StatusCode DataObjectToTObject (DataObject *obj, RootAddress *addr)
 transformation to root
 
virtual StatusCode TObjectToDataObject (DataObject *&obj)
 transformation from root
 
 EvtRecDTagCnv (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
 
virtual destinationconvert (const source &) const =0
 

Friends

class CnvFactory< EvtRecDTagCnv >
 

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

Constructor & Destructor Documentation

◆ ~EvtRecDTagCnv() [1/2]

virtual EvtRecDTagCnv::~EvtRecDTagCnv ( )
inlinevirtual

◆ EvtRecDTagCnv() [1/2]

EvtRecDTagCnv::EvtRecDTagCnv ( ISvcLocator *  svc)
protected

Definition at line 24 of file EvtRecDTagCnv.cxx.

26{
27 m_rootBranchname = "m_evtRecDTagCol";
28 m_adresses.push_back(&m_evtRecDTagCol);
29 m_evtRecDTagCol = 0;
30}
std::vector< void * > m_adresses
each converter knows the corresponding adresses
std::string m_rootBranchname
root branchname (may be concatenated of severals)

◆ ~EvtRecDTagCnv() [2/2]

virtual EvtRecDTagCnv::~EvtRecDTagCnv ( )
inlinevirtual

◆ EvtRecDTagCnv() [2/2]

EvtRecDTagCnv::EvtRecDTagCnv ( ISvcLocator *  svc)
protected

Member Function Documentation

◆ classID() [1/2]

static const CLID & EvtRecDTagCnv::classID ( )
inlinestatic

Definition at line 19 of file Event/RootCnvSvc/RootCnvSvc-02-01-12/RootCnvSvc/EvtRec/EvtRecDTagCnv.h.

19{ return CLID_EvtRecDTagCol; }
const CLID & CLID_EvtRecDTagCol
Definition: EventModel.cxx:380

◆ classID() [2/2]

static const CLID & EvtRecDTagCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/2]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 127 of file EvtRecDTagCnv.cxx.

127 {
128 MsgStream log(msgSvc(), "EvtRecDTagCnv");
129 log << MSG::DEBUG << "EvtRecDTagCnv::DataObjectToTObject" << endreq;
130
131 EvtRecDTagCol* evtRecDTagCol = dynamic_cast<EvtRecDTagCol*> (obj);
132 if ( ! evtRecDTagCol ) {
133 log << MSG::ERROR << "Could not downcast to EvtRecDTagCol" << endreq;
134 return StatusCode::FAILURE;
135 }
136
137 DataObject* evt;
138 m_eds->findObject(EventModel::EvtRec::Event, evt);
139 if ( evt == NULL ) {
140 log << MSG::ERROR << "Could not get EvtRecObject in TDS" << endreq;
141 return StatusCode::FAILURE;
142 }
143 EvtRecObject* devtTds = dynamic_cast<EvtRecObject*> (evt);
144 if ( ! devtTds ) {
145 log << MSG::ERROR << "EvtRecDTagCnv: Could not downcast to TDS EvtRecObject" << endreq;
146 }
147
148 IOpaqueAddress *addr;
149 m_cnvSvc->getEvtRecCnv()->createRep(evt, addr);
151
152 const TObjArray* m_evtRecDTagCol = recEvt->getEvtRecDTagCol();
153 if ( ! m_evtRecDTagCol ) return StatusCode::SUCCESS;
154
155 IDataProviderSvc* dataSvc = 0;
156 StatusCode sc = serviceLocator()->getService("EventDataSvc",
157 IDataProviderSvc::interfaceID(), (IInterface*&)dataSvc);
158 if ( sc.isFailure() ) {
159 log << MSG::FATAL << "Could not get EventDataSvc in EvtRecDTagCnv" << endreq;
160 return sc;
161 }
162
163 EvtRecTrackCol::iterator evtRecTrackColbegin, evtRecTrackColend;
164
165 SmartDataPtr<EvtRecTrackCol> evtRecTrackCol(dataSvc, EventModel::EvtRec::EvtRecTrackCol);
166 if ( ! evtRecTrackCol) {
167 log << MSG::INFO << "Could not find EvtRecTrackCol" << endreq;
168 }
169 else {
170 evtRecTrackColbegin = evtRecTrackCol->begin();
171 evtRecTrackColend = evtRecTrackCol->end();
172 }
173
174 // convert
175 recEvt->clearEvtRecDTagCol();
176 EvtRecDTagCol::const_iterator evtRecDTag = evtRecDTagCol->begin();
177
178 for ( ; evtRecDTag != evtRecDTagCol->end(); evtRecDTag++) {
179 EvtRecDTag* ptr = *evtRecDTag;
180 TEvtRecDTag* evtRecDTagRoot = new TEvtRecDTag();
181
182 // set ...
183 evtRecDTagRoot->setdecayMode( ptr->decayMode() );
184 evtRecDTagRoot->settype( ptr->type() );
185 evtRecDTagRoot->setbeamE( ptr->beamE() );
186 evtRecDTagRoot->setmass( ptr->mass() );
187 evtRecDTagRoot->setmBC( ptr->mBC() );
188 evtRecDTagRoot->setdeltaE( ptr->deltaE() );
189 evtRecDTagRoot->setcharge( ptr->charge() );
190 evtRecDTagRoot->setcharm( ptr->charm() );
191 evtRecDTagRoot->setnumOfChildren( ptr->numOfChildren() );
192
193 HepLorentzVector p4=ptr->p4();
194 evtRecDTagRoot->setpx(p4.x());
195 evtRecDTagRoot->setpy(p4.y());
196 evtRecDTagRoot->setpz(p4.z());
197 evtRecDTagRoot->setpe(p4.t());
198
199
200
201 SmartRefVector<EvtRecTrack> tracks=ptr->tracks();
202 // assert(evtRecTrackColbegin != evtRecTrackColend);
203 for(unsigned int i=0; i<tracks.size();i++){
204 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
205 evtRecTrackColend, tracks[i]);
206 //assert(it != evtRecTrackColend);
207 evtRecDTagRoot->addTrack(it - evtRecTrackColbegin );
208 }
209
210
211 SmartRefVector<EvtRecTrack> showers=ptr->showers();
212 // assert(evtRecTrackColbegin != evtRecTrackColend);
213 for(unsigned int i=0; i<showers.size();i++){
214 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
215 evtRecTrackColend, showers[i]);
216 //assert(it != evtRecTrackColend);
217 evtRecDTagRoot->addShower(it - evtRecTrackColbegin );
218 }
219
220
221 SmartRefVector<EvtRecTrack> otherTracks=ptr->otherTracks();
222 // assert(evtRecTrackColbegin != evtRecTrackColend);
223 for(unsigned int i=0; i<otherTracks.size();i++){
224 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
225 evtRecTrackColend, otherTracks[i]);
226 //assert(it != evtRecTrackColend);
227 evtRecDTagRoot->addOtherTrack(it - evtRecTrackColbegin );
228 }
229
230 SmartRefVector<EvtRecTrack> otherShowers=ptr->otherShowers();
231 // assert(evtRecTrackColbegin != evtRecTrackColend);
232 for(unsigned int i=0; i<otherShowers.size();i++){
233 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
234 evtRecTrackColend, otherShowers[i]);
235 //assert(it != evtRecTrackColend);
236 evtRecDTagRoot->addOtherShower(it - evtRecTrackColbegin );
237 }
238
239 SmartRefVector<EvtRecTrack> pionId=ptr->pionId();
240 // assert(evtRecTrackColbegin != evtRecTrackColend);
241 for(unsigned int i=0; i<pionId.size();i++){
242 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
243 evtRecTrackColend, pionId[i]);
244 //assert(it != evtRecTrackColend);
245 evtRecDTagRoot->addPionId(it - evtRecTrackColbegin );
246 }
247
248 SmartRefVector<EvtRecTrack> kaonId=ptr->kaonId();
249 // assert(evtRecTrackColbegin != evtRecTrackColend);
250 for(unsigned int i=0; i<kaonId.size();i++){
251 EvtRecTrackCol::iterator it = find(evtRecTrackColbegin,
252 evtRecTrackColend, kaonId[i]);
253 //assert(it != evtRecTrackColend);
254 evtRecDTagRoot->addKaonId(it - evtRecTrackColbegin );
255 }
256
257
258 recEvt->addEvtRecDTag(evtRecDTagRoot);
259 }
260
261 return StatusCode::SUCCESS;
262}
IDataProviderSvc * m_eds
pointer to eventdataservice
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)
Convert the transient object to the requested representation.
void addEvtRecDTag(TEvtRecDTag *dtag)

◆ DataObjectToTObject() [2/2]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/2]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 32 of file EvtRecDTagCnv.cxx.

32 {
33 // creation of TDS object from root object
34 MsgStream log(msgSvc(), "EvtRecDTagCnv");
35 log << MSG::DEBUG << "EvtRecDTagCnv::TObjectToDataObject" << endreq;
36
37 // create the TDS location for the EvtRecDTag Collection
38 EvtRecDTagCol* evtRecDTagCol = new EvtRecDTagCol;
39 refpObject = evtRecDTagCol;
40
41 if ( ! m_evtRecDTagCol ) 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 EvtRecDTagCnv" << 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 evtRecDTagIter(m_evtRecDTagCol);
58 TEvtRecDTag* evtRecDTagRoot = 0;
59 while ( (evtRecDTagRoot = (TEvtRecDTag*)evtRecDTagIter.Next() ) ) {
60 EvtRecDTag* evtRecDTag = new EvtRecDTag();
61 m_common.m_rootEvtRecDTagMap[evtRecDTagRoot] = evtRecDTag;
62
63 // set ....
64 evtRecDTag->setdecayMode( (EvtRecDTag::DecayMode)evtRecDTagRoot->decayMode() );
65 evtRecDTag->settype( (EvtRecDTag::SelType)evtRecDTagRoot->type() );
66 evtRecDTag->setbeamE( evtRecDTagRoot->beamE() );
67 evtRecDTag->setmass( evtRecDTagRoot->mass() );
68 evtRecDTag->setmBC( evtRecDTagRoot->mBC() );
69 evtRecDTag->setdeltaE( evtRecDTagRoot->deltaE() );
70 evtRecDTag->setcharge( evtRecDTagRoot->charge() );
71 evtRecDTag->setcharm( evtRecDTagRoot->charm() );
72 evtRecDTag->setnumOfChildren( evtRecDTagRoot->numOfChildren() );
73
74 HepLorentzVector p4(evtRecDTagRoot->px(),evtRecDTagRoot->py(),evtRecDTagRoot->pz(),evtRecDTagRoot->pe());
75 evtRecDTag->setp4(p4);
76
77
78 const std::vector<int>& tracks=evtRecDTagRoot->tracks();
79 const std::vector<int>& showers=evtRecDTagRoot->showers();
80 const std::vector<int>& otherTracks=evtRecDTagRoot->otherTracks();
81 const std::vector<int>& otherShowers=evtRecDTagRoot->otherShowers();
82 const std::vector<int>& pionId=evtRecDTagRoot->pionId();
83 const std::vector<int>& kaonId=evtRecDTagRoot->kaonId();
84
85 for(unsigned int i=0; i<tracks.size();i++)
86 evtRecDTag->addTrack(
87 dynamic_cast<EvtRecTrack*>(evtRecTrackCol->containedObject(tracks[i]))
88 );
89
90 for(unsigned int i=0; i<showers.size();i++)
91 evtRecDTag->addShower(
92 dynamic_cast<EvtRecTrack*>(evtRecTrackCol->containedObject(showers[i]))
93 );
94
95
96 for(unsigned int i=0; i<otherTracks.size();i++)
97 evtRecDTag->addOtherTrack(
98 dynamic_cast<EvtRecTrack*>(evtRecTrackCol->containedObject(otherTracks[i]))
99 );
100
101
102 for(unsigned int i=0; i<otherShowers.size();i++)
103 evtRecDTag->addOtherShower(
104 dynamic_cast<EvtRecTrack*>(evtRecTrackCol->containedObject(otherShowers[i]))
105 );
106
107 for(unsigned int i=0; i<pionId.size();i++)
108 evtRecDTag->addPionId(
109 dynamic_cast<EvtRecTrack*>(evtRecTrackCol->containedObject(pionId[i]))
110 );
111
112 for(unsigned int i=0; i<kaonId.size();i++)
113 evtRecDTag->addKaonId(
114 dynamic_cast<EvtRecTrack*>(evtRecTrackCol->containedObject(kaonId[i]))
115 );
116
117
118
119 evtRecDTagCol->push_back(evtRecDTag);
120 }
121
122 delete m_evtRecDTagCol;
123 m_evtRecDTagCol = 0;
124 return StatusCode::SUCCESS;
125}
void addOtherTrack(const SmartRef< EvtRecTrack > track)
void addOtherShower(const SmartRef< EvtRecTrack > shower)
void addKaonId(const SmartRef< EvtRecTrack > kaonId)
void addPionId(const SmartRef< EvtRecTrack > pionId)
void addShower(const SmartRef< EvtRecTrack > shower)
void addTrack(const SmartRef< EvtRecTrack > track)
static std::map< const TObject *, const EvtRecDTag * > m_rootEvtRecDTagMap

◆ TObjectToDataObject() [2/2]

virtual StatusCode EvtRecDTagCnv::TObjectToDataObject ( DataObject *&  obj)
protectedvirtual

transformation from root

Implements RootEventBaseCnv.

Friends And Related Function Documentation

◆ CnvFactory< EvtRecDTagCnv >


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