BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecTDS Class Reference

#include <EmcRecTDS.h>

Public Member Functions

StatusCode RegisterReconEvent ()
 
StatusCode RegisterHit (RecEmcHitMap &aHitMap)
 
StatusCode RegisterCluster (RecEmcClusterMap &aClusterMap)
 
StatusCode RegisterShower (RecEmcShowerMap &aShowerMap)
 
StatusCode RegisterToTDS (RecEmcHitMap &aHitMap, RecEmcClusterMap &aClusterMap, RecEmcShowerMap &aShowerMap)
 
StatusCode CheckRegister ()
 

Detailed Description

Definition at line 5 of file EmcRecTDS.h.

Member Function Documentation

◆ CheckRegister()

StatusCode EmcRecTDS::CheckRegister ( )

Definition at line 208 of file EmcRecTDS.cxx.

209{
210 IMessageSvc* msgSvc;
211 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
212 MsgStream log(msgSvc, "EmcRecTDS");
213 log << MSG::INFO << "EmcRecTDS::CheckRegister()" << endreq;
214
215 IDataProviderSvc* eventSvc;
216 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
217
218 // check RecEmcHitCol registered
219 SmartDataPtr<RecEmcHitCol> aHitCol(eventSvc,"/Event/Recon/RecEmcHitCol");
220 if (!aHitCol) {
221 log << MSG::FATAL << "Could not find emcRecHitCol" << endreq;
222 return( StatusCode::FAILURE);
223 }
224
225 RecEmcHitCol::iterator iHitCol;
226 for(iHitCol=aHitCol->begin();
227 iHitCol!=aHitCol->end();
228 iHitCol++){
229 //cout<<*(*iHitCol);
230 }
231
232 // check RecEmcClusterCol registered
233 SmartDataPtr<RecEmcClusterCol> aClusterCol(eventSvc,"/Event/Recon/RecEmcClusterCol");
234 if (!aClusterCol) {
235 log << MSG::FATAL << "Could not find emcRecClusterCol" << endreq;
236 return( StatusCode::FAILURE);
237 }
238
239 RecEmcClusterCol::iterator iClusterCol;
240 for(iClusterCol=aClusterCol->begin();
241 iClusterCol!=aClusterCol->end();
242 iClusterCol++){
243 //cout<<*(*iClusterCol);
244 }
245
246 // check RecEmcShowerCol registered
247 SmartDataPtr<RecEmcShowerCol> aShowerCol(eventSvc,"/Event/Recon/RecEmcShowerCol");
248 if (!aShowerCol) {
249 log << MSG::FATAL << "Could not find emcRecShowerCol" << endreq;
250 return( StatusCode::FAILURE);
251 }
252
253 RecEmcShowerCol::iterator iShowerCol;
254 for(iShowerCol=aShowerCol->begin();
255 iShowerCol!=aShowerCol->end();
256 iShowerCol++){
257 //cout<<*(*iShowerCol);
258 }
259
260 return StatusCode::SUCCESS;
261}
IMessageSvc * msgSvc()

Referenced by EmcRec::execute().

◆ RegisterCluster()

StatusCode EmcRecTDS::RegisterCluster ( RecEmcClusterMap & aClusterMap)

Definition at line 93 of file EmcRecTDS.cxx.

94{
96
97 IMessageSvc* msgSvc;
98 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
99 MsgStream log(msgSvc, "EmcRecTDS");
100 log << MSG::INFO << "EmcRecTDS::RegisterCluster()" << endreq;
101
102 IDataProviderSvc* eventSvc;
103 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
104
105 RecEmcClusterCol *aRecEmcClusterCol = new RecEmcClusterCol;
106 RecEmcClusterMap::iterator iClusterMap;
107 for(iClusterMap=aClusterMap.begin();
108 iClusterMap!=aClusterMap.end();
109 iClusterMap++){
110 aRecEmcClusterCol->add(new RecEmcCluster(iClusterMap->second));
111 }
112
113 //check whether the RecEmcClusterCol has been already registered
114 StatusCode sc;
115 DataObject *aRecEmcClusterEvent;
116 eventSvc->findObject("/Event/Recon/RecEmcClusterCol", aRecEmcClusterEvent);
117 if(aRecEmcClusterEvent!=NULL) {
118 //then unregister RecEmcClusterCol
119 sc = eventSvc->unregisterObject("/Event/Recon/RecEmcClusterCol");
120 delete aRecEmcClusterEvent; //it must be delete to avoid memory leakage
121 if(sc!=StatusCode::SUCCESS) {
122 log << MSG::FATAL << "Could not unregister EMC cluster collection" << endreq;
123 return( StatusCode::FAILURE);
124 }
125 }
126
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);
131 }
132
133 return StatusCode::SUCCESS;
134}
ObjectVector< RecEmcCluster > RecEmcClusterCol
#define NULL
StatusCode RegisterReconEvent()
Definition EmcRecTDS.cxx:24

Referenced by RegisterToTDS().

◆ RegisterHit()

StatusCode EmcRecTDS::RegisterHit ( RecEmcHitMap & aHitMap)

Definition at line 50 of file EmcRecTDS.cxx.

51{
53
54 IMessageSvc* msgSvc;
55 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
56 MsgStream log(msgSvc, "EmcRecTDS");
57 log << MSG::INFO << "EmcRecTDS::RegisterHit()" << endreq;
58
59 IDataProviderSvc* eventSvc;
60 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
61
62 RecEmcHitCol *aRecEmcHitCol = new RecEmcHitCol;
63 RecEmcHitMap::iterator iHitMap;
64 for(iHitMap=aHitMap.begin();
65 iHitMap!=aHitMap.end();
66 iHitMap++){
67 aRecEmcHitCol->add(new RecEmcHit(iHitMap->second));
68 }
69
70 //check whether the RecEmcHitCol has been already registered
71 StatusCode sc;
72 DataObject *aRecEmcHitEvent;
73 eventSvc->findObject("/Event/Recon/RecEmcHitCol", aRecEmcHitEvent);
74 if(aRecEmcHitEvent!=NULL) {
75 //then unregister RecEmcHitCol
76 sc = eventSvc->unregisterObject("/Event/Recon/RecEmcHitCol");
77 delete aRecEmcHitEvent; //it must be delete to avoid memory leakage
78 if(sc!=StatusCode::SUCCESS) {
79 log << MSG::FATAL << "Could not unregister EMC shower collection" << endreq;
80 return( StatusCode::FAILURE);
81 }
82 }
83
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);
88 }
89
90 return StatusCode::SUCCESS;
91}
ObjectVector< RecEmcHit > RecEmcHitCol
Definition RecEmcHit.h:76

Referenced by RegisterToTDS().

◆ RegisterReconEvent()

StatusCode EmcRecTDS::RegisterReconEvent ( )

Definition at line 24 of file EmcRecTDS.cxx.

25{
26 IMessageSvc* msgSvc;
27 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
28 MsgStream log(msgSvc, "EmcRecTDS");
29
30 IDataProviderSvc* eventSvc;
31 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
32
33 //check whether the Recon has been already registered
34 DataObject *aReconEvent;
35 eventSvc->findObject("/Event/Recon",aReconEvent);
36 if(aReconEvent==NULL) {
37 log << MSG::INFO << "EmcRecTDS::RegisterReconEvent()" << endreq;
38 //then register Recon
39 aReconEvent = new ReconEvent();
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;
44 }
45 }
46
47 return StatusCode::SUCCESS;
48}

Referenced by RegisterCluster(), RegisterHit(), and RegisterShower().

◆ RegisterShower()

StatusCode EmcRecTDS::RegisterShower ( RecEmcShowerMap & aShowerMap)

Definition at line 136 of file EmcRecTDS.cxx.

137{
139
140 IMessageSvc* msgSvc;
141 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
142 MsgStream log(msgSvc, "EmcRecTDS");
143 log << MSG::INFO << "EmcRecTDS::RegisterShower()" << endreq;
144
145 IDataProviderSvc* eventSvc;
146 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
147
148 SmartDataPtr<RecEmcClusterCol> aClusterCol(eventSvc,"/Event/Recon/RecEmcClusterCol");
149 if (!aClusterCol) {
150 log << MSG::INFO << "Could not find emcRecClusterCol" << endreq;
151 }
152
153 // ShowerMap --> Shower Container
154 RecEmcShowerCol *aRecEmcShowerCol = new RecEmcShowerCol;
155 RecEmcShowerVec aShowerVec;
156
157 RecEmcShowerMap::iterator iShowerMap;
158 for(iShowerMap=aShowerMap.begin();
159 iShowerMap!=aShowerMap.end();
160 iShowerMap++) {
161 //Find cluster in TDS
162 if(aClusterCol) {
163 RecEmcID clusterId(iShowerMap->second.getClusterId());
164 RecEmcClusterCol::iterator iClusterCol;
165 for(iClusterCol=aClusterCol->begin();
166 iClusterCol!=aClusterCol->end();
167 iClusterCol++){
168 if(clusterId==(*iClusterCol)->getClusterId()) {
169 iShowerMap->second.Cluster(*iClusterCol);
170 break;
171 //emcRecClusterCol->InsertShower(*iCluster);
172 }
173 }
174 }
175 aShowerVec.push_back(iShowerMap->second);
176 }
177 sort(aShowerVec.begin(), aShowerVec.end(), greater<RecEmcShower>());
178 RecEmcShowerVec::iterator iShowerVec;
179 for(iShowerVec=aShowerVec.begin();
180 iShowerVec!=aShowerVec.end();
181 iShowerVec++) {
182 aRecEmcShowerCol->add(new RecEmcShower(*iShowerVec));
183 }
184
185 //check whether the RecEmcShowerCol has been already registered
186 StatusCode sc;
187 DataObject *aRecEmcShowerEvent;
188 eventSvc->findObject("/Event/Recon/RecEmcShowerCol", aRecEmcShowerEvent);
189 if(aRecEmcShowerEvent!=NULL) {
190 //then unregister RecEmcShowerCol
191 StatusCode sc = eventSvc->unregisterObject("/Event/Recon/RecEmcShowerCol");
192 delete aRecEmcShowerEvent; //it must be delete to avoid memory leakage
193 if(sc!=StatusCode::SUCCESS) {
194 log << MSG::FATAL << "Could not unregister EMC shower collection" << endreq;
195 return( StatusCode::FAILURE);
196 }
197 }
198
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);
203 }
204
205 return StatusCode::SUCCESS;
206}
ObjectVector< RecEmcShower > RecEmcShowerCol
vector< RecEmcShower > RecEmcShowerVec

Referenced by RegisterToTDS().

◆ RegisterToTDS()

StatusCode EmcRecTDS::RegisterToTDS ( RecEmcHitMap & aHitMap,
RecEmcClusterMap & aClusterMap,
RecEmcShowerMap & aShowerMap )

Definition at line 15 of file EmcRecTDS.cxx.

17{
18 RegisterCluster(aClusterMap);
19 RegisterShower(aShowerMap);
20 RegisterHit(aHitMap);
21 return StatusCode::SUCCESS;
22}
StatusCode RegisterCluster(RecEmcClusterMap &aClusterMap)
Definition EmcRecTDS.cxx:93
StatusCode RegisterShower(RecEmcShowerMap &aShowerMap)
StatusCode RegisterHit(RecEmcHitMap &aHitMap)
Definition EmcRecTDS.cxx:50

Referenced by EmcRec::execute().


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