LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
phot::ScintTimeLAr Class Reference

#include "ScintTimeLAr.h"

Inheritance diagram for phot::ScintTimeLAr:
phot::ScintTime

Public Member Functions

 ScintTimeLAr (fhicl::ParameterSet const &pset)
 
void initRand (CLHEP::HepRandomEngine &engine)
 
void GenScintTime (bool is_fast, CLHEP::HepRandomEngine &engine)
 
double fastScintTime ()
 
double slowScintTime ()
 
double GetScintTime () const
 

Protected Attributes

double timing {0.0}
 

Private Member Functions

double single_exp (double t, double tau2) const
 
double bi_exp (double t, double tau1, double tau2) const
 
double with_rising_time (double tau1, double tau2)
 

Private Attributes

int LogLevel
 
std::unique_ptr< CLHEP::RandFlat > fUniformGen
 
const double SRTime
 
const double SDTime
 
const double FRTime
 
const double FDTime
 
const bool fNoFastRisingTime
 
const bool fNoSlowRisingTime
 

Detailed Description

Definition at line 24 of file ScintTimeLAr.h.

Constructor & Destructor Documentation

phot::ScintTimeLAr::ScintTimeLAr ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 15 of file ScintTimeLAr.cc.

References e, FDTime, fNoFastRisingTime, fNoSlowRisingTime, FRTime, fhicl::ParameterSet::get(), LogLevel, SDTime, and SRTime.

16  : LogLevel{pset.get<int>("LogLevel")}
17  , SRTime{pset.get<double>("SlowRisingTime", 0.)}
18  , SDTime{pset.get<double>("SlowDecayTime", 0.)}
19  , FRTime{pset.get<double>("FastRisingTime", 0.)}
20  , FDTime{pset.get<double>("FastDecayTime", 0.)}
21  , fNoFastRisingTime((FRTime >= 1.e-8) && (FRTime != -1.))
22  , fNoSlowRisingTime((SRTime >= 1.e-8) && (SRTime != -1.))
23  {
24  if (LogLevel >= 1) {
25  std::cout << "ScintTimeLAr Tool configure:" << std::endl;
26  std::cout << "Fast rising time: " << FRTime << ", Fast decay time: " << FDTime
27  << ", Slow rising time: " << SRTime << ", Slow decay time: " << SDTime << std::endl;
28  }
29  }
const bool fNoSlowRisingTime
Definition: ScintTimeLAr.h:40
const double SRTime
Definition: ScintTimeLAr.h:36
const double FDTime
Definition: ScintTimeLAr.h:39
const double FRTime
Definition: ScintTimeLAr.h:38
const bool fNoFastRisingTime
Definition: ScintTimeLAr.h:40
const double SDTime
Definition: ScintTimeLAr.h:37
Float_t e
Definition: plot.C:35

Member Function Documentation

double phot::ScintTimeLAr::bi_exp ( double  t,
double  tau1,
double  tau2 
) const
private

Definition at line 43 of file ScintTimeLAr.cc.

Referenced by GenScintTime(), and with_rising_time().

44  {
45  return (((std::exp((-1.0 * t) / tau2) * (1.0 - std::exp((-1.0 * t) / tau1))) / tau2) / tau2) *
46  (tau1 + tau2);
47  }
double phot::ScintTimeLAr::fastScintTime ( )
inlinevirtual

Implements phot::ScintTime.

Definition at line 106 of file ScintTimeLAr.cc.

References FDTime, fNoFastRisingTime, FRTime, fUniformGen, and with_rising_time().

107  {
108  if (fNoFastRisingTime) { return -FDTime * std::log(fUniformGen->fire()); }
109  return with_rising_time(FRTime, FDTime);
110  }
std::unique_ptr< CLHEP::RandFlat > fUniformGen
Definition: ScintTimeLAr.h:34
const double FDTime
Definition: ScintTimeLAr.h:39
const double FRTime
Definition: ScintTimeLAr.h:38
const bool fNoFastRisingTime
Definition: ScintTimeLAr.h:40
double with_rising_time(double tau1, double tau2)
Definition: ScintTimeLAr.cc:50
void phot::ScintTimeLAr::GenScintTime ( bool  is_fast,
CLHEP::HepRandomEngine &  engine 
)
virtual

Implements phot::ScintTime.

Definition at line 71 of file ScintTimeLAr.cc.

References bi_exp(), d, e, FDTime, FRTime, SDTime, single_exp(), SRTime, and phot::ScintTime::timing.

72  {
73  double tau1;
74  double tau2;
75 
76  if (is_fast) {
77  tau1 = FRTime;
78  tau2 = FDTime;
79  }
80  else {
81  tau1 = SRTime;
82  tau2 = SDTime;
83  }
84 
85  CLHEP::RandFlat randflatscinttime{engine};
86 
87  if ((tau1 < 1e-8) || (tau1 == -1.0)) {
88  timing = -tau2 * std::log(randflatscinttime());
89  return;
90  }
91 
92  //ran1, ran2 = random numbers for the algorithm
93  while (1) {
94  auto ran1 = randflatscinttime();
95  auto ran2 = randflatscinttime();
96  auto d = (tau1 + tau2) / tau2;
97  auto t = -tau2 * std::log(1 - ran1);
98  auto g = d * single_exp(t, tau2);
99  if (ran2 <= bi_exp(t, tau1, tau2) / g) {
100  timing = t;
101  return;
102  }
103  }
104  }
double bi_exp(double t, double tau1, double tau2) const
Definition: ScintTimeLAr.cc:43
Float_t d
Definition: plot.C:235
const double SRTime
Definition: ScintTimeLAr.h:36
const double FDTime
Definition: ScintTimeLAr.h:39
double single_exp(double t, double tau2) const
Definition: ScintTimeLAr.cc:37
const double FRTime
Definition: ScintTimeLAr.h:38
const double SDTime
Definition: ScintTimeLAr.h:37
Float_t e
Definition: plot.C:35
double timing
Definition: ScintTime.h:29
double phot::ScintTime::GetScintTime ( ) const
inlineinherited

Definition at line 22 of file ScintTime.h.

22 { return timing; }
double timing
Definition: ScintTime.h:29
void phot::ScintTimeLAr::initRand ( CLHEP::HepRandomEngine &  engine)
virtual

Implements phot::ScintTime.

Definition at line 31 of file ScintTimeLAr.cc.

References fUniformGen.

32  {
33  fUniformGen = std::make_unique<CLHEP::RandFlat>(engine);
34  }
std::unique_ptr< CLHEP::RandFlat > fUniformGen
Definition: ScintTimeLAr.h:34
double phot::ScintTimeLAr::single_exp ( double  t,
double  tau2 
) const
private

Definition at line 37 of file ScintTimeLAr.cc.

Referenced by GenScintTime(), and with_rising_time().

38  {
39  return std::exp((-1.0 * t) / tau2) / tau2;
40  }
double phot::ScintTimeLAr::slowScintTime ( )
inlinevirtual

Implements phot::ScintTime.

Definition at line 112 of file ScintTimeLAr.cc.

References fNoSlowRisingTime, fUniformGen, SDTime, SRTime, and with_rising_time().

113  {
114  if (fNoSlowRisingTime) { return -SDTime * std::log(fUniformGen->fire()); }
115  return with_rising_time(SRTime, SDTime);
116  }
const bool fNoSlowRisingTime
Definition: ScintTimeLAr.h:40
std::unique_ptr< CLHEP::RandFlat > fUniformGen
Definition: ScintTimeLAr.h:34
const double SRTime
Definition: ScintTimeLAr.h:36
const double SDTime
Definition: ScintTimeLAr.h:37
double with_rising_time(double tau1, double tau2)
Definition: ScintTimeLAr.cc:50
double phot::ScintTimeLAr::with_rising_time ( double  tau1,
double  tau2 
)
private

Definition at line 50 of file ScintTimeLAr.cc.

References bi_exp(), d, fUniformGen, and single_exp().

Referenced by fastScintTime(), and slowScintTime().

51  {
52  // TODO: This method is very inefficient.
53  // If we care about simulating the rising time, it would be better
54  // to simulate random numbers according a general distribution
55  double d = (tau1 + tau2) / tau2;
56  while (1) {
57  double ran1 = fUniformGen->fire();
58  double ran2 = fUniformGen->fire();
59  double t = -tau2 * std::log(1 - ran1);
60  double g = d * single_exp(t, tau2);
61  if (ran2 <= bi_exp(t, tau1, tau2) / g) { return t; }
62  }
63  }
double bi_exp(double t, double tau1, double tau2) const
Definition: ScintTimeLAr.cc:43
Float_t d
Definition: plot.C:235
std::unique_ptr< CLHEP::RandFlat > fUniformGen
Definition: ScintTimeLAr.h:34
double single_exp(double t, double tau2) const
Definition: ScintTimeLAr.cc:37

Member Data Documentation

const double phot::ScintTimeLAr::FDTime
private

Definition at line 39 of file ScintTimeLAr.h.

Referenced by fastScintTime(), GenScintTime(), and ScintTimeLAr().

const bool phot::ScintTimeLAr::fNoFastRisingTime
private

Definition at line 40 of file ScintTimeLAr.h.

Referenced by fastScintTime(), and ScintTimeLAr().

const bool phot::ScintTimeLAr::fNoSlowRisingTime
private

Definition at line 40 of file ScintTimeLAr.h.

Referenced by ScintTimeLAr(), and slowScintTime().

const double phot::ScintTimeLAr::FRTime
private

Definition at line 38 of file ScintTimeLAr.h.

Referenced by fastScintTime(), GenScintTime(), and ScintTimeLAr().

std::unique_ptr<CLHEP::RandFlat> phot::ScintTimeLAr::fUniformGen
private

Definition at line 34 of file ScintTimeLAr.h.

Referenced by fastScintTime(), initRand(), slowScintTime(), and with_rising_time().

int phot::ScintTimeLAr::LogLevel
private

Definition at line 33 of file ScintTimeLAr.h.

Referenced by ScintTimeLAr().

const double phot::ScintTimeLAr::SDTime
private

Definition at line 37 of file ScintTimeLAr.h.

Referenced by GenScintTime(), ScintTimeLAr(), and slowScintTime().

const double phot::ScintTimeLAr::SRTime
private

Definition at line 36 of file ScintTimeLAr.h.

Referenced by GenScintTime(), ScintTimeLAr(), and slowScintTime().

double phot::ScintTime::timing {0.0}
protectedinherited

Definition at line 29 of file ScintTime.h.

Referenced by GenScintTime().


The documentation for this class was generated from the following files: