33 #include "art/Framework/Core/EDAnalyzer.h"
34 #include "art/Framework/Core/ModuleMacros.h"
35 #include "art/Framework/Principal/Event.h"
36 #include "art/Framework/Principal/Handle.h"
37 #include "art/Framework/Principal/Run.h"
38 #include "art/Framework/Principal/SubRun.h"
39 #include "fhiclcpp/ParameterSet.h"
40 #include "messagefacility/MessageLogger/MessageLogger.h"
48 #include "TLorentzVector.h"
49 #include "canvas/Persistency/Common/FindManyP.h"
50 #include "canvas/Persistency/Common/FindMany.h"
51 #include "canvas/Persistency/Common/FindOneP.h"
52 #include "canvas/Utilities/InputTag.h"
53 #include "larcore/Geometry/Geometry.h"
54 #include "larcoreobj/SummaryData/POTSummary.h"
55 #include "lardataobj/AnalysisBase/Calorimetry.h"
56 #include "lardataobj/AnalysisBase/CosmicTag.h"
57 #include "lardataobj/MCBase/MCShower.h"
58 #include "lardataobj/RecoBase/Cluster.h"
59 #include "lardataobj/RecoBase/Hit.h"
60 #include "lardataobj/RecoBase/PFParticle.h"
61 #include "lardataobj/RecoBase/Shower.h"
62 #include "lardataobj/RecoBase/Track.h"
63 #include "lardataobj/RecoBase/Vertex.h"
64 #include "nusimdata/SimulationBase/MCParticle.h"
65 #include "nusimdata/SimulationBase/MCTruth.h"
66 #include "uboone/EventWeight/MCEventWeight.h"
67 #include "larevt/SpaceChargeServices/SpaceChargeService.h"
68 #include "uboone/UBXSec/DataTypes/SelectionResult.h"
69 #include "lardataobj/AnalysisBase/ParticleID.h"
70 #include "TEfficiency.h"
71 #include "art/Framework/Services/Optional/TFileService.h"
73 #include "ElectronEventSelectionAlg.h"
74 #include "PandoraInterfaceHelper.h"
76 #include "EnergyHelper.h"
77 #include "GeometryHelper.h"
79 #include "larcore/Geometry/WireGeo.h"
80 #include "lardata/DetectorInfoServices/DetectorPropertiesService.h"
81 #include "lardata/DetectorInfoServices/DetectorClocksService.h"
82 #include "lardata/DetectorInfo/DetectorProperties.h"
83 #include "larreco/RecoAlg/TrackMomentumCalculator.h"
85 #include "uboone/EventWeight/EventWeightTreeUtility.h"
107 void analyze(art::Event
const &e)
override;
121 void reconfigure(fhicl::ParameterSet
const &pset)
override;
137 std::vector<size_t> &candidates,
138 const art::Event &evt);
148 std::vector<art::Ptr<recob::Track>> &tracks);
157 art::Ptr<recob::Shower> get_most_energetic_shower(
158 std::vector<art::Ptr<recob::Shower>> &showers);
175 art::Event
const &evt,
177 std::vector<int> &neutrino_pdg,
178 std::vector<std::string> &neutrino_process,
179 std::vector<double> &neutrino_energy,
180 std::vector<art::Ptr<recob::PFParticle>> &neutrino_pf,
182 std::vector<int> &cosmic_pdg,
183 std::vector<std::string> &cosmic_process,
184 std::vector<double> &cosmic_energy,
185 std::vector<art::Ptr<recob::PFParticle>> &cosmic_pf);
187 void fillTrackFields(
size_t pf_id,
188 recob::PFParticle
const *pfparticle,
189 art::FindManyP<recob::Cluster> *clusters_per_pfpart,
190 art::FindManyP<recob::SpacePoint> *spcpnts_per_pfpart,
191 art::FindOneP<recob::Track> *track_per_pfpart,
192 art::FindManyP<anab::Calorimetry> *calos_per_track,
193 art::FindManyP<simb::MCParticle, anab::BackTrackerHitMatchingData> *mcps_per_hit,
194 art::FindManyP<recob::Hit> *hits_per_spcpnts,
195 art::FindManyP<anab::ParticleID> *pid_per_track,
196 art::FindManyP<recob::Hit> *hits_per_cluster);
199 std::string m_hitfinderLabel;
200 std::string _geantModuleLabel =
"largeant";
201 std::string m_pfp_producer;
202 std::string m_pid_producer;
203 std::string m_calorimetry_producer;
205 std::string m_spacepointLabel;
206 std::string _mctruthLabel =
"generator";
207 std::string m_hitmatching_producer;
213 uboone::EWTreeUtil ewutil;
214 trkf::TrackMomentumCalculator _trkmom;
216 float _lee_bins[12] = {200, 300, 375, 475, 550, 675, 800, 950, 1100, 1300, 1500, 3000};
217 float _lee_scaling[13] = {0, 3.88549, 3.05421, 1.59615, 0.383725, 0, 0, 0, 0, 0, 0, 0, 0};
219 TH1F *_h_lee_scaling =
new TH1F(
"h_lee_scaling",
"", 11, _lee_bins);
226 double _reco_nu_energy;
227 bool m_showersAsTracks;
229 int _interaction_type;
231 double m_fidvolXstart;
234 double m_fidvolYstart;
237 double m_fidvolZstart;
239 bool m_useParticleID;
241 bool m_isCosmicInTime;
243 bool m_isOverlaidSample;
244 bool m_save_flux_info;
245 const int k_cosmic = 1;
246 const int k_nu_e = 2;
247 const int k_nu_mu = 3;
249 const int k_dirt = 5;
250 const int k_data = 6;
251 const int k_other = 0;
252 const int k_mixed = 7;
253 const int k_nu_e_other = 8;
254 std::vector<double> _energy;
255 int _true_nu_is_fiducial;
260 int _n_showers_as_tracks;
264 double _interaction_length;
272 std::vector< std::vector<double> > _genie_weights;
273 std::vector< std::string > _genie_names;
275 std::vector< std::vector<double> > _flux_weights;
276 std::vector< std::string > _flux_names;
278 std::vector<double> _true_shower_x_sce;
279 std::vector<double> _true_shower_y_sce;
280 std::vector<double> _true_shower_z_sce;
281 std::vector<int> _true_shower_pdg;
282 std::vector<double> _true_shower_depE;
284 int _nu_matched_tracks;
285 int _nu_matched_showers;
303 double _cosmic_fraction;
305 std::vector<int> _flash_passed;
306 std::vector<int> _track_passed;
307 std::vector<int> _shower_passed;
308 std::vector<int> _primary_indexes;
309 std::vector<int> _number_tracks;
310 std::vector<int> _number_showers;
312 std::vector<int> _matched_showers;
313 std::vector<int> _matched_tracks;
315 std::vector<std::string> _matched_tracks_process;
316 std::vector<double> _matched_tracks_energy;
318 std::vector<std::string> _matched_showers_process;
319 std::vector<double> _matched_showers_energy;
321 std::map<std::string, std::vector<double>> _weights;
324 int _chosen_candidate;
329 std::vector<std::vector<double>> _shower_dQdx_hits;
330 std::vector<std::vector<double>> _shower_dEdx_hits;
332 std::vector<std::vector<double>> _shower_dQdx;
333 std::vector<std::vector<double>> _shower_dEdx;
334 std::vector<std::vector<double>> _shower_dQdx_cali;
335 std::vector<std::vector<double>> _shower_dEdx_cali;
336 std::vector<std::vector<double>> _shower_pitches;
337 std::vector<std::vector<int>> _shower_dQdx_hits_in_the_box;
339 std::vector<std::vector<double>> _track_dQdx_hits;
340 std::vector<std::vector<double>> _track_dEdx_hits;
342 std::vector<std::vector<double>> _track_dQdx;
343 std::vector<std::vector<double>> _track_dQdx_cali;
345 std::vector<std::vector<double>> _track_dEdx;
346 std::vector<double> _track_energy_length;
348 std::vector<size_t> _nu_track_ids;
349 std::vector<size_t> _nu_shower_as_track_ids;
351 std::vector<size_t> _nu_shower_ids;
353 std::vector< std::vector<size_t> > _nu_track_daughters;
354 std::vector< std::vector<size_t> > _nu_shower_daughters;
356 std::vector<double> _shower_open_angle;
357 std::vector<double> _shower_length;
358 std::vector<double> _shower_dir_x;
359 std::vector<double> _shower_dir_y;
360 std::vector<double> _shower_dir_z;
362 std::vector<double> _shower_start_x;
363 std::vector<double> _shower_start_y;
364 std::vector<double> _shower_start_z;
366 std::vector<double> _shower_theta;
367 std::vector<double> _shower_phi;
369 std::vector<std::vector<double>> _shower_energy;
370 std::vector<std::vector<double>> _shower_energy_cali;
371 std::vector<std::vector<double>> _track_energy_cali;
373 std::vector<double> _track_dir_x;
374 std::vector<double> _track_dir_y;
375 std::vector<double> _track_dir_z;
376 std::vector<int> _track_is_fiducial;
377 std::vector<int> _shower_is_fiducial;
379 std::vector<double> _track_res_mean;
380 std::vector<double> _track_res_std;
382 std::vector<double> _shower_res_mean;
383 std::vector<double> _shower_res_std;
385 std::vector<double> _track_start_x;
386 std::vector<double> _track_start_y;
387 std::vector<double> _track_start_z;
389 std::vector<double> _track_end_x;
390 std::vector<double> _track_end_y;
391 std::vector<double> _track_end_z;
393 std::vector<double> _track_theta;
394 std::vector<double> _track_phi;
396 std::vector<double> _track_length;
397 std::vector<double> _track_id;
399 std::vector<double> _track_bragg_p;
400 std::vector<double> _track_bragg_mu;
401 std::vector<double> _track_bragg_mip;
403 std::vector<double> _track_pidchi;
404 std::vector<double> _track_pidchipr;
405 std::vector<double> _track_pidchika;
406 std::vector<double> _track_pidchipi;
407 std::vector<double> _track_pidchimu;
408 std::vector<double> _track_pida;
410 std::vector<double> _track_energy_dedx;
411 std::vector<std::vector<double>> _track_energy_hits;
413 std::vector<int> _nu_daughters_pdg;
414 std::vector<double> _nu_daughters_E;
416 std::vector<double> _nu_daughters_px;
417 std::vector<double> _nu_daughters_py;
418 std::vector<double> _nu_daughters_pz;
420 std::vector<double> _nu_daughters_vx;
421 std::vector<double> _nu_daughters_vy;
422 std::vector<double> _nu_daughters_vz;
424 std::vector<double> _nu_daughters_endx;
425 std::vector<double> _nu_daughters_endy;
426 std::vector<double> _nu_daughters_endz;
428 std::vector<double> _flash_PE;
429 std::vector<double> _flash_time;
434 std::vector<std::vector<double>> _shower_pca;
435 std::vector<std::vector<double>> _track_pca;
437 std::vector<std::vector<int>> _shower_nhits;
438 std::vector<std::vector<int>> _track_nhits;
444 #endif // PANDORA_LEE_H
Definition: PandoraLEEAnalyzer.h:89
art::Ptr< recob::Track > get_longest_track(std::vector< art::Ptr< recob::Track >> &tracks)
Return the longest reconstructed track.
Definition: PandoraLEEAnalyzer_module.cc:293
Definition: PandoraInterfaceHelper.h:55
Definition: ElectronEventSelectionAlg.h:61
void reconfigure(fhicl::ParameterSet const &pset) override
Assigns the values of the FHICL file.
Definition: PandoraLEEAnalyzer_module.cc:1539
void endSubRun(const art::SubRun &sr)
Method called at the end of each subrun, it stores the number of POT.
Definition: PandoraLEEAnalyzer_module.cc:360
Definition: EnergyHelper.h:51
size_t choose_candidate(std::vector< size_t > &candidates, const art::Event &evt)
Return the longest reconstructed track.
Definition: PandoraLEEAnalyzer_module.cc:322
void categorizePFParticles(art::Event const &evt, std::vector< int > &neutrino_pdg, std::vector< std::string > &neutrino_process, std::vector< double > &neutrino_energy, std::vector< art::Ptr< recob::PFParticle >> &neutrino_pf, std::vector< int > &cosmic_pdg, std::vector< std::string > &cosmic_process, std::vector< double > &cosmic_energy, std::vector< art::Ptr< recob::PFParticle >> &cosmic_pf)
Determines if a PFParticle is matched with a MCParticle coming from a neutrino interaction or a cosmi...
Definition: PandoraLEEAnalyzer_module.cc:690
void clear()
Clears filled variables.
Definition: PandoraLEEAnalyzer_module.cc:384
void analyze(art::Event const &e) override
Main analyzer method, runs for every event in the file.
Definition: PandoraLEEAnalyzer_module.cc:745
Definition: GeometryHelper.h:40