All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CosmicIdAna_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: CosmicIdAna
3 // Module Type: analyzer
4 // File: CosmicIdAna_module.cc
5 //
6 // Tom Brooks (tbrooks@fnal.gov)
7 ////////////////////////////////////////////////////////////////////////
8 
9 // sbndcode includes
14 
15 // LArSoft includes
22 #include "nusimdata/SimulationBase/MCParticle.h"
23 #include "nusimdata/SimulationBase/MCTruth.h"
29 
30 // Framework includes
31 #include "art/Framework/Core/EDAnalyzer.h"
32 #include "art/Framework/Principal/Event.h"
33 #include "art/Framework/Principal/Handle.h"
34 #include "art_root_io/TFileService.h"
35 #include "canvas/Persistency/Common/FindManyP.h"
36 #include "fhiclcpp/ParameterSet.h"
37 #include "fhiclcpp/types/Table.h"
38 #include "fhiclcpp/types/Atom.h"
39 
40 #include "Pandora/PdgTable.h"
41 
42 // ROOT includes. Note: To look up the properties of the ROOT classes,
43 // use the ROOT web site; e.g.,
44 // <https://root.cern.ch/doc/master/annotated.html>
45 #include "TVector3.h"
46 #include "TH1.h"
47 
48 // C++ includes
49 #include <map>
50 #include <vector>
51 #include <string>
52 
53 namespace sbnd {
54 
55  class CosmicIdAna : public art::EDAnalyzer {
56  public:
57 
58  struct BeamTime {
59  using Name = fhicl::Name;
60  using Comment = fhicl::Comment;
61 
62  fhicl::Atom<double> BeamTimeMin {
63  Name("BeamTimeMin"),
64  Comment("")
65  };
66 
67  fhicl::Atom<double> BeamTimeMax {
68  Name("BeamTimeMax"),
69  Comment("")
70  };
71 
72  };
73 
74  // Describes configuration parameters of the module
75  struct Config {
76  using Name = fhicl::Name;
77  using Comment = fhicl::Comment;
78 
79  // One Atom for each parameter
80  fhicl::Atom<art::InputTag> SimModuleLabel {
81  Name("SimModuleLabel"),
82  Comment("tag of detector simulation data product")
83  };
84 
85  fhicl::Atom<art::InputTag> TpcTrackModuleLabel {
86  Name("TpcTrackModuleLabel"),
87  Comment("tag of TPC track producer data product")
88  };
89 
90  fhicl::Atom<art::InputTag> PandoraLabel {
91  Name("PandoraLabel"),
92  Comment("tag of pandora data product")
93  };
94 
95  fhicl::Atom<bool> Verbose {
96  Name("Verbose"),
97  Comment("Print information about what's going on")
98  };
99 
100  fhicl::Table<CosmicIdAlg::Config> CosIdAlg {
101  Name("CosIdAlg"),
102  };
103 
104  fhicl::Table<trkf::TrajectoryMCSFitter::Config> fitter {
105  Name("fitter"),
106  };
107 
108  fhicl::Table<BeamTime> BeamTimeLimits {
109  Name("BeamTimeLimits"),
110  Comment("")
111  };
112 
113  }; // Inputs
114 
115  using Parameters = art::EDAnalyzer::Table<Config>;
116 
117  // Constructor: configures module
118  explicit CosmicIdAna(Parameters const& config);
119 
120  // Called once, at start of the job
121  virtual void beginJob() override;
122 
123  // Called once per event
124  virtual void analyze(const art::Event& event) override;
125 
126  // Called once, at end of the job
127  virtual void endJob() override;
128 
129  typedef art::Handle< std::vector<recob::PFParticle> > PFParticleHandle;
130  typedef std::map< size_t, art::Ptr<recob::PFParticle> > PFParticleIdMap;
131 
132  private:
133 
134  // fcl file parameters
135  art::InputTag fSimModuleLabel; ///< name of detsim producer
136  art::InputTag fTpcTrackModuleLabel; ///< name of TPC track producer
137  art::InputTag fPandoraLabel;
138  bool fVerbose; ///< print information about what's going on
139  double fBeamTimeMin;
140  double fBeamTimeMax;
141 
144  // Momentum fitters
147 
148  // histograms
149  std::vector<std::string> trueCategories{"NuMu","Dirt","Cr","Other"};
150  size_t nTC = trueCategories.size();
151  std::vector<std::string> recoCategories{"NuMu","Dirt","Cr","Other","OtherNu"};
152  size_t nRC = recoCategories.size();
153  std::vector<std::string> cuts{"None","FV","SP","Geo","CC","AC","CT","CH","PT","PN","Tot","Remain"};
154  size_t nCuts = cuts.size();
155 
156  TH1D* hBeamTime;
157 
158  TH1D *hTrueMom[4][12];
159  TH1D *hTrueLength[4][12];
160  TH1D *hTrueTheta[4][12];
161  TH1D *hTruePhi[4][12];
162 
163  TH1D *hRecoMom[5][12];
164  TH1D *hRecoLength[5][12];
165  TH1D *hRecoTheta[5][12];
166  TH1D *hRecoPhi[5][12];
167 
168  // performance counters
169 
170  void GetPFParticleIdMap(const PFParticleHandle &pfParticleHandle, PFParticleIdMap &pfParticleMap);
171 
172  }; // class CosmicIdAna
173 
174 
175  // Constructor
177  : EDAnalyzer(config)
178  , fSimModuleLabel (config().SimModuleLabel())
179  , fTpcTrackModuleLabel (config().TpcTrackModuleLabel())
180  , fPandoraLabel (config().PandoraLabel())
181  , fVerbose (config().Verbose())
182  , fBeamTimeMin (config().BeamTimeLimits().BeamTimeMin())
183  , fBeamTimeMax (config().BeamTimeLimits().BeamTimeMax())
184  , cosIdAlg (config().CosIdAlg())
185  , fMcsFitter (config().fitter)
186  {
187 
188  } // CosmicIdAna()
189 
190 
192  {
193  // Access tfileservice to handle creating and writing histograms
194  art::ServiceHandle<art::TFileService> tfs;
195 
196  hBeamTime = tfs->make<TH1D>("BeamTime", "", 100, -10, 10);
197 
198  for(size_t i = 0; i < nTC; i++){
199  for(size_t j = 0; j < nCuts; j++){
200  TString hMom_name = Form("hTrueMom%s_%s", trueCategories[i].c_str(), cuts[j].c_str());
201  hTrueMom[i][j] = tfs->make<TH1D>(hMom_name, "", 20, 0, 2);
202  TString hLength_name = Form("hTrueLength%s_%s", trueCategories[i].c_str(), cuts[j].c_str());
203  hTrueLength[i][j] = tfs->make<TH1D>(hLength_name, "", 20, 0, 500);
204  TString hTheta_name = Form("hTrueTheta%s_%s", trueCategories[i].c_str(), cuts[j].c_str());
205  hTrueTheta[i][j] = tfs->make<TH1D>(hTheta_name, "", 20, 0, 3.2);
206  TString hPhi_name = Form("hTruePhi%s_%s", trueCategories[i].c_str(), cuts[j].c_str());
207  hTruePhi[i][j] = tfs->make<TH1D>(hPhi_name, "", 20, -3.2, 3.2);
208  }
209  }
210 
211  for(size_t i = 0; i < nRC; i++){
212  for(size_t j = 0; j < nCuts; j++){
213  TString hMom_name = Form("hRecoMom%s_%s", recoCategories[i].c_str(), cuts[j].c_str());
214  hRecoMom[i][j] = tfs->make<TH1D>(hMom_name, "", 20, 0, 2);
215  TString hLength_name = Form("hRecoLength%s_%s", recoCategories[i].c_str(), cuts[j].c_str());
216  hRecoLength[i][j] = tfs->make<TH1D>(hLength_name, "", 20, 0, 500);
217  TString hTheta_name = Form("hRecoTheta%s_%s", recoCategories[i].c_str(), cuts[j].c_str());
218  hRecoTheta[i][j] = tfs->make<TH1D>(hTheta_name, "", 20, 0, 3.2);
219  TString hPhi_name = Form("hRecoPhi%s_%s", recoCategories[i].c_str(), cuts[j].c_str());
220  hRecoPhi[i][j] = tfs->make<TH1D>(hPhi_name, "", 20, -3.2, 3.2);
221  }
222  }
223 
224  // Initial output
225  if(fVerbose) std::cout<<"----------------- Cosmic ID Ana Module -------------------"<<std::endl;
226 
227  }// CosmicIdAna::beginJob()
228 
229 
230  void CosmicIdAna::analyze(const art::Event& event)
231  {
232 
233  // Fetch basic event info
234  if(fVerbose){
235  std::cout<<"============================================"<<std::endl
236  <<"Run = "<<event.run()<<", SubRun = "<<event.subRun()<<", Event = "<<event.id().event()<<std::endl
237  <<"============================================"<<std::endl;
238  }
239 
240  //----------------------------------------------------------------------------------------------------------
241  // GETTING PRODUCTS
242  //----------------------------------------------------------------------------------------------------------
243 
244  // Get truth info and matching
245  art::ServiceHandle<cheat::ParticleInventoryService> pi_serv;
246  // Retrieve all the truth info in the events
247  auto particleHandle = event.getValidHandle<std::vector<simb::MCParticle>>(fSimModuleLabel);
248 
249  // Get PFParticles from pandora
250  PFParticleHandle pfParticleHandle;
251  event.getByLabel(fPandoraLabel, pfParticleHandle);
252  if( !pfParticleHandle.isValid() ){
253  if(fVerbose) std::cout<<"Failed to find the PFParticles."<<std::endl;
254  return;
255  }
256  PFParticleIdMap pfParticleMap;
257  this->GetPFParticleIdMap(pfParticleHandle, pfParticleMap);
258  // Get PFParticle to track associations
259  art::FindManyP< recob::Track > pfPartToTrackAssoc(pfParticleHandle, event, fTpcTrackModuleLabel);
260 
261  // Get track to hit and colorimetry associations
262  auto tpcTrackHandle = event.getValidHandle<std::vector<recob::Track>>(fTpcTrackModuleLabel);
263  art::FindManyP<recob::Hit> findManyHits(tpcTrackHandle, event, fTpcTrackModuleLabel);
264 
265  //----------------------------------------------------------------------------------------------------------
266  // TRUTH MATCHING
267  //----------------------------------------------------------------------------------------------------------
268 
269  // Record all true particles and sort by type
270  std::map<int, simb::MCParticle> particles;
271  std::vector<simb::MCParticle> parts;
272  std::vector<int> nuParticleIds;
273  std::vector<int> lepParticleIds;
274  std::vector<int> dirtParticleIds;
275  std::vector<int> crParticleIds;
276 
277  // Loop over all true particles
278  for (auto const& particle: (*particleHandle)){
279  // Store particle
280  int partId = particle.TrackId();
281  particles[partId] = particle;
282  parts.push_back(particle);
283  // Get MCTruth
284  art::Ptr<simb::MCTruth> truth = pi_serv->TrackIdToMCTruth_P(partId);
285  int pdg = std::abs(particle.PdgCode());
286 
287  // If origin is a neutrino
288  if(truth->Origin() == simb::kBeamNeutrino){
289  geo::Point_t vtx;
290  vtx.SetX(truth->GetNeutrino().Nu().Vx()); vtx.SetY(truth->GetNeutrino().Nu().Vy()); vtx.SetZ(truth->GetNeutrino().Nu().Vz());
291  // If neutrino vertex is not inside the TPC then call it a dirt particle
292  if(!fTpcGeo.InFiducial(vtx, 0.)){
293  dirtParticleIds.push_back(partId);
294  }
295  // If it's a primary muon
296  else if(pdg==13 && particle.Mother()==0){
297  lepParticleIds.push_back(partId);
298  }
299  // Other nu particles
300  else{
301  nuParticleIds.push_back(partId);
302  }
303  hBeamTime->Fill(particle.T() * 1e-3);
304  }
305 
306  // If origin is a cosmic ray
307  else if(truth->Origin() == simb::kCosmicRay){
308  crParticleIds.push_back(partId);
309  }
310  }
311 
312  //----------------------------------------------------------------------------------------------------------
313  // FAKE PDS RECONSTRUCTION
314  //----------------------------------------------------------------------------------------------------------
315 
316  // Create fake flashes in each tpc
317  std::pair<std::vector<double>, std::vector<double>> fakeFlashes = CosmicIdUtils::FakeTpcFlashes(parts);
318  std::vector<double> fakeTpc0Flashes = fakeFlashes.first;
319  std::vector<double> fakeTpc1Flashes = fakeFlashes.second;
320  bool tpc0BeamFlash = CosmicIdUtils::BeamFlash(fakeTpc0Flashes, fBeamTimeMin, fBeamTimeMax);
321  bool tpc1BeamFlash = CosmicIdUtils::BeamFlash(fakeTpc1Flashes, fBeamTimeMin, fBeamTimeMax);
322 
323  // If there are no flashes in time with the beam then ignore the event
324  if(!tpc0BeamFlash && !tpc1BeamFlash) return;
325 
326  //----------------------------------------------------------------------------------------------------------
327  // COSMIC ID - CALCULATING CUTS
328  //----------------------------------------------------------------------------------------------------------
329 
330  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(event);
331  auto const detProp = art::ServiceHandle<detinfo::DetectorPropertiesService const>()->DataFor(event, clockData);
332 
333  //Loop over the pfparticle map
334  for (PFParticleIdMap::const_iterator it = pfParticleMap.begin(); it != pfParticleMap.end(); ++it){
335 
336  const art::Ptr<recob::PFParticle> pParticle(it->second);
337  // Only look for primary particles
338  if (!pParticle->IsPrimary()) continue;
339  // Check if this particle is identified as the neutrino
340  const int pdg(pParticle->PdgCode());
341  const bool isNeutrino(std::abs(pdg) == pandora::NU_E || std::abs(pdg) == pandora::NU_MU || std::abs(pdg) == pandora::NU_TAU);
342  //Find neutrino pfparticle
343  if(!isNeutrino) continue;
344 
345  int pfpType = 3;
346  std::vector<recob::Track> nuTracks;
347 
348  // Loop over daughters of pfparticle
349  for (const size_t daughterId : pParticle->Daughters()){
350 
351  // Get tracks associated with daughter
352  art::Ptr<recob::PFParticle> pDaughter = pfParticleMap.at(daughterId);
353  const std::vector< art::Ptr<recob::Track> > associatedTracks(pfPartToTrackAssoc.at(pDaughter.key()));
354  if(associatedTracks.size() != 1) continue;
355 
356  // Get the first associated track
357  recob::Track tpcTrack = *associatedTracks.front();
358  nuTracks.push_back(tpcTrack);
359 
360  // Truth match muon tracks and pfps
361  std::vector<art::Ptr<recob::Hit>> hits = findManyHits.at(tpcTrack.ID());
362  int trueId = RecoUtils::TrueParticleIDFromTotalRecoHits(clockData, hits, false);
363  int trackType = 3;
364  if(std::find(lepParticleIds.begin(), lepParticleIds.end(), trueId) != lepParticleIds.end()){
365  trackType = 0;
366  pfpType = 0;
367  }
368  else if(std::find(nuParticleIds.begin(), nuParticleIds.end(), trueId) != nuParticleIds.end()){
369  if(pfpType != 0) pfpType = 4;
370  }
371  else if(std::find(dirtParticleIds.begin(), dirtParticleIds.end(), trueId) != dirtParticleIds.end()){
372  trackType = 1;
373  if(pfpType != 0 && pfpType != 4) pfpType = 1;
374  }
375  else if(std::find(crParticleIds.begin(), crParticleIds.end(), trueId) != crParticleIds.end()){
376  trackType = 2;
377  if(pfpType != 0 && pfpType != 4 && pfpType != 1) pfpType = 2;
378  }
379 
380  // Fill cut histograms per track
381  if(particles.find(trueId) != particles.end()){
382  // Only look at muons
383  if(std::abs(particles[trueId].PdgCode()) == 13){
384  // Calculate the true variables
385  std::pair<TVector3, TVector3> se = fTpcGeo.CrossingPoints(particles[trueId]);
386  double momentum = particles[trueId].P();
387  double length = fTpcGeo.TpcLength(particles[trueId]);
388  double theta = (se.second-se.first).Theta();
389  double phi = (se.second-se.first).Phi();
390  // Switch on each cut individually
391  for(size_t j = 0; j < nCuts; j++){
392  bool plot = false;
393  if(j == 0) plot = true;
394  if(j == 1){
395  cosIdAlg.SetCuts(true, false, false, false, false, false, false, false, false);
396  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
397  }
398  if(j == 2){
399  cosIdAlg.SetCuts(false, true, false, false, false, false, false, false, false);
400  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
401  }
402  if(j == 3){
403  cosIdAlg.SetCuts(false, false, true, false, false, false, false, false, false);
404  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
405  }
406  if(j == 4){
407 
408  cosIdAlg.SetCuts(false, false, false, true, false, false, false, false, false);
409  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
410  }
411  if(j == 5){
412  cosIdAlg.SetCuts(false, false, false, false, true, false, false, false, false);
413  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
414  }
415  if(j == 6){
416  cosIdAlg.SetCuts(false, false, false, false, false, true, false, false, false);
417  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
418  }
419  if(j == 7){
420  cosIdAlg.SetCuts(false, false, false, false, false, false, true, false, false);
421  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
422  }
423  if(j == 8){
424  cosIdAlg.SetCuts(false, false, false, false, false, false, false, true, false);
425  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
426  }
427  if(j == 9){
428  cosIdAlg.SetCuts(false, false, false, false, false, false, false, false, true);
429  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
430  }
431  // Return to the cuts specified in the fhicl file
432  if(j == 10){
434  if(cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
435  }
436  if(j == 11 && !cosIdAlg.CosmicId(tpcTrack, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
437  if(!plot) continue;
438  // Fill histograms if track ID'd as cosmic
439  hTrueMom[trackType][j]->Fill(momentum);
440  hTrueLength[trackType][j]->Fill(length);
441  hTrueTheta[trackType][j]->Fill(theta);
442  hTruePhi[trackType][j]->Fill(phi);
443  }
444  }
445  }
446 
447  }
448 
449  if(nuTracks.size() == 0) continue;
450 
451  // Sort tracks by length
452  std::sort(nuTracks.begin(), nuTracks.end(), [](auto& left, auto& right){
453  return left.Length() > right.Length();});
454 
455  // Choose the longest track as the muon candidate
456  recob::Track nuTrack = nuTracks[0];
457  // Calculate the reconstructed variables
458  double recoMuMomentum = 0.;
459  bool exits = fTpcGeo.InFiducial(nuTrack.End(), 5., 5.);
460  double length = nuTrack.Length();
461  double theta = nuTrack.Theta();
462  double phi = nuTrack.Phi();
463  if(exits){
464  recob::MCSFitResult mcsResult = fMcsFitter.fitMcs(nuTrack);
465  recoMuMomentum = mcsResult.bestMomentum();
466  }
467  else{
468  recoMuMomentum = fRangeFitter.GetTrackMomentum(length, 13);
469  }
470  // Turn on each cut individually
471  for(size_t j = 0; j < nCuts; j++){
472  bool plot = false;
473  if(j == 0) plot = true;
474  if(j == 1){
475  cosIdAlg.SetCuts(true, false, false, false, false, false, false, false, false);
476  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
477  plot = true;
478  }
479  }
480  if(j == 2){
481  cosIdAlg.SetCuts(false, true, false, false, false, false, false, false, false);
482  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
483  plot = true;
484  }
485  }
486  if(j == 3){
487  cosIdAlg.SetCuts(false, false, true, false, false, false, false, false, false);
488  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
489  plot = true;
490  }
491  }
492  if(j == 4){
493  cosIdAlg.SetCuts(false, false, false, true, false, false, false, false, false);
494  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
495  plot = true;
496  }
497  }
498  if(j == 5){
499  cosIdAlg.SetCuts(false, false, false, false, true, false, false, false, false);
500  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
501  plot = true;
502  }
503  }
504  if(j == 6){
505  cosIdAlg.SetCuts(false, false, false, false, false, true, false, false, false);
506  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
507  plot = true;
508  }
509  }
510  if(j == 7){
511  cosIdAlg.SetCuts(false, false, false, false, false, false, true, false, false);
512  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
513  plot = true;
514  }
515  }
516  if(j == 8){
517  cosIdAlg.SetCuts(false, false, false, false, false, false, false, true, false);
518  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
519  plot = true;
520  }
521  }
522  if(j == 9){
523  cosIdAlg.SetCuts(false, false, false, false, false, false, false, false, true);
524  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
525  plot = true;
526  }
527  }
528  // Return to the cuts specified in the fhicl file
529  if(j == 10){
531  if(cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)) plot = true;
532  }
533  if(j == 11 && !cosIdAlg.CosmicId(detProp, *pParticle, pfParticleMap, event, fakeTpc0Flashes, fakeTpc1Flashes)){
534  plot = true;
535  }
536  if(!plot) continue;
537  //Fill histograms if PFP ID'd as a cosmic
538  hRecoMom[pfpType][j]->Fill(recoMuMomentum);
539  hRecoLength[pfpType][j]->Fill(length);
540  hRecoTheta[pfpType][j]->Fill(theta);
541  hRecoPhi[pfpType][j]->Fill(phi);
542  }
543 
544  }
545 
546  } // CosmicIdAna::analyze()
547 
548 
550 
551  } // CosmicIdAna::endJob()
552 
553  void CosmicIdAna::GetPFParticleIdMap(const PFParticleHandle &pfParticleHandle, PFParticleIdMap &pfParticleMap){
554  for (unsigned int i = 0; i < pfParticleHandle->size(); ++i){
555  const art::Ptr<recob::PFParticle> pParticle(pfParticleHandle, i);
556  if (!pfParticleMap.insert(PFParticleIdMap::value_type(pParticle->Self(), pParticle)).second){
557  std::cout << " Unable to get PFParticle ID map, the input PFParticle collection has repeat IDs!" <<"\n";
558  }
559  }
560  }
561 
562  //------------------------------------------------------------------------------------------------------------------------------------------
563 
564  DEFINE_ART_MODULE(CosmicIdAna)
565 } // namespace sbnd
BEGIN_PROLOG Verbose
void GetPFParticleIdMap(const PFParticleHandle &pfParticleHandle, PFParticleIdMap &pfParticleMap)
fhicl::Atom< art::InputTag > TpcTrackModuleLabel
trkf::TrajectoryMCSFitter fMcsFitter
art::InputTag fTpcTrackModuleLabel
name of TPC track producer
var pdg
Definition: selectors.fcl:14
bool BeamFlash(std::vector< double > flashes, double beamTimeMin, double beamTimeMax)
fhicl::Atom< art::InputTag > SimModuleLabel
Declaration of signal hit object.
walls no right
Definition: selectors.fcl:105
bool CosmicId(recob::Track track, const art::Event &event, std::vector< double > t0Tpc0, std::vector< double > t0Tpc1)
std::vector< std::string > recoCategories
process_name plot
TH1D * hRecoLength[5][12]
fhicl::Atom< bool > Verbose
CosmicIdAna(Parameters const &config)
TH1D * hTrueTheta[4][12]
std::vector< std::string > cuts
T abs(T value)
float bestMomentum() const
momentum for best direction fit
Definition: MCSFitResult.h:56
art::EDAnalyzer::Table< Config > Parameters
double TpcLength(const simb::MCParticle &particle)
const Cut kCosmicRay
BEGIN_PROLOG vertical distance to the surface Name
walls no left
Definition: selectors.fcl:105
int TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit > > &hits, bool rollup_unsaved_ids=1)
TH1D * hTrueLength[4][12]
fhicl::Table< CosmicIdAlg::Config > CosIdAlg
std::map< size_t, art::Ptr< recob::PFParticle > > PFParticleIdMap
virtual void beginJob() override
trkf::TrackMomentumCalculator fRangeFitter
Definition of data types for geometry description.
Provides recob::Track data product.
art::InputTag fSimModuleLabel
name of detsim producer
Class storing the result of the Maximum Likelihood fit of Multiple Coulomb Scattering angles between ...
Definition: MCSFitResult.h:19
fhicl::Table< trkf::TrajectoryMCSFitter::Config > fitter
art::InputTag fPandoraLabel
art::Handle< std::vector< recob::PFParticle > > PFParticleHandle
virtual void endJob() override
TH1D * hRecoTheta[5][12]
do i e
Class for Maximum Likelihood fit of Multiple Coulomb Scattering angles between segments within a Trac...
std::pair< std::vector< double >, std::vector< double > > FakeTpcFlashes(std::vector< simb::MCParticle > particles)
Definition: CosmicIdUtils.cc:8
stream1 can override from command line with o or output services user sbnd
bool fVerbose
print information about what&#39;s going on
fhicl::Atom< double > BeamTimeMax
art::ServiceHandle< art::TFileService > tfs
std::vector< std::string > trueCategories
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
virtual void analyze(const art::Event &event) override
fhicl::Table< BeamTime > BeamTimeLimits
BEGIN_PROLOG could also be cout
auto const detProp
Track from a non-cascading particle.A recob::Track consists of a recob::TrackTrajectory, plus additional members relevant for a &quot;fitted&quot; track:
double GetTrackMomentum(double trkrange, int pdg) const
std::pair< TVector3, TVector3 > CrossingPoints(const simb::MCParticle &particle)
fhicl::Atom< art::InputTag > PandoraLabel
bool InFiducial(geo::Point_t point, double fiducial)
fhicl::Atom< double > BeamTimeMin
void SetCuts(bool FV, bool SP, bool Geo, bool CC, bool AC, bool CT, bool CH, bool PT, bool PN)