109 FairRootManager* ioman = FairRootManager::Instance();
112 LOG(fatal) <<
"R3BNeulandNeutronReconstructionMon::Init: No FairRootManager";
117 if (
dynamic_cast<TClonesArray*
>(ioman->GetObject(
fInput)) ==
nullptr)
119 LOG(fatal) <<
"R3BNeulandNeutronReconstructionMon::Init No " <<
fInput <<
"!";
122 if (!TString((
dynamic_cast<TClonesArray*
>(ioman->GetObject(
fInput)))->GetClass()->GetName())
123 .EqualTo(
"R3BNeulandNeutron"))
125 LOG(fatal) <<
"R3BNeulandNeutronReconstructionMon::Init Branch " <<
fInput
126 <<
" does not contain "
127 "R3BNeulandNeutrons!";
133 if (
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"NeulandPrimaryPoints")) ==
nullptr)
135 LOG(fatal) <<
"R3BNeulandNeutronReconstructionMon::Init No NeulandPrimaryPoints!";
138 if (!TString((
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"NeulandPrimaryPoints")))->GetClass()->GetName())
139 .EqualTo(
"R3BNeulandPoint"))
141 LOG(fatal) <<
"R3BNeulandNeutronReconstructionMon::Init Branch NeulandPrimaryPoints "
142 "does not contain R3BNeulandPoint!";
148 if (
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"MCTrack")) ==
nullptr)
150 LOG(fatal) <<
"R3BNeulandNeutronReconstructionMon::Init No MCTrack!";
153 if (!TString((
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"MCTrack")))->GetClass()->GetName())
154 .EqualTo(
"R3BMCTrack"))
156 LOG(fatal) <<
"R3BNeulandNeutronReconstructionMon::Init Branch MCTrack "
157 "does not contain FairMCPoints!";
160 fMCTracks =
dynamic_cast<TClonesArray*
>(ioman->GetObject(
"MCTrack"));
162 TH1::AddDirectory(kFALSE);
164 fhScore =
new TH1D(
"fhScore",
"Neuland Neutron Reconstruction Score (lower is better)", 5000, 0, 5000);
165 fhCountN =
new TH1D(
"fhCountN",
"Number of reconstructed Neutrons", 11, -0.5, 10.5);
167 new TH1D(
"fhCountNdiff",
"Number of reacted primary Neutrons - Number of reconstructed Neutrons", 11, -5, 5);
168 fhEdiff =
new TH1D(
"fhEdiff",
"Energy of primary Neutron - Energy of reconstructed Neutron", 2001, -1000, 1000);
170 fhErel =
new TH1D(
"fhErel",
"fhErel", 5000, 0, 5000);
171 fhErelMC =
new TH1D(
"fhErelMC",
"fhErelMC", 5000, 0, 5000);
172 fhErelVSnNreco =
new TH2D(
"fhErelVSnNreco",
"fhErelVSnNreco", 5000, 0, 5000, 11, -0.5, 10.5);
174 fhErelVSnNrecoNPNIPs =
new TH2D(
"fhErelVSnNrecoNPNIPs",
"fhErelVSnNrecoNPNIPs", 5000, 0, 5000, 11, -0.5, 10.5);
176 fhNreacNreco =
new TH2D(
"fhNreacNreco",
"fhNreacNreco", 11, -0.5, 10.5, 11, -0.5, 10.5);
186 std::vector<R3BNeulandNeutron> neutrons;
187 neutrons.reserve(nReconstructedNeutrons);
188 for (Int_t i = 0; i < nReconstructedNeutrons; i++)
194 std::vector<R3BNeulandPoint> npnips;
195 npnips.reserve(nReconstructedNeutrons);
196 for (Int_t i = 0; i < nNPNIPS; i++)
200 fhCountN->Fill(nReconstructedNeutrons);
201 fhCountNdiff->Fill((Int_t)nNPNIPS - (Int_t)nReconstructedNeutrons);
245 TLorentzVector p4_reco;
246 Double_t m0_reco = 0;
248 TLorentzVector p4_mc;
251 TLorentzVector p4_npnips;
252 Double_t m0_npnips = 0;
254 for (
const auto& neutron : neutrons)
256 auto pos = neutron.GetP();
257 p4_reco += TLorentzVector(TVector3{ pos.X(), pos.Y(), pos.Z() }, neutron.GetEtot());
261 for (
const auto& npnip : npnips)
265 p4_npnips += TLorentzVector(MCTrack->
GetPx() * 1000.,
266 MCTrack->
GetPy() * 1000.,
267 MCTrack->
GetPz() * 1000.,
269 m0_npnips += MCTrack->
GetMass() * 1000.;
273 const Int_t nMCTracks =
fMCTracks->GetEntries();
274 for (Int_t i = 0; i < nMCTracks; i++)
289 p4_reco += TLorentzVector(MCTrack->
GetPx() * 1000.,
290 MCTrack->
GetPy() * 1000.,
291 MCTrack->
GetPz() * 1000.,
293 m0_reco += MCTrack->
GetMass() * 1000.;
295 p4_npnips += TLorentzVector(MCTrack->
GetPx() * 1000.,
296 MCTrack->
GetPy() * 1000.,
297 MCTrack->
GetPz() * 1000.,
299 m0_npnips += MCTrack->
GetMass() * 1000.;
303 p4_mc += TLorentzVector(MCTrack->
GetPx() * 1000.,
304 MCTrack->
GetPy() * 1000.,
305 MCTrack->
GetPz() * 1000.,
307 m0_mc += MCTrack->
GetMass() * 1000.;
310 const Double_t minv = p4_reco.Mag() - m0_reco;
311 fhErel->Fill(minv * 1000.);
316 fhmErelnReco[nReconstructedNeutrons] =
new TH1D(
"fhErel" + TString::Itoa(nReconstructedNeutrons, 10),
317 "fhErel" + TString::Itoa(nReconstructedNeutrons, 10),
322 fhmErelnReco.at(nReconstructedNeutrons)->Fill(minv * 1000.);
324 const Double_t minv_mc = p4_mc.Mag() - m0_mc;
327 const Double_t minv_npnips = p4_npnips.Mag() - m0_npnips;