134 {
136
138 Gaudi::svcLocator()->service(
"MessageSvc",
msgSvc );
139 MsgStream log(
msgSvc,
"EmcRecTDS" );
140 log << MSG::INFO << "EmcRecTDS::RegisterShower()" << endmsg;
141
142 IDataProviderSvc* eventSvc;
143 Gaudi::svcLocator()->service( "EventDataSvc", eventSvc );
144
145 SmartDataPtr<RecEmcClusterCol> aClusterCol( eventSvc, "/Event/Recon/RecEmcClusterCol" );
146 if ( !aClusterCol ) { log << MSG::INFO << "Could not find emcRecClusterCol" << endmsg; }
147
148
151
152 RecEmcShowerMap::iterator iShowerMap;
153 for ( iShowerMap = aShowerMap.begin(); iShowerMap != aShowerMap.end(); iShowerMap++ )
154 {
155
156 if ( aClusterCol )
157 {
158 RecEmcID clusterId( iShowerMap->second.getClusterId() );
159 RecEmcClusterCol::iterator iClusterCol;
160 for ( iClusterCol = aClusterCol->begin(); iClusterCol != aClusterCol->end();
161 iClusterCol++ )
162 {
163 if ( clusterId == ( *iClusterCol )->getClusterId() )
164 {
165 iShowerMap->second.Cluster( *iClusterCol );
166 break;
167
168 }
169 }
170 }
171 aShowerVec.push_back( iShowerMap->second );
172 }
173 sort( aShowerVec.begin(), aShowerVec.end(), greater<RecEmcShower>() );
174 RecEmcShowerVec::iterator iShowerVec;
175 for ( iShowerVec = aShowerVec.begin(); iShowerVec != aShowerVec.end(); iShowerVec++ )
176 { aRecEmcShowerCol->add( new RecEmcShower( *iShowerVec ) ); }
177
178
179 StatusCode sc;
180 DataObject* aRecEmcShowerEvent;
181 eventSvc->findObject( "/Event/Recon/RecEmcShowerCol", aRecEmcShowerEvent );
182 if ( aRecEmcShowerEvent != NULL )
183 {
184
185 StatusCode sc = eventSvc->unregisterObject( "/Event/Recon/RecEmcShowerCol" );
186 delete aRecEmcShowerEvent;
187 if ( sc != StatusCode::SUCCESS )
188 {
189 log << MSG::FATAL << "Could not unregister EMC shower collection" << endmsg;
190 return ( StatusCode::FAILURE );
191 }
192 }
193
194 sc = eventSvc->registerObject( "/Event/Recon/RecEmcShowerCol", aRecEmcShowerCol );
195 if ( sc != StatusCode::SUCCESS )
196 {
197 log << MSG::FATAL << "Could not register EMC shower collection" << endmsg;
198 return ( StatusCode::FAILURE );
199 }
200
201 return StatusCode::SUCCESS;
202}
ObjectVector< RecEmcShower > RecEmcShowerCol
vector< RecEmcShower > RecEmcShowerVec