CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
RecEmcClusterCnv Class Reference

#include <RecEmcClusterCnv.h>

+ Inheritance diagram for RecEmcClusterCnv:

Public Member Functions

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

 RecEmcClusterCnv (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< RecEmcClusterCnv >
 

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 15 of file RecEmcClusterCnv.h.

Constructor & Destructor Documentation

◆ ~RecEmcClusterCnv()

virtual RecEmcClusterCnv::~RecEmcClusterCnv ( )
inlinevirtual

Definition at line 25 of file RecEmcClusterCnv.h.

25{ };

◆ RecEmcClusterCnv()

RecEmcClusterCnv::RecEmcClusterCnv ( ISvcLocator *  svc)
protected

Definition at line 33 of file RecEmcClusterCnv.cxx.

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

Definition at line 20 of file RecEmcClusterCnv.h.

21 {
23 }
const CLID & CLID_RecEmcClusterCol
Definition: EventModel.cxx:368

◆ DataObjectToTObject()

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

transformation to root

Implements RootEventBaseCnv.

Definition at line 149 of file RecEmcClusterCnv.cxx.

149 {
150
151 MsgStream log(msgSvc(), "RecEmcClusterCnv");
152 log << MSG::DEBUG << "RecEmcClusterCnv::DataObjectToTObject" << endreq;
153 //cout<<"RecEmcClusterCnv::DataObjectToTObject"<<endl;
154 StatusCode sc=StatusCode::SUCCESS;
155
156 RecEmcClusterCol * emcClusterColTds=dynamic_cast<RecEmcClusterCol *> (obj);
157 if (!emcClusterColTds) {
158 log << MSG::ERROR << "Could not downcast to RecEmcClusterCol" << endreq;
159 return StatusCode::FAILURE;
160 }
161
162 DataObject *evt;
163 m_eds->findObject(EventModel::Recon::Event,evt);
164 if (evt==NULL) {
165 log << MSG::ERROR << "Could not get RecEvent in TDS " << endreq;
166 return StatusCode::FAILURE;
167 }
168 ReconEvent * devtTds=dynamic_cast<ReconEvent *> (evt);
169 if (!devtTds) {
170 log << MSG::ERROR << "RecEmcClusterCnv:Could not downcast to TDS DstEvent" << endreq;
171 }
172 IOpaqueAddress *addr;
173
174 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
176
177 const TObjArray *m_emcClusterCol = recEvt->getEmcClusterCol();
178 if (!m_emcClusterCol) return sc;
179
180 //necessary in case there is I/O at the same time since array is static
181 recEvt->clearEmcClusterCol();
182
183 RecEmcClusterCol::const_iterator emcClusterTds;
184
185 for(emcClusterTds = emcClusterColTds->begin();
186 emcClusterTds != emcClusterColTds->end();
187 emcClusterTds++) {
188 Int_t clusterId = (*emcClusterTds)->getClusterId();
189
190 vector<Int_t> vecHits;
191 RecEmcHitMap::const_iterator iHitMap;
192 for(iHitMap=(*emcClusterTds)->Begin();
193 iHitMap!=(*emcClusterTds)->End();
194 iHitMap++) {
195 vecHits.push_back(iHitMap->first);
196 }
197
198 vector<Int_t> vecSeeds;
199 RecEmcHitMap::const_iterator iSeedMap;
200 for(iSeedMap=(*emcClusterTds)->BeginSeed();
201 iSeedMap!=(*emcClusterTds)->EndSeed();
202 iSeedMap++) {
203 vecSeeds.push_back(iSeedMap->first);
204 }
205
206 vector<RecEmcID> vecShowerId=(*emcClusterTds)->getShowerIdVec();
207 vector<RecEmcID>::iterator iShowerId;
208 vector<Int_t> vecShowers;
209 for(iShowerId=vecShowerId.begin();
210 iShowerId!=vecShowerId.end();
211 iShowerId++) {
212 vecShowers.push_back(*iShowerId);
213 }
214
215 //cout<<"clusterId="<<RecEmcID(clusterId)<<endl;
216
217 TRecEmcCluster *emcClusterRoot = new TRecEmcCluster();
218 //m_common.m_recEmcClusterMap[(*emcClusterTds)] = emcClusterRoot;
219
220 emcClusterRoot->setClusterId(clusterId);
221 emcClusterRoot->setVecHits(vecHits);
222 emcClusterRoot->setVecSeeds(vecSeeds);
223 emcClusterRoot->setVecShowers(vecShowers);
224
225 recEvt->addEmcCluster(emcClusterRoot);
226 }
227
228 return StatusCode::SUCCESS;
229}
ObjectVector< RecEmcCluster > RecEmcClusterCol
Definition: RecEmcCluster.h:93
static TRecTrackEvent * getWriteObject()
returns object to be written (maintained here for all DIGI-converters)
Definition: RecTrackCnv.h:36
RecTrackCnv * getRecTrackCnv()
Definition: RootCnvSvc.h:166
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 setVecSeeds(const vector< Int_t > &vecSeeds)
void setVecShowers(const vector< Int_t > &vecShowers)
void setVecHits(const vector< Int_t > &vecHits)
void setClusterId(const Int_t id)
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) *‍/
_EXTERN_ std::string Event
Definition: EventModel.h:90

◆ TObjectToDataObject()

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

transformation from root

Implements RootEventBaseCnv.

Definition at line 48 of file RecEmcClusterCnv.cxx.

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

Friends And Related Function Documentation

◆ CnvFactory< RecEmcClusterCnv >

friend class CnvFactory< RecEmcClusterCnv >
friend

Definition at line 9 of file RecEmcClusterCnv.h.


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