50 MsgStream log(
msgSvc(),
"RecEmcClusterCnv");
51 log << MSG::DEBUG <<
"RecEmcClusterCnv::TObjectToDataObject" << endreq;
53 StatusCode sc=StatusCode::SUCCESS;
55 IDataProviderSvc* eventSvc;
56 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
58 SmartDataPtr<RecEmcHitCol> emcRecHitCol(eventSvc,
60 if(!emcRecHitCol) log << MSG::INFO <<
"can't retrieve RecEmcHitCol" << endreq;
64 refpObject=emcClusterTdsCol;
67 if (!m_recEmcClusterCol)
return sc;
68 TIter emcClusterIter(m_recEmcClusterCol);
70 while ((emcClusterRoot = (
TRecEmcCluster*)emcClusterIter.Next())) {
74 m_common.m_rootRecEmcClusterMap[emcClusterRoot] = emcClusterTds;
78 vector<int> vecShowers = emcClusterRoot->
vecShowers();
79 vector<int>::iterator iVecShower;
80 vector<RecEmcID> vecShowerId;
81 for(iVecShower=vecShowers.begin();
82 iVecShower!=vecShowers.end();
85 vecShowerId.push_back(
id);
90 vector<Int_t> vecHits = emcClusterRoot->
vecHits();
91 vector<Int_t> vecSeeds = emcClusterRoot->
vecSeeds();
92 vector<Int_t>::iterator iVecHit;
95 for(iVecHit=vecHits.begin();
96 iVecHit!=vecHits.end();
101 RecEmcHitCol::iterator iHit;
102 for(iHit=emcRecHitCol->begin();
103 iHit!=emcRecHitCol->end();
106 RecEmcID idHit((*iHit)->getCellId());
111 emcClusterTds->
Insert(*(*iHit));
118 for(iVecHit=vecSeeds.begin();
119 iVecHit!=vecSeeds.end();
124 RecEmcHitCol::iterator iHit;
125 for(iHit=emcRecHitCol->begin();
126 iHit!=emcRecHitCol->end();
129 RecEmcID idHit((*iHit)->getCellId());
142 emcClusterTdsCol->push_back(emcClusterTds);
146 return StatusCode::SUCCESS;
151 MsgStream log(
msgSvc(),
"RecEmcClusterCnv");
152 log << MSG::DEBUG <<
"RecEmcClusterCnv::DataObjectToTObject" << endreq;
154 StatusCode sc=StatusCode::SUCCESS;
157 if (!emcClusterColTds) {
158 log << MSG::ERROR <<
"Could not downcast to RecEmcClusterCol" << endreq;
159 return StatusCode::FAILURE;
165 log << MSG::ERROR <<
"Could not get RecEvent in TDS " << endreq;
166 return StatusCode::FAILURE;
170 log << MSG::ERROR <<
"RecEmcClusterCnv:Could not downcast to TDS DstEvent" << endreq;
172 IOpaqueAddress *addr;
174 m_cnvSvc->getRecTrackCnv()->createRep(evt,addr);
178 if (!m_emcClusterCol)
return sc;
183 RecEmcClusterCol::const_iterator emcClusterTds;
185 for(emcClusterTds = emcClusterColTds->begin();
186 emcClusterTds != emcClusterColTds->end();
188 Int_t clusterId = (*emcClusterTds)->getClusterId();
190 vector<Int_t> vecHits;
191 RecEmcHitMap::const_iterator iHitMap;
192 for(iHitMap=(*emcClusterTds)->Begin();
193 iHitMap!=(*emcClusterTds)->End();
195 vecHits.push_back(iHitMap->first);
198 vector<Int_t> vecSeeds;
199 RecEmcHitMap::const_iterator iSeedMap;
200 for(iSeedMap=(*emcClusterTds)->BeginSeed();
201 iSeedMap!=(*emcClusterTds)->EndSeed();
203 vecSeeds.push_back(iSeedMap->first);
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();
212 vecShowers.push_back(*iShowerId);
228 return StatusCode::SUCCESS;