269{
270
272
273 G4int tofDigiCollID = -1;
274 tofDigiCollID = m_DigiMan->GetDigiCollectionID("BesTofDigitsCollection");
275
276 if(tofDigiCollID>=0)
277 {
279 G4int nDigi = tofDC->entries();
280 if(nDigi>0)
281 {
282
283
284
286 vector<BesTofDigi*>* vecDC = tofDC->GetVector();
287 for(int i=0;i<nDigi-1;i++)
288 for(int j=i+1;j<nDigi;j++)
289 if((*vecDC)[i]->GetTrackIndex()>(*vecDC)[j]->GetTrackIndex())
290 {
291 digi = (*vecDC)[i];
292 (*vecDC)[i] = (*vecDC)[j];
293 (*vecDC)[j] = digi;
294 }
295
296
297
298
299 for(int i=0;i<nDigi;i++)
300 {
301
302 digi = (*tofDC)[i];
303
306
307
308
309
310
311
312
313
314
315
316
317
318 unsigned int layer = 0;
320 unsigned int time =0;
321
322
323
324
325 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2)
326 {
327
328
329
331 layer = 1;
333 }
334
335
337
340 else
342
343
344 unsigned int charge;
345
347 {
348
350
351 if(charge>=8192)
352 {
353
354 charge = (charge | 0x080000);
355
356
357
358
359 }
360 charge = ( (
time & 0x07e000) | charge) ;
361 }
362 else
363 charge =0;
364
365
367
368 if( charge & 0x80000 )
370
372 aTofDigiCol->push_back(tofDigi);
373
374
375 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2)
376 {
377
381 else
383
384
385
386
387
388
389
390
391
393 {
394
395
397
398
399 if(charge>=8192)
400 {
401
402 charge = (charge | 0x080000);
403 }
404 charge = ( (
time & 0x07e000) | charge) ;
405 }
406 else
407 charge = 0;
408
409
410
412
413 if( charge & 0x80000 )
416
417 aTofDigiCol->push_back(tofDigi);
418
419
420 }
421
422 }
423
424
425
426
427
428
429
430 else if(barrel_ec == 3 || barrel_ec == 4 || barrel_ec == 5 || barrel_ec == 6)
431 {
432
434
435
436
437
438
441 else
443
444
445
446 unsigned int time2;
447
449 else time2 = 0;
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
505
506
508
509 aTofDigiCol->push_back(tofDigi);
510
511
512
513
514 }
515
516
517
518
519
520
521
522
523
524
525
526 }
527 }
528 }
529
530
531 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", aTofDigiCol);
532 if(scTof!=StatusCode::SUCCESS)
533 G4cout<< "Could not register TOF digi collection" <<G4endl;
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556}
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)