G4StationSimulator.cc
Go to the documentation of this file.
1 #include "G4StationSimulator.h"
2 #include "G4StationPhysicsList.h"
8 #include "G4StationEventAction.h"
9 #include "G4StationRunAction.h"
10 #include "G4StationVisManager.h"
11 #include "G4StationFastCerenkov.h"
12 #include "G4OutputHandler.h"
13 
14 #include <G4RunManager.hh>
15 #include <G4UImanager.hh>
16 #include <G4VisManager.hh>
17 
18 #include <fwk/CentralConfig.h>
19 #include <fwk/RandomEngineRegistry.h>
20 
21 #include <det/Detector.h>
22 
23 #include <evt/Event.h>
24 #include <evt/ShowerSimData.h>
25 
26 #include <sdet/SDetector.h>
27 #include <sdet/Station.h>
28 #include <sdet/PMTConstants.h>
29 #include <sdet/PMT.h>
30 
31 #include <mdet/MDetector.h>
32 #include <mdet/Counter.h>
33 
34 #include <sevt/PMT.h>
35 #include <sevt/PMTSimData.h>
36 #include <sevt/SEvent.h>
37 #include <sevt/Station.h>
38 #include <sevt/StationSimData.h>
39 
40 #include <utl/ErrorLogger.h>
41 #include <utl/Reader.h>
42 #include <utl/Particle.h>
43 #include <utl/ParticleCases.h>
44 #include <utl/ShowerParticleIterator.h>
45 #include <utl/TimeDistribution.h>
46 #include <utl/TimeDistributionAlgorithm.h>
47 
48 #include <cstddef>
49 #include <iostream>
50 #include <sstream>
51 
52 //using namespace utl;
53 using namespace fwk;
54 using namespace std;
55 using namespace det;
56 using namespace evt;
57 using namespace sdet;
58 using namespace sevt;
59 using namespace mdet;
60 using namespace mevt;
61 using namespace cevt;
62 
63 
64 namespace G4StationSimulatorOG {
65 
66  bool G4StationSimulator::Setup::fgLock = false;
67 
68  G4StationSimulator::Current G4StationSimulator::fgCurrent;
69  bool G4StationSimulator::fgMuCapture = false;
70 
71 
74  {
75  auto& cc = *CentralConfig::GetInstance();
76  const utl::Branch topB = cc.GetTopBranch("G4StationSimulator");
77  const utl::Branch visB = topB.GetChild("visualization");
78 
79  visB.GetChild("geometry").GetData(fGeoVisOn);
80  visB.GetChild("trajectories").GetData(fTrajVisOn);
81  visB.GetChild("renderfile").GetData(fRenderFile);
82 
83  const utl::Branch verB = topB.GetChild("verbosity");
84  if (verB)
85  verB.GetData(fVerbosity);
86 
87  const utl::Branch trackModeB = topB.GetChild("fullTrackMode");
88  trackModeB.GetData(fTrackMode);
89 
90  const utl::Branch fastModeB = topB.GetChild("fastMode");
91  fastModeB.GetData(fFastMode);
92 
93  const utl::Branch rangeCutsB = topB.GetChild("rangeCuts");
94  if (rangeCutsB) {
95  rangeCutsB.GetChild("default").GetData(fRangeCutDefault);
96  rangeCutsB.GetChild("muonplus").GetData(fRangeCutMuonPlus);
97  rangeCutsB.GetChild("muonminus").GetData(fRangeCutMuonMinus);
98  rangeCutsB.GetChild("electron").GetData(fRangeCutElectron);
99  rangeCutsB.GetChild("positron").GetData(fRangeCutPositron);
100  rangeCutsB.GetChild("gamma").GetData(fRangeCutGamma);
101  rangeCutsB.GetChild("opticalphoton").GetData(fRangeCutOpticalPhoton);
102  }
103 
104  const utl::Branch martaB = cc.GetTopBranch("CachedShowerRegenerator").GetChild("MARTA");
105  // Needed to be consistent with CachedShowerRegenerator area of injection (NB: variable loaded with AugerUnits)
106  // MARTA needs to be checked before AMIGA because of its smaller simulation radius
107  if (martaB) {
108  martaB.GetChild("Simulate").GetData(fMARTAEnabled);
109  if (fMARTAEnabled) {
110  INFO("MARTA RPC G4 simulation has been activated");
111  martaB.GetChild("Radius").GetData(fSimulationRadius);
112  // Auger to CLHEP unit conversion
113  fSimulationRadius *= CLHEP::m / utl::m;
114  }
115  }
116 
117  const utl::Branch umdB = cc.GetTopBranch("CachedShowerRegenerator").GetChild("UMD");
118  // Needed to be consistent with CachedShowerRegenerator area of injection (NB: variable loaded with AugerUnits)
119  if (umdB) {
120  umdB.GetChild("Simulate").GetData(fUMDEnabled);
121  if (fUMDEnabled) {
122  INFO("UMD tank+ground G4 simulation has been activated");
123  umdB.GetChild("MaxRadius").GetData(fSimulationRadius);
124  fSimulationRadius += 1*utl::cm;
125  // Auger to CLHEP unit conversion
126  fSimulationRadius *= CLHEP::m / utl::m;
127  // Parameters for underground propagation
128  const utl::Branch ugrdB = topB.GetChild("underGroundSim");
129  ugrdB.GetChild("umd_scinti_yield").GetData(fScintYield);
130  fScintYield /= utl::keV; // unit-less number
131  // Tracking or not the optical photons in umd scintillators
132  ugrdB.GetChild("umdFastMode").GetData(fUMDFastMode);
133  // Tracking or not low energetic paricles underground
134  ugrdB.GetChild("umdFastProp").GetData(fUMDFastProp);
135  ugrdB.GetChild("onlyMuons").GetData(fUMDOnlyMuons);
136  const utl::Branch cutsB = ugrdB.GetChild("energyLimits");
137  cutsB.GetChild("muons").GetData(fUMDMuonsCut);
138  cutsB.GetChild("electrons").GetData(fUMDElectCut);
139  cutsB.GetChild("gammas").GetData(fUMDGammaCut);
140  cutsB.GetChild("other").GetData(fUMDOtherCut);
141  fUMDMuonsCut *= CLHEP::eV / utl::eV;
142  fUMDElectCut *= CLHEP::eV / utl::eV;
143  fUMDGammaCut *= CLHEP::eV / utl::eV;
144  fUMDOtherCut *= CLHEP::eV / utl::eV;
145  }
146  }
147  const utl::Branch muCaptureB = topB.GetChild("muCapture");
148  muCaptureB.GetData(fgMuCapture);
149 
150  const auto sepMode = topB.GetChild("signalSeparationMode").Get<string>();
151  if (sepMode == "Standard")
152  fSignalSeparationMode = eStandard;
153  else if (sepMode == "Universality")
154  fSignalSeparationMode = eUniversality;
155 
156  if ((fGeoVisOn || fTrajVisOn) && !fVisManager)
157  fVisManager = new G4StationVisManager;
158 
159  if (!fRunManager)
160  fRunManager = new G4RunManager;
161 
162  fUImanager = G4UImanager::GetUIpointer();
163 
164  G4OutputHandler* const logger = new G4OutputHandler();
165  fUImanager->SetCoutDestination(logger);
166 
167  fRunManager->SetUserInitialization(new G4StationPhysicsList(*this, fFastMode));
168 
169  fRunManager->SetUserAction(new G4StationPrimaryGenerator);
170 
171  fStackingAction = new G4StationStackingAction();
172  fRunManager->SetUserAction(fStackingAction);
173  fRunManager->SetUserAction(new G4StationTrackingAction(fUMDEnabled));
174  fRunManager->SetUserAction(new G4StationSteppingAction(fMARTAEnabled));
175  fRunManager->SetUserAction(new G4StationEventAction(fUMDEnabled));
176  fRunManager->SetUserAction(new G4StationRunAction);
177 
178  switch (fVerbosity) {
179  case 1:
180  fUImanager->ApplyCommand("/run/verbose 1");
181  fUImanager->ApplyCommand("/event/verbose 0");
182  fUImanager->ApplyCommand("/tracking/verbose 0");
183  break;
184  case 2:
185  fUImanager->ApplyCommand("/run/verbose 1");
186  fUImanager->ApplyCommand("/event/verbose 1");
187  fUImanager->ApplyCommand("/tracking/verbose 0");
188  break;
189  case 3:
190  fUImanager->ApplyCommand("/run/verbose 1");
191  fUImanager->ApplyCommand("/event/verbose 1");
192  fUImanager->ApplyCommand("/tracking/verbose 1");
193  break;
194  default:
195  fUImanager->ApplyCommand("/run/verbose 0");
196  fUImanager->ApplyCommand("/event/verbose 0");
197  fUImanager->ApplyCommand("/tracking/verbose 0");
198  }
199 
200  fDetectorConstructed = false;
201 
202  return eSuccess;
203  }
204 
205 
207  G4StationSimulator::Run(Event& event)
208  {
209  if (!event.HasSEvent()) {
210  ERROR("SEvent does not exist.");
211  return eFailure;
212  }
213 
214  if (fMARTAEnabled && !event.HasCEvent()) {
215  event.MakeCEvent();
216  //WARNING("CEvent does not exist. Making it now. This should not be a problem if you are using the ParticleInjector module.");
217  }
218 
219  G4Random::setTheEngine(&RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector).GetEngine());
220 
221  SEvent& sEvent = event.GetSEvent();
222 
223  if (!fDetectorConstructed && sEvent.GetNumberOfStations() > 0) {
224 
225  INFO("Constructing G4Station");
226 
227  const auto sIt = sEvent.StationsBegin();
228  if (sIt == sEvent.StationsEnd()) {
229  ERROR("No stations!");
230  return eFailure;
231  }
232 
233  Setup setup(Detector::GetInstance().GetSDetector().GetStation(sIt->GetId()));
234 
235  // Construct detector geometry and register w/ RunManager
236  fRunManager->SetUserInitialization(new G4StationConstruction(fSimulationRadius, fUMDEnabled, fScintYield, fMARTAEnabled));
237 
238  fRunManager->Initialize();
239 
240  fDetectorConstructed = true;
241 
242  if (fGeoVisOn || fTrajVisOn) {
243  fVisManager->Initialize();
244  fUImanager->ApplyCommand(("/vis/open " + fRenderFile).c_str());
245  fUImanager->ApplyCommand("/vis/scene/create");
246  fUImanager->ApplyCommand("/vis/sceneHandler/attach");
247  fUImanager->ApplyCommand("/vis/scene/add/volume");
248  fUImanager->ApplyCommand("/vis/viewer/set/viewpointThetaPhi 0. 0.");
249  fUImanager->ApplyCommand("/vis/viewer/set/targetPoint 0 0 0");
250  fUImanager->ApplyCommand("/vis/viewer/zoom 1");
251  fUImanager->ApplyCommand("/vis/viewero/set/style/wireframe");
252  fUImanager->ApplyCommand("/vis/drawVolume");
253  fUImanager->ApplyCommand("/vis/scene/notifyHandlers");
254  fUImanager->ApplyCommand("/vis/viewer/update");
255  }
256  if (fTrajVisOn) {
257  fUImanager->ApplyCommand("/tracking/storeTrajectory 1");
258  fUImanager->ApplyCommand("/vis/scene/add/trajectories");
259  }
260 
261  }
262 
263  return fFastMode ? RunFast(event) : RunFull(event);
264  }
265 
266 
268  G4StationSimulator::RunFull(Event& event)
269  {
270  // full-blown tank sim (no optimization of photon tracking) with
271  // G4-internal tracking of all particles (including photons)
272  if (fTrackMode)
273  fSimulatorSignature = "G4StationSimulatorFullTrackOG";
274  else {
275  // full-blown tank sim (no optimization of photon tracking) but with
276  // photon killing according to the PMT quantum efficiency
277  fSimulatorSignature = "G4StationSimulatorFullOG";
278  }
279 
280  INFO(fSimulatorSignature);
281 
282  // Get the SEvent
283  SEvent& sEvent = event.GetSEvent();
284 
285  if (!event.HasMEvent() && fUMDEnabled)
286  event.MakeMEvent();
287 
288  // Get the SDetector
289  const SDetector& sDetector = Detector::GetInstance().GetSDetector();
290 
291  for (auto& station : sEvent.StationsRange()) {
292 
293  if (!fDetectorConstructed) {
294  ERROR("The detector hasn't been initialized when looping over stations");
295  return eFailure;
296  }
297 
298  const int stationId = station.GetId();
299 
300  // Add Stations and SimData to CEvent (MARTA)
301  if (fMARTAEnabled) {
302  CEvent& cEvent = event.GetCEvent();
303  if (!cEvent.HasStation(stationId)) {
304  cEvent.MakeStation(stationId);
305  cEvent.GetStation(stationId).MakeSimData();
306  }
307  }
308 
309  if (station.HasSimData()) {
310  sevt::StationSimData& simData = station.GetSimData();
311  simData.SetSimulatorSignature(fSimulatorSignature);
312 
313  const unsigned long numParticles = simData.ParticlesEnd() - simData.ParticlesBegin();
314 
315  if (numParticles)
316  G4cerr << stationId << ':' << numParticles << ' ' << flush;
317  else
318  continue;
319 
320  /* Counting the number of particles that are actually simulated (post
321  station-level thinning). Due to resampling simulation option that
322  uses cycles with maximum particle number per cycle, we always check
323  if particles have already been simulated. */
324  const unsigned int nParticlesAlreadySimulated = simData.GetTotalSimParticleCount();
325  if (!nParticlesAlreadySimulated)
326  simData.SetTotalSimParticleCount(numParticles);
327  else
328  simData.SetTotalSimParticleCount(nParticlesAlreadySimulated + numParticles);
329 
330  Setup setup;
331  setup.Set(station);
332  setup.Set(sDetector.GetStation(stationId));
333 
334  if (fUMDEnabled && fgCurrent.GetDetectorStation().ExistsAssociatedCounter()) {
335  const auto counterId = fgCurrent.GetDetectorStation().GetAssociatedCounterId();
336 
337  MEvent& mEvent = event.GetMEvent();
338  if (!mEvent.HasCounter(counterId))
339  mEvent.MakeCounter(counterId);
340  setup.Set(mEvent.GetCounter(counterId));
341 
342  const MDetector& mDetector = Detector::GetInstance().GetMDetector();
343  setup.Set(mDetector.GetCounter(counterId));
344  }
345 
346  ConstructTraces(station);
347 
348  for (auto& particle : simData.ParticlesRange()) {
349  setup.Set(particle);
350  fRunManager->BeamOn(1);
351  // Add particles from simulation to CEvent data (particles in the RPC's)
352  if (fMARTAEnabled) {
353  CEvent& cEvent = event.GetCEvent();
354  cevt::StationSimData& martaSimData = cEvent.GetStation(stationId).GetSimData();
355  FillRPCSimData(martaSimData);
356  }
357  }
358  }
359  }
360 
361  return eSuccess;
362  }
363 
364 
366  G4StationSimulator::RunFast(Event& event)
367  {
368  fSimulatorSignature = "G4StationSimulatorOG";
369  INFO(fSimulatorSignature);
370 
371  // Get the SEvent
372  SEvent& sEvent = event.GetSEvent();
373 
374  if (!event.HasMEvent() && fUMDEnabled)
375  event.MakeMEvent();
376 
377  // Get the SDetector
378  const SDetector& sDetector = Detector::GetInstance().GetSDetector();
379 
380  if (!fDetectorConstructed) {
381  // find first station with SimData
382  sevt::Station* station = nullptr;
383  for (auto& s : sEvent.StationsRange())
384  if (s.HasSimData()) {
385  station = &s;
386  break;
387  }
388  if (!station) {
389  INFO("No stations with SimData found.");
390  return eSuccess;
391  }
392 
393  Setup setup(sDetector.GetStation(*station));
394  fStationConstruction = new G4StationConstruction(fSimulationRadius, fUMDEnabled, fScintYield, fMARTAEnabled);
395  fRunManager->SetUserInitialization(fStationConstruction);
396  fRunManager->Initialize();
397  fDetectorConstructed = true;
398  }
399 
400  for (auto& station : sEvent.StationsRange()) {
401 
402  const int stationId = station.GetId();
403 
404  // Add Stations and SimData to CEvent (MARTA)
405  if (fMARTAEnabled) {
406  CEvent& cEvent = event.GetCEvent();
407  if (!cEvent.HasStation(stationId)) {
408  cEvent.MakeStation(stationId);
409  cEvent.GetStation(stationId).MakeSimData();
410  }
411  }
412 
413  if (!station.HasSimData())
414  continue;
415 
416  sevt::StationSimData& simData = station.GetSimData();
417 
418  simData.SetSimulatorSignature(fSimulatorSignature);
419 
420  const unsigned long numParticles = simData.GetNParticles();
421 
422  if (numParticles)
423  cerr << "StationId " << stationId << " : Particles " << numParticles << endl;
424  else
425  continue;
426 
427  /* Counting the number of particles that are actually simulated (post
428  station-level thinning). Due to resampling simulation option that
429  uses cycles with maximum particle number per cycle, we always check
430  if particles have already been simulated. */
431  const unsigned int nParticlesAlreadySimulated = simData.GetTotalSimParticleCount();
432  if (!nParticlesAlreadySimulated)
433  simData.SetTotalSimParticleCount(numParticles);
434  else
435  simData.SetTotalSimParticleCount(nParticlesAlreadySimulated + numParticles);
436 
437  Setup setup;
438  setup.Set(station);
439  setup.Set(sDetector.GetStation(station));
440 
441  if (fUMDEnabled) {
442  if (fgCurrent.GetDetectorStation().ExistsAssociatedCounter()) {
443  const auto counterId = fgCurrent.GetDetectorStation().GetAssociatedCounterId();
444  MEvent& mEvent = event.GetMEvent();
445  if (!mEvent.HasCounter(counterId))
446  mEvent.MakeCounter(counterId);
447  setup.Set(mEvent.GetCounter(counterId));
448  const MDetector& mDetector = Detector::GetInstance().GetMDetector();
449  setup.Set(mDetector.GetCounter(counterId));
450  }
451  }
452 
453  ConstructTraces(station);
454 
455  // prod the Cerenkov process update it's tank description data
456  G4StationFastCerenkov::GetDataFromConstruction();
457 
458  for (auto& particle : simData.ParticlesRange()) {
459  setup.Set(particle);
460  fRunManager->BeamOn(1);
461  // Add particles from simulation to CEvent data
462  if (fMARTAEnabled) {
463  CEvent& cEvent = event.GetCEvent();
464  cevt::StationSimData& martaSimData = cEvent.GetStation(stationId).GetSimData();
465  FillRPCSimData(martaSimData);
466  }
467  }
468 
469  }
470 
471  // flush all remaining G4 output (otherwise its flushed after the program ends)
472  G4cout << endl;
473 
474  return eSuccess;
475  }
476 
477 
479  G4StationSimulator::Finish()
480  {
481  delete fRunManager;
482  fRunManager = nullptr;
483 
484  return eSuccess;
485  }
486 
487 
488  void
489  G4StationSimulator::ConstructTraces(sevt::Station& station)
490  const
491  {
492  const sevt::StationSimData& sSim = station.GetSimData();
493 
494  // Add pmt sim data only if the station contains particles
495  if (!sSim.GetNParticles())
496  return;
497 
498  for (auto& pmt : station.PMTsRange(sdet::PMTConstants::eAnyType))
499  if (!pmt.HasSimData())
500  pmt.MakeSimData();
501  }
502 
503 
504  void
505  G4StationSimulator::AddInjectedParticle(const size_t modId, const size_t stripId, const utl::Particle& particle)
506  const
507  {
508  if (!fgCurrent.GetEventUMDCounter().HasSimData())
509  fgCurrent.GetEventUMDCounter().MakeSimData();
510 
511  if (!fgCurrent.GetEventUMDCounter().HasModule(modId))
512  fgCurrent.GetEventUMDCounter().MakeModule(modId);
513 
514  mevt::Module& module = fgCurrent.GetEventUMDCounter().GetModule(modId);
515 
516  if (!module.HasScintillator(stripId))
517  module.MakeScintillator(stripId);
518 
519  mevt::Scintillator& scinti = module.GetScintillator(stripId);
520 
521  if (!scinti.HasSimData())
522  scinti.MakeSimData();
523 
524  mevt::ScintillatorSimData& simData = scinti.GetSimData();
525 
526  // Load particle in the proper event scintillator
527  // (NOTE: any particle entering in more than one strip (or bouncing back to same strip) is stored in each corresponding
528  // scintillator strip but with different type:
529  // 1) as utl::Particle::eShower for the first strip (or first time in a strip) and
530  // 2) as utl::Particle::eCornerClipping in the following stirp(s)
531  simData.AddParticle(particle);
532 
533  const auto type = particle.GetType();
534  if (type == utl::Particle::eMuon || type == utl::Particle::eAntiMuon) {
535  if (particle.GetSource() != utl::Particle::eCornerClipping)
537  else
539  } else if (type == utl::Particle::eElectron || type == utl::Particle::ePositron)
540  simData.IncrementNumberOfElectrons();
541  }
542 
543 
544  void
545  G4StationSimulator::AddUMDPhoton(const size_t modId, const size_t stripId, const double peTime)
546  const
547  {
548  // peTime is in Auger units!
549 
550  auto& counter = fgCurrent.GetEventUMDCounter();
551  if (!counter.HasSimData())
552  counter.MakeSimData();
553 
554  if (!counter.HasModule(modId))
555  counter.MakeModule(modId);
556 
557  mevt::Module& module = counter.GetModule(modId);
558 
559  if (!module.HasScintillator(stripId))
560  module.MakeScintillator(stripId);
561 
562  mevt::Scintillator& scinti = module.GetScintillator(stripId);
563 
564  if (!scinti.HasSimData())
565  scinti.MakeSimData();
566 
567  mevt::ScintillatorSimData& simData = scinti.GetSimData();
568 
569  simData.AddPhotonTime(peTime); // Auger units
570  }
571 
572 
573  void
574  G4StationSimulator::AddPhoton(const int nPMT, const double peTime)
575  const
576  {
577  /* In principle, we should print an ERROR and throw a non existent component
578  exception. Once the hardware creation/destruction/update issues have been
579  resolved within geant, the warning below can be changed to an error and an
580  exception thrown. */
581  if (!fgCurrent.GetEventStation().HasPMT(nPMT)) {
582  WARNING("Attempt to add photoelectron to PMT that does not exist. Doing nothing.");
583  return;
584  }
585 
586  PMTSimData& pmtSim = fgCurrent.GetEventStation().GetPMT(nPMT).GetSimData();
587 
588  const auto type = fgCurrent.GetParticle().GetType();
589  const auto source = fgCurrent.GetParticle().GetSource();
590 
591  auto component = sevt::StationConstants::eTotal;
592  auto extraComponent = sevt::StationConstants::eTotal;
593 
594  switch (fSignalSeparationMode) {
595  case eStandard:
596  switch (type) {
597  case OFFLINE_ELECTRONS:
601  break;
602  case OFFLINE_PHOTON:
606  break;
607  case OFFLINE_MUONS:
608  component = sevt::StationConstants::eMuon;
609  break;
610  case OFFLINE_HADRONS:
612  break;
613  default:
614  cerr << "Unknown particle type" << endl;
615  exit(-1);
616  }
617  break;
618  case eUniversality:
619  switch (type) {
620  case OFFLINE_ELECTRONS:
623  else if (source == utl::Particle::eShowerFromMuonDecay)
625  else
627  break;
628  case OFFLINE_PHOTON:
631  else if (source == utl::Particle::eShowerFromMuonDecay)
633  else
635  break;
636  case OFFLINE_MUONS:
637  component = sevt::StationConstants::eMuon;
638  break;
639  case OFFLINE_HADRONS:
641  break;
642  default:
643  cerr << "Unknown particle type" << endl;
644  exit(-1);
645  }
646  break;
647  }
648 
649  if (!pmtSim.HasPETimeDistribution())
650  pmtSim.MakePETimeDistribution();
651  pmtSim.GetPETimeDistribution().AddTime(peTime);
652 
653  if (!pmtSim.HasPETimeDistribution(component))
654  pmtSim.MakePETimeDistribution(component);
655  pmtSim.GetPETimeDistribution(component).AddTime(peTime);
656 
657  if (extraComponent != sevt::StationConstants::eTotal) {
658  if (!pmtSim.HasPETimeDistribution(extraComponent))
659  pmtSim.MakePETimeDistribution(extraComponent);
660  pmtSim.GetPETimeDistribution(extraComponent).AddTime(peTime);
661  }
662  }
663 
664 
665  void
666  G4StationSimulator::FillRPCSimData(cevt::StationSimData& simData)
667  const
668  {
669  auto& rpcParticleListMap = G4StationSteppingAction::fgRPCParticleListMap;
670  for (const auto& rpcParticleList : rpcParticleListMap) {
671  const auto& particleList = rpcParticleList.second;
672  for (const auto& p : particleList)
673  simData.AddParticle(p);
674  }
675  rpcParticleListMap.clear();
676 
677  G4StationSteppingAction::fgRPCTrackIDListMap.clear();
678  }
679 
680 }
Branch GetTopBranch() const
Definition: Branch.cc:63
const double eV
Definition: GalacticUnits.h:35
Station Level Simulated Data
constexpr double eV
Definition: AugerUnits.h:185
StationIterator StationsEnd()
End of all stations.
Definition: SEvent.h:59
void AddParticle(const utl::Particle &particle)
Add a simulated particle to the station.
bool HasMEvent() const
Station Level Simulated Data
total (shower and background)
bool HasScintillator(const int sId) const
void MakeScintillator(const int sId)
int GetNumberOfStations() const
Get total number of stations in the event.
Definition: SEvent.h:124
Interface class to access to the SD part of an event.
Definition: SEvent.h:39
Describes a particle for Simulation.
Definition: Particle.h:26
void Set(const sdet::Station &s) const
#define INFO(message)
Macro for logging informational messages.
Definition: ErrorLogger.h:161
void AddParticle(const utl::Particle &particle)
electrons produced by hadrons close to the detector
void Init()
Initialise the registry.
bool HasCounter(const int cId) const
Definition: MEvent.h:43
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
Definition: Branch.cc:211
Station & GetStation(const int stationId)
retrieve station by id throw utl::NonExistentComponentException if n.a.
Definition: CEvent.cc:68
int exit
Definition: dump1090.h:237
implementation of G4 visualization manager
Detector associated to muon detector hierarchy.
Definition: MDetector.h:32
void SetSimulatorSignature(const std::string &name)
Set name of the tank simulator module used to simulate this station.
bool HasPETimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal) const
Check if a PE release time distribution exists (optionally for a given source)
Definition: PMTSimData.h:65
T Get() const
Definition: Branch.h:271
electrons and positrons from shower
Scintillator & GetScintillator(const int sId)
Scintillator level event data.
Class representing a document branch.
Definition: Branch.h:107
class to hold data at Station level
constexpr double s
Definition: AugerUnits.h:163
Module level event data.
Definition: MEvent/Module.h:41
#define WARNING(message)
Macro for logging warning messages.
Definition: ErrorLogger.h:163
void GetData(bool &b) const
Overloads of the GetData member template function.
Definition: Branch.cc:644
ParticleIterator ParticlesBegin()
Beginning of simulated particles entering the station.
Scintillator level simulation data.
ResultFlag
Flag returned by module methods to the RunController.
Definition: VModule.h:60
unsigned int GetTotalSimParticleCount() const
Get the total number of particles that were actually simulated (after thinning)
static CentralConfig * GetInstance()
Use this the first time you get an instance of central configuration.
void SetTotalSimParticleCount(const unsigned int n)
StationIterator StationsBegin()
Beginning of all stations.
Definition: SEvent.h:57
Source GetSource() const
Source of the particle (eg. shower or background)
Definition: Particle.h:107
Class to hold simulated data at PMT level.
Definition: PMTSimData.h:40
constexpr double cm
Definition: AugerUnits.h:117
struct particle_info particle[80]
void MakeStation(const int stationId)
make a station with specifying Id, throw if invalid stationId
Definition: CEvent.cc:99
int GetType() const
Definition: Particle.h:101
bool HasStation(const int stationId) const
Check whether station exists.
Definition: CEvent.cc:115
Detector description interface for SDetector-related data.
Definition: SDetector.h:42
void MakeCounter(const int cId)
Definition: MEvent.h:40
sevt::StationSimData & GetSimData()
Get simulated data at station level.
utl::CoordinateSystemPtr Get(const std::string &id)
Get a well-known Coordinate System.
Counter & GetCounter(const int cId)
Definition: MEvent.h:34
constexpr double keV
Definition: AugerUnits.h:186
bool HasSimData() const
bool HasCEvent() const
unsigned int GetNParticles() const
utl::TimeDistributionI & GetPETimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal)
Simulated photoelectron time distribution.
Definition: PMTSimData.h:54
const Station & GetStation(const int stationId) const
Get station by Station Id.
Definition: SDetector.cc:192
const Counter & GetCounter(int id) const
Retrieve Counter by id.
Definition: MDetector.h:68
#define ERROR(message)
Macro for logging error messages.
Definition: ErrorLogger.h:165
ParticleIterator ParticlesEnd()
End of simulated particles entering the station.
constexpr double m
Definition: AugerUnits.h:121
void AddTime(const double time, const T weight=T(1))
Add an entry (optionally weighted) for the given time. Slot will be computed.
Root of the Muon event hierarchy.
Definition: MEvent.h:25
mu+ and mu- (including signal from mu decay electrons) from shower
bool HasSEvent() const
StationSimData & GetSimData()
Get simulated data at station level.
ScintillatorSimData & GetSimData()
void MakePETimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal)
Create a PE release time distribution (optionally for given source)
Definition: PMTSimData.cc:12
Interface class to access to the SD part of an event.
Definition: CEvent.h:46
void MakeSimData()
Make station simulated data object.

, generated on Tue Sep 26 2023.