147 {
148
149
151
152 G4int tofDigiCollID = -1;
153 tofDigiCollID = m_DigiMan->GetDigiCollectionID("BesTofDigitsCollection");
154
155 if( tofDigiCollID>=0 ) {
157 G4int nDigi = tofDC->entries();
158 if( nDigi>0 ) {
159
160 BesTofDigi* digi;
161 vector<BesTofDigi*>* vecDC = tofDC->GetVector();
162 for( int i=0; i<nDigi-1; i++ ) {
163 for( int j=i+1; j<nDigi; j++ ) {
164 if( (*vecDC)[i]->GetTrackIndex()>(*vecDC)[j]->GetTrackIndex() ) {
165 digi = (*vecDC)[i];
166 (*vecDC)[i] = (*vecDC)[j];
167 (*vecDC)[j] = digi;
168 }
169 }
170 }
171
172
173 for( int i=0; i<nDigi; i++ ) {
174 digi = (*tofDC)[i];
175
176
177
179
180
182
184 unsigned int layer = 0;
186 layer = 1;
188 }
189
190
191 Identifier ident =
TofID::cell_id ( barrel_ec, layer, scinNum, 0);
195 }
196 else {
198 }
199
202
204
206
208 }
210 }
211 else {
213 }
214
215 TofDigi* tofDigi =
new TofDigi(ident,
time,
charge);
218 }
220 aTofDigiCol->push_back(tofDigi);
221
222
226 }
227 else {
229 }
230
232
234
236
238 }
240 }
241 else {
243 }
244
248 }
250 aTofDigiCol->push_back(tofDigi);
251 }
252 else {
253 if( barrel_ec==3 || barrel_ec==4 ) {
254 unsigned int endcap = 0;
256 unsigned int strip = digi->
GetStrip();
257 if( barrel_ec==4 ) {
258 endcap = 1;
259 }
260
261
263 unsigned int tleading;
266 }
267 else { tleading = 0; }
268 unsigned int ttrailing;
271 }
272 else { ttrailing = 0; }
273 TofDigi* tofDigi = new TofDigi( ident, tleading, ttrailing );
275 aTofDigiCol->push_back( tofDigi );
276
277
278
279
280
281
282
286 }
287 else { tleading = 0; }
290 }
291 else { ttrailing = 0; }
292 tofDigi = new TofDigi( ident, tleading, ttrailing );
294 aTofDigiCol->push_back( tofDigi );
295 }
296 }
297
298 }
299 }
300 }
301
302
303 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", aTofDigiCol);
304 if( scTof!=StatusCode::SUCCESS ) {
305 G4cout<< "Could not register TOF digi collection" <<G4endl;
306 }
307 return;
308}
G4TDigiCollection< BesTofDigi > BesTofDigitsCollection
ObjectVector< TofDigi > TofDigiCol
static unsigned int TofTimeChannel(double time)
void setOverflow(const unsigned int overflow)
static Identifier cell_id(int barrel_ec, int layer, int phi_module, int end)
For a single crystal.
static bool is_scin(const Identifier &id)
static value_type getPHI_BARREL_MAX()
static bool is_barrel(const Identifier &id)
Test for barrel.