2 #include <utl/ErrorLogger.h>
3 #include <utl/PhysicalConstants.h>
4 #include <utl/AugerUnits.h>
5 #include <utl/ParticleCases.h>
8 #include <sevt/SEvent.h>
9 #include <sevt/Station.h>
11 #include <sevt/StationSimData.h>
12 #include <sevt/PMTSimData.h>
14 #include <fwk/CentralConfig.h>
15 #include <fwk/RandomEngineRegistry.h>
16 #include <det/Detector.h>
17 #include <sdet/SDetector.h>
19 #include <CLHEP/Random/RandFlat.h>
28 using CLHEP::RandFlat;
29 using namespace TabulatedTankSimulatorNS;
32 namespace TabulatedTankSimulatorNS {
39 TabulatedTankSimulator::TabulatedTankSimulator() :
54 CentralConfig::GetInstance()->
GetTopBranch(
"TabulatedTankSimulator");
58 if (sepMode ==
"Standard")
60 else if (sepMode ==
"Universality")
64 &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector).GetEngine();
71 bool UseEnlargeArea =
false;
81 INFO(
"TabulatedTankSimulator::Run()");
83 SEvent& sEvent =
event.GetSEvent();
95 INFO(
"TabulatedTankSimulator::Finish()");
113 default:
return -5000;
131 if (!std::isnan(time) && !std::isinf(time))
145 const sdet::SDetector& sDetector = det::Detector::GetInstance().GetSDetector();
149 const unsigned long numParticles =
162 if (!nParticlesAlreadySimulated)
169 pmtIt != station.
PMTsEnd(); ++pmtIt) {
170 if (!pmtIt->HasSimData()) {
171 pmtIt->MakeSimData();
172 pmtIt->GetSimData().MakePETimeDistribution();
179 const double pke = pIt->GetKineticEnergy();
182 const int itype =
PDGToCDF(pIt->GetType());
196 if (nPe + nPe_decay == 0)
200 msg <<
"Theta " << ptheta*180/3.14 <<
"| KE GeV " << pke/
GeV <<
" | Id " << itype
201 <<
" | NPE= " << nPe <<
" - " << nPe_decay;
208 for (
int kk = 0; kk < (nPe + nPe_decay); ++kk) {
215 const int pmtId = int(RandFlat::shoot(
fRandomEngine, 0, 3)) + 1;
216 if (!station.
HasPMT(pmtId))
222 AddPhoton(*pIt, pmtSim, pe_time.GetInterval());
232 const int type = particle.
GetType();
258 cerr <<
"Unknown particle type" << endl;
297 cerr <<
"Unknown particle type" << endl;
Branch GetTopBranch() const
constexpr double kMuonLifetime
bool HasPMT(const unsigned int pmtId) const
Check if a particular PMT object exists.
Station Level Simulated Data
StationIterator StationsEnd()
End of all stations.
PMTSimData & GetSimData()
Get object containing PMT simulated data.
Detector description interface for Station-related data.
Report success to RunController.
total (shower and background)
virtual ~TabulatedTankSimulator()
fwk::VModule::ResultFlag Init()
Initialize: invoked at beginning of run (NOT beginning of event)
Interface class to access to the SD part of an event.
Describes a particle for Simulation.
PMTIterator PMTsBegin(const sdet::PMTConstants::PMTType type=sdet::PMTConstants::eWaterCherenkovLarge)
begin PMT iterator for read/write
#define INFO(message)
Macro for logging informational messages.
electrons produced by hadrons close to the detector
Branch GetChild(const std::string &childName) const
Get child of this Branch by child name.
boost::filter_iterator< PMTFilter, InternalPMTIterator > PMTIterator
Iterator over station for read/write.
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)
void MakeSimData()
Make PMT simulated data object.
ParticleVector::iterator ParticleIterator
fwk::VModule::ResultFlag Finish()
Finish: invoked at end of the run (NOT end of the event)
void AddPhoton(const utl::Particle &particle, sevt::PMTSimData &pmtSim, const double peTime) const
electrons and positrons from shower
Class representing a document branch.
void SimulateStation(sevt::Station &station)
class to hold data at Station level
DetectorResponse * fTankResponse
bool HasSimData() const
Check whether station simulated data exists.
utl::CoordinateSystemPtr GetLocalCoordinateSystem() const
Get the Auger reference system centered on the tank.
PMTIterator PMTsEnd(const sdet::PMTConstants::PMTType type=sdet::PMTConstants::eWaterCherenkovLarge)
end PMT iterator for read/write
double GetPe(double ke, double theta, int itype, double f)
void GetData(bool &b) const
Overloads of the GetData member template function.
bool HasSimData() const
Check for existence of PMT simulated data object.
photons from muon decay in shower
ParticleIterator ParticlesBegin()
Beginning of simulated particles entering the station.
fwk::VModule::ResultFlag Run(evt::Event &event)
Run: invoked once per event.
utl::RandomEngine::RandomEngineType * fRandomEngine
SignalSeparationMode fSignalSeparationMode
A TimeInterval is used to represent time elapsed between two events.
ResultFlag
Flag returned by module methods to the RunController.
PMT & GetPMT(const unsigned int pmtId)
Retrive a PMT by Id.
unsigned int GetTotalSimParticleCount() const
Get the total number of particles that were actually simulated (after thinning)
void SetTotalSimParticleCount(const unsigned int n)
StationIterator StationsBegin()
Beginning of all stations.
Source GetSource() const
Source of the particle (eg. shower or background)
Class to hold simulated data at PMT level.
struct particle_info particle[80]
Detector description interface for SDetector-related data.
#define OFFLINE_ELECTRONS
boost::indirect_iterator< InternalStationIterator, Station & > StationIterator
Iterator over all stations.
sevt::StationSimData & GetSimData()
Get simulated data at station level.
utl::TimeDistributionI & GetPETimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal)
Simulated photoelectron time distribution.
const Station & GetStation(const int stationId) const
Get station by Station Id.
ParticleIterator ParticlesEnd()
End of simulated particles entering the station.
void AddTime(const double time, const T weight=T(1))
Add an entry (optionally weighted) for the given time. Slot will be computed.
int PDGToCDF(const int pid)
mu+ and mu- (including signal from mu decay electrons) from shower
const double pulse_cdfMax
electrons from muon decay in shower
void MakePETimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal)
Create a PE release time distribution (optionally for given source)