10 #include <sevt/PMTConstants.h>
11 #include <sevt/PMTSimData.h>
12 #include <sevt/SEvent.h>
13 #include <sevt/Station.h>
14 #include <sevt/StationSimData.h>
16 #include <utl/ErrorLogger.h>
17 #include <utl/Particle.h>
18 #include <utl/Trace.h>
19 #include <utl/PhysicalConstants.h>
21 #include <fwk/RandomEngineRegistry.h>
22 #include <CLHEP/Random/RandFlat.h>
23 #include <CLHEP/Random/RandPoisson.h>
24 #include <CLHEP/Random/RandExponential.h>
25 #include <fwk/RunController.h>
28 #include <G4HCofThisEvent.hh>
29 #include <G4SDManager.hh>
31 #include <G4TouchableHistory.hh>
33 #include <G4Trajectory.hh>
34 #include <G4TrajectoryContainer.hh>
35 #include <G4VHitsCollection.hh>
40 using namespace G4TankSimulatorASCII;
46 using CLHEP::RandFlat;
47 using CLHEP::RandPoisson;
48 using CLHEP::RandExponential;
52 G4ASCIIAction::G4ASCIIAction(
const G4String name) :
53 G4VSensitiveDetector(name)
57 dynamic_cast<G4TankSimulator*
>(&RunController::GetInstance().GetModule(
"G4TankSimulatorASCII"));
60 &RandomEngineRegistry::GetInstance().Get(RandomEngineRegistry::eDetector);
69 if ( theStep->GetTrack()->GetDefinition()->GetPDGCharge() == 0 )
return true;
71 if ( theStep->GetTrack()->GetVolume()->GetName() !=
"scin" )
77 const bool IsFromMuonDecay=theStep->GetTrack()->GetUserInformation();
78 unsigned int fBarIndex=theStep->GetTrack()->GetVolume()->GetCopyNo();
79 const unsigned int fPMTIndex=5;
80 const double time = theStep->GetPreStepPoint()->GetGlobalTime();
81 const double Edep=theStep->GetTotalEnergyDeposit();
82 const double xPos=theStep->GetTrack()->GetPosition().x();
83 if ( Edep <=0. )
return true;
93 if ( theStep->GetTrack()->GetTrackID() ==1 )
111 if (!station.
HasPMT(fPMTIndex)) {
144 const double attenuationLength=308.*
CLHEP::cm,attenuationAmplitude=24.4;
145 const double attenuationReferenceEnergy=2.25*
CLHEP::MeV;
149 double lambda=attenuationAmplitude*exp(-X/attenuationLength);
151 double nPe_mean=lambda*Edep/attenuationReferenceEnergy;
154 const double refractionIndex=1.42;
155 const double decayTime[2]={ 3.7, 3.5 } ;
160 for (
unsigned int ipe=0;ipe<nPe;ipe++)
162 double delay=pathDelay;
165 delay += ( fiberDelay+scintDelay);
169 if ( IsFromMuonDecay )
bool HasPMT(const unsigned int pmtId) const
Check if a particular PMT object exists.
static double ASCII_Track_p
PMTSimData & GetSimData()
Get object containing PMT simulated data.
total (shower and background)
class that handles Geant4 SD simulation
RandomEngineType & GetEngine()
static sevt::SEvent::StationIterator GetCurrentEventStationIt()
static int GetCurrentParticleId()
bool compDist(antenna i, antenna j)
Histogram class for time distributions with suppressed empty bins.
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.
static double MichelElectronNPE_time[2]
electrons and positrons from shower
utl::RandomEngine * fRandomEngine
class to hold data at Station level
static double ASCII_Edep_i[27]
static int MichelElectronNPE[2]
static double ASCII_Edep_Michel
G4TankSimulator * fG4TankSimulator
bool HasSimData() const
Check for existence of PMT simulated data object.
constexpr double kSpeedOfLight
PMT & GetPMT(const unsigned int pmtId)
Retrive a PMT by Id.
Class to hold simulated data at PMT level.
struct particle_info particle[80]
static double ASCII_Track
#define OFFLINE_ELECTRONS
utl::TimeDistributionI & GetPETimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal)
Simulated photoelectron time distribution.
static double ASCII_Edep_p
void AddTime(const double time, const T weight=T(1))
Add an entry (optionally weighted) for the given time. Slot will be computed.
mu+ and mu- (including signal from mu decay electrons) from shower
void MakePETimeDistribution(const StationConstants::SignalComponent source=StationConstants::eTotal)
Create a PE release time distribution (optionally for given source)
static int GetPrimaryId()
G4bool ProcessHits(G4Step *theStep, G4TouchableHistory *R0Hist)