141 fhNPNIPsEToFVSTime =
new TH2D(
"NPNIPEToFVSTime",
"NPNIP E_{ToF} vs. NPNIP Time", 100, 0, 1000, 500, 0, 500);
145 fhPDG =
new TH1D(
"hPDG",
146 "Number of particles by PDG code created by primary neutron interaction resulting in a point",
150 fhEPrimarys =
new TH1D(
"hE_primarys",
"Energy of primary particles", 10000, 0, 10000);
151 fhEPrimarys2 =
new TH1D(
"hE_primarys2",
"Tot. Energy of primary particles", 100000, 0, 100000);
152 fhEPrimaryNeutrons =
new TH1D(
"hE_primary_neutrons",
"Energy of primary Neutrons", 10000, 0, 10000);
153 fhErelMC =
new TH1D(
"hErelMC",
"Erel", 5000, 0, 5000);
155 "Total Light Yield of non-neutron LandPoints created by primary neutron interaction(s)",
159 fhEtot =
new TH1D(
"hE_tot",
"Total Light Yield of non-neutron LandPoints", 6000, 0, 6000);
161 "hE_secondary_neutrons",
"Energy of neutron tracks created by primary neutron interaction", 6000, 0, 6000);
162 fhMotherIDs =
new TH1D(
"hmotherIDs",
"MotherIDs", 6010, -10, 6000);
163 fhPrimaryDaughterIDs =
new TH1D(
"hprimary_daughter_IDs",
"IDs of tracks with a primary mother", 6001, -1, 6000);
164 fhMCToF =
new TH1D(
"fhMCToF",
"Energy of primary Neutron - ToF Energy from PNIPS", 2001, -1000, 1000);
166 fhNPNIPSrvsz =
new TH2D(
"fhNPNIPSrvsz",
"NPNIPS R = #sqrt(x**2+y**2) vs z", 600, 1000, 4000, 40, 0, 200);
170 fhNPNIPSxy =
new TH2D(
"fhNPNIPSxy",
"NPNIPS xy", 101, -200, 200, 101, -200, 200);
171 fhNPNIPSxy->GetXaxis()->SetTitle(
"NPNIP X [cm]");
172 fhNPNIPSxy->GetYaxis()->SetTitle(
"NPNIP Y [cm]");
174 fhnNPNIPs =
new TH1D(
"fhnNPNIPs",
"Number of NPNIPs per event", 10, -0.5, 9.5);
176 fhnProducts =
new TH1D(
"nProducts",
"Number of products created by primary neutron interaction", 20, -0.5, 19.5);
178 new TH1D(
"nProductsCharged",
179 "Number of products created by primary neutron interaction w/o gammas, neutrons, pion0",
183 fhSumProductEnergy =
new TH1D(
"SumProductEnergy",
"Sum product energy", 1000, 0, 1000);
184 fhnSecondaryNeutrons =
new TH1D(
"NumberSecondaryNeutrons",
"Number of Secondary Neutrons", 10, -0.5, 9.5);
185 fhnSecondaryProtons =
new TH1D(
"NumberSecondaryProtons",
"Number of Secondary Protons", 10, -0.5, 9.5);
188 std::array<double, 148> bins = {
189 1.00000000e-02, 1.07151931e-02, 1.14815362e-02, 1.23026877e-02, 1.31825674e-02, 1.41253754e-02, 1.51356125e-02,
190 1.62181010e-02, 1.73780083e-02, 1.86208714e-02, 1.99526231e-02, 2.13796209e-02, 2.29086765e-02, 2.45470892e-02,
191 2.63026799e-02, 2.81838293e-02, 3.01995172e-02, 3.23593657e-02, 3.46736850e-02, 3.71535229e-02, 3.98107171e-02,
192 4.26579519e-02, 4.57088190e-02, 4.89778819e-02, 5.24807460e-02, 5.62341325e-02, 6.02559586e-02, 6.45654229e-02,
193 6.91830971e-02, 7.41310241e-02, 7.94328235e-02, 8.51138038e-02, 9.12010839e-02, 9.77237221e-02, 1.04712855e-01,
194 1.12201845e-01, 1.20226443e-01, 1.28824955e-01, 1.38038426e-01, 1.47910839e-01, 1.58489319e-01, 1.69824365e-01,
195 1.81970086e-01, 1.94984460e-01, 2.08929613e-01, 2.23872114e-01, 2.39883292e-01, 2.57039578e-01, 2.75422870e-01,
196 2.95120923e-01, 3.16227766e-01, 3.38844156e-01, 3.63078055e-01, 3.89045145e-01, 4.16869383e-01, 4.46683592e-01,
197 4.78630092e-01, 5.12861384e-01, 5.49540874e-01, 5.88843655e-01, 6.30957344e-01, 6.76082975e-01, 7.24435960e-01,
198 7.76247117e-01, 8.31763771e-01, 8.91250938e-01, 9.54992586e-01, 1.02329299e+00, 1.09647820e+00, 1.17489755e+00,
199 1.25892541e+00, 1.34896288e+00, 1.44543977e+00, 1.54881662e+00, 1.65958691e+00, 1.77827941e+00, 1.90546072e+00,
200 2.04173794e+00, 2.18776162e+00, 2.34422882e+00, 2.51188643e+00, 2.69153480e+00, 2.88403150e+00, 3.09029543e+00,
201 3.31131121e+00, 3.54813389e+00, 3.80189396e+00, 4.07380278e+00, 4.36515832e+00, 4.67735141e+00, 5.01187234e+00,
202 5.37031796e+00, 5.75439937e+00, 6.16595002e+00, 6.60693448e+00, 7.07945784e+00, 7.58577575e+00, 8.12830516e+00,
203 8.70963590e+00, 9.33254301e+00, 1.00000000e+01, 1.07151931e+01, 1.14815362e+01, 1.23026877e+01, 1.31825674e+01,
204 1.41253754e+01, 1.51356125e+01, 1.62181010e+01, 1.73780083e+01, 1.86208714e+01, 1.99526231e+01, 2.13796209e+01,
205 2.29086765e+01, 2.45470892e+01, 2.63026799e+01, 2.81838293e+01, 3.01995172e+01, 3.23593657e+01, 3.46736850e+01,
206 3.71535229e+01, 3.98107171e+01, 4.26579519e+01, 4.57088190e+01, 4.89778819e+01, 5.24807460e+01, 5.62341325e+01,
207 6.02559586e+01, 6.45654229e+01, 6.91830971e+01, 7.41310241e+01, 7.94328235e+01, 8.51138038e+01, 9.12010839e+01,
208 9.77237221e+01, 1.04712855e+02, 1.12201845e+02, 1.20226443e+02, 1.28824955e+02, 1.38038426e+02, 1.47910839e+02,
209 1.58489319e+02, 1.69824365e+02, 1.81970086e+02, 1.94984460e+02, 2.08929613e+02, 2.23872114e+02, 2.39883292e+02,
214 "Deposited Energy vs Generated Light",
219 fhElossVSLightLog =
new TH2D(
"fhElossVSLightLog",
"Deposited Energy vs Generated Light", 600, -3, 3, 600, -3, 3);
221 fhThetaLight =
new TH2D(
"fhThetaLight",
"fhThetaLight", 200, -100, 100, 400, 0, 400);
227 fh3 =
new TH3D(
"hMCTracks",
"hMCTracks", 60, 1400, 1700, 50, -125, 125, 50, -125, 125);
228 fh3->SetTitle(
"NeuLAND MCTracks");
229 fh3->GetXaxis()->SetTitle(
"Z");
230 fh3->GetYaxis()->SetTitle(
"X");
231 fh3->GetZaxis()->SetTitle(
"Y");
232 FairRootManager::Instance()->Register(
"NeulandMCMon",
"MC Tracks in NeuLAND",
fh3, kTRUE);
234 fh3PNIP =
new TH3D(
"h3DNPNIPS",
"h3DNPNIPS", 60, 1400, 1700, 50, -125, 125, 50, -125, 125);
235 fh3PNIP->SetTitle(
"NeuLAND 3D NPNIPS");
236 fh3PNIP->GetXaxis()->SetTitle(
"Z");
237 fh3PNIP->GetYaxis()->SetTitle(
"X");
238 fh3PNIP->GetZaxis()->SetTitle(
"Y");
239 FairRootManager::Instance()->Register(
"Neuland3DPNIP",
"First interactions in NeuLAND",
fh3PNIP, kTRUE);
250 const auto& mcTracks =
fMCTracks.Retrieve();
253 for (
const auto& mcTrack : mcTracks)
259 if (mcTrack->GetMotherId() == -1)
279 for (
const auto& npnip : npnips)
282 const Double_t point_mag2 =
283 std::pow(npnip.GetX(), 2) + std::pow(npnip.GetY(), 2) + std::pow(npnip.GetZ(), 2);
284 const Double_t velocity_sq = point_mag2 / std::pow(npnip.GetTime(), 2);
289 auto* mcTrack = mcTracks.at(npnip.GetTrackID());
292 fhNPNIPSrvsz->Fill(npnip.GetZ(), std::sqrt(std::pow(npnip.GetX(), 2) + std::pow(npnip.GetY(), 2)));
297 std::map<Int_t, Double_t> EtotPDG;
299 Double_t EtotPrim = 0.;
301 for (
const auto& point : points)
303 const R3BMCTrack* mcTrack = mcTracks.at(point.GetTrackID());
305 Etot += point.GetLightYield() * 1000.;
314 EtotPrim += point.GetLightYield() * 1000.;
324 TString name = TString(
"Light Yield of PID ") + TString::Itoa(mcTrack->
GetPdgCode(), 10) +
325 TString(
" with a primary neutron mother");
327 new TH1D(
"hE_PDG_" + TString::Itoa(mcTrack->
GetPdgCode(), 10), name, 3000, 0, 3000);
338 EtotPDG[mcTrack->
GetPdgCode()] += point.GetLightYield() * 1000.;
340 fhElossVSLight->Fill(point.GetEnergyLoss() * 1000., point.GetLightYield() * 1000.);
342 std::log10(point.GetLightYield() * 1000.));
347 new TH2D(
"fhElossVSLightLog_" + TString::Itoa(mcTrack->
GetPdgCode(), 10),
348 "Deposited Energy vs Generated Light",
357 std::log10(point.GetLightYield() * 1000.));
365 for (
const auto& kv : EtotPDG)
369 TString name = TString(
"Sum Light Yield of PID ") + TString::Itoa(kv.first, 10);
370 fhmEtotPdg[kv.first] =
new TH1D(
"fhEtotPDG_" + TString::Itoa(kv.first, 10), name, 3000, 0, 3000);
376 TString name = TString(
"Percent Light Yield of PID ") + TString::Itoa(kv.first, 10) +
377 TString(
" to total Light Yield.");
378 fhmEtotPdgRel[kv.first] =
new TH1D(
"fhEtotPDGRel_" + TString::Itoa(kv.first, 10), name, 110, 0, 110);
392 std::vector<int> primaryNeutronIDs;
393 std::map<int, std::vector<R3BMCTrack*>> tracksByPrimaryNeutronID;
395 const Int_t nTracks = mcTracks.size();
396 for (Int_t j = 0; j < nTracks; j++)
401 primaryNeutronIDs.push_back(j);
405 for (Int_t j = 0; j < nTracks; j++)
408 for (
const Int_t primaryNeutronID : primaryNeutronIDs)
412 tracksByPrimaryNeutronID[primaryNeutronID].push_back(track);
417 for (
const Int_t primaryNeutronID : primaryNeutronIDs)
419 auto& tracks = tracksByPrimaryNeutronID[primaryNeutronID];
427 if (b->GetPdgCode() == 2112 || b->GetPdgCode() == 22 ||
428 b->GetPdgCode() == 111)
443 if (t->GetPdgCode() == 2112)
455 if (t->GetPdgCode() == 2212)
462 const Double_t sumProductEnergy = std::accumulate(tracks.begin(),
466 { return a + 1000. * (b->GetEnergy() - b->GetMass()); });
468 fhSumProductEnergy->Fill(sumProductEnergy);
470 if (fIsFullSimAnaEnabled)
472 std::map<int, int> mCountByProductPdg;
474 for (
const auto& track : tracks)
476 if (mCountByProductPdg.find(track->GetPdgCode()) == mCountByProductPdg.end())
478 mCountByProductPdg[track->GetPdgCode()] = 1;
482 mCountByProductPdg[track->GetPdgCode()]++;
485 auto& hEnergy = fhmEnergyByProductPdg[track->GetPdgCode()];
486 if (hEnergy ==
nullptr)
488 hEnergy =
new TH1D(TString::Itoa(track->GetPdgCode(), 10),
489 TString::Itoa(track->GetPdgCode(), 10),
494 hEnergy->Fill(1000. * (track->GetEnergy() - track->GetMass()));
496 const auto l =
lookup(track->GetPdgCode());
497 auto& hEnergyRed = fhmEnergyByProductPdgReduced[l];
498 if (hEnergyRed ==
nullptr)
500 hEnergyRed =
new TH1D(l.c_str(), l.c_str(), 1000, 0, 1000);
502 hEnergyRed->Fill(1000. * (track->GetEnergy() - track->GetMass()));
505 for (
const auto& kv : mCountByProductPdg)
507 const int pdg = kv.first;
508 auto& hCount = fhmCountByProductPdg[pdg];
509 if (hCount ==
nullptr)
511 hCount =
new TH1D(TString::Itoa(pdg, 10), TString::Itoa(pdg, 10), 10, 0, 10);
513 hCount->Fill(kv.second);
515 const auto l =
lookup(kv.first);
516 auto& hCountRed = fhmCountByProductPdgReduced[l];
517 if (hCountRed ==
nullptr)
519 hCountRed =
new TH1D(l.c_str(), l.c_str(), 10, 0, 10);
521 hCountRed->Fill(kv.second);
524 std::sort(tracks.begin(),
529 std::vector<int> filteredPdgCodes{ 22, 111 };
530 const TString reaction = std::accumulate(
534 [&](TString s,
const R3BMCTrack* b) -> TString
536 if (std::find(filteredPdgCodes.begin(), filteredPdgCodes.end(), b->
GetPdgCode()) !=
537 filteredPdgCodes.end())
541 return s +=
"_" + TString::Itoa(b->
GetPdgCode(), 10);
544 if (fhmEnergyByReaction[reaction] ==
nullptr)
546 fhmEnergyByReaction[reaction] =
new TH1D(reaction, reaction, 1000, 0, 1000);
548 fhmEnergyByReaction[reaction]->Fill(sumProductEnergy);
550 for (
const auto& track : tracks)
552 auto& hEnergy = fhmmEnergyByReactionByProductPdg[reaction][track->GetPdgCode()];
553 if (hEnergy ==
nullptr)
555 hEnergy =
new TH1D(TString::Itoa(track->GetPdgCode(), 10) + reaction,
556 TString::Itoa(track->GetPdgCode(), 10) + reaction,
561 hEnergy->Fill(1000. * (track->GetEnergy() - track->GetMass()));
568 ROOT::Math::PxPyPzEVector p4;
570 for (
const auto track : mcTracks)
572 if (track->GetMotherId() != -1)
576 p4 += track->GetFourMomentum();
577 m0 += track->GetMass();
579 fhErelMC->Fill((p4.M() - m0) * 1e6);
582 if (fIs3DTrackEnabled)
585 for (
const auto& point : points)
587 if (point.GetLightYield() > 0)
589 const auto pos = point.GetPosition();
590 fh3->Fill(pos.Z(), pos.X(), pos.Y(), point.GetEnergyLoss() * 1000.);
594 fh3PNIP->Reset(
"ICES");
595 for (
const auto& npnip : npnips)
597 fh3PNIP->Fill(npnip.GetZ(), npnip.GetX(), npnip.GetY(), npnip.GetTime());