79 #ifndef OpFastScintillation_h 80 #define OpFastScintillation_h 1 90 #include "Geant4/G4ForceCondition.hh" 91 #include "Geant4/G4ParticleDefinition.hh" 92 #include "Geant4/G4PhysicsOrderedFreeVector.hh" 93 #include "Geant4/G4PhysicsTable.hh" 94 #include "Geant4/G4ProcessType.hh" 95 #include "Geant4/G4String.hh" 96 #include "Geant4/G4ThreeVector.hh" 97 #include "Geant4/G4Types.hh" 98 #include "Geant4/G4VRestDiscreteProcess.hh" 101 #include "TVector3.h" 105 class G4EmSaturation;
108 class G4VParticleChange;
116 class PhotonVisibilityService;
145 G4ProcessType
type = fElectromagnetic);
158 virtual G4bool IsApplicable(
const G4ParticleDefinition& aParticleType);
162 G4double GetMeanFreePath(
const G4Track& aTrack, G4double, G4ForceCondition*);
167 G4double GetMeanLifeTime(
const G4Track& aTrack, G4ForceCondition*);
172 virtual G4VParticleChange* PostStepDoIt(
const G4Track& aTrack,
const G4Step& aStep);
173 virtual G4VParticleChange* AtRestDoIt(
const G4Track& aTrack,
const G4Step& aStep);
177 void SetTrackSecondariesFirst(
const G4bool state);
182 void SetFiniteRiseTime(
const G4bool state);
186 G4bool GetTrackSecondariesFirst()
const;
189 G4bool GetFiniteRiseTime()
const;
192 void SetScintillationYieldFactor(
const G4double yieldfactor);
197 G4double GetScintillationYieldFactor()
const;
200 void SetScintillationExcitationRatio(
const G4double excitationratio);
206 G4double GetScintillationExcitationRatio()
const;
209 G4PhysicsTable* GetFastIntegralTable()
const;
212 G4PhysicsTable* GetSlowIntegralTable()
const;
224 void SetScintillationByParticleType(
const G4bool);
232 void DumpPhysicsTable()
const;
239 void getVUVTimes(std::vector<double>& arrivalTimes,
240 const double distance_in_cm,
241 const size_t angle_bin);
242 void generateParam(
const size_t index,
const size_t angle_bin);
245 void getVISTimes(std::vector<double>& arrivalTimes,
246 const TVector3& ScintPoint,
247 const TVector3& OpDetPoint);
250 void detectedDirectHits(std::map<size_t, int>& DetectedNum,
253 void detectedReflecHits(std::map<size_t, int>& ReflDetectedNum,
258 void BuildThePhysicsTable();
262 bool RecordPhotonsProduced(
const G4Step& aStep,
double N);
291 bool usesSemiAnalyticModel()
const;
293 int VUVHits(
const double Nphotons_created,
300 const double cathode_hits_rec,
301 const std::array<double, 3> hotspot)
const;
304 G4double single_exp(
const G4double t,
const G4double tau2)
const;
305 G4double bi_exp(
const G4double t,
const G4double tau1,
const G4double tau2)
const;
307 G4double scint_time(
const G4Step& aStep,
308 G4double ScintillationTime,
309 G4double ScintillationRiseTime)
const;
310 void propagationTime(std::vector<double>& arrival_time_dist,
312 const size_t OpChannel,
313 bool Reflected =
false);
316 G4double sample_time(
const G4double tau1,
const G4double tau2)
const;
319 double reemission_energy()
const;
321 std::unique_ptr<CLHEP::RandGeneral>
fTPBEm;
323 void average_position(G4Step
const& aStep,
double* xzyPos)
const;
338 double fstep_size, fmin_d, fmax_d,
fvuv_vgroup_mean, fvuv_vgroup_max, finflexion_point_distance,
339 fangle_bin_timing_vuv;
340 std::vector<std::vector<double>> fparameters[7];
352 std::vector<std::vector<std::vector<double>>>
ftau_pars;
359 double Rectangle_SolidAngle(
const double a,
const double b,
const double d)
const;
360 double Rectangle_SolidAngle(
Dims const& o,
const std::array<double, 3> v)
const;
362 double Disk_SolidAngle(
const double d,
const double h,
const double b)
const;
364 double Omega_Dome_Model(
const double distance,
const double theta)
const;
368 G4double Gaisser_Hillas(
const double x,
const double* par)
const;
410 void ProcessStep(
const G4Step& step);
418 bool const fUseNhitsModel =
false;
420 bool const fOnlyActiveVolume =
false;
423 bool const fOnlyOneCryostat =
false;
425 bool const fOpaqueCathode =
false;
428 bool isScintInActiveVolume(
geo::Point_t const& ScintPoint);
429 double interpolate(
const std::vector<double>& xData,
430 const std::vector<double>& yData,
435 const std::vector<double>& xData,
436 const std::vector<double>& yData1,
437 const std::vector<double>& yData2,
438 const std::vector<double>& yData3,
440 bool extrapolate)
const;
442 static std::vector<geo::BoxBoundedGeo> extractActiveVolumes(
geo::GeometryCore const& geom);
458 inline G4bool OpFastScintillation::IsApplicable(
const G4ParticleDefinition& aParticleType)
460 if (aParticleType.GetParticleName() ==
"opticalphoton")
return false;
461 if (aParticleType.IsShortLived())
return false;
466 inline void OpFastScintillation::SetTrackSecondariesFirst(
const G4bool state)
468 fTrackSecondariesFirst = state;
471 inline void OpFastScintillation::SetFiniteRiseTime(
const G4bool state)
473 fFiniteRiseTime = state;
476 inline G4bool OpFastScintillation::GetTrackSecondariesFirst()
const 478 return fTrackSecondariesFirst;
481 inline G4bool OpFastScintillation::GetFiniteRiseTime()
const 483 return fFiniteRiseTime;
486 inline void OpFastScintillation::SetScintillationYieldFactor(
const G4double yieldfactor)
488 YieldFactor = yieldfactor;
491 inline G4double OpFastScintillation::GetScintillationYieldFactor()
const 496 inline void OpFastScintillation::SetScintillationExcitationRatio(
const G4double excitationratio)
498 ExcitationRatio = excitationratio;
501 inline G4double OpFastScintillation::GetScintillationExcitationRatio()
const 503 return ExcitationRatio;
506 inline G4PhysicsTable* OpFastScintillation::GetSlowIntegralTable()
const 508 return theSlowIntegralTable.get();
511 inline G4PhysicsTable* OpFastScintillation::GetFastIntegralTable()
const 513 return theFastIntegralTable.get();
516 inline void OpFastScintillation::DumpPhysicsTable()
const 518 if (theFastIntegralTable) {
519 G4int PhysicsTableSize = theFastIntegralTable->entries();
520 G4PhysicsOrderedFreeVector* v;
521 for (G4int i = 0; i < PhysicsTableSize; i++) {
522 v = (G4PhysicsOrderedFreeVector*)(*theFastIntegralTable)[i];
526 if (theSlowIntegralTable) {
527 G4int PhysicsTableSize = theSlowIntegralTable->entries();
528 G4PhysicsOrderedFreeVector* v;
529 for (G4int i = 0; i < PhysicsTableSize; i++) {
530 v = (G4PhysicsOrderedFreeVector*)(*theSlowIntegralTable)[i];
536 template <
typename TReal>
537 inline constexpr
double dist(
const TReal*
x,
const TReal*
y,
const unsigned int dimension)
540 for (
unsigned int p = 0; p <
dimension; ++p) {
541 d += (*(x + p) - *(y + p)) * (*(x + p) - *(y + p));
546 template <
typename TVector3>
547 inline constexpr
double dist(
const std::array<double, 3>
x,
550 const unsigned int start)
553 for (
unsigned int p = start; p <
dimension; ++p) {
554 d += (x[p] - y[p]) * (x[p] - y[p]);
561 template <
typename TReal>
562 inline constexpr
static bool 565 TReal diff = std::fabs(a - b);
566 if (diff <= tolerance)
return true;
567 if (diff < std::fmax(std::fabs(a), std::fabs(b)) * tolerance)
return true;
573 template <
typename TReal>
576 TReal tolerance = std::numeric_limits<TReal>::epsilon())
578 if (std::fabs(a) <= tolerance)
return true;
584 template <
typename TReal>
585 inline constexpr
static bool 589 if (diff < tolerance)
return true;
590 if (diff < std::fmax(std::fabs(a), std::fabs(b)) * tolerance)
return true;
594 template <
typename TReal>
595 inline constexpr
static bool 599 if (diff > tolerance)
return true;
600 if (diff > std::fmax(std::fabs(a), std::fabs(b)) * tolerance)
return true;
std::vector< std::vector< std::vector< double > > > fvispars_dome
G4bool scintillationByParticleType
G4EmSaturation * GetSaturation() const
std::vector< geo::Point_t > fOpDetCenter
void interpolate3(std::array< double, 3 > &inter, const std::vector< double > &xData, const std::vector< double > &yData1, const std::vector< double > &yData2, const std::vector< double > &yData3, const double x, const bool extrapolate)
std::vector< double > fOpDetHeight
std::map< double, double > tpbemission
std::vector< std::vector< std::vector< double > > > fvispars_flat
G4bool fTrackSecondariesFirst
constexpr double dist(const std::array< double, 3 > x, const TVector3 y, const unsigned int dimension, const unsigned int start)
std::vector< double > fvis_distances_r_flat
double finter_d(double *x, double *par)
std::vector< double > fdistances_refl
std::unique_ptr< G4PhysicsTable > theSlowIntegralTable
double model_far(double *x, double *par)
std::vector< std::vector< TF1 > > VUV_timing
std::vector< int > fOpDetType
double model_close(double *x, double *par)
std::vector< std::vector< double > > fGHvuvpars_flat
std::vector< std::vector< double > > VUV_min
std::vector< std::vector< double > > fGHvuvpars_dome
std::vector< double > fborder_corr_angulo_dome
constexpr unsigned int dimension()
bool const bPropagate
Whether propagation of photons is enabled.
std::vector< std::vector< double > > fborder_corr_dome
std::vector< std::vector< double > > fborder_corr_flat
std::vector< double > fvis_distances_x_flat
constexpr double acos_table(const double x)
std::vector< double > fborder_corr_angulo_flat
std::vector< double > fOpDetLength
geo::Point_t fcathode_centre
Definitions of geometry vector data types.
std::unique_ptr< CLHEP::RandGeneral > fTPBEm
std::vector< geo::BoxBoundedGeo > const fActiveVolumes
std::vector< std::vector< std::vector< double > > > ftau_pars
G4bool GetScintillationByParticleType() const
Description of geometry of one entire detector.
static constexpr bool isDefinitelyGreaterThan(TReal a, TReal b, TReal tolerance=std::numeric_limits< TReal >::epsilon())
Provides a base class aware of world box coordinates.
std::vector< double > fradial_distances_refl
std::vector< double > fvis_distances_r_dome
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
General LArSoft Utilities.
std::vector< std::vector< std::vector< double > > > fcut_off_pars
A container for photon visibility mapping data.
static constexpr bool isApproximatelyEqual(TReal a, TReal b, TReal tolerance=std::numeric_limits< TReal >::epsilon())
std::vector< double > fvis_distances_x_dome
Declaration of types related to photon visibility.
phot::MappedT0s_t ReflT0s
phot::PhotonVisibilityService const *const fPVS
Photon visibility service instance.
std::vector< std::vector< double > > VUV_max
void AddSaturation(G4EmSaturation *sat)
G4EmSaturation * emSaturation
static const size_t acos_bins
static constexpr bool isDefinitelyLessThan(TReal a, TReal b, TReal tolerance=std::numeric_limits< TReal >::epsilon())
phot::MappedFunctions_t ParPropTimeTF1
double interpolate(const std::vector< double > &xData, const std::vector< double > &yData, const double x, const bool extrapolate, size_t i)
Namespace collecting geometry-related classes utilities.
static constexpr bool isApproximatelyZero(TReal a, TReal tolerance=std::numeric_limits< TReal >::epsilon())
double LandauPlusExpoFinal(double *x, double *par)
double fast_acos(double x)
std::unique_ptr< G4PhysicsTable > theFastIntegralTable