test_recombinationmodels.cxx
Go to the documentation of this file.
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 
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 }
49 {
51  spin(model, "larsoft");
52 }
53 void test_mip()
54 {
56  spin(model, "mip");
57 }
58 void test_birks()
59 {
61  spin(model, "birks");
62 }
63 void test_box()
64 {
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 }
static const double eplus
Definition: Units.h:110
Model for a MIP, dQ = (Rmip/Wi)*dE.
std::string string
Definition: nybbler.cc:12
static const double micrometer
Definition: Units.h:40
const std::vector< int > nvec
STL namespace.
void spin(IRecombinationModel &model, const std::string &label)
const std::vector< double > svec
static const double MeV
Definition: Units.h:128
const std::vector< double > evec
static const double cm
Definition: Units.h:59
Definition: Main.h:22
static const double keV
Definition: Units.h:130
void test_mip()
void test_birks()
void test_larsoft()
QTextStream & endl(QTextStream &s)
void test_box()