Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
wire-cell-build
gen
test
test_recombinationmodels.cxx
Go to the documentation of this file.
1
#include "
WireCellGen/RecombinationModels.h
"
2
3
#include "
WireCellUtil/Units.h
"
4
#include "
WireCellUtil/Testing.h
"
5
6
#include <vector>
7
#include <iostream>
8
9
/* From Brooke corresponding to example data used:
10
To convert "dE" to "n", the following was used:
11
fNumIonElectrons = fGeVToElectrons * 1.e-3 * e;
12
where
13
constexpr double kGeVToElectrons = 4.237e7; ///< 23.6eV per ion pair, 1e9 eV/GeV
14
15
"depos": [
16
{"x":107.42, "y":-23.175, "z":58.1284, "q":0.0797872, "t":3284.98, "s":0.0208263, "n":3380},
17
{"x":107.419, "y":-23.15, "z":58.1216, "q":0.0533235, "t":3284.98, "s":0.0311329, "n":2259},
18
{"x":107.418, "y":-23.1345, "z":58.1173, "q":0.000891013, "t":3284.98, "s":0.000947381, "n":37},
19
{"x":107.417, "y":-23.1195, "z":58.1133, "q":0.0433082, "t":3284.98, "s":0.0301825, "n":1834},
20
21
*/
22
using namespace
WireCell
;
23
using namespace
std
;
24
25
const
std::vector<double>
evec
{0.0797872,0.0533235,0.000891013, 0.02};
26
const
std::vector<double>
svec
{0.0208263, 0.0311329, 0.000947381, 0.01};
27
const
std::vector<int>
nvec
{3380, 2259, 37, 847};
28
29
void
spin
(
IRecombinationModel
&
model
,
const
std::string
&
label
)
30
{
31
cerr <<
"Model: "
<< label <<
endl
;
32
for
(
size_t
ind=0; ind<
nvec
.size(); ++ind) {
33
// values from larsoft dump
34
double
lsenergy =
evec
[ind]*
units::MeV
;
35
double
lsstep =
svec
[ind]*
units::cm
;
36
double
lscharge =
nvec
[ind]*(-1.0*
units::eplus
);
37
double
dEdX = lsenergy/lsstep;
38
39
double
gotcharge =
model
(lsenergy, lsstep);
40
cerr <<
"\tdE="
<< lsenergy/
units::keV
<<
" keV, "
41
<<
"dX="
<< lsstep/
units::micrometer
<<
" um, "
42
<<
"dE/dX="
<< dEdX/(units::MeV/
units::cm
) <<
" MeV/cm, "
43
<<
"dQls="
<< lscharge/(-1*
units::eplus
) <<
" ele, "
44
<<
"dQ="
<< gotcharge/(-1*
units::eplus
) <<
" ele\n"
;
45
}
46
47
}
48
void
test_larsoft
()
49
{
50
Gen::MipRecombination
model
(1.0);
51
spin
(model,
"larsoft"
);
52
}
53
void
test_mip
()
54
{
55
Gen::MipRecombination
model
;
56
spin
(model,
"mip"
);
57
}
58
void
test_birks
()
59
{
60
Gen::BirksRecombination
model
;
61
spin
(model,
"birks"
);
62
}
63
void
test_box
()
64
{
65
Gen::BoxRecombination
model
;
66
spin
(model,
"box"
);
67
}
68
69
int
main
()
70
{
71
test_larsoft
();
72
test_mip
();
73
test_birks
();
74
test_box
();
75
return
0;
76
}
WireCell::units::eplus
static const double eplus
Definition:
Units.h:110
WireCell::Gen::MipRecombination
Model for a MIP, dQ = (Rmip/Wi)*dE.
Definition:
RecombinationModels.h:14
string
std::string string
Definition:
nybbler.cc:12
WireCell::units::micrometer
static const double micrometer
Definition:
Units.h:40
nvec
const std::vector< int > nvec
Definition:
test_recombinationmodels.cxx:27
WireCell::IRecombinationModel
Definition:
IRecombinationModel.h:8
std
STL namespace.
test_nxdot.label
label
Definition:
test_nxdot.py:6
spin
void spin(IRecombinationModel &model, const std::string &label)
Definition:
test_recombinationmodels.cxx:29
svec
const std::vector< double > svec
Definition:
test_recombinationmodels.cxx:26
plot_model.model
model
Definition:
plot_model.py:61
Testing.h
WireCell::units::MeV
static const double MeV
Definition:
Units.h:128
evec
const std::vector< double > evec
Definition:
test_recombinationmodels.cxx:25
WireCell::units::cm
static const double cm
Definition:
Units.h:59
WireCell
Definition:
Main.h:22
WireCell::units::keV
static const double keV
Definition:
Units.h:130
test_mip
void test_mip()
Definition:
test_recombinationmodels.cxx:53
main
int main()
Definition:
test_recombinationmodels.cxx:69
WireCell::Gen::BoxRecombination
Definition:
RecombinationModels.h:47
test_birks
void test_birks()
Definition:
test_recombinationmodels.cxx:58
WireCell::Gen::BirksRecombination
Definition:
RecombinationModels.h:28
test_larsoft
void test_larsoft()
Definition:
test_recombinationmodels.cxx:48
RecombinationModels.h
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Units.h
test_box
void test_box()
Definition:
test_recombinationmodels.cxx:63
Generated by
1.8.11