26 if (!neutronG || !protonG || !pionG) {
27 std::cerr <<
"FluenceWeightCalculator not initialized\n";
30 switch (std::abs(pdg)) {
32 return neutronG->Eval(kineticEnergy,
nullptr,
"S");
35 return ((kineticEnergy > 1e-3) ? protonG->Eval(kineticEnergy,
nullptr,
"S") : 0.);
38 return ((kineticEnergy > 10.) ? pionG->Eval(kineticEnergy,
nullptr,
"S") : 0.);
83 neutronG = std::make_unique<TGraph>();
84 neutronG->SetName(
"neutronDW");
86 protonG = std::make_unique<TGraph>();
87 protonG->SetName(
"protonDW");
89 pionG = std::make_unique<TGraph>();
90 pionG->SetName(
"pionDW");
95 std::cerr <<
"Error: cannot open file with damage weights.\n";
99 while (std::getline(in, line)) {
100 if (line.empty() || line[0] ==
'#') {
103 std::istringstream ss(line);
104 std::string particle, e_str, w_str;
105 if (!std::getline(ss, particle,
',')) {
108 if (!std::getline(ss, e_str,
',')) {
111 if (!std::getline(ss, w_str,
',')) {
114 auto e = std::stod(e_str);
115 auto w = std::stod(w_str);
116 auto pdg = std::stoi(particle);
119 neutronG->SetPoint(neuN++, e,
w);
123 protonG->SetPoint(proN++, e,
w);
127 pionG->SetPoint(pioN++, e,
w);
133 auto fout =
new TFile(
"rd50_niel.root",
"recreate");