LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
DUNE::NeutrinoTrackingEff Class Reference
Inheritance diagram for DUNE::NeutrinoTrackingEff:
art::EDAnalyzer art::detail::Analyzer art::detail::LegacyModule art::Observer art::ModuleBase

Public Types

using ModuleType = EDAnalyzer
 

Public Member Functions

 NeutrinoTrackingEff (fhicl::ParameterSet const &pset)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

std::string const & processName () const
 
bool wantAllEvents () const noexcept
 
bool wantEvent (ScheduleID id, Event const &e) const
 
Handle< TriggerResults > getTriggerResults (Event const &e) const
 
ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

void beginJob ()
 
void endJob ()
 
void beginRun (const art::Run &run)
 
void analyze (const art::Event &evt)
 
void processEff (const art::Event &evt)
 
void truthMatcher (detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> all_hits, std::vector< art::Ptr< recob::Hit >> track_hits, const simb::MCParticle *&MCparticle, double &Efrac, double &Ecomplet)
 
double truthLength (const detinfo::DetectorClocksData &clockData, detinfo::DetectorPropertiesData const &detProp, const simb::MCParticle *MCparticle)
 
bool insideFV (double vertex[4])
 
void doEfficiencies ()
 

Private Attributes

std::string fMCTruthModuleLabel
 
std::string fTrackModuleLabel
 
int fNeutrinoPDGcode
 
int fLeptonPDGcode
 
double fMaxNeutrinoE
 
double fMaxLeptonP
 
bool fisNeutrinoInt
 
int MC_isCC
 
int MC_incoming_PDG
 
double MC_incoming_P [4]
 
double MC_vertex [4]
 
double MC_lepton_startMomentum [4]
 
int MC_leading_protonID
 
int MC_leading_PionPlusID
 
int MC_leading_PionMinusID
 
int MC_leptonID
 
int MC_kaonID
 
int MC_michelID
 
double MC_leptonP
 
double MC_leading_PionPlusP
 
double MC_leading_ProtonP
 
double MC_leading_PionMinusP
 
double MC_kaonP
 
double MC_michelP
 
TH1D * h_Ev_den
 
TH1D * h_Ev_num
 
TH1D * h_Pmu_den
 
TH1D * h_Pmu_num
 
TH1D * h_theta_den
 
TH1D * h_theta_num
 
TH1D * h_Pproton_den
 
TH1D * h_Pproton_num
 
TH1D * h_Ppion_plus_den
 
TH1D * h_Ppion_plus_num
 
TH1D * h_Ppion_minus_den
 
TH1D * h_Ppion_minus_num
 
TH1D * h_Efrac_lepton
 
TH1D * h_Ecomplet_lepton
 
TH1D * h_Efrac_proton
 
TH1D * h_Ecomplet_proton
 
TH1D * h_Efrac_pion_plus
 
TH1D * h_Ecomplet_pion_plus
 
TH1D * h_Efrac_pion_minus
 
TH1D * h_Ecomplet_pion_minus
 
TH1D * h_trackRes_lepton
 
TH1D * h_trackRes_proton
 
TH1D * h_trackRes_pion_plus
 
TH1D * h_trackRes_pion_minus
 
TH1D * h_muon_length
 
TH1D * h_proton_length
 
TH1D * h_pionp_length
 
TH1D * h_pionm_length
 
TH1D * h_muonwtrk_length
 
TH1D * h_protonwtrk_length
 
TH1D * h_pionpwtrk_length
 
TH1D * h_pionmwtrk_length
 
TEfficiency * h_Eff_Ev = 0
 
TEfficiency * h_Eff_Pmu = 0
 
TEfficiency * h_Eff_theta = 0
 
TEfficiency * h_Eff_Pproton = 0
 
TEfficiency * h_Eff_Ppion_plus = 0
 
TEfficiency * h_Eff_Ppion_minus = 0
 
TEfficiency * h_Eff_Lmuon = 0
 
TEfficiency * h_Eff_Lproton = 0
 
TEfficiency * h_Eff_Lpion_plus = 0
 
TEfficiency * h_Eff_Lpion_minus = 0
 
TH1D * h_Pkaon_den
 
TH1D * h_Pkaon_num
 
TH1D * h_Pmichel_e_den
 
TH1D * h_Pmichel_e_num
 
TH1D * h_Efrac_kaon
 
TH1D * h_Ecomplet_kaon
 
TH1D * h_trackRes_kaon
 
TH1D * h_Efrac_michel
 
TH1D * h_Ecomplet_michel
 
TH1D * h_trackRes_michel
 
TH1D * h_kaon_length
 
TH1D * h_michel_length
 
TH1D * h_kaonwtrk_length
 
TH1D * h_michelwtrk_length
 
TEfficiency * h_Eff_Pkaon = 0
 
TEfficiency * h_Eff_Pmichel = 0
 
TEfficiency * h_Eff_Lkaon = 0
 
TEfficiency * h_Eff_Lmichel = 0
 
float fFidVolCutX
 
float fFidVolCutY
 
float fFidVolCutZ
 
float fFidVolXmin
 
float fFidVolXmax
 
float fFidVolYmin
 
float fFidVolYmax
 
float fFidVolZmin
 
float fFidVolZmax
 
double fDriftVelocity
 
art::ServiceHandle< geo::Geometry const > geom
 
geo::WireReadoutGeom const & wireReadoutGeom = art::ServiceHandle<geo::WireReadout>()->Get()
 

Detailed Description

Definition at line 52 of file NeutrinoTrackingEff_module.cc.

Member Typedef Documentation

Definition at line 22 of file EDAnalyzer.h.

Constructor & Destructor Documentation

DUNE::NeutrinoTrackingEff::NeutrinoTrackingEff ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 189 of file NeutrinoTrackingEff_module.cc.

References e, fDriftVelocity, fFidVolCutX, fFidVolCutY, fFidVolCutZ, fisNeutrinoInt, fLeptonPDGcode, fMaxLeptonP, fMaxNeutrinoE, fMCTruthModuleLabel, fNeutrinoPDGcode, fTrackModuleLabel, and fhicl::ParameterSet::get().

189  : EDAnalyzer(p)
190  {
191  fMCTruthModuleLabel = p.get<std::string>("MCTruthModuleLabel");
192  fTrackModuleLabel = p.get<std::string>("TrackModuleLabel");
193  fisNeutrinoInt = p.get<bool>("isNeutrinoInt");
194  fLeptonPDGcode = p.get<int>("LeptonPDGcode");
195  fNeutrinoPDGcode = p.get<int>("NeutrinoPDGcode");
196  fMaxNeutrinoE = p.get<double>("MaxNeutrinoE");
197  fMaxLeptonP = p.get<double>("MaxLeptonP");
198  fFidVolCutX = p.get<float>("FidVolCutX");
199  fFidVolCutY = p.get<float>("FidVolCutY");
200  fFidVolCutZ = p.get<float>("FidVolCutZ");
201 
202  auto const detProp =
204  fDriftVelocity = detProp.DriftVelocity() * 1e-3; // cm/ns
205  }
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.cc:6
Float_t e
Definition: plot.C:35

Member Function Documentation

void DUNE::NeutrinoTrackingEff::analyze ( const art::Event evt)
private

Definition at line 423 of file NeutrinoTrackingEff_module.cc.

References art::Event::isRealData(), and processEff().

424  {
425  if (event.isRealData()) return;
426 
427  processEff(event);
428  }
void processEff(const art::Event &evt)
Event finding and building.
void DUNE::NeutrinoTrackingEff::beginJob ( )
privatevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 207 of file NeutrinoTrackingEff_module.cc.

References fFidVolCutX, fFidVolCutY, fFidVolCutZ, fFidVolXmax, fFidVolXmin, fFidVolYmax, fFidVolYmin, fFidVolZmax, fFidVolZmin, fMaxLeptonP, fMaxNeutrinoE, h_Ecomplet_kaon, h_Ecomplet_lepton, h_Ecomplet_michel, h_Ecomplet_pion_minus, h_Ecomplet_pion_plus, h_Ecomplet_proton, h_Efrac_kaon, h_Efrac_lepton, h_Efrac_michel, h_Efrac_pion_minus, h_Efrac_pion_plus, h_Efrac_proton, h_Ev_den, h_Ev_num, h_kaon_length, h_kaonwtrk_length, h_michel_length, h_michelwtrk_length, h_muon_length, h_muonwtrk_length, h_pionm_length, h_pionmwtrk_length, h_pionp_length, h_pionpwtrk_length, h_Pkaon_den, h_Pkaon_num, h_Pmichel_e_den, h_Pmichel_e_num, h_Pmu_den, h_Pmu_num, h_Ppion_minus_den, h_Ppion_minus_num, h_Ppion_plus_den, h_Ppion_plus_num, h_Pproton_den, h_Pproton_num, h_proton_length, h_protonwtrk_length, h_theta_den, h_theta_num, h_trackRes_kaon, h_trackRes_lepton, h_trackRes_michel, h_trackRes_pion_minus, h_trackRes_pion_plus, and h_trackRes_proton.

208  {
209  std::cout << "job begin..." << std::endl;
210  auto const* geo = lar::providerFrom<geo::Geometry>();
211  // Define histogram boundaries (cm).
212  // For now only draw cryostat=0.
213  double minx = 1e9;
214  double maxx = -1e9;
215  double miny = 1e9;
216  double maxy = -1e9;
217  double minz = 1e9;
218  double maxz = -1e9;
219  for (auto const& tpc : geo->Iterate<geo::TPCGeo>(geo::CryostatID{0})) {
220  auto const world = tpc.GetCenter();
221  if (minx > world.X() - tpc.HalfWidth()) minx = world.X() - tpc.HalfWidth();
222  if (maxx < world.X() + tpc.HalfWidth()) maxx = world.X() + tpc.HalfWidth();
223  if (miny > world.Y() - tpc.HalfHeight()) miny = world.Y() - tpc.HalfHeight();
224  if (maxy < world.Y() + tpc.HalfHeight()) maxy = world.Y() + tpc.HalfHeight();
225  if (minz > world.Z() - tpc.Length() / 2.) minz = world.Z() - tpc.Length() / 2.;
226  if (maxz < world.Z() + tpc.Length() / 2.) maxz = world.Z() + tpc.Length() / 2.;
227  }
228 
229  fFidVolXmin = minx + fFidVolCutX;
230  fFidVolXmax = maxx - fFidVolCutX;
231  fFidVolYmin = miny + fFidVolCutY;
232  fFidVolYmax = maxy - fFidVolCutY;
233  fFidVolZmin = minz + fFidVolCutZ;
234  fFidVolZmax = maxz - fFidVolCutZ;
235 
236  std::cout << "Fiducial volume:"
237  << "\n"
238  << fFidVolXmin << "\t< x <\t" << fFidVolXmax << "\n"
239  << fFidVolYmin << "\t< y <\t" << fFidVolYmax << "\n"
240  << fFidVolZmin << "\t< z <\t" << fFidVolZmax << "\n";
241 
243 
244  double E_bins[21] = {0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4, 4.5, 5.0,
245  5.5, 6.0, 7.0, 8.0, 10.0, 12.0, 14.0, 17.0, 20.0, 25.0};
246  double theta_bin[44] = {0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10.,
247  11., 12., 13., 14., 15., 16., 17., 18., 19., 20., 22.,
248  24., 26., 28., 30., 32., 34., 36., 38., 40., 42., 44.,
249  46., 48., 50., 55., 60., 65., 70., 75., 80., 85., 90.};
250  double Pbins[18] = {
251  0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.5, 3.0};
252 
253  for (int i = 0; i < 21; ++i)
254  E_bins[i] *= fMaxNeutrinoE / 25.;
255  for (int i = 0; i < 18; ++i)
256  Pbins[i] *= fMaxLeptonP / 3.0;
257 
258  h_Ev_den = tfs->make<TH1D>(
259  "h_Ev_den", "Neutrino Energy; Neutrino Energy (GeV); Tracking Efficiency", 20, E_bins);
260  h_Ev_num = tfs->make<TH1D>(
261  "h_Ev_num", "Neutrino Energy; Neutrino Energy (GeV); Tracking Efficiency", 20, E_bins);
262  h_Pmu_den = tfs->make<TH1D>(
263  "h_Pmu_den", "Muon Momentum; Muon Momentum (GeV); Tracking Efficiency", 20, E_bins);
264  h_Pmu_num = tfs->make<TH1D>(
265  "h_Pmu_num", "Muon Momentum; Muon Momentum (GeV); Tracking Efficiency", 20, E_bins);
266  h_theta_den =
267  tfs->make<TH1D>("h_theta_den",
268  "Theta; Theta w.r.t beam direction (Degrees); Tracking Efficiency",
269  43,
270  theta_bin);
271  h_theta_num =
272  tfs->make<TH1D>("h_theta_num",
273  "Theta; Theta w.r.t beam direction (Degrees); Tracking Efficiency",
274  43,
275  theta_bin);
276  h_Pproton_den = tfs->make<TH1D>(
277  "h_Pproton_den", "Protons; Proton Momentum (GeV); Tracking Efficiency", 17, Pbins);
278  h_Pproton_num = tfs->make<TH1D>(
279  "h_Pproton_num", "Protons; Proton Momentum (GeV); Tracking Efficiency", 17, Pbins);
280  h_Ppion_plus_den = tfs->make<TH1D>(
281  "h_Ppion_plus_den", "Pions Plus; Pion Momentum (GeV); Tracking Efficiency", 17, Pbins);
282  h_Ppion_plus_num = tfs->make<TH1D>(
283  "h_Ppion_plus_num", "Pions Plus; Pion Momentum (GeV); Tracking Efficiency", 17, Pbins);
284  h_Ppion_minus_den = tfs->make<TH1D>(
285  "h_Ppion_minus_den", "Pions Minus; Pion Momentum (GeV); Tracking Efficiency", 17, Pbins);
286  h_Ppion_minus_num = tfs->make<TH1D>(
287  "h_Ppion_minus_num", "Pions Minus; Pion Momentum (GeV); Tracking Efficiency", 17, Pbins);
288  h_Ev_den->Sumw2();
289  h_Ev_num->Sumw2();
290  h_Pmu_den->Sumw2();
291  h_Pmu_num->Sumw2();
292  h_theta_den->Sumw2();
293  h_theta_num->Sumw2();
294  h_Pproton_den->Sumw2();
295  h_Pproton_num->Sumw2();
296  h_Ppion_plus_den->Sumw2();
297  h_Ppion_plus_num->Sumw2();
298  h_Ppion_minus_den->Sumw2();
299  h_Ppion_minus_num->Sumw2();
300 
301  h_Efrac_lepton = tfs->make<TH1D>("h_Efrac_lepton", "Efrac Lepton; Track Purity;", 60, 0, 1.2);
303  tfs->make<TH1D>("h_Ecomplet_lepton", "Ecomplet Lepton; Track Completeness;", 60, 0, 1.2);
304  h_Efrac_proton = tfs->make<TH1D>("h_Efrac_proton", "Efrac Proton; Track Purity;", 60, 0, 1.2);
306  tfs->make<TH1D>("h_Ecomplet_proton", "Ecomplet Proton; Track Completeness;", 60, 0, 1.2);
308  tfs->make<TH1D>("h_Efrac_pion_plus", "Efrac Pion +; Track Purity;", 60, 0, 1.2);
310  tfs->make<TH1D>("h_Ecomplet_pion_plus", "Ecomplet Pion +; Track Completeness;", 60, 0, 1.2);
312  tfs->make<TH1D>("h_Efrac_pion_minus", "Efrac Pion -; Track Purity;", 60, 0, 1.2);
314  tfs->make<TH1D>("h_Ecomplet_pion_minus", "Ecomplet Pion -; Track Completeness;", 60, 0, 1.2);
315  h_trackRes_lepton = tfs->make<TH1D>(
316  "h_trackRes_lepton", "Muon Residual; Truth length - Reco length (cm);", 200, -100, 100);
317  h_trackRes_proton = tfs->make<TH1D>(
318  "h_trackRes_proton", "Proton Residual; Truth length - Reco length (cm);", 200, -100, 100);
319  h_trackRes_pion_plus = tfs->make<TH1D>(
320  "h_trackRes_pion_plus", "Pion + Residual; Truth length - Reco length (cm);", 200, -100, 100);
321  h_trackRes_pion_minus = tfs->make<TH1D>(
322  "h_trackRes_pion_minus", "Pion - Residual; Truth length - Reco length (cm);", 200, -100, 100);
323  h_Efrac_lepton->Sumw2();
324  h_Ecomplet_lepton->Sumw2();
325  h_Efrac_proton->Sumw2();
326  h_Ecomplet_proton->Sumw2();
327  h_Efrac_pion_plus->Sumw2();
328  h_Ecomplet_pion_plus->Sumw2();
329  h_Efrac_pion_minus->Sumw2();
330  h_Ecomplet_pion_minus->Sumw2();
331  h_trackRes_lepton->Sumw2();
332  h_trackRes_proton->Sumw2();
333  h_trackRes_pion_plus->Sumw2();
334  h_trackRes_pion_minus->Sumw2();
335 
336  h_muon_length =
337  tfs->make<TH1D>("h_muon_length", "Muon Length; Muon Truth Length (cm)", 40, 0, 100);
339  tfs->make<TH1D>("h_proton_length", "Proton Length; Proton Truth Length (cm)", 40, 0, 100);
341  tfs->make<TH1D>("h_pionp_length", "Pion + Length; Pion^{+} Truth Length (cm)", 40, 0, 100);
343  tfs->make<TH1D>("h_pionm_length", "Pion - Length; Pion^{-} Truth Length (cm)", 40, 0, 100);
344 
346  tfs->make<TH1D>("h_muonwtrk_length", "Muon Length; Muon Truth Length (cm)", 40, 0, 100);
348  tfs->make<TH1D>("h_protonwtrk_length", "Proton Length; Proton Truth Length (cm)", 40, 0, 100);
349  h_pionpwtrk_length = tfs->make<TH1D>(
350  "h_pionpwtrk_length", "Pion + Length; Pion^{+} Truth Length (cm)", 40, 0, 100);
351  h_pionmwtrk_length = tfs->make<TH1D>(
352  "h_pionmwtrk_length", "Pion - Length; Pion^{-} Truth Length (cm)", 40, 0, 100);
353 
354  h_muon_length->Sumw2();
355  h_muonwtrk_length->Sumw2();
356  h_proton_length->Sumw2();
357  h_protonwtrk_length->Sumw2();
358  h_pionp_length->Sumw2();
359  h_pionpwtrk_length->Sumw2();
360  h_pionm_length->Sumw2();
361  h_pionmwtrk_length->Sumw2();
362 
363  h_Pkaon_den =
364  tfs->make<TH1D>("h_Pkaon_den", "Kaon; Kaon Momentum (GeV); Tracking Efficiency", 17, Pbins);
365  h_Pkaon_num =
366  tfs->make<TH1D>("h_Pkaon_num", "Kaon; Kaon Momentum (GeV); Tracking Efficiency", 17, Pbins);
368  tfs->make<TH1D>("h_Pmichel_e_den",
369  "Michel Electron; Michele e Momentum (GeV); Tracking Efficiency",
370  17,
371  Pbins);
373  tfs->make<TH1D>("h_Pmichel_e_num",
374  "Michel Electron; Michele e Momentum (GeV); Tracking Efficiency",
375  17,
376  Pbins);
377  h_Pkaon_den->Sumw2();
378  h_Pkaon_num->Sumw2();
379  h_Pmichel_e_den->Sumw2();
380  h_Pmichel_e_num->Sumw2();
381  h_Efrac_kaon = tfs->make<TH1D>("h_Efrac_kaon", "Efrac Kaon; Track Purity;", 60, 0, 1.2);
383  tfs->make<TH1D>("h_Ecomplet_kaon", "Ecomplet Kaon; Track Completeness;", 60, 0, 1.2);
384  h_trackRes_kaon = tfs->make<TH1D>(
385  "h_trackRes_kaon", "Kaon Residual; Truth length - Reco length (cm);", 200, -100, 100);
387  tfs->make<TH1D>("h_Efrac_michel", "Efrac Michel; Track Energy fraction;", 60, 0, 1.2);
389  tfs->make<TH1D>("h_Ecomplet_michel", "Ecomplet Michel; Track Completeness;", 60, 0, 1.2);
390  h_trackRes_michel = tfs->make<TH1D>(
391  "h_trackRes_michel", "Michel Residual; Truth length - Reco length (cm);", 200, -100, 100);
392  h_kaon_length =
393  tfs->make<TH1D>("h_kaon_length", "Kaon Length; Kaon Truth Length (cm)", 40, 0, 100);
395  tfs->make<TH1D>("h_kaonwtrk_length", "Kaon Length; Kaon Truth Length (cm)", 40, 0, 100);
397  tfs->make<TH1D>("h_michel_length", "Michel Length; Michel e Truth Length (cm)", 40, 0, 100);
398  h_michelwtrk_length = tfs->make<TH1D>(
399  "h_michelwtrk_length", "Michel Length; Michel e Truth Length (cm)", 40, 0, 100);
400 
401  h_Efrac_kaon->Sumw2();
402  h_Ecomplet_kaon->Sumw2();
403  h_trackRes_kaon->Sumw2();
404  h_Efrac_michel->Sumw2();
405  h_Ecomplet_michel->Sumw2();
406  h_trackRes_michel->Sumw2();
407  h_kaon_length->Sumw2();
408  h_kaonwtrk_length->Sumw2();
409  h_michel_length->Sumw2();
410  h_michelwtrk_length->Sumw2();
411  }
Geometry information for a single TPC.
Definition: TPCGeo.h:33
ROOT libraries.
The data type to uniquely identify a cryostat.
Definition: geo_types.h:187
void DUNE::NeutrinoTrackingEff::beginRun ( const art::Run run)
private

Definition at line 418 of file NeutrinoTrackingEff_module.cc.

419  {
420  mf::LogInfo("NeutrinoTrackingEff") << "begin run..." << std::endl;
421  }
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Analyzer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 25 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

26  {
27  setupQueues(resources);
28  ProcessingFrame const frame{ScheduleID{}};
29  beginJobWithFrame(frame);
30  }
virtual void beginJobWithFrame(ProcessingFrame const &)=0
virtual void setupQueues(SharedResources const &)=0
bool art::detail::Analyzer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 68 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

69  {
70  ProcessingFrame const frame{mc.scheduleID()};
71  beginRunWithFrame(std::as_const(rp).makeRun(mc), frame);
72  return true;
73  }
virtual void beginRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 84 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

85  {
86  ProcessingFrame const frame{mc.scheduleID()};
87  beginSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
88  return true;
89  }
virtual void beginSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
void DUNE::NeutrinoTrackingEff::doEfficiencies ( )
private

Definition at line 994 of file NeutrinoTrackingEff_module.cc.

References DEFINE_ART_MODULE, h_Eff_Ev, h_Eff_Lkaon, h_Eff_Lmichel, h_Eff_Lmuon, h_Eff_Lpion_minus, h_Eff_Lpion_plus, h_Eff_Lproton, h_Eff_Pkaon, h_Eff_Pmichel, h_Eff_Pmu, h_Eff_Ppion_minus, h_Eff_Ppion_plus, h_Eff_Pproton, h_Eff_theta, h_Ev_den, h_Ev_num, h_kaon_length, h_kaonwtrk_length, h_michel_length, h_michelwtrk_length, h_muon_length, h_muonwtrk_length, h_pionm_length, h_pionmwtrk_length, h_pionp_length, h_pionpwtrk_length, h_Pkaon_den, h_Pkaon_num, h_Pmichel_e_den, h_Pmichel_e_num, h_Pmu_den, h_Pmu_num, h_Ppion_minus_den, h_Ppion_minus_num, h_Ppion_plus_den, h_Ppion_plus_num, h_Pproton_den, h_Pproton_num, h_proton_length, h_protonwtrk_length, h_theta_den, and h_theta_num.

Referenced by endJob().

995  {
997 
998  if (TEfficiency::CheckConsistency(*h_Ev_num, *h_Ev_den)) {
999  h_Eff_Ev = tfs->make<TEfficiency>(*h_Ev_num, *h_Ev_den);
1000  TGraphAsymmErrors* grEff_Ev = h_Eff_Ev->CreateGraph();
1001  grEff_Ev->Write("grEff_Ev");
1002  h_Eff_Ev->Write("h_Eff_Ev");
1003  }
1004  if (TEfficiency::CheckConsistency(*h_Pmu_num, *h_Pmu_den)) {
1005  h_Eff_Pmu = tfs->make<TEfficiency>(*h_Pmu_num, *h_Pmu_den);
1006  TGraphAsymmErrors* grEff_Pmu = h_Eff_Pmu->CreateGraph();
1007  grEff_Pmu->Write("grEff_Pmu");
1008  h_Eff_Pmu->Write("h_Eff_Pmu");
1009  }
1010  if (TEfficiency::CheckConsistency(*h_theta_num, *h_theta_den)) {
1011  h_Eff_theta = tfs->make<TEfficiency>(*h_theta_num, *h_theta_den);
1012  TGraphAsymmErrors* grEff_theta = h_Eff_theta->CreateGraph();
1013  grEff_theta->Write("grEff_theta");
1014  h_Eff_theta->Write("h_Eff_theta");
1015  }
1016  if (TEfficiency::CheckConsistency(*h_Pproton_num, *h_Pproton_den)) {
1017  h_Eff_Pproton = tfs->make<TEfficiency>(*h_Pproton_num, *h_Pproton_den);
1018  TGraphAsymmErrors* grEff_Pproton = h_Eff_Pproton->CreateGraph();
1019  grEff_Pproton->Write("grEff_Pproton");
1020  h_Eff_Pproton->Write("h_Eff_Pproton");
1021  }
1022  if (TEfficiency::CheckConsistency(*h_Ppion_plus_num, *h_Ppion_plus_den)) {
1023  h_Eff_Ppion_plus = tfs->make<TEfficiency>(*h_Ppion_plus_num, *h_Ppion_plus_den);
1024  TGraphAsymmErrors* grEff_Ppion_plus = h_Eff_Ppion_plus->CreateGraph();
1025  grEff_Ppion_plus->Write("grEff_Ppion_plus");
1026  h_Eff_Ppion_plus->Write("h_Eff_Ppion_plus");
1027  }
1028  if (TEfficiency::CheckConsistency(*h_Ppion_minus_num, *h_Ppion_minus_den)) {
1029  h_Eff_Ppion_minus = tfs->make<TEfficiency>(*h_Ppion_minus_num, *h_Ppion_minus_den);
1030  TGraphAsymmErrors* grEff_Ppion_minus = h_Eff_Ppion_minus->CreateGraph();
1031  grEff_Ppion_minus->Write("grEff_Ppion_minus");
1032  h_Eff_Ppion_minus->Write("h_Eff_Ppion_minus");
1033  }
1034  if (TEfficiency::CheckConsistency(*h_muonwtrk_length, *h_muon_length)) {
1035  h_Eff_Lmuon = tfs->make<TEfficiency>(*h_muonwtrk_length, *h_muon_length);
1036  TGraphAsymmErrors* grEff_Lmuon = h_Eff_Lmuon->CreateGraph();
1037  grEff_Lmuon->Write("grEff_Lmuon");
1038  h_Eff_Lmuon->Write("h_Eff_Lmuon");
1039  }
1040  if (TEfficiency::CheckConsistency(*h_protonwtrk_length, *h_proton_length)) {
1041  h_Eff_Lproton = tfs->make<TEfficiency>(*h_protonwtrk_length, *h_proton_length);
1042  TGraphAsymmErrors* grEff_Lproton = h_Eff_Lproton->CreateGraph();
1043  grEff_Lproton->Write("grEff_Lproton");
1044  h_Eff_Lproton->Write("h_Eff_Lproton");
1045  }
1046  if (TEfficiency::CheckConsistency(*h_pionpwtrk_length, *h_pionp_length)) {
1047  h_Eff_Lpion_plus = tfs->make<TEfficiency>(*h_pionpwtrk_length, *h_pionp_length);
1048  TGraphAsymmErrors* grEff_Lpion_plus = h_Eff_Lpion_plus->CreateGraph();
1049  grEff_Lpion_plus->Write("grEff_Lpion_plus");
1050  h_Eff_Lpion_plus->Write("h_Eff_Lpion_plus");
1051  }
1052  if (TEfficiency::CheckConsistency(*h_pionpwtrk_length, *h_pionp_length)) {
1053  h_Eff_Lpion_minus = tfs->make<TEfficiency>(*h_pionmwtrk_length, *h_pionm_length);
1054  TGraphAsymmErrors* grEff_Lpion_minus = h_Eff_Lpion_minus->CreateGraph();
1055  grEff_Lpion_minus->Write("grEff_Lpion_minus");
1056  h_Eff_Lpion_minus->Write("h_Eff_Lpion_minus");
1057  }
1058  if (TEfficiency::CheckConsistency(*h_Pkaon_num, *h_Pkaon_den)) {
1059  h_Eff_Pkaon = tfs->make<TEfficiency>(*h_Pkaon_num, *h_Pkaon_den);
1060  TGraphAsymmErrors* grEff_Pkaon = h_Eff_Pkaon->CreateGraph();
1061  grEff_Pkaon->Write("grEff_Pkaon");
1062  h_Eff_Pkaon->Write("h_Eff_Pkaon");
1063  }
1064  if (TEfficiency::CheckConsistency(*h_kaonwtrk_length, *h_kaon_length)) {
1065  h_Eff_Lkaon = tfs->make<TEfficiency>(*h_kaonwtrk_length, *h_kaon_length);
1066  TGraphAsymmErrors* grEff_Lkaon = h_Eff_Lkaon->CreateGraph();
1067  grEff_Lkaon->Write("grEff_Lkaon");
1068  h_Eff_Lkaon->Write("h_Eff_Lkaon");
1069  }
1070  if (TEfficiency::CheckConsistency(*h_Pmichel_e_num, *h_Pmichel_e_den)) {
1071  h_Eff_Pmichel = tfs->make<TEfficiency>(*h_Pmichel_e_num, *h_Pmichel_e_den);
1072  TGraphAsymmErrors* grEff_Pmichel = h_Eff_Pmichel->CreateGraph();
1073  grEff_Pmichel->Write("grEff_Pmichel");
1074  h_Eff_Pmichel->Write("h_Eff_Pmichel");
1075  }
1076  if (TEfficiency::CheckConsistency(*h_michelwtrk_length, *h_michel_length)) {
1077  h_Eff_Lmichel = tfs->make<TEfficiency>(*h_michelwtrk_length, *h_michel_length);
1078  TGraphAsymmErrors* grEff_Lmichel = h_Eff_Lmichel->CreateGraph();
1079  grEff_Lmichel->Write("grEff_Lmichel");
1080  h_Eff_Lmichel->Write("h_Eff_Lmichel");
1081  }
1082  }
void art::detail::Analyzer::doEndJob ( )
inherited

Definition at line 33 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

34  {
35  ProcessingFrame const frame{ScheduleID{}};
36  endJobWithFrame(frame);
37  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 76 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

77  {
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(std::as_const(rp).makeRun(mc), frame);
80  return true;
81  }
virtual void endRunWithFrame(Run const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 92 of file Analyzer.cc.

References art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

93  {
94  ProcessingFrame const frame{mc.scheduleID()};
95  endSubRunWithFrame(std::as_const(srp).makeSubRun(mc), frame);
96  return true;
97  }
virtual void endSubRunWithFrame(SubRun const &, ProcessingFrame const &)=0
bool art::detail::Analyzer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited

Definition at line 100 of file Analyzer.cc.

References e, and art::ModuleContext::scheduleID().

Referenced by art::detail::Analyzer::Analyzer().

105  {
106  auto const e = std::as_const(ep).makeEvent(mc);
107  if (wantEvent(mc.scheduleID(), e)) {
108  ++counts_run;
109  ProcessingFrame const frame{mc.scheduleID()};
110  analyzeWithFrame(e, frame);
111  ++counts_passed;
112  }
113  return true;
114  }
bool wantEvent(ScheduleID id, Event const &e) const
Definition: Observer.cc:63
Float_t e
Definition: plot.C:35
virtual void analyzeWithFrame(Event const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 47 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

48  {
49  ProcessingFrame const frame{ScheduleID{}};
51  }
TFile fb("Li6.root")
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 61 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

62  {
63  ProcessingFrame const frame{ScheduleID{}};
65  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Analyzer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 40 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

41  {
42  ProcessingFrame const frame{ScheduleID{}};
44  }
TFile fb("Li6.root")
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
void art::detail::Analyzer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 54 of file Analyzer.cc.

Referenced by art::detail::Analyzer::Analyzer().

55  {
56  ProcessingFrame const frame{ScheduleID{}};
58  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void DUNE::NeutrinoTrackingEff::endJob ( )
privatevirtual

Reimplemented from art::EDAnalyzer.

Definition at line 413 of file NeutrinoTrackingEff_module.cc.

References doEfficiencies().

414  {
415  doEfficiencies();
416  }
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
Handle< TriggerResults > art::Observer::getTriggerResults ( Event const &  e) const
protectedinherited

Definition at line 75 of file Observer.cc.

References art::ProductRetriever::get(), and art::Observer::selectors_.

Referenced by art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

76  {
77  if (selectors_) {
78  return selectors_->getOneTriggerResults(e);
79  }
80 
81  // The following applies for cases where no SelectEvents entries
82  // exist.
83  Handle<TriggerResults> h;
84  if (e.get(empty_process_name, h)) {
85  return h;
86  }
87  return Handle<TriggerResults>{};
88  }
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79
bool DUNE::NeutrinoTrackingEff::insideFV ( double  vertex[4])
private

Definition at line 984 of file NeutrinoTrackingEff_module.cc.

References fFidVolXmin, fFidVolYmax, fFidVolYmin, fFidVolZmax, fFidVolZmin, x, y, and z.

Referenced by processEff().

985  {
986  double const x = vertex[0];
987  double const y = vertex[1];
988  double const z = vertex[2];
989 
990  return x > fFidVolXmin && x < fFidVolXmax && y > fFidVolYmin && y < fFidVolYmax &&
991  z > fFidVolZmin && z < fFidVolZmax;
992  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Double_t z
Definition: plot.C:276
vertex reconstruction
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void DUNE::NeutrinoTrackingEff::processEff ( const art::Event evt)
private

save FS particles

Definition at line 430 of file NeutrinoTrackingEff_module.cc.

References sim::ParticleList::begin(), simb::MCNeutrino::CCNC(), sim::ParticleList::end(), art::fill_ptr_vector(), fisNeutrinoInt, fLeptonPDGcode, fMaxNeutrinoE, fMCTruthModuleLabel, fNeutrinoPDGcode, fTrackModuleLabel, art::ProductRetriever::getByLabel(), simb::MCTruth::GetNeutrino(), h_Ecomplet_kaon, h_Ecomplet_lepton, h_Ecomplet_michel, h_Ecomplet_pion_minus, h_Ecomplet_pion_plus, h_Ecomplet_proton, h_Efrac_kaon, h_Efrac_lepton, h_Efrac_michel, h_Efrac_pion_minus, h_Efrac_pion_plus, h_Efrac_proton, h_Ev_den, h_Ev_num, h_kaon_length, h_kaonwtrk_length, h_michel_length, h_michelwtrk_length, h_muon_length, h_muonwtrk_length, h_pionm_length, h_pionmwtrk_length, h_pionp_length, h_pionpwtrk_length, h_Pkaon_den, h_Pkaon_num, h_Pmichel_e_den, h_Pmichel_e_num, h_Pmu_den, h_Pmu_num, h_Ppion_minus_den, h_Ppion_minus_num, h_Ppion_plus_den, h_Ppion_plus_num, h_Pproton_den, h_Pproton_num, h_proton_length, h_protonwtrk_length, h_theta_den, h_theta_num, h_trackRes_kaon, h_trackRes_lepton, h_trackRes_michel, h_trackRes_pion_minus, h_trackRes_pion_plus, h_trackRes_proton, insideFV(), recob::Track::Length(), MC_incoming_P, MC_incoming_PDG, MC_isCC, MC_kaonID, MC_kaonP, MC_leading_PionMinusID, MC_leading_PionMinusP, MC_leading_PionPlusID, MC_leading_PionPlusP, MC_leading_protonID, MC_leading_ProtonP, MC_lepton_startMomentum, MC_leptonID, MC_leptonP, MC_michelID, MC_michelP, MC_vertex, MF_LOG_DEBUG, simb::MCParticle::Momentum(), simb::MCParticle::Mother(), simb::MCTruth::NeutrinoSet(), simb::MCNeutrino::Nu(), cheat::ParticleInventoryService::ParticleList(), simb::MCParticle::PdgCode(), simb::MCParticle::Position(), simb::MCParticle::Process(), track, simb::MCParticle::TrackId(), truthLength(), and truthMatcher().

Referenced by analyze().

431  {
432  // Save neutrino's interaction info
434  event.getByLabel(fMCTruthModuleLabel, MCtruthHandle);
435  std::vector<art::Ptr<simb::MCTruth>> MCtruthlist;
436  art::fill_ptr_vector(MCtruthlist, MCtruthHandle);
437  art::Ptr<simb::MCTruth> MCtruth;
438 
439  //For now assume that there is only one neutrino interaction...
440  MCtruth = MCtruthlist[0];
441  if (MCtruth->NeutrinoSet()) {
442  simb::MCNeutrino nu = MCtruth->GetNeutrino();
443  if (nu.CCNC() == 0)
444  MC_isCC = 1;
445  else if (nu.CCNC() == 1)
446  MC_isCC = 0;
447  simb::MCParticle neutrino = nu.Nu();
448  MC_incoming_PDG = nu.Nu().PdgCode();
449  const TLorentzVector& nu_momentum = nu.Nu().Momentum(0);
450  nu_momentum.GetXYZT(MC_incoming_P);
451  const TLorentzVector& vertex = neutrino.Position(0);
452  vertex.GetXYZT(MC_vertex);
453  }
454 
456 
457  double tmp_leadingPionPlusE = 0.0;
458  double tmp_leadingPionMinusE = 0.0;
459  double tmp_leadingProtonE = 0.0;
460 
461  simb::MCParticle* MClepton = nullptr;
462  simb::MCParticle* MCproton = nullptr;
463  simb::MCParticle* MCpion_plus = nullptr;
464  simb::MCParticle* MCpion_minus = nullptr;
465  simb::MCParticle* MCkaon = nullptr;
466  simb::MCParticle* MCmichel = nullptr;
467 
469  const sim::ParticleList& plist = pi_serv->ParticleList();
470  simb::MCParticle* particle = 0;
471  int i = 0; // particle index
472 
473  auto const clockData =
475  auto const detProp =
477 
478  for (sim::ParticleList::const_iterator ipar = plist.begin(); ipar != plist.end(); ++ipar) {
479  particle = ipar->second;
480  if (particle->PdgCode() == fLeptonPDGcode && particle->Mother() == 0) { //primary lepton
481  const TLorentzVector& lepton_momentum = particle->Momentum(0);
482  lepton_momentum.GetXYZT(MC_lepton_startMomentum);
483  MC_leptonID = particle->TrackId();
484  MC_leptonP = sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
485  pow(particle->Momentum().Pz(), 2));
486  MClepton = particle;
487  }
488  if (particle->Mother() == 0) { //save primary particle i.e. from the neutrino interaction
489  //save leading pion and proton
490  if (particle->PdgCode() == 2212) {
491  if (particle->Momentum().E() > tmp_leadingProtonE) {
492  tmp_leadingProtonE = particle->Momentum().E();
493  MC_leading_protonID = particle->TrackId();
495  sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
496  pow(particle->Momentum().Pz(), 2));
497  MCproton = particle;
498  }
499  }
500  else if (particle->PdgCode() == 211) {
501  if (particle->Momentum().E() > tmp_leadingPionPlusE) {
502  tmp_leadingPionPlusE = particle->Momentum().E();
503  MC_leading_PionPlusID = particle->TrackId();
505  sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
506  pow(particle->Momentum().Pz(), 2));
507  MCpion_plus = particle;
508  }
509  }
510  else if (particle->PdgCode() == -211) {
511  if (particle->Momentum().E() > tmp_leadingPionMinusE) {
512  tmp_leadingPionMinusE = particle->Momentum().E();
513  MC_leading_PionMinusID = particle->TrackId();
515  sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
516  pow(particle->Momentum().Pz(), 2));
517  MCpion_minus = particle;
518  }
519  }
520  i++; //paticle index
521  }
522 
523  //=======================================================================================
524  //add Nucleon decay stuff and particle cannon
525  //=======================================================================================
526  if (!fisNeutrinoInt) {
527  if (particle->Mother() == 0) {
528  const TLorentzVector& positionStart = particle->Position(0);
529  positionStart.GetXYZT(MC_vertex);
530  }
531  if (particle->PdgCode() == 321) { //save primary Kaon
532  MC_kaonID = particle->TrackId();
533  MC_kaonP = sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
534  pow(particle->Momentum().Pz(), 2));
535  MCkaon = particle;
536  }
537  else if (particle->PdgCode() == fLeptonPDGcode) { // Particle cannon muon
538  MC_leptonID = particle->TrackId();
539  MC_leptonP = sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
540  pow(particle->Momentum().Pz(), 2));
541  MClepton = particle;
542  }
543  else if (particle->PdgCode() == 2212) {
544  if (particle->Momentum().E() > tmp_leadingProtonE) {
545  tmp_leadingProtonE = particle->Momentum().E();
546  MC_leading_protonID = particle->TrackId();
548  sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
549  pow(particle->Momentum().Pz(), 2));
550  MCproton = particle;
551  }
552  }
553  else if (particle->PdgCode() == 211) {
554  if (particle->Momentum().E() > tmp_leadingPionPlusE) {
555  tmp_leadingPionPlusE = particle->Momentum().E();
556  MC_leading_PionPlusID = particle->TrackId();
558  sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
559  pow(particle->Momentum().Pz(), 2));
560  MCpion_plus = particle;
561  }
562  }
563  else if (particle->PdgCode() == -211) {
564  if (particle->Momentum().E() > tmp_leadingPionMinusE) {
565  tmp_leadingPionMinusE = particle->Momentum().E();
566  MC_leading_PionMinusID = particle->TrackId();
568  sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
569  pow(particle->Momentum().Pz(), 2));
570  MCpion_minus = particle;
571  }
572  }
573  else if (particle->Process() == "Decay" &&
574  particle->PdgCode() == -11) { // michel electron from muon decay
575  MC_michelID = particle->TrackId();
576  MC_michelP = sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
577  pow(particle->Momentum().Pz(), 2));
578  MCmichel = particle;
579  }
580  else if (TMath::Abs(particle->PdgCode() == 321)) { //save primary Kaon
581  MC_kaonID = particle->TrackId();
582  MC_kaonP = sqrt(pow(particle->Momentum().Px(), 2) + pow(particle->Momentum().Py(), 2) +
583  pow(particle->Momentum().Pz(), 2));
584  MCkaon = particle;
585  }
586  }
587  }
588  //===================================================================
589  //Saving denominator histograms
590  //===================================================================
591  if (not insideFV(MC_vertex)) return;
592  double Pv =
593  sqrt(pow(MC_incoming_P[0], 2) + pow(MC_incoming_P[1], 2) + pow(MC_incoming_P[2], 2));
594  double theta_mu = acos((MC_incoming_P[0] * MC_lepton_startMomentum[0] +
597  (Pv * MC_leptonP));
598  theta_mu *= (180.0 / 3.14159);
599  double truth_lengthLepton = truthLength(clockData, detProp, MClepton);
600  double proton_length = truthLength(clockData, detProp, MCproton);
601  double pion_plus_length = truthLength(clockData, detProp, MCpion_plus);
602  double pion_minus_length = truthLength(clockData, detProp, MCpion_minus);
603  double kaonLength = truthLength(clockData, detProp, MCkaon);
604  double michelLength = truthLength(clockData, detProp, MCmichel);
605 
606  // save CC events within the fiducial volume with the favorite neutrino
607  // flavor
609  if (MClepton) {
610  h_Ev_den->Fill(MC_incoming_P[3]);
611  h_Pmu_den->Fill(MC_leptonP);
612  h_theta_den->Fill(theta_mu);
613  h_muon_length->Fill(truth_lengthLepton);
614  }
615  if (MCproton) {
617  h_proton_length->Fill(proton_length);
618  }
619  if (MCpion_plus) {
621  h_pionp_length->Fill(pion_plus_length);
622  }
623  if (MCpion_minus) {
625  h_pionm_length->Fill(pion_minus_length);
626  }
627  if (MCkaon) {
628  h_Pkaon_den->Fill(MC_kaonP);
629  h_kaon_length->Fill(kaonLength);
630  }
631  }
632 
633  //save events for Nucleon decay and particle cannon
634  if (!fisNeutrinoInt) {
635  if (MClepton) {
636  h_Pmu_den->Fill(MC_leptonP);
637  h_muon_length->Fill(truth_lengthLepton);
638  }
639  if (MCkaon) {
640  h_Pkaon_den->Fill(MC_kaonP);
641  h_kaon_length->Fill(kaonLength);
642  }
643  if (MCproton) {
645  h_proton_length->Fill(proton_length);
646  }
647  if (MCpion_plus) {
649  h_pionp_length->Fill(pion_plus_length);
650  }
651  if (MCpion_minus) {
653  h_pionm_length->Fill(pion_minus_length);
654  }
655  if (MCmichel) {
657  h_michel_length->Fill(michelLength);
658  }
659  }
660 
661  //========================================================================
662  // Reco stuff, once we have selected a MC Particle let's find out if there is a track associated
663  //========================================================================
664  art::Handle<std::vector<recob::Track>> trackListHandle;
665  if (!event.getByLabel(fTrackModuleLabel, trackListHandle)) return;
666  std::vector<art::Ptr<recob::Track>> tracklist;
667  art::fill_ptr_vector(tracklist, trackListHandle);
668  int n_recoTrack = tracklist.size();
669 
670  art::FindManyP<recob::Hit> track_hits(trackListHandle, event, fTrackModuleLabel);
671  if (n_recoTrack == 0) {
672  MF_LOG_DEBUG("NeutrinoTrackingEff") << "There are no reco tracks... bye";
673  return;
674  }
675  MF_LOG_DEBUG("NeutrinoTrackingEff") << "Found this many reco tracks " << n_recoTrack;
676 
677  double Efrac_lepton = 0.0;
678  double Ecomplet_lepton = 0.0;
679  double Efrac_proton = 0.0;
680  double Ecomplet_proton = 0.0;
681  double Efrac_pionplus = 0.0;
682  double Ecomplet_pionplus = 0.0;
683  double Efrac_pionminus = 0.0;
684  double Ecomplet_pionminus = 0.0;
685  double Efrac_kaon = 0.0;
686  double Ecomplet_kaon = 0.0;
687  double Efrac_michel = 0.0;
688  double Ecomplet_michel = 0.0;
689  double trackLength_lepton = 0.0;
690  double trackLength_proton = 0.0;
691  double trackLength_pion_plus = 0.0;
692  double trackLength_pion_minus = 0.0;
693  double trackLength_kaon = 0.0;
694  double trackLength_michel = 0.0;
695  const simb::MCParticle* MClepton_reco = nullptr;
696  const simb::MCParticle* MCproton_reco = nullptr;
697  const simb::MCParticle* MCpion_plus_reco = nullptr;
698  const simb::MCParticle* MCpion_minus_reco = nullptr;
699  const simb::MCParticle* MCkaon_reco = nullptr;
700  const simb::MCParticle* MCmichel_reco = nullptr;
701 
702  std::vector<art::Ptr<recob::Hit>> tmp_all_trackHits = track_hits.at(0);
703  std::vector<art::Ptr<recob::Hit>> all_hits;
705  auto const pd = event.getProductDescription(tmp_all_trackHits[0].id());
706  if (pd && event.getByLabel(pd->inputTag(), hithandle)) {
707  art::fill_ptr_vector(all_hits, hithandle);
708  }
709 
710  for (int i = 0; i < n_recoTrack; i++) {
711  art::Ptr<recob::Track> track = tracklist[i];
712  std::vector<art::Ptr<recob::Hit>> all_trackHits = track_hits.at(i);
713  double tmpEfrac = 0;
714  double tmpEcomplet = 0;
715  const simb::MCParticle* particle;
716  truthMatcher(clockData, all_hits, all_trackHits, particle, tmpEfrac, tmpEcomplet);
717  if (!particle) continue;
718  if ((particle->PdgCode() == fLeptonPDGcode) && (particle->TrackId() == MC_leptonID)) {
719  // save the best track ... based on completeness if there is more than
720  // one track if( tmpEfrac > Efrac_lepton ){ ///this was base on purity
721  if (tmpEcomplet > Ecomplet_lepton) {
722  Ecomplet_lepton = tmpEcomplet;
723  Efrac_lepton = tmpEfrac;
724  trackLength_lepton = track->Length();
725  MClepton_reco = particle;
726  }
727  }
728  else if ((particle->PdgCode() == 2212) && (particle->TrackId() == MC_leading_protonID)) {
729  //save the best track ... based on completeness if there is more than one track
730  if (tmpEcomplet > Ecomplet_proton) {
731  Ecomplet_proton = tmpEcomplet;
732  Efrac_proton = tmpEfrac;
733  trackLength_proton = track->Length();
734  MCproton_reco = particle;
735  }
736  }
737  else if ((particle->PdgCode() == 211) && (particle->TrackId() == MC_leading_PionPlusID)) {
738  //save the best track ... based on completeness if there is more than one track
739  if (tmpEcomplet > Ecomplet_pionplus) {
740  Ecomplet_pionplus = tmpEcomplet;
741  Efrac_pionplus = tmpEfrac;
742  trackLength_pion_plus = track->Length();
743  MCpion_plus_reco = particle;
744  }
745  }
746  else if ((particle->PdgCode() == -211) && (particle->TrackId() == MC_leading_PionMinusID)) {
747  //save the best track ... based on completeness if there is more than one track
748  if (tmpEcomplet > Ecomplet_pionminus) {
749  Ecomplet_pionminus = tmpEcomplet;
750  Efrac_pionminus = tmpEfrac;
751  trackLength_pion_minus = track->Length();
752  MCpion_minus_reco = particle;
753  }
754  }
755  //kaon from nucleon decay
756  else if ((TMath::Abs(particle->PdgCode()) == 321) && (particle->TrackId() == MC_kaonID)) {
757  //save the best track ... based on completeness if there is more than one track
758  if (tmpEcomplet > Ecomplet_kaon) {
759  Ecomplet_kaon = tmpEcomplet;
760  Efrac_kaon = tmpEfrac;
761  trackLength_kaon = track->Length();
762  MCkaon_reco = particle;
763  }
764  }
765  //michel from nucleon decay
766  else if ((particle->PdgCode() == -11) && (particle->TrackId() == MC_michelID)) {
767  //save the best track ... based on completeness if there is more than one track
768  if (tmpEcomplet > Ecomplet_michel) {
769  Ecomplet_michel = tmpEcomplet;
770  Efrac_michel = tmpEfrac;
771  trackLength_michel = track->Length();
772  MCmichel_reco = particle;
773  }
774  }
775  }
776 
777  double Reco_LengthRes = truth_lengthLepton - trackLength_lepton;
778  double Reco_LengthResProton = proton_length - trackLength_proton;
779  double Reco_LengthResPionPlus = pion_plus_length - trackLength_pion_plus;
780  double Reco_LengthResPionMinus = pion_minus_length - trackLength_pion_minus;
781 
782  if (MClepton_reco && MClepton) {
784  h_Pmu_num->Fill(MC_leptonP);
785  h_Ev_num->Fill(MC_incoming_P[3]);
786  h_theta_num->Fill(theta_mu);
787  h_Efrac_lepton->Fill(Efrac_lepton);
788  h_Ecomplet_lepton->Fill(Ecomplet_lepton);
789  h_trackRes_lepton->Fill(Reco_LengthRes);
790  h_muonwtrk_length->Fill(truth_lengthLepton);
791  }
792  }
793  if (MCproton_reco && MCproton) {
796  h_Efrac_proton->Fill(Efrac_proton);
797  h_Ecomplet_proton->Fill(Ecomplet_proton);
798  h_trackRes_proton->Fill(Reco_LengthResProton);
799  h_protonwtrk_length->Fill(proton_length);
800  }
801  }
802  if (MCpion_plus_reco && MCpion_plus) {
805  h_Efrac_pion_plus->Fill(Efrac_pionplus);
806  h_Ecomplet_pion_plus->Fill(Ecomplet_pionplus);
807  h_trackRes_pion_plus->Fill(Reco_LengthResPionPlus);
808  h_pionpwtrk_length->Fill(pion_plus_length);
809  }
810  }
811  if (MCpion_minus_reco && MCpion_minus) {
814  h_Efrac_pion_minus->Fill(Efrac_pionminus);
815  h_Ecomplet_pion_minus->Fill(Ecomplet_pionminus);
816  h_trackRes_pion_minus->Fill(Reco_LengthResPionMinus);
817  h_pionmwtrk_length->Fill(pion_minus_length);
818  }
819  }
820  if (MCkaon_reco && MCkaon) {
822  h_Pkaon_num->Fill(MC_kaonP);
823  h_Efrac_kaon->Fill(Efrac_kaon);
824  h_Ecomplet_kaon->Fill(Ecomplet_kaon);
825  h_trackRes_kaon->Fill(kaonLength - trackLength_kaon);
826  h_kaonwtrk_length->Fill(kaonLength);
827  }
828  }
829  //Non neutrino events
830  //=========================================================
831  if (!fisNeutrinoInt) {
832  if (MClepton_reco && MClepton) {
833  h_Pmu_num->Fill(MC_leptonP);
834  h_Efrac_lepton->Fill(Efrac_lepton);
835  h_Ecomplet_lepton->Fill(Ecomplet_lepton);
836  h_trackRes_lepton->Fill(Reco_LengthRes);
837  h_muonwtrk_length->Fill(truth_lengthLepton);
838  }
839  if (MCkaon_reco && MCkaon) {
840  h_Pkaon_num->Fill(MC_kaonP);
841  h_Efrac_kaon->Fill(Efrac_kaon);
842  h_Ecomplet_kaon->Fill(Ecomplet_kaon);
843  h_trackRes_kaon->Fill(kaonLength - trackLength_kaon);
844  h_kaonwtrk_length->Fill(kaonLength);
845  }
846  if (MCproton_reco && MCproton) {
848  h_Efrac_proton->Fill(Efrac_proton);
849  h_Ecomplet_proton->Fill(Ecomplet_proton);
850  h_trackRes_proton->Fill(Reco_LengthResProton);
851  h_protonwtrk_length->Fill(proton_length);
852  }
853  if (MCpion_plus_reco && MCpion_plus) {
855  h_Efrac_pion_plus->Fill(Efrac_pionplus);
856  h_Ecomplet_pion_plus->Fill(Ecomplet_pionplus);
857  h_trackRes_pion_plus->Fill(Reco_LengthResPionPlus);
858  h_pionpwtrk_length->Fill(pion_plus_length);
859  }
860  if (MCpion_minus_reco && MCpion_minus) {
862  h_Efrac_pion_minus->Fill(Efrac_pionminus);
863  h_Ecomplet_pion_minus->Fill(Ecomplet_pionminus);
864  h_trackRes_pion_minus->Fill(Reco_LengthResPionMinus);
865  h_pionmwtrk_length->Fill(pion_minus_length);
866  }
867  if (MCmichel_reco && MCmichel) {
869  h_Efrac_michel->Fill(Efrac_michel);
870  h_Ecomplet_michel->Fill(Ecomplet_michel);
871  h_trackRes_michel->Fill(michelLength - trackLength_michel);
872  h_michelwtrk_length->Fill(michelLength);
873  }
874  }
875  }
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:220
int PdgCode() const
Definition: MCParticle.h:213
int CCNC() const
Definition: MCNeutrino.h:148
const simb::MCNeutrino & GetNeutrino() const
Definition: MCTruth.h:77
int Mother() const
Definition: MCParticle.h:214
const simb::MCParticle & Nu() const
Definition: MCNeutrino.h:146
list_type::const_iterator const_iterator
Definition: ParticleList.h:132
std::string Process() const
Definition: MCParticle.h:216
void truthMatcher(detinfo::DetectorClocksData const &clockData, std::vector< art::Ptr< recob::Hit >> all_hits, std::vector< art::Ptr< recob::Hit >> track_hits, const simb::MCParticle *&MCparticle, double &Efrac, double &Ecomplet)
int TrackId() const
Definition: MCParticle.h:211
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:207
iterator begin()
Definition: ParticleList.h:305
double truthLength(const detinfo::DetectorClocksData &clockData, detinfo::DetectorPropertiesData const &detProp, const simb::MCParticle *MCparticle)
const sim::ParticleList & ParticleList() const
const TLorentzVector & Momentum(const int i=0) const
Definition: MCParticle.h:221
#define MF_LOG_DEBUG(id)
bool NeutrinoSet() const
Definition: MCTruth.h:78
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:306
Event generator information.
Definition: MCNeutrino.h:18
Float_t track
Definition: plot.C:35
Event finding and building.
vertex reconstruction
string const & art::Observer::processName ( ) const
protectedinherited

Definition at line 57 of file Observer.cc.

References art::Observer::process_name_.

Referenced by art::FileDumperOutput::printPrincipal().

58  {
59  return process_name_;
60  }
std::string process_name_
Definition: Observer.h:76
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)
double DUNE::NeutrinoTrackingEff::truthLength ( const detinfo::DetectorClocksData clockData,
detinfo::DetectorPropertiesData const &  detProp,
const simb::MCParticle MCparticle 
)
private

Definition at line 939 of file NeutrinoTrackingEff_module.cc.

References fDriftVelocity, geo::GeometryCore::FindTPCAtPosition(), geo::WireReadoutGeom::FirstPlane(), geom, geo::PlaneGeo::GetCenter(), detinfo::DetectorPropertiesData::NumberTimeSamples(), simb::MCParticle::NumberTrajectoryPoints(), simb::MCParticle::Position(), simb::MCParticle::T(), detinfo::ElecClock::TickPeriod(), geo::vect::toPoint(), detinfo::DetectorClocksData::TPCClock(), detinfo::trigger_offset(), simb::MCParticle::Vx(), simb::MCParticle::Vy(), simb::MCParticle::Vz(), and wireReadoutGeom.

Referenced by processEff().

942  {
943  // Calculate the truth length considering only the part that is
944  // inside the TPC Base on a peace of code from
945  // dune/TrackingAna/TrackingEfficiency_module.cc
946 
947  if (!MCparticle) return -999.0;
948  int numberTrajectoryPoints = MCparticle->NumberTrajectoryPoints();
949  std::vector<double> TPCLengthHits(numberTrajectoryPoints, 0.0);
950  int FirstHit = 0, LastHit = 0;
951  double TPCLength = 0.0;
952  bool BeenInVolume = false;
953 
954  double const WindowSize = detProp.NumberTimeSamples() * clockData.TPCClock().TickPeriod() * 1e3;
955 
956  for (unsigned int MCHit = 0; MCHit < TPCLengthHits.size(); ++MCHit) {
957  if (MCHit != 0)
958  TPCLengthHits[MCHit] = sqrt(pow((MCparticle->Vx(MCHit - 1) - MCparticle->Vx(MCHit)), 2) +
959  pow((MCparticle->Vy(MCHit - 1) - MCparticle->Vy(MCHit)), 2) +
960  pow((MCparticle->Vz(MCHit - 1) - MCparticle->Vz(MCHit)), 2));
961  auto const position = geo::vect::toPoint(MCparticle->Position(MCHit).Vect());
962  geo::TPCID tpcid = geom->FindTPCAtPosition(position);
963  if (tpcid.isValid) {
964  // -- Check if hit is within drift window...
965  double XPlanePosition = wireReadoutGeom.FirstPlane(tpcid).GetCenter().X();
966  double DriftTimeCorrection = fabs(position.X() - XPlanePosition) / fDriftVelocity;
967  double TimeAtPlane = MCparticle->T() + DriftTimeCorrection;
968 
969  if (TimeAtPlane < trigger_offset(clockData) ||
970  TimeAtPlane > trigger_offset(clockData) + WindowSize)
971  continue;
972  LastHit = MCHit;
973  if (!BeenInVolume) {
974  BeenInVolume = true;
975  FirstHit = MCHit;
976  }
977  }
978  }
979  for (int Hit = FirstHit + 1; Hit <= LastHit; ++Hit)
980  TPCLength += TPCLengthHits[Hit];
981  return TPCLength;
982  }
art::ServiceHandle< geo::Geometry const > geom
unsigned int NumberTrajectoryPoints() const
Definition: MCParticle.h:219
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:220
Point_t const & GetCenter() const
Returns the centre of the wire plane in world coordinates [cm].
Definition: PlaneGeo.h:366
constexpr double TickPeriod() const noexcept
A single tick period in microseconds.
Definition: ElecClock.h:310
TPCID FindTPCAtPosition(Point_t const &point) const
Returns the ID of the TPC at specified location.
double T(const int i=0) const
Definition: MCParticle.h:225
ElecClock const & TPCClock() const noexcept
Borrow a const TPC clock with time set to Trigger time [us].
Point_t toPoint(Point const &p)
Convert the specified point into a geo::Point_t.
The data type to uniquely identify a TPC.
Definition: geo_types.h:306
double Vx(const int i=0) const
Definition: MCParticle.h:222
PlaneGeo const & FirstPlane(TPCID const &tpcid) const
Returns the first plane of the specified TPC.
geo::WireReadoutGeom const & wireReadoutGeom
double Vz(const int i=0) const
Definition: MCParticle.h:224
int trigger_offset(DetectorClocksData const &data)
double Vy(const int i=0) const
Definition: MCParticle.h:223
void DUNE::NeutrinoTrackingEff::truthMatcher ( detinfo::DetectorClocksData const &  clockData,
std::vector< art::Ptr< recob::Hit >>  all_hits,
std::vector< art::Ptr< recob::Hit >>  track_hits,
const simb::MCParticle *&  MCparticle,
double &  Efrac,
double &  Ecomplet 
)
private

Definition at line 877 of file NeutrinoTrackingEff_module.cc.

References cheat::BackTrackerService::HitToTrackIDEs(), and cheat::ParticleInventoryService::TrackIdToParticle_P().

Referenced by processEff().

883  {
886  std::map<int, double> trkID_E;
887  for (size_t j = 0; j < track_hits.size(); ++j) {
888  art::Ptr<recob::Hit> hit = track_hits[j];
889  std::vector<sim::TrackIDE> TrackIDs = bt_serv->HitToTrackIDEs(clockData, hit);
890  for (size_t k = 0; k < TrackIDs.size(); k++) {
891  trkID_E[TrackIDs[k].trackID] += TrackIDs[k].energy;
892  }
893  }
894  double max_E = -999.0;
895  double total_E = 0.0;
896  int TrackID = -999;
897  double partial_E =
898  0.0; // amount of energy deposited by the particle that deposited more energy...
899 
900  // If the collection of hits have more than one particle associate
901  // save the particle w/ the highest energy deposition since we are
902  // looking for muons/pions/protons this should be enough
903  if (!trkID_E.size()) {
904  MCparticle = 0;
905  return; //Ghost track???
906  }
907  for (std::map<int, double>::iterator ii = trkID_E.begin(); ii != trkID_E.end(); ++ii) {
908  total_E += ii->second;
909  if ((ii->second) > max_E) {
910  partial_E = ii->second;
911  max_E = ii->second;
912  TrackID = ii->first;
913  }
914  }
915  MCparticle = pi_serv->TrackIdToParticle_P(TrackID);
916 
917  // In the current simulation, we do not save EM Shower daughters
918  // in GEANT. But we do save the energy deposition in TrackIDEs. If
919  // the energy deposition is from a particle that is the daughter
920  // of an EM particle, the negative of the parent track ID is saved
921  // in TrackIDE for the daughter particle we don't want to track
922  // gammas or any other EM activity
923  if (TrackID < 0) return;
924 
925  Efrac = (partial_E) / total_E;
926 
927  // Completeness
928  double totenergy = 0;
929  for (size_t k = 0; k < all_hits.size(); ++k) {
930  art::Ptr<recob::Hit> hit = all_hits[k];
931  std::vector<sim::TrackIDE> TrackIDs = bt_serv->HitToTrackIDEs(clockData, hit);
932  for (size_t l = 0; l < TrackIDs.size(); ++l) {
933  if (TrackIDs[l].trackID == TrackID) totenergy += TrackIDs[l].energy;
934  }
935  }
936  Ecomplet = partial_E / totenergy;
937  }
intermediate_table::iterator iterator
std::vector< sim::TrackIDE > HitToTrackIDEs(detinfo::DetectorClocksData const &clockData, recob::Hit const &hit) const
std::vector< TrackID > TrackIDs
const simb::MCParticle * TrackIdToParticle_P(int id) const
Detector simulation of raw signals on wires.
bool art::Observer::wantAllEvents ( ) const
inlineprotectednoexceptinherited

Definition at line 31 of file Observer.h.

References e, art::Observer::getTriggerResults(), art::Observer::wantAllEvents_, and art::Observer::wantEvent().

32  {
33  return wantAllEvents_;
34  }
bool wantAllEvents_
Definition: Observer.h:75
bool art::Observer::wantEvent ( ScheduleID  id,
Event const &  e 
) const
protectedinherited

Definition at line 63 of file Observer.cc.

References art::Observer::rejectors_, art::Observer::selectors_, and art::Observer::wantAllEvents_.

Referenced by art::OutputModule::doEvent(), art::OutputModule::doWriteEvent(), and art::Observer::wantAllEvents().

64  {
65  if (wantAllEvents_) {
66  return true;
67  }
68  bool const select_event = selectors_ ? selectors_->matchEvent(id, e) : true;
69  bool const reject_event =
70  rejectors_ ? rejectors_->matchEvent(id, e) : false;
71  return select_event and not reject_event;
72  }
bool wantAllEvents_
Definition: Observer.h:75
std::optional< detail::ProcessAndEventSelectors > rejectors_
Definition: Observer.h:80
Float_t e
Definition: plot.C:35
std::optional< detail::ProcessAndEventSelectors > selectors_
Definition: Observer.h:79

Member Data Documentation

double DUNE::NeutrinoTrackingEff::fDriftVelocity
private

Definition at line 182 of file NeutrinoTrackingEff_module.cc.

Referenced by NeutrinoTrackingEff(), and truthLength().

float DUNE::NeutrinoTrackingEff::fFidVolCutX
private

Definition at line 171 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and NeutrinoTrackingEff().

float DUNE::NeutrinoTrackingEff::fFidVolCutY
private

Definition at line 172 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and NeutrinoTrackingEff().

float DUNE::NeutrinoTrackingEff::fFidVolCutZ
private

Definition at line 173 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and NeutrinoTrackingEff().

float DUNE::NeutrinoTrackingEff::fFidVolXmax
private

Definition at line 176 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob().

float DUNE::NeutrinoTrackingEff::fFidVolXmin
private

Definition at line 175 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and insideFV().

float DUNE::NeutrinoTrackingEff::fFidVolYmax
private

Definition at line 178 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and insideFV().

float DUNE::NeutrinoTrackingEff::fFidVolYmin
private

Definition at line 177 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and insideFV().

float DUNE::NeutrinoTrackingEff::fFidVolZmax
private

Definition at line 180 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and insideFV().

float DUNE::NeutrinoTrackingEff::fFidVolZmin
private

Definition at line 179 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and insideFV().

bool DUNE::NeutrinoTrackingEff::fisNeutrinoInt
private

Definition at line 82 of file NeutrinoTrackingEff_module.cc.

Referenced by NeutrinoTrackingEff(), and processEff().

int DUNE::NeutrinoTrackingEff::fLeptonPDGcode
private

Definition at line 79 of file NeutrinoTrackingEff_module.cc.

Referenced by NeutrinoTrackingEff(), and processEff().

double DUNE::NeutrinoTrackingEff::fMaxLeptonP
private

Definition at line 81 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and NeutrinoTrackingEff().

double DUNE::NeutrinoTrackingEff::fMaxNeutrinoE
private

Definition at line 80 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), NeutrinoTrackingEff(), and processEff().

std::string DUNE::NeutrinoTrackingEff::fMCTruthModuleLabel
private

Definition at line 76 of file NeutrinoTrackingEff_module.cc.

Referenced by NeutrinoTrackingEff(), and processEff().

int DUNE::NeutrinoTrackingEff::fNeutrinoPDGcode
private

Definition at line 78 of file NeutrinoTrackingEff_module.cc.

Referenced by NeutrinoTrackingEff(), and processEff().

std::string DUNE::NeutrinoTrackingEff::fTrackModuleLabel
private

Definition at line 77 of file NeutrinoTrackingEff_module.cc.

Referenced by NeutrinoTrackingEff(), and processEff().

art::ServiceHandle<geo::Geometry const> DUNE::NeutrinoTrackingEff::geom
private

Definition at line 183 of file NeutrinoTrackingEff_module.cc.

Referenced by truthLength().

TH1D* DUNE::NeutrinoTrackingEff::h_Ecomplet_kaon
private

Definition at line 157 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ecomplet_lepton
private

Definition at line 118 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ecomplet_michel
private

Definition at line 160 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ecomplet_pion_minus
private

Definition at line 124 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ecomplet_pion_plus
private

Definition at line 122 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ecomplet_proton
private

Definition at line 120 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Ev = 0
private

Definition at line 139 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Lkaon = 0
private

Definition at line 168 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Lmichel = 0
private

Definition at line 169 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Lmuon = 0
private

Definition at line 146 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Lpion_minus = 0
private

Definition at line 149 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Lpion_plus = 0
private

Definition at line 148 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Lproton = 0
private

Definition at line 147 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Pkaon = 0
private

Definition at line 166 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Pmichel = 0
private

Definition at line 167 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Pmu = 0
private

Definition at line 140 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Ppion_minus = 0
private

Definition at line 144 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Ppion_plus = 0
private

Definition at line 143 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_Pproton = 0
private

Definition at line 142 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TEfficiency* DUNE::NeutrinoTrackingEff::h_Eff_theta = 0
private

Definition at line 141 of file NeutrinoTrackingEff_module.cc.

Referenced by doEfficiencies().

TH1D* DUNE::NeutrinoTrackingEff::h_Efrac_kaon
private

Definition at line 156 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Efrac_lepton
private

Definition at line 117 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Efrac_michel
private

Definition at line 159 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Efrac_pion_minus
private

Definition at line 123 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Efrac_pion_plus
private

Definition at line 121 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Efrac_proton
private

Definition at line 119 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ev_den
private

Definition at line 104 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ev_num
private

Definition at line 105 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_kaon_length
private

Definition at line 162 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_kaonwtrk_length
private

Definition at line 164 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_michel_length
private

Definition at line 163 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_michelwtrk_length
private

Definition at line 165 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_muon_length
private

Definition at line 130 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_muonwtrk_length
private

Definition at line 134 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_pionm_length
private

Definition at line 133 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_pionmwtrk_length
private

Definition at line 137 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_pionp_length
private

Definition at line 132 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_pionpwtrk_length
private

Definition at line 136 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Pkaon_den
private

Definition at line 152 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Pkaon_num
private

Definition at line 153 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Pmichel_e_den
private

Definition at line 154 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Pmichel_e_num
private

Definition at line 155 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Pmu_den
private

Definition at line 106 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Pmu_num
private

Definition at line 107 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ppion_minus_den
private

Definition at line 114 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ppion_minus_num
private

Definition at line 115 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ppion_plus_den
private

Definition at line 112 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Ppion_plus_num
private

Definition at line 113 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Pproton_den
private

Definition at line 110 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_Pproton_num
private

Definition at line 111 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_proton_length
private

Definition at line 131 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_protonwtrk_length
private

Definition at line 135 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_theta_den
private

Definition at line 108 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_theta_num
private

Definition at line 109 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), doEfficiencies(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_trackRes_kaon
private

Definition at line 158 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_trackRes_lepton
private

Definition at line 125 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_trackRes_michel
private

Definition at line 161 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_trackRes_pion_minus
private

Definition at line 128 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_trackRes_pion_plus
private

Definition at line 127 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

TH1D* DUNE::NeutrinoTrackingEff::h_trackRes_proton
private

Definition at line 126 of file NeutrinoTrackingEff_module.cc.

Referenced by beginJob(), and processEff().

double DUNE::NeutrinoTrackingEff::MC_incoming_P[4]
private

Definition at line 86 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

int DUNE::NeutrinoTrackingEff::MC_incoming_PDG
private

Definition at line 85 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

int DUNE::NeutrinoTrackingEff::MC_isCC
private

Definition at line 84 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

int DUNE::NeutrinoTrackingEff::MC_kaonID
private

Definition at line 94 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

double DUNE::NeutrinoTrackingEff::MC_kaonP
private

Definition at line 101 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

int DUNE::NeutrinoTrackingEff::MC_leading_PionMinusID
private

Definition at line 92 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

double DUNE::NeutrinoTrackingEff::MC_leading_PionMinusP
private

Definition at line 100 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

int DUNE::NeutrinoTrackingEff::MC_leading_PionPlusID
private

Definition at line 91 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

double DUNE::NeutrinoTrackingEff::MC_leading_PionPlusP
private

Definition at line 98 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

int DUNE::NeutrinoTrackingEff::MC_leading_protonID
private

Definition at line 90 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

double DUNE::NeutrinoTrackingEff::MC_leading_ProtonP
private

Definition at line 99 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

double DUNE::NeutrinoTrackingEff::MC_lepton_startMomentum[4]
private

Definition at line 88 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

int DUNE::NeutrinoTrackingEff::MC_leptonID
private

Definition at line 93 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

double DUNE::NeutrinoTrackingEff::MC_leptonP
private

Definition at line 97 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

int DUNE::NeutrinoTrackingEff::MC_michelID
private

Definition at line 95 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

double DUNE::NeutrinoTrackingEff::MC_michelP
private

Definition at line 102 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

double DUNE::NeutrinoTrackingEff::MC_vertex[4]
private

Definition at line 87 of file NeutrinoTrackingEff_module.cc.

Referenced by processEff().

geo::WireReadoutGeom const& DUNE::NeutrinoTrackingEff::wireReadoutGeom = art::ServiceHandle<geo::WireReadout>()->Get()
private

Definition at line 184 of file NeutrinoTrackingEff_module.cc.

Referenced by truthLength().


The documentation for this class was generated from the following file: