Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
larsim
larsim
PhotonPropagation
ScintTimeTools
ScintTimeLAr_tool.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
// Class: ScintTimeLAr
3
// Plugin Type: tool
4
// File: ScintTimeLAr_tool.cc ScintTimeLAr.h
5
// Description:
6
// Generate a random number for timing of LAr scintillation
7
// Oct. 8 by Mu Wei
8
////////////////////////////////////////////////////////////////////////
9
#include "
larsim/PhotonPropagation/ScintTimeTools/ScintTimeLAr.h
"
10
11
namespace
phot
12
{
13
//......................................................................
14
ScintTimeLAr::ScintTimeLAr
(
fhicl::ParameterSet
const
& pset)
15
: LogLevel{pset.
get
<
int
>(
"LogLevel"
)}
16
,
SRTime
{pset.get<
double
>(
"SlowRisingTime"
, 0.0)}
17
,
SDTime
{pset.get<
double
>(
"SlowDecayTime"
, 0.0)}
18
,
FRTime
{pset.get<
double
>(
"FastRisingTime"
, 0.0)}
19
,
FDTime
{pset.get<
double
>(
"FastDecayTime"
, 0.0)}
20
{
21
if
(
LogLevel
>= 1 )
22
{
23
std::cout <<
"ScintTimeLAr Tool configure:"
<<
std::endl
;
24
std::cout <<
"Fast rising time: "
<<
FRTime
25
<<
", Fast decay time: "
<<
FDTime
26
<<
", Slow rising time: "
<<
SRTime
27
<<
", Slow decay time: "
<<
SDTime
28
<<
std::endl
;
29
}
30
}
31
32
//......................................................................
33
double
ScintTimeLAr::single_exp
(
double
t
,
double
tau2)
34
{
35
return
std::exp((-1.0 * t) / tau2) / tau2;
36
}
37
38
//......................................................................
39
double
ScintTimeLAr::bi_exp
(
double
t
,
double
tau1
,
double
tau2)
40
{
41
return
(((std::exp((-1.0 * t) / tau2) * (1.0 - std::exp((-1.0 * t) / tau1))) / tau2) / tau2) * (tau1 + tau2);
42
}
43
44
//......................................................................
45
// Returns the time within the time distribution of the scintillation process, when the photon was created.
46
// Scintillation light has an exponential decay which is given by the decay time, tau2,
47
// and an exponential increase, which here is given by the rise time, tau1.
48
// randflatScintTimeLAr is passed to use the saved seed from the RandomNumberSaver in order to be able to reproduce the same results.
49
void
ScintTimeLAr::GenScintTime
(
bool
is_fast, CLHEP::HepRandomEngine& engine)
50
{
51
double
tau1
;
52
double
tau2;
53
54
if
(is_fast == 1)
// fast scinitllation
55
{
56
tau1 =
FRTime
;
57
tau2 =
FDTime
;
58
}
59
else
60
{
61
tau1 =
SRTime
;
62
tau2 =
SDTime
;
63
}
64
65
CLHEP::RandFlat randflatscinttime{engine};
66
67
if
((tau1 == 0.0) || (tau1 == -1.0))
68
{
69
timing
= -tau2 * std::log(randflatscinttime());
70
return
;
71
}
72
73
//ran1, ran2 = random numbers for the algorithm
74
while
(1)
75
{
76
auto
ran1 = randflatscinttime();
77
auto
ran2 = randflatscinttime();
78
auto
d
= (tau1 + tau2) / tau2;
79
auto
t
= -tau2 * std::log(1 - ran1);
80
auto
g
=
d
*
single_exp
(
t
, tau2);
81
if
(ran2 <=
bi_exp
(
t
, tau1, tau2) /
g
)
82
{
83
timing
=
t
;
84
return
;
85
}
86
}
87
}
88
}
89
90
DEFINE_ART_CLASS_TOOL
(
phot::ScintTimeLAr
)
DEFINE_ART_CLASS_TOOL
#define DEFINE_ART_CLASS_TOOL(tool)
Definition:
ToolMacros.h:42
phot::ScintTimeLAr::FDTime
double FDTime
Definition:
ScintTimeLAr.h:40
genie::units::g
static constexpr double g
Definition:
Units.h:144
phot::ScintTimeLAr::SDTime
double SDTime
Definition:
ScintTimeLAr.h:38
bump_copyright.d
string d
Definition:
bump_copyright.py:70
tau1
G4double tau1[100]
Definition:
G4S2Light.cc:61
phot::ScintTimeLAr::FRTime
double FRTime
Definition:
ScintTimeLAr.h:39
phot::ScintTimeLAr::LogLevel
int LogLevel
Definition:
ScintTimeLAr.h:34
phot::ScintTimeLAr::GenScintTime
void GenScintTime(bool is_fast, CLHEP::HepRandomEngine &engine)
Definition:
ScintTimeLAr_tool.cc:49
phot::ScintTimeLAr::ScintTimeLAr
ScintTimeLAr(fhicl::ParameterSet const &pset)
Definition:
ScintTimeLAr_tool.cc:14
phot::ScintTimeLAr::single_exp
double single_exp(double t, double tau2)
Definition:
ScintTimeLAr_tool.cc:33
reco_momentum_tuples.t
t
Definition:
reco_momentum_tuples.py:25
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
phot::ScintTimeLAr::SRTime
double SRTime
Definition:
ScintTimeLAr.h:37
phot
General LArSoft Utilities.
Definition:
PhotonLibraryPropagationS2_module.cc:56
phot::ScintTimeLAr
Definition:
ScintTimeLAr.h:27
phot::ScintTimeLAr::bi_exp
double bi_exp(double t, double tau1, double tau2)
Definition:
ScintTimeLAr_tool.cc:39
ScintTimeLAr.h
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
phot::ScintTime::timing
double timing
Definition:
ScintTime.h:32
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11