41 if (!neutronG || !protonG || !pionG) {
42 std::cerr <<
"FluenceWeightCalculator not initialized\n";
45 const int apdg = std::abs(pdg);
47 return evalClamped(*neutronG, kineticEnergy);
50 return electronG ? evalClamped(*electronG, kineticEnergy) : 0.;
53 if (apdg >= 1000 && apdg < 10000) {
54 return ((kineticEnergy > 1e-3) ? evalClamped(*protonG, kineticEnergy) : 0.);
57 if (apdg >= 100 && apdg < 1000) {
58 return ((kineticEnergy > 10.) ? evalClamped(*pionG, kineticEnergy) : 0.);
108 neutronG = std::make_unique<TGraph>();
109 neutronG->SetName(
"neutronDW");
111 protonG = std::make_unique<TGraph>();
112 protonG->SetName(
"protonDW");
114 pionG = std::make_unique<TGraph>();
115 pionG->SetName(
"pionDW");
117 electronG = std::make_unique<TGraph>();
118 electronG->SetName(
"electronDW");
123 std::cerr <<
"Error: cannot open file with damage weights.\n";
127 while (std::getline(in, line)) {
128 if (line.empty() || line[0] ==
'#') {
131 std::istringstream ss(line);
132 std::string particle, e_str, w_str;
133 if (!std::getline(ss, particle,
',')) {
136 if (!std::getline(ss, e_str,
',')) {
139 if (!std::getline(ss, w_str,
',')) {
142 auto e = std::stod(e_str);
143 auto w = std::stod(w_str);
144 auto pdg = std::stoi(particle);
147 neutronG->SetPoint(neuN++, e,
w);
151 protonG->SetPoint(proN++, e,
w);
155 pionG->SetPoint(pioN++, e,
w);
159 electronG->SetPoint(eleN++, e,
w);
169 auto fout =
new TFile(
"rd50_niel.root",
"recreate");