261{
262
264
265 G4int tofDigiCollID = -1;
266 tofDigiCollID = m_DigiMan->GetDigiCollectionID("BesTofDigitsCollection");
267
268 if(tofDigiCollID>=0)
269 {
271 G4int nDigi = tofDC->entries();
272 if(nDigi>0)
273 {
274
275
276
278 vector<BesTofDigi*>* vecDC = tofDC->GetVector();
279 for(int i=0;i<nDigi-1;i++)
280 for(int j=i+1;j<nDigi;j++)
281 if((*vecDC)[i]->GetTrackIndex()>(*vecDC)[j]->GetTrackIndex())
282 {
283 digi = (*vecDC)[i];
284 (*vecDC)[i] = (*vecDC)[j];
285 (*vecDC)[j] = digi;
286 }
287
288
289
290
291 for(int i=0;i<nDigi;i++)
292 {
293
294 digi = (*tofDC)[i];
295
298
299
300
301
302
303
304
305
306
307
308
309
310 unsigned int layer = 0;
312 unsigned int time =0;
313
314
315
316
317 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2)
318 {
319
320
321
323 layer = 1;
325 }
326
327
329
332 else
334
335
336 unsigned int charge;
337
339 {
340
342
343 if(charge>=8192)
344 {
345
346 charge = (charge | 0x080000);
347
348
349
350
351 }
352 charge = ( (
time & 0x07e000) | charge) ;
353 }
354 else
355 charge =0;
356
357
359
360 if( charge & 0x80000 )
362
364 aTofDigiCol->push_back(tofDigi);
365
366
367 if(barrel_ec == 0 || barrel_ec == 1 || barrel_ec == 2)
368 {
369
373 else
375
376
377
378
379
380
381
382
383
385 {
386
387
389
390
391 if(charge>=8192)
392 {
393
394 charge = (charge | 0x080000);
395 }
396 charge = ( (
time & 0x07e000) | charge) ;
397 }
398 else
399 charge = 0;
400
401
402
404
405 if( charge & 0x80000 )
408
409 aTofDigiCol->push_back(tofDigi);
410
411
412 }
413
414 }
415
416
417
418
419
420
421
422 else if(barrel_ec == 3 || barrel_ec == 4 || barrel_ec == 5 || barrel_ec == 6)
423 {
424
426
427
428
429
430
433 else
435
436
437
438 unsigned int time2;
439
441 else time2 = 0;
442
443
444
445
446
447
448
449
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
497
498
500
501 aTofDigiCol->push_back(tofDigi);
502
503
504
505
506 }
507
508
509
510
511
512
513
514
515
516
517
518 }
519 }
520 }
521
522
523 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", aTofDigiCol);
524 if(scTof!=StatusCode::SUCCESS)
525 G4cout<< "Could not register TOF digi collection" <<G4endl;
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548}
ObjectVector< TofDigi > TofDigiCol
G4TDigiCollection< BesTofDigi > BesTofDigitsCollection
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)