2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/ISvcLocator.h"
4#include "GaudiKernel/IDataProviderSvc.h"
5#include "GaudiKernel/Bootstrap.h"
6#include "GaudiKernel/IMessageSvc.h"
7#include "GaudiKernel/StatusCode.h"
9#include "GaudiKernel/SmartDataPtr.h"
21 return StatusCode::SUCCESS;
27 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
28 MsgStream log(
msgSvc,
"EmcRecTDS");
30 IDataProviderSvc* eventSvc;
31 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
34 DataObject *aReconEvent;
35 eventSvc->findObject(
"/Event/Recon",aReconEvent);
36 if(aReconEvent==
NULL) {
37 log << MSG::INFO <<
"EmcRecTDS::RegisterReconEvent()" << endreq;
40 StatusCode sc = eventSvc->registerObject(
"/Event/Recon",aReconEvent);
41 if(sc!=StatusCode::SUCCESS) {
42 log << MSG::FATAL <<
"Could not register ReconEvent" <<endreq;
43 return StatusCode::FAILURE;
47 return StatusCode::SUCCESS;
55 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
56 MsgStream log(
msgSvc,
"EmcRecTDS");
57 log << MSG::INFO <<
"EmcRecTDS::RegisterHit()" << endreq;
59 IDataProviderSvc* eventSvc;
60 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
63 RecEmcHitMap::iterator iHitMap;
64 for(iHitMap=aHitMap.begin();
65 iHitMap!=aHitMap.end();
67 aRecEmcHitCol->add(
new RecEmcHit(iHitMap->second));
72 DataObject *aRecEmcHitEvent;
73 eventSvc->findObject(
"/Event/Recon/RecEmcHitCol", aRecEmcHitEvent);
74 if(aRecEmcHitEvent!=
NULL) {
76 sc = eventSvc->unregisterObject(
"/Event/Recon/RecEmcHitCol");
77 delete aRecEmcHitEvent;
78 if(sc!=StatusCode::SUCCESS) {
79 log << MSG::FATAL <<
"Could not unregister EMC shower collection" << endreq;
80 return( StatusCode::FAILURE);
84 sc = eventSvc->registerObject(
"/Event/Recon/RecEmcHitCol", aRecEmcHitCol);
85 if(sc!=StatusCode::SUCCESS) {
86 log << MSG::FATAL <<
"Could not register EMC hit collection" << endreq;
87 return( StatusCode::FAILURE);
90 return StatusCode::SUCCESS;
98 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
99 MsgStream log(
msgSvc,
"EmcRecTDS");
100 log << MSG::INFO <<
"EmcRecTDS::RegisterCluster()" << endreq;
102 IDataProviderSvc* eventSvc;
103 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
106 RecEmcClusterMap::iterator iClusterMap;
107 for(iClusterMap=aClusterMap.begin();
108 iClusterMap!=aClusterMap.end();
110 aRecEmcClusterCol->add(
new RecEmcCluster(iClusterMap->second));
115 DataObject *aRecEmcClusterEvent;
116 eventSvc->findObject(
"/Event/Recon/RecEmcClusterCol", aRecEmcClusterEvent);
117 if(aRecEmcClusterEvent!=
NULL) {
119 sc = eventSvc->unregisterObject(
"/Event/Recon/RecEmcClusterCol");
120 delete aRecEmcClusterEvent;
121 if(sc!=StatusCode::SUCCESS) {
122 log << MSG::FATAL <<
"Could not unregister EMC cluster collection" << endreq;
123 return( StatusCode::FAILURE);
127 sc = eventSvc->registerObject(
"/Event/Recon/RecEmcClusterCol", aRecEmcClusterCol);
128 if(sc!=StatusCode::SUCCESS) {
129 log << MSG::FATAL <<
"Could not register EMC cluster collection" << endreq;
130 return( StatusCode::FAILURE);
133 return StatusCode::SUCCESS;
141 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
142 MsgStream log(
msgSvc,
"EmcRecTDS");
143 log << MSG::INFO <<
"EmcRecTDS::RegisterShower()" << endreq;
145 IDataProviderSvc* eventSvc;
146 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
148 SmartDataPtr<RecEmcClusterCol> aClusterCol(eventSvc,
"/Event/Recon/RecEmcClusterCol");
150 log << MSG::INFO <<
"Could not find emcRecClusterCol" << endreq;
157 RecEmcShowerMap::iterator iShowerMap;
158 for(iShowerMap=aShowerMap.begin();
159 iShowerMap!=aShowerMap.end();
163 RecEmcID clusterId(iShowerMap->second.getClusterId());
164 RecEmcClusterCol::iterator iClusterCol;
165 for(iClusterCol=aClusterCol->begin();
166 iClusterCol!=aClusterCol->end();
168 if(clusterId==(*iClusterCol)->getClusterId()) {
169 iShowerMap->second.Cluster(*iClusterCol);
175 aShowerVec.push_back(iShowerMap->second);
177 sort(aShowerVec.begin(), aShowerVec.end(), greater<RecEmcShower>());
178 RecEmcShowerVec::iterator iShowerVec;
179 for(iShowerVec=aShowerVec.begin();
180 iShowerVec!=aShowerVec.end();
187 DataObject *aRecEmcShowerEvent;
188 eventSvc->findObject(
"/Event/Recon/RecEmcShowerCol", aRecEmcShowerEvent);
189 if(aRecEmcShowerEvent!=
NULL) {
191 StatusCode sc = eventSvc->unregisterObject(
"/Event/Recon/RecEmcShowerCol");
192 delete aRecEmcShowerEvent;
193 if(sc!=StatusCode::SUCCESS) {
194 log << MSG::FATAL <<
"Could not unregister EMC shower collection" << endreq;
195 return( StatusCode::FAILURE);
199 sc = eventSvc->registerObject(
"/Event/Recon/RecEmcShowerCol", aRecEmcShowerCol);
200 if(sc!=StatusCode::SUCCESS) {
201 log << MSG::FATAL <<
"Could not register EMC shower collection" << endreq;
202 return( StatusCode::FAILURE);
205 return StatusCode::SUCCESS;
211 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc);
212 MsgStream log(
msgSvc,
"EmcRecTDS");
213 log << MSG::INFO <<
"EmcRecTDS::CheckRegister()" << endreq;
215 IDataProviderSvc* eventSvc;
216 Gaudi::svcLocator()->service(
"EventDataSvc", eventSvc);
219 SmartDataPtr<RecEmcHitCol> aHitCol(eventSvc,
"/Event/Recon/RecEmcHitCol");
221 log << MSG::FATAL <<
"Could not find emcRecHitCol" << endreq;
222 return( StatusCode::FAILURE);
225 RecEmcHitCol::iterator iHitCol;
226 for(iHitCol=aHitCol->begin();
227 iHitCol!=aHitCol->end();
233 SmartDataPtr<RecEmcClusterCol> aClusterCol(eventSvc,
"/Event/Recon/RecEmcClusterCol");
235 log << MSG::FATAL <<
"Could not find emcRecClusterCol" << endreq;
236 return( StatusCode::FAILURE);
239 RecEmcClusterCol::iterator iClusterCol;
240 for(iClusterCol=aClusterCol->begin();
241 iClusterCol!=aClusterCol->end();
247 SmartDataPtr<RecEmcShowerCol> aShowerCol(eventSvc,
"/Event/Recon/RecEmcShowerCol");
249 log << MSG::FATAL <<
"Could not find emcRecShowerCol" << endreq;
250 return( StatusCode::FAILURE);
253 RecEmcShowerCol::iterator iShowerCol;
254 for(iShowerCol=aShowerCol->begin();
255 iShowerCol!=aShowerCol->end();
260 return StatusCode::SUCCESS;
map< RecEmcID, RecEmcCluster, less< RecEmcID > > RecEmcClusterMap
ObjectVector< RecEmcCluster > RecEmcClusterCol
ObjectVector< RecEmcHit > RecEmcHitCol
map< RecEmcID, RecEmcHit, less< RecEmcID > > RecEmcHitMap
map< RecEmcID, RecEmcShower, less< RecEmcID > > RecEmcShowerMap
ObjectVector< RecEmcShower > RecEmcShowerCol
vector< RecEmcShower > RecEmcShowerVec
StatusCode RegisterCluster(RecEmcClusterMap &aClusterMap)
StatusCode RegisterShower(RecEmcShowerMap &aShowerMap)
StatusCode RegisterToTDS(RecEmcHitMap &aHitMap, RecEmcClusterMap &aClusterMap, RecEmcShowerMap &aShowerMap)
StatusCode CheckRegister()
StatusCode RegisterHit(RecEmcHitMap &aHitMap)
StatusCode RegisterReconEvent()