150{
151
153
154 G4int tofDigiCollID = -1;
155 tofDigiCollID = m_DigiMan->GetDigiCollectionID("BesTofDigitsCollection");
156
157 if(tofDigiCollID>=0)
158 {
160 G4int nDigi = tofDC->entries();
161 if(nDigi>0)
162 {
163
164
165
167 vector<BesTofDigi*>* vecDC = tofDC->GetVector();
168 for(int i=0;i<nDigi-1;i++)
169 for(int j=i+1;j<nDigi;j++)
170 if((*vecDC)[i]->GetTrackIndex()>(*vecDC)[j]->GetTrackIndex())
171 {
172 digi = (*vecDC)[i];
173 (*vecDC)[i] = (*vecDC)[j];
174 (*vecDC)[j] = digi;
175 }
176
177
178
179
180 for(int i=0;i<nDigi;i++)
181 {
182
183 digi = (*tofDC)[i];
184
187
188
189
190
191
192
193
194
195
196
197
198
199 unsigned int layer = 0;
201 unsigned int time =0;
202
203
204
205
206 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2)
207 {
208
209
210
212 layer = 1;
214 }
215
216
218
221 else
223
224
225 unsigned int charge;
226
228 {
229
231
232 if(charge>=8192)
233 {
234
235 charge = (charge | 0x080000);
236
237
238
239
240 }
241 charge = ( (
time & 0x07e000) | charge) ;
242 }
243 else
244 charge =0;
245
246
248
249 if( charge & 0x80000 )
251
253 aTofDigiCol->push_back(tofDigi);
254
255
256 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2)
257 {
258
262 else
264
265
266
267
268
269
270
271
272
274 {
275
276
278
279
280 if(charge>=8192)
281 {
282
283 charge = (charge | 0x080000);
284 }
285 charge = ( (
time & 0x07e000) | charge) ;
286 }
287 else
288 charge = 0;
289
290
291
293
294 if( charge & 0x80000 )
297
298 aTofDigiCol->push_back(tofDigi);
299
300
301 }
302
303 }
304
305
306
307
308
309
310
311 else if(barrel_ec == 3 || barrel_ec == 4 || barrel_ec == 5 || barrel_ec == 6)
312 {
313
315
316
317
318
319
322 else
324
325
326
327 unsigned int time2;
328
330 else time2 = 0;
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
386
387
389
390 aTofDigiCol->push_back(tofDigi);
391
392
393
394
395 }
396
397
398
399
400
401
402
403
404
405
406
407 }
408 }
409 }
410
411
412 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", aTofDigiCol);
413 if(scTof!=StatusCode::SUCCESS)
414 G4cout<< "Could not register TOF digi collection" <<G4endl;
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437}
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 value_type getPHI_BARREL_MAX()
static bool is_barrel(const Identifier &id)
Test for barrel.
static Identifier cell_id_mrpc(int partID, int scinNum)