263{
264
266
268 const int hitID((*i)->GetHitID());
271
272
273
274 const bool isECA (region==3);
275 const bool isECB (region==4);
276
278
280
281
282
283
284
285
286
287
289
291
293
295
296
298
299
301 {
302
303 const TimedHitPtr<TRTUncompressedHit> *theHit = &(*hit_iter);
304
306
307
308
309
310 double timeOfHit(0.0);
312 const double globalHitTime(
hitTime(*theHit));
313 const double globalTime = static_cast<double>((*theHit)->GetGlobalTime());
314 const double bunchCrossingTime(globalHitTime - globalTime);
317 }
318
319
320
321
322 const int particleEncoding((*theHit)->GetParticleEncoding());
323
324
325 if (particleEncoding == 0)
326 {
327
328
329
330
333 ATH_MSG_WARNING (
"Ignoring sim. particle with pdgcode 0. This warning is only shown once per job" );
334 }
335 continue;
336 }
337
338
339
341
343
344
345
346
347
348 if ( energyDeposit<30.0 ) {
349
350
351
352 double ArEmulationScaling_BA = 0.05;
353 double ArEmulationScaling_ECA = 0.20;
354 double ArEmulationScaling_ECB = 0.20;
355
356
357 double KrEmulationScaling_BA = 0.20;
358 double KrEmulationScaling_ECA = 0.39;
359 double KrEmulationScaling_ECB = 0.39;
360
361 if (isBarrel) {
362 double trEfficiencyBarrel =
m_settings->trEfficiencyBarrel(strawGasType);
363 double hitx = TRThitGlobalPos[0];
364 double hity = TRThitGlobalPos[1];
365 double hitz = TRThitGlobalPos[2];
366 double hitEta = std::abs(
log(
tan(0.5*atan2(sqrt(hitx*hitx+hity*hity),hitz))));
367 if ( hitEta < 0.5 ) { trEfficiencyBarrel *= ( 0.833333+0.6666667*hitEta*hitEta ); }
368
369 if ( strawGasType == 0 && emulationArflag ) { trEfficiencyBarrel *= ArEmulationScaling_BA; }
370 if ( strawGasType == 0 && emulationKrflag ) { trEfficiencyBarrel *= KrEmulationScaling_BA; }
371 if ( CLHEP::RandFlat::shoot(rndmEngine) > trEfficiencyBarrel ) continue;
372 }
373 else {
374 if (isECA) {
375 double trEfficiencyEndCapA =
m_settings->trEfficiencyEndCapA(strawGasType);
376
377 if ( strawGasType == 0 && emulationArflag ) { trEfficiencyEndCapA *= ArEmulationScaling_ECA; }
378 if ( strawGasType == 0 && emulationKrflag ) { trEfficiencyEndCapA *= KrEmulationScaling_ECA; }
379 if ( CLHEP::RandFlat::shoot(rndmEngine) > trEfficiencyEndCapA ) continue;
380 }
381 if (isECB) {
382 double trEfficiencyEndCapB =
m_settings->trEfficiencyEndCapB(strawGasType);
383
384 if ( strawGasType == 0 && emulationArflag ) { trEfficiencyEndCapB *= ArEmulationScaling_ECB; }
385 if ( strawGasType == 0 && emulationKrflag ) { trEfficiencyEndCapB *= KrEmulationScaling_ECB; }
386 if ( CLHEP::RandFlat::shoot(rndmEngine) > trEfficiencyEndCapB ) continue;
387 }
388 }
389 }
390
391
392 m_clusterlist.emplace_back( energyDeposit*CLHEP::keV, timeOfHit, (*theHit)->GetPostStepX(), (*theHit)->GetPostStepY(), (*theHit)->GetPostStepZ() );
393
394
395
396 }
399 ) {
400
401 m_clusterlist.emplace_back( (*theHit)->GetEnergyDeposit()*CLHEP::keV, timeOfHit, (*theHit)->GetPostStepX(), (*theHit)->GetPostStepY(), (*theHit)->GetPostStepZ() );
402 }
403 else {
404
405 double particleCharge =
MC::charge(particleEncoding);
406 double particleMass(0.);
407
408 const auto particleMassFromTable =
m_genData->particleMass(abs(particleEncoding));
409 if (particleMassFromTable) {
410 particleMass = particleMassFromTable.value();
411 }
412 else {
413
415 ATH_MSG_WARNING (
"Data for sim. particle with pdgcode "<<particleEncoding <<
" is not a nucleus and could not be retrieved from GenData. Assuming mass of pion. Please investigate." );
417 }
418 else {
423 particleMass = std::abs( Z*Mp+(A-Z)*Mn );
424
425 if (!alreadyPrintedPDGcodeWarning) {
426 ATH_MSG_WARNING (
"Data for sim. particle with pdgcode "<<particleEncoding
427 <<" could not be retrieved from GenData (unexpected ion)."
428 <<" Please Investigate the PDGTABLE.MeV file."
429 <<" Calculating mass and charge from pdg code."
430 <<" The result is: Charge = "<<particleCharge<<" Mass = "<<particleMass<<"MeV" );
431 alreadyPrintedPDGcodeWarning = true;
432 }
433 }
434 }
435
436 if (!particleCharge) { continue; }
437
438 if (!particleMass) {
439 ATH_MSG_WARNING (
"Ignoring ionization from particle with pdg code "<<particleEncoding
440 <<" since it appears to be a massless charged particle. Please investigate." );
441 continue;
442 }
443
444
445
446
447
448 const double scaledKineticEnergy( static_cast<double>((*theHit)->GetKineticEnergy()) * ( CLHEP::proton_mass_c2 / particleMass ));
449
451 (*theHit)->GetPreStepX(),(*theHit)->GetPreStepY(),(*theHit)->GetPreStepZ(),
452 (*theHit)->GetPostStepX(),(*theHit)->GetPostStepY(),(*theHit)->GetPostStepZ(),
454
455 }
456 }
457
459
461
462
463
464
465
466
467
468
470
472
474
476
477
479
481
482
483
484
485
487
489
490
492 {
493 outdigit = TRTDigit(hitID, 0);
494 return;
495 }
496
497
498 double lowthreshold, noiseamplitude;
501 } else {
503 noiseamplitude = 0.0;
504 }
505
506
508}
float hitTime(const AFP_SIDSimHit &hit)
Amg::Vector3D getGlobalPosition(int hitID, const TimedHitPtr< TRTUncompressedHit > *theHit, const InDetDD::TRT_DetElementContainer *detElements)
std::vector< cluster > m_clusterlist
void ClustersToDeposits(MagField::AtlasFieldCache &fieldCache, int hitID, const std::vector< cluster > &clusters, std::vector< TRTElectronicsProcessing::Deposit > &deposits, const Amg::Vector3D &TRThitGlobalPos, double m_cosmicEventPhase, int strawGasType, CLHEP::HepRandomEngine *rndmEngine)
Transform the ioniation clusters along the particle trajectory inside a straw to energy deposits (i....
std::vector< TRTElectronicsProcessing::Deposit > m_depositList
void addClustersFromStep(double scaledKineticEnergy, double particleCharge, double timeOfHit, double prex, double prey, double prez, double postx, double posty, double postz, std::vector< cluster > &clusterlist, int strawGasType, CLHEP::HepRandomEngine *rndmEngine, CLHEP::HepRandomEngine *paiRndmEngine)
This is the main function for re-simulation of the ionisation in the active gas via the PAI model.
TimedHitCollection< TRTUncompressedHit >::const_iterator hitCollConstIter
int numberOfProtons(const T &p)
bool isGenericMultichargedParticle(const T &p)
In addition, there is a need to identify ”Q-ball” and similar very exotic (multi-charged) particles w...
bool isPhoton(const T &p)
bool isMonopole(const T &p)
PDG rule 11i Magnetic monopoles and dyons are assumed to have one unit of Dirac monopole charge and a...
double charge(const T &p)
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
double baryonNumber(const T &p)
constexpr double protonMassInMeV
the mass of the proton (in MeV)
constexpr double chargedPionMassInMeV
the mass of the charged pion (in MeV)
constexpr double neutronMassInMeV
the mass of the neutron (in MeV)