127 fPrimaryNeutronInteractionPoints.init();
129 fNeulandPoints.init();
131 fhNPNIPsEToFVSTime =
new TH2D(
"NPNIPEToFVSTime",
"NPNIP E_{ToF} vs. NPNIP Time", 100, 0, 1000, 500, 0, 500);
132 fhNPNIPsEToFVSTime->GetXaxis()->SetTitle(
"NPNIP E_{ToF} [MeV]");
133 fhNPNIPsEToFVSTime->GetYaxis()->SetTitle(
"NPNIP t [ns]");
135 fhPDG =
new TH1D(
"hPDG",
136 "Number of particles by PDG code created by primary neutron interaction resulting in a point",
140 fhEPrimarys =
new TH1D(
"hE_primarys",
"Energy of primary particles", 10000, 0, 10000);
141 fhEPrimarys2 =
new TH1D(
"hE_primarys2",
"Tot. Energy of primary particles", 100000, 0, 100000);
142 fhEPrimaryNeutrons =
new TH1D(
"hE_primary_neutrons",
"Energy of primary Neutrons", 10000, 0, 10000);
143 fhErelMC =
new TH1D(
"hErelMC",
"Erel", 5000, 0, 5000);
144 fhEtotPrim =
new TH1D(
"hE_tot_prim",
145 "Total Light Yield of non-neutron LandPoints created by primary neutron interaction(s)",
149 fhEtot =
new TH1D(
"hE_tot",
"Total Light Yield of non-neutron LandPoints", 6000, 0, 6000);
150 fhESecondaryNeutrons =
new TH1D(
151 "hE_secondary_neutrons",
"Energy of neutron tracks created by primary neutron interaction", 6000, 0, 6000);
152 fhMotherIDs =
new TH1D(
"hmotherIDs",
"MotherIDs", 6010, -10, 6000);
153 fhPrimaryDaughterIDs =
new TH1D(
"hprimary_daughter_IDs",
"IDs of tracks with a primary mother", 6001, -1, 6000);
154 fhMCToF =
new TH1D(
"fhMCToF",
"Energy of primary Neutron - ToF Energy from PNIPS", 2001, -1000, 1000);
156 fhNPNIPSrvsz =
new TH2D(
"fhNPNIPSrvsz",
"NPNIPS R = #sqrt(x**2+y**2) vs z", 600, 1000, 4000, 40, 0, 200);
157 fhNPNIPSrvsz->GetXaxis()->SetTitle(
"NPNIP Z [cm]");
158 fhNPNIPSrvsz->GetYaxis()->SetTitle(
"NPNIP R [cm]");
160 fhNPNIPSxy =
new TH2D(
"fhNPNIPSxy",
"NPNIPS xy", 101, -200, 200, 101, -200, 200);
161 fhNPNIPSxy->GetXaxis()->SetTitle(
"NPNIP X [cm]");
162 fhNPNIPSxy->GetYaxis()->SetTitle(
"NPNIP Y [cm]");
164 fhnNPNIPs =
new TH1D(
"fhnNPNIPs",
"Number of NPNIPs per event", 10, -0.5, 9.5);
166 fhnProducts =
new TH1D(
"nProducts",
"Number of products created by primary neutron interaction", 20, -0.5, 19.5);
168 new TH1D(
"nProductsCharged",
169 "Number of products created by primary neutron interaction w/o gammas, neutrons, pion0",
173 fhSumProductEnergy =
new TH1D(
"SumProductEnergy",
"Sum product energy", 1000, 0, 1000);
174 fhnSecondaryNeutrons =
new TH1D(
"NumberSecondaryNeutrons",
"Number of Secondary Neutrons", 10, -0.5, 9.5);
175 fhnSecondaryProtons =
new TH1D(
"NumberSecondaryProtons",
"Number of Secondary Protons", 10, -0.5, 9.5);
178 std::array<double, 148> bins = {
179 1.00000000e-02, 1.07151931e-02, 1.14815362e-02, 1.23026877e-02, 1.31825674e-02, 1.41253754e-02, 1.51356125e-02,
180 1.62181010e-02, 1.73780083e-02, 1.86208714e-02, 1.99526231e-02, 2.13796209e-02, 2.29086765e-02, 2.45470892e-02,
181 2.63026799e-02, 2.81838293e-02, 3.01995172e-02, 3.23593657e-02, 3.46736850e-02, 3.71535229e-02, 3.98107171e-02,
182 4.26579519e-02, 4.57088190e-02, 4.89778819e-02, 5.24807460e-02, 5.62341325e-02, 6.02559586e-02, 6.45654229e-02,
183 6.91830971e-02, 7.41310241e-02, 7.94328235e-02, 8.51138038e-02, 9.12010839e-02, 9.77237221e-02, 1.04712855e-01,
184 1.12201845e-01, 1.20226443e-01, 1.28824955e-01, 1.38038426e-01, 1.47910839e-01, 1.58489319e-01, 1.69824365e-01,
185 1.81970086e-01, 1.94984460e-01, 2.08929613e-01, 2.23872114e-01, 2.39883292e-01, 2.57039578e-01, 2.75422870e-01,
186 2.95120923e-01, 3.16227766e-01, 3.38844156e-01, 3.63078055e-01, 3.89045145e-01, 4.16869383e-01, 4.46683592e-01,
187 4.78630092e-01, 5.12861384e-01, 5.49540874e-01, 5.88843655e-01, 6.30957344e-01, 6.76082975e-01, 7.24435960e-01,
188 7.76247117e-01, 8.31763771e-01, 8.91250938e-01, 9.54992586e-01, 1.02329299e+00, 1.09647820e+00, 1.17489755e+00,
189 1.25892541e+00, 1.34896288e+00, 1.44543977e+00, 1.54881662e+00, 1.65958691e+00, 1.77827941e+00, 1.90546072e+00,
190 2.04173794e+00, 2.18776162e+00, 2.34422882e+00, 2.51188643e+00, 2.69153480e+00, 2.88403150e+00, 3.09029543e+00,
191 3.31131121e+00, 3.54813389e+00, 3.80189396e+00, 4.07380278e+00, 4.36515832e+00, 4.67735141e+00, 5.01187234e+00,
192 5.37031796e+00, 5.75439937e+00, 6.16595002e+00, 6.60693448e+00, 7.07945784e+00, 7.58577575e+00, 8.12830516e+00,
193 8.70963590e+00, 9.33254301e+00, 1.00000000e+01, 1.07151931e+01, 1.14815362e+01, 1.23026877e+01, 1.31825674e+01,
194 1.41253754e+01, 1.51356125e+01, 1.62181010e+01, 1.73780083e+01, 1.86208714e+01, 1.99526231e+01, 2.13796209e+01,
195 2.29086765e+01, 2.45470892e+01, 2.63026799e+01, 2.81838293e+01, 3.01995172e+01, 3.23593657e+01, 3.46736850e+01,
196 3.71535229e+01, 3.98107171e+01, 4.26579519e+01, 4.57088190e+01, 4.89778819e+01, 5.24807460e+01, 5.62341325e+01,
197 6.02559586e+01, 6.45654229e+01, 6.91830971e+01, 7.41310241e+01, 7.94328235e+01, 8.51138038e+01, 9.12010839e+01,
198 9.77237221e+01, 1.04712855e+02, 1.12201845e+02, 1.20226443e+02, 1.28824955e+02, 1.38038426e+02, 1.47910839e+02,
199 1.58489319e+02, 1.69824365e+02, 1.81970086e+02, 1.94984460e+02, 2.08929613e+02, 2.23872114e+02, 2.39883292e+02,
203 fhElossVSLight =
new TH2D(
"fhElossVSLight",
204 "Deposited Energy vs Generated Light",
209 fhElossVSLightLog =
new TH2D(
"fhElossVSLightLog",
"Deposited Energy vs Generated Light", 600, -3, 3, 600, -3, 3);
211 fhThetaLight =
new TH2D(
"fhThetaLight",
"fhThetaLight", 200, -100, 100, 400, 0, 400);
213 if (fIs3DTrackEnabled)
217 fh3 =
new TH3D(
"hMCTracks",
"hMCTracks", 60, 1400, 1700, 50, -125, 125, 50, -125, 125);
218 fh3->SetTitle(
"NeuLAND MCTracks");
219 fh3->GetXaxis()->SetTitle(
"Z");
220 fh3->GetYaxis()->SetTitle(
"X");
221 fh3->GetZaxis()->SetTitle(
"Y");
222 FairRootManager::Instance()->Register(
"NeulandMCMon",
"MC Tracks in NeuLAND", fh3, kTRUE);
224 fh3PNIP =
new TH3D(
"h3DNPNIPS",
"h3DNPNIPS", 60, 1400, 1700, 50, -125, 125, 50, -125, 125);
225 fh3PNIP->SetTitle(
"NeuLAND 3D NPNIPS");
226 fh3PNIP->GetXaxis()->SetTitle(
"Z");
227 fh3PNIP->GetYaxis()->SetTitle(
"X");
228 fh3PNIP->GetZaxis()->SetTitle(
"Y");
229 FairRootManager::Instance()->Register(
"Neuland3DPNIP",
"First interactions in NeuLAND", fh3PNIP, kTRUE);
239 const auto& npnips = fPrimaryNeutronInteractionPoints.get();
240 const auto& mcTracks = fMCTracks.Retrieve();
241 const auto& points = fNeulandPoints.get();
243 for (
const auto& mcTrack : mcTracks)
246 fhMotherIDs->Fill(mcTrack->GetMotherId());
249 if (mcTrack->GetMotherId() == -1)
252 fhEPrimarys2->Fill(mcTrack->GetEnergy() * 1000.);
268 fhnNPNIPs->Fill(npnips.size());
269 for (
const auto& npnip : npnips)
272 const Double_t s2 = std::pow(npnip.GetX(), 2) + std::pow(npnip.GetY(), 2) + std::pow(npnip.GetZ(), 2);
273 const Double_t v2 = s2 / std::pow(npnip.GetTime(), 2);
275 const Double_t
c2 = 898.75517873681758374898;
277 const Double_t ETimeOfFlight =
massNeutron * ((1. / std::sqrt(1 - (v2 /
c2))) - 1);
279 auto mcTrack = mcTracks.at(npnip.GetTrackID());
280 fhNPNIPsEToFVSTime->Fill(ETimeOfFlight, npnip.GetTime());
282 fhNPNIPSrvsz->Fill(npnip.GetZ(), std::sqrt(std::pow(npnip.GetX(), 2) + std::pow(npnip.GetY(), 2)));
283 fhNPNIPSxy->Fill(npnip.GetX(), npnip.GetY());
287 std::map<Int_t, Double_t> EtotPDG;
289 Double_t EtotPrim = 0.;
291 for (
const auto& point : points)
293 const R3BMCTrack* mcTrack = mcTracks.at(point.GetTrackID());
295 Etot += point.GetLightYield() * 1000.;
304 EtotPrim += point.GetLightYield() * 1000.;
309 fhPrimaryDaughterIDs->Fill(point.GetTrackID());
314 TString name = TString(
"Light Yield of PID ") + TString::Itoa(mcTrack->
GetPdgCode(), 10) +
315 TString(
" with a primary neutron mother");
317 new TH1D(
"hE_PDG_" + TString::Itoa(mcTrack->
GetPdgCode(), 10), name, 3000, 0, 3000);
320 fhmEPdg[mcTrack->
GetPdgCode()]->Fill(point.GetLightYield() * 1000.);
328 EtotPDG[mcTrack->
GetPdgCode()] += point.GetLightYield() * 1000.;
330 fhElossVSLight->Fill(point.GetEnergyLoss() * 1000., point.GetLightYield() * 1000.);
331 fhElossVSLightLog->Fill(std::log10(point.GetEnergyLoss() * 1000.),
332 std::log10(point.GetLightYield() * 1000.));
334 if (!fhmElossVSLightLogPdg[mcTrack->
GetPdgCode()])
336 fhmElossVSLightLogPdg[mcTrack->
GetPdgCode()] =
337 new TH2D(
"fhElossVSLightLog_" + TString::Itoa(mcTrack->
GetPdgCode(), 10),
338 "Deposited Energy vs Generated Light",
346 fhmElossVSLightLogPdg[mcTrack->
GetPdgCode()]->Fill(std::log10(point.GetEnergyLoss() * 1000.),
347 std::log10(point.GetLightYield() * 1000.));
349 fhThetaLight->Fill(
GetTheta(mcTrack), point.GetLightYield() * 1000.);
353 fhEtotPrim->Fill(EtotPrim);
355 for (
const auto& kv : EtotPDG)
357 if (!fhmEtotPdg[kv.first])
359 TString name = TString(
"Sum Light Yield of PID ") + TString::Itoa(kv.first, 10);
360 fhmEtotPdg[kv.first] =
new TH1D(
"fhEtotPDG_" + TString::Itoa(kv.first, 10), name, 3000, 0, 3000);
362 fhmEtotPdg[kv.first]->Fill(kv.second);
364 if (!fhmEtotPdgRel[kv.first])
366 TString name = TString(
"Percent Light Yield of PID ") + TString::Itoa(kv.first, 10) +
367 TString(
" to total Light Yield.");
368 fhmEtotPdgRel[kv.first] =
new TH1D(
"fhEtotPDGRel_" + TString::Itoa(kv.first, 10), name, 110, 0, 110);
372 fhmEtotPdgRel[kv.first]->Fill(0);
376 fhmEtotPdgRel[kv.first]->Fill(kv.second / Etot * 100.);
382 std::vector<int> primaryNeutronIDs;
383 std::map<int, std::vector<R3BMCTrack*>> tracksByPrimaryNeutronID;
385 const Int_t nTracks = mcTracks.size();
386 for (Int_t j = 0; j < nTracks; j++)
391 primaryNeutronIDs.push_back(j);
395 for (Int_t j = 0; j < nTracks; j++)
398 for (
const Int_t primaryNeutronID : primaryNeutronIDs)
402 tracksByPrimaryNeutronID[primaryNeutronID].push_back(track);
407 for (
const Int_t primaryNeutronID : primaryNeutronIDs)
409 auto& tracks = tracksByPrimaryNeutronID[primaryNeutronID];
410 fhnProducts->Fill(tracks.size());
412 fhnProductsCharged->Fill(std::accumulate(tracks.begin(),
417 if (b->GetPdgCode() == 2112 || b->GetPdgCode() == 22 ||
418 b->GetPdgCode() == 111)
428 fhnSecondaryNeutrons->Fill(std::accumulate(tracks.begin(),
433 if (t->GetPdgCode() == 2112)
440 fhnSecondaryProtons->Fill(std::accumulate(tracks.begin(),
445 if (t->GetPdgCode() == 2212)
452 const Double_t sumProductEnergy = std::accumulate(tracks.begin(),
456 { return a + 1000. * (b->GetEnergy() - b->GetMass()); });
458 fhSumProductEnergy->Fill(sumProductEnergy);
460 if (fIsFullSimAnaEnabled)
462 std::map<int, int> mCountByProductPdg;
464 for (
const auto& track : tracks)
466 if (mCountByProductPdg.find(track->GetPdgCode()) == mCountByProductPdg.end())
468 mCountByProductPdg[track->GetPdgCode()] = 1;
472 mCountByProductPdg[track->GetPdgCode()]++;
475 auto& hEnergy = fhmEnergyByProductPdg[track->GetPdgCode()];
476 if (hEnergy ==
nullptr)
478 hEnergy =
new TH1D(TString::Itoa(track->GetPdgCode(), 10),
479 TString::Itoa(track->GetPdgCode(), 10),
484 hEnergy->Fill(1000. * (track->GetEnergy() - track->GetMass()));
486 const auto l =
lookup(track->GetPdgCode());
487 auto& hEnergyRed = fhmEnergyByProductPdgReduced[l];
488 if (hEnergyRed ==
nullptr)
490 hEnergyRed =
new TH1D(l.c_str(), l.c_str(), 1000, 0, 1000);
492 hEnergyRed->Fill(1000. * (track->GetEnergy() - track->GetMass()));
495 for (
const auto& kv : mCountByProductPdg)
497 const int pdg = kv.first;
498 auto& hCount = fhmCountByProductPdg[pdg];
499 if (hCount ==
nullptr)
501 hCount =
new TH1D(TString::Itoa(pdg, 10), TString::Itoa(pdg, 10), 10, 0, 10);
503 hCount->Fill(kv.second);
505 const auto l =
lookup(kv.first);
506 auto& hCountRed = fhmCountByProductPdgReduced[l];
507 if (hCountRed ==
nullptr)
509 hCountRed =
new TH1D(l.c_str(), l.c_str(), 10, 0, 10);
511 hCountRed->Fill(kv.second);
514 std::sort(tracks.begin(),
519 std::vector<int> filteredPdgCodes{ 22, 111 };
520 const TString reaction = std::accumulate(
524 [&](TString s,
const R3BMCTrack* b) -> TString
526 if (std::find(filteredPdgCodes.begin(), filteredPdgCodes.end(), b->
GetPdgCode()) !=
527 filteredPdgCodes.end())
531 return s +=
"_" + TString::Itoa(b->
GetPdgCode(), 10);
534 if (fhmEnergyByReaction[reaction] ==
nullptr)
536 fhmEnergyByReaction[reaction] =
new TH1D(reaction, reaction, 1000, 0, 1000);
538 fhmEnergyByReaction[reaction]->Fill(sumProductEnergy);
540 for (
const auto& track : tracks)
542 auto& hEnergy = fhmmEnergyByReactionByProductPdg[reaction][track->GetPdgCode()];
543 if (hEnergy ==
nullptr)
545 hEnergy =
new TH1D(TString::Itoa(track->GetPdgCode(), 10) + reaction,
546 TString::Itoa(track->GetPdgCode(), 10) + reaction,
551 hEnergy->Fill(1000. * (track->GetEnergy() - track->GetMass()));
558 ROOT::Math::PxPyPzEVector p4;
560 for (
const auto track : mcTracks)
562 if (track->GetMotherId() != -1)
566 p4 += track->GetFourMomentum();
567 m0 += track->GetMass();
569 fhErelMC->Fill((p4.M() - m0) * 1e6);
572 if (fIs3DTrackEnabled)
575 for (
const auto& point : points)
577 if (point.GetLightYield() > 0)
579 const auto pos = point.GetPosition();
580 fh3->Fill(pos.Z(), pos.X(), pos.Y(), point.GetEnergyLoss() * 1000.);
584 fh3PNIP->Reset(
"ICES");
585 for (
const auto& npnip : npnips)
587 fh3PNIP->Fill(npnip.GetZ(), npnip.GetX(), npnip.GetY(), npnip.GetTime());