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

#include <RecEmcClusterCnv.h>

Inheritance diagram for RecEmcClusterCnv:

Public Member Functions

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

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

◆ ~RecEmcClusterCnv() [1/3]

virtual RecEmcClusterCnv::~RecEmcClusterCnv ( )
inlinevirtual

◆ RecEmcClusterCnv() [1/3]

RecEmcClusterCnv::RecEmcClusterCnv ( ISvcLocator * svc)

Definition at line 33 of file RecEmcClusterCnv.cxx.

33 : RootEventBaseCnv( classID(), svc ) {
34 // cout<<"in RecEmcClusterCnv::constructor: clusterid= "<<aCluster->clID()<<endl;
35
36 // Here we associate this converter with the /Event path on the TDS.
37 MsgStream log( msgSvc(), "RecEmcClusterCnv" );
38 // log << MSG::DEBUG << "Constructor called for " << objType() << endmsg;
39 // m_rootTreename ="Rec";
40 m_rootBranchname = "m_recEmcClusterCol";
41 // declareObject(EventModel::Recon::RecEmcClusterCol, objType(), m_rootTreename,
42 // m_rootBranchname);
43 m_adresses.push_back( &m_recEmcClusterCol );
44 m_recEmcClusterCol = 0;
45}
IMessageSvc * msgSvc()
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)

◆ ~RecEmcClusterCnv() [2/3]

virtual RecEmcClusterCnv::~RecEmcClusterCnv ( )
inlinevirtual

◆ RecEmcClusterCnv() [2/3]

RecEmcClusterCnv::RecEmcClusterCnv ( ISvcLocator * svc)

◆ ~RecEmcClusterCnv() [3/3]

virtual RecEmcClusterCnv::~RecEmcClusterCnv ( )
inlinevirtual

◆ RecEmcClusterCnv() [3/3]

RecEmcClusterCnv::RecEmcClusterCnv ( ISvcLocator * svc)

Member Function Documentation

◆ classID() [1/3]

const CLID & RecEmcClusterCnv::classID ( )
inlinestatic

Definition at line 19 of file Event/RootCnvSvc/include/RootCnvSvc/Rec/RecEmcClusterCnv.h.

19{ return CLID_RecEmcClusterCol; }
const CLID & CLID_RecEmcClusterCol

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

◆ classID() [2/3]

const CLID & RecEmcClusterCnv::classID ( )
inlinestatic

◆ classID() [3/3]

const CLID & RecEmcClusterCnv::classID ( )
inlinestatic

◆ DataObjectToTObject() [1/3]

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 144 of file RecEmcClusterCnv.cxx.

144 {
145
146 MsgStream log( msgSvc(), "RecEmcClusterCnv" );
147 log << MSG::DEBUG << "RecEmcClusterCnv::DataObjectToTObject" << endmsg;
148 // cout<<"RecEmcClusterCnv::DataObjectToTObject"<<endl;
149 StatusCode sc = StatusCode::SUCCESS;
150
151 RecEmcClusterCol* emcClusterColTds = dynamic_cast<RecEmcClusterCol*>( obj );
152 if ( !emcClusterColTds )
153 {
154 log << MSG::ERROR << "Could not downcast to RecEmcClusterCol" << endmsg;
155 return StatusCode::FAILURE;
156 }
157
158 DataObject* evt;
159 m_eds->findObject( EventModel::Recon::Event, evt );
160 if ( evt == NULL )
161 {
162 log << MSG::ERROR << "Could not get RecEvent in TDS " << endmsg;
163 return StatusCode::FAILURE;
164 }
165 ReconEvent* devtTds = dynamic_cast<ReconEvent*>( evt );
166 if ( !devtTds )
167 { log << MSG::ERROR << "RecEmcClusterCnv:Could not downcast to TDS DstEvent" << endmsg; }
168 IOpaqueAddress* addr;
169
170 m_cnvSvc->getRecTrackCnv()->createRep( evt, addr );
171 TRecTrackEvent* recEvt = m_cnvSvc->getRecTrackCnv()->getWriteObject();
172
173 const TObjArray* m_emcClusterCol = recEvt->getEmcClusterCol();
174 if ( !m_emcClusterCol ) return sc;
175
176 // necessary in case there is I/O at the same time since array is static
177 recEvt->clearEmcClusterCol();
178
179 RecEmcClusterCol::const_iterator emcClusterTds;
180
181 for ( emcClusterTds = emcClusterColTds->begin(); emcClusterTds != emcClusterColTds->end();
182 emcClusterTds++ )
183 {
184 Int_t clusterId = ( *emcClusterTds )->getClusterId();
185
186 vector<Int_t> vecHits;
187 RecEmcHitMap::const_iterator iHitMap;
188 for ( iHitMap = ( *emcClusterTds )->Begin(); iHitMap != ( *emcClusterTds )->End();
189 iHitMap++ )
190 { vecHits.push_back( iHitMap->first ); }
191
192 vector<Int_t> vecSeeds;
193 RecEmcHitMap::const_iterator iSeedMap;
194 for ( iSeedMap = ( *emcClusterTds )->BeginSeed();
195 iSeedMap != ( *emcClusterTds )->EndSeed(); iSeedMap++ )
196 { vecSeeds.push_back( iSeedMap->first ); }
197
198 vector<RecEmcID> vecShowerId = ( *emcClusterTds )->getShowerIdVec();
199 vector<RecEmcID>::iterator iShowerId;
200 vector<Int_t> vecShowers;
201 for ( iShowerId = vecShowerId.begin(); iShowerId != vecShowerId.end(); iShowerId++ )
202 { vecShowers.push_back( *iShowerId ); }
203
204 // cout<<"clusterId="<<RecEmcID(clusterId)<<endl;
205
206 TRecEmcCluster* emcClusterRoot = new TRecEmcCluster();
207 // m_common.m_recEmcClusterMap[(*emcClusterTds)] = emcClusterRoot;
208
209 emcClusterRoot->setClusterId( clusterId );
210 emcClusterRoot->setVecHits( vecHits );
211 emcClusterRoot->setVecSeeds( vecSeeds );
212 emcClusterRoot->setVecShowers( vecShowers );
213
214 recEvt->addEmcCluster( emcClusterRoot );
215 }
216
217 return StatusCode::SUCCESS;
218}
ObjectVector< RecEmcCluster > RecEmcClusterCol
IDataProviderSvc * m_eds
pointer to eventdataservice
void setVecSeeds(const vector< Int_t > &vecSeeds)
void setVecShowers(const vector< Int_t > &vecShowers)
void setVecHits(const vector< Int_t > &vecHits)
void addEmcCluster(TRecEmcCluster *Track)
Add a TkrTrack into the Emc data collection *‍/.
const TObjArray * getEmcClusterCol() const
retrieve the whole TObjArray of EmcCluster Data
void clearEmcClusterCol()
clear the whole array (necessary because of the consts-s) *‍/

◆ DataObjectToTObject() [2/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ DataObjectToTObject() [3/3]

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

transformation to root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [1/3]

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 47 of file RecEmcClusterCnv.cxx.

47 {
48 // creation of TDS object from root object
49 MsgStream log( msgSvc(), "RecEmcClusterCnv" );
50 log << MSG::DEBUG << "RecEmcClusterCnv::TObjectToDataObject" << endmsg;
51 // cout << "RecEmcClusterCnv::TObjectToDataObject" << endl;
52 StatusCode sc = StatusCode::SUCCESS;
53
54 IDataProviderSvc* eventSvc;
55 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc );
56
57 SmartDataPtr<RecEmcHitCol> emcRecHitCol( eventSvc, EventModel::Recon::RecEmcHitCol );
58 if ( !emcRecHitCol ) log << MSG::INFO << "can't retrieve RecEmcHitCol" << endmsg;
59
60 // create the TDS location for the RecEmcCluster Collection
61 RecEmcClusterCol* emcClusterTdsCol = new RecEmcClusterCol;
62 refpObject = emcClusterTdsCol;
63
64 // now convert
65 if ( !m_recEmcClusterCol ) return sc;
66 TIter emcClusterIter( m_recEmcClusterCol );
67 TRecEmcCluster* emcClusterRoot = 0;
68 while ( ( emcClusterRoot = (TRecEmcCluster*)emcClusterIter.Next() ) )
69 {
70 RecEmcID clusterId( emcClusterRoot->clusterId() );
71
72 RecEmcCluster* emcClusterTds = new RecEmcCluster();
73 m_common.m_rootRecEmcClusterMap[emcClusterRoot] = emcClusterTds;
74
75 emcClusterTds->ClusterId( clusterId );
76
77 vector<int> vecShowers = emcClusterRoot->vecShowers();
78 vector<int>::iterator iVecShower;
79 vector<RecEmcID> vecShowerId;
80 for ( iVecShower = vecShowers.begin(); iVecShower != vecShowers.end(); iVecShower++ )
81 {
82 RecEmcID id( *iVecShower );
83 vecShowerId.push_back( id );
84 }
85 emcClusterTds->ShowerIdVec( vecShowerId );
86
87 if ( emcRecHitCol )
88 {
89 vector<Int_t> vecHits = emcClusterRoot->vecHits();
90 vector<Int_t> vecSeeds = emcClusterRoot->vecSeeds();
91 vector<Int_t>::iterator iVecHit;
92
93 // put hit map into cluster
94 for ( iVecHit = vecHits.begin(); iVecHit != vecHits.end(); iVecHit++ )
95 {
96
97 RecEmcID id( *iVecHit );
98
99 RecEmcHitCol::iterator iHit;
100 for ( iHit = emcRecHitCol->begin(); iHit != emcRecHitCol->end(); iHit++ )
101 {
102
103 RecEmcID idHit( ( *iHit )->getCellId() );
104
105 if ( id == idHit )
106 {
107 // RecEmcFraction frac(*(*iHit));
108 // frac.Fraction(iHit->second);
109 emcClusterTds->Insert( *( *iHit ) );
110 break;
111 }
112 } // RecEmcHitCol
113 } // VecHit
114
115 // put seed map into cluster
116 for ( iVecHit = vecSeeds.begin(); iVecHit != vecSeeds.end(); iVecHit++ )
117 {
118
119 RecEmcID id( *iVecHit );
120
121 RecEmcHitCol::iterator iHit;
122 for ( iHit = emcRecHitCol->begin(); iHit != emcRecHitCol->end(); iHit++ )
123 {
124
125 RecEmcID idHit( ( *iHit )->getCellId() );
126
127 if ( id == idHit )
128 {
129 // RecEmcFraction frac(*(*iHit));
130 // frac.Fraction(iHit->second);
131 emcClusterTds->InsertSeed( *( *iHit ) );
132 break;
133 }
134 } // RecEmcHitCol
135 } // VecHit
136 }
137
138 emcClusterTdsCol->push_back( emcClusterTds );
139 }
140
141 return StatusCode::SUCCESS;
142}
void Insert(const RecEmcHit &aHit)
void ShowerIdVec(const vector< RecEmcID > &showerIdVec)
void InsertSeed(const RecEmcHit &aSeed)
void ClusterId(const RecEmcID id)

◆ TObjectToDataObject() [2/3]

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

transformation from root

Implements RootEventBaseCnv.

◆ TObjectToDataObject() [3/3]

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

transformation from root

Implements RootEventBaseCnv.

◆ CnvFactory< RecEmcClusterCnv >


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