PandoraAnalysis_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: pandoraAnalysis
3 // Plugin Type: analyzer (art v3_05_01)
4 // File: pandoraAnalysis_module.cc
5 //
6 // Generated at Fri Aug 7 15:01:35 2020 by Maria Brigida Brunetti using cetskelgen
7 // from cetlib version v3_10_00.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "fhiclcpp/ParameterSet.h"
19 
20 #include "art_root_io/TFileService.h"
24 #include "canvas/Persistency/Common/FindManyP.h"
34 
39 
41 
42 #include <TTree.h>
43 #include <vector>
44 #include <string>
45 #include <TH1D.h>
46 #include <TLorentzVector.h>
47 
48 
49 namespace test {
50  class pandoraAnalysis;
51 }
52 
53 
55 public:
56  explicit pandoraAnalysis(fhicl::ParameterSet const& p);
57  // The compiler-generated destructor is fine for non-base
58  // classes without bare pointers or other resource use.
59 
60  // Plugins should not be copied or assigned.
61  pandoraAnalysis(pandoraAnalysis const&) = delete;
62  pandoraAnalysis(pandoraAnalysis&&) = delete;
63  pandoraAnalysis& operator=(pandoraAnalysis const&) = delete;
65 
66  // Required functions.
67  void analyze(art::Event const& e) override;
68 
69  // Selected optional functions.
70  void beginJob() override;
71  void endJob() override;
72 
73  void reset(bool deepClean=false);
74 
75 private:
76 
77  // Declare member data here.
78 
79  TTree *fTree;
80 
81  unsigned int fEventID;
82  unsigned int fRunID;
83  unsigned int fSubRunID;
84 
85  unsigned int fNMCParticles;
86  unsigned int fNPFParticles;
87 
88 /* static const int kNMaxMCParticles = 200;
89  static const int kNMaxPFParticles = 200;
90  static const int kNMaxPFPClusters = 3;*/
91 
92  static const int kNMaxMCParticles = 20000;
93  static const int kNMaxPFParticles = 2000;
94  static const int kNMaxPFPClusters = 100;
95  static const int kNViews = 3;
96 
97 
126  //int fMCPfoMatchedPosition[kNMaxMCParticles];
127 
148 
149 
176 
193 
198 
205 
207 };
208 
209 
211  : EDAnalyzer{p}
212 {
213  fTruthLabel = p.get<std::string>("TruthLabel");
214  fHitLabel = p.get<std::string>("HitLabel");
215  fPFParticleLabel = p.get<std::string>("PFParticleLabel");
216  fTrackLabel = p.get<std::string>("TrackLabel");
217  fShowerLabel = p.get<std::string>("ShowerLabel");
219  fRollUpUnsavedIDs = p.get<bool>("RollUpUnsavedIDs");
220 }
221 
223 {
224  reset(); //Don't deep clean
226  fEventID = e.id().event();
227  fRunID = e.id().run();
228  fSubRunID = e.id().subRun();
229  auto const clockData = art::ServiceHandle<detinfo::DetectorClocksService>()->DataFor(e);
230  std::cout << "=============== EVENT ID " << fEventID << " == RUN ID " << fRunID << " == SUBRUN ID " << fSubRunID << " ================" << std::endl;
231 
232 
233  //Get all hits
234  std::vector<art::Ptr<recob::Hit> > allHits;
235  auto hitHandle = e.getHandle<std::vector<recob::Hit>>(fHitLabel);
236  if (hitHandle)
237  {art::fill_ptr_vector(allHits, hitHandle);}
238 
239  //Fill MC particle to hits map
240  std::map<int,int> trueParticleHits, trueParticleHitsView0, trueParticleHitsView1, trueParticleHitsView2;
241  for (const auto& hit: allHits){
243  if (TruthMatchUtils::Valid(g4ID)){
244  trueParticleHits[g4ID]++;
245  if(hit->View()==0)trueParticleHitsView0[g4ID]++;
246  if(hit->View()==1)trueParticleHitsView1[g4ID]++;
247  if(hit->View()==2)trueParticleHitsView2[g4ID]++;
248  }
249  }
250 
251  //Access the truth information
252  if(!e.isRealData()){
253  art::ValidHandle<std::vector<simb::MCParticle>> mcParticles = e.getValidHandle<std::vector<simb::MCParticle>>(fTruthLabel);
254  if(mcParticles.isValid()){
255 
256  fNMCParticles=mcParticles->size();
257  bool isMCPrimary(false);
258  for(unsigned int iMc=0; iMc< mcParticles->size(); iMc++){
259  const simb::MCParticle trueParticle = mcParticles->at(iMc);
260  fMCParticleTrueEnergy[iMc]=trueParticle.E();
261  fMCParticlePdgCode[iMc]=trueParticle.PdgCode();
262  fMCParticleTrackID[iMc]=trueParticle.TrackId();
263  fMCParticleVertexTime[iMc]=trueParticle.T();
264  fMCParticleEndTime[iMc]=trueParticle.EndT();
265  fMCParticleParentTrackID[iMc]=trueParticle.Mother();
266  fMCParticleStartProcess[iMc]=trueParticle.Process();
267  fMCParticleEndProcess[iMc]=trueParticle.EndProcess();
269  trueParticle.Process()=="primary"? isMCPrimary=true:isMCPrimary=false;
270  fMCIsPrimary[iMc] = isMCPrimary;
271  fMCParticleNHits[iMc]=trueParticleHits[trueParticle.TrackId()];
272  fMCParticleNHitsView[iMc][0]=trueParticleHitsView0[trueParticle.TrackId()];
273  fMCParticleNHitsView[iMc][1]=trueParticleHitsView1[trueParticle.TrackId()];
274  fMCParticleNHitsView[iMc][2]=trueParticleHitsView2[trueParticle.TrackId()];
275  fMCParticleStartPositionX[iMc] = trueParticle.Position().X();
276  fMCParticleStartPositionY[iMc] = trueParticle.Position().Y();
277  fMCParticleStartPositionZ[iMc] = trueParticle.Position().Z();
278  fMCParticleStartPositionT[iMc] = trueParticle.Position().T();
279  fMCParticleEndPositionX[iMc] = trueParticle.EndPosition().X();
280  fMCParticleEndPositionY[iMc] = trueParticle.EndPosition().Y();
281  fMCParticleEndPositionZ[iMc] = trueParticle.EndPosition().Z();
282  fMCParticleEndPositionT[iMc] = trueParticle.EndPosition().T();
283 
284  fMCParticleStartMomentumX[iMc] = trueParticle.Momentum().X();
285  fMCParticleStartMomentumY[iMc] = trueParticle.Momentum().Y();
286  fMCParticleStartMomentumZ[iMc] = trueParticle.Momentum().Z();
287  fMCParticleStartMomentumE[iMc] = trueParticle.Momentum().E();
288  fMCParticleEndMomentumX[iMc] = trueParticle.EndMomentum().X();
289  fMCParticleEndMomentumY[iMc] = trueParticle.EndMomentum().Y();
290  fMCParticleEndMomentumZ[iMc] = trueParticle.EndMomentum().Z();
291  fMCParticleEndMomentumE[iMc] = trueParticle.EndMomentum().E();
292 
293  }
294  }
295  }
296 
297  //Access the PFParticles from Pandora
298  const std::vector<art::Ptr<recob::PFParticle>> pfparticleVect = dune_ana::DUNEAnaEventUtils::GetPFParticles(e,fPFParticleLabel);
299  fNPFParticles = pfparticleVect.size();
300  if(!fNPFParticles) {
301  std::cout << "No PFParticles found!" << std::endl;
302  return;
303  }
304 
305  //Access the Clusters
306  std::vector<art::Ptr<recob::Cluster>> clusterVect;
307  auto clusterHandle = e.getHandle<std::vector<recob::Cluster> >(fPFParticleLabel);
308  if (clusterHandle)
309  art::fill_ptr_vector(clusterVect,clusterHandle);
310 
311  art::FindManyP<recob::Cluster> clusterParticleAssoc(pfparticleVect, e, fPFParticleLabel);
312 
313  auto trackHandle = e.getHandle<std::vector<recob::Track> >(fTrackLabel);
314  if (!trackHandle){
315  std::cout<<"Unable to find std::vector<recob::Track> with module label: " << fTrackLabel << std::endl;
316  return;
317  }
318  std::vector<art::Ptr<recob::Track> > trackList;
319  art::fill_ptr_vector(trackList, trackHandle);
320 
321  //std::map<int,int> pfpToMcMap;
322  int iPfp(0);
323  for(const art::Ptr<recob::PFParticle> &pfp: pfparticleVect){
324 
325  fPFPID[iPfp]=iPfp;
326  fPFPIsPrimary[iPfp]=pfp->IsPrimary();
327  fPFPPdgCode[iPfp]=pfp->PdgCode();
328  fPFPNChildren[iPfp]=pfp->NumDaughters();
329  (pfp->IsPrimary())? fPFPParentID[iPfp]=-1 : fPFPParentID[iPfp]=pfp->Parent();
330 
331  std::vector<art::Ptr<recob::Cluster>> pfpClusters = clusterParticleAssoc.at(pfp.key());
332  fPFPNClusters[iPfp]=pfpClusters.size();
333  if(!pfpClusters.empty()){
334  int iClu(0);
335  for(const art::Ptr<recob::Cluster> &clu:pfpClusters){
336  fPFPCluPlane[iPfp][iClu]=clu->Plane().asPlaneID().Plane;
337  fPFPCluView[iPfp][iClu]=clu->View();
338  fPFPCluNHits[iPfp][iClu]=clu->NHits();
339  fPFPCluIntegral[iPfp][iClu]=clu->Integral();
340  iClu++;
341  if (iClu == kNMaxPFPClusters)
342  break;
343  }
344  }
345 
346  std::vector<art::Ptr<recob::Hit>> pfpHits;
347 
349  fPFPIsTrack[iPfp]=true;
351 
352  fPFPTrackID[iPfp]=track->ID();
353  fPFPTrackLength[iPfp]=track->Length();
354  fPFPTrackStartX[iPfp]=track->Start().X();
355  fPFPTrackStartY[iPfp]=track->Start().Y();
356  fPFPTrackStartZ[iPfp]=track->Start().Z();
357  fPFPTrackVertexX[iPfp]=track->Vertex().X();
358  fPFPTrackVertexY[iPfp]=track->Vertex().Y();
359  fPFPTrackVertexZ[iPfp]=track->Vertex().Z();
360  fPFPTrackEndX[iPfp]=track->End().X();
361  fPFPTrackEndY[iPfp]=track->End().Y();
362  fPFPTrackEndZ[iPfp]=track->End().Z();
363  fPFPTrackTheta[iPfp]=track->Theta();
364  fPFPTrackPhi[iPfp]=track->Phi();
365  fPFPTrackZenithAngle[iPfp]=track->ZenithAngle();
366  fPFPTrackAzimuthAngle[iPfp]=track->AzimuthAngle();
367  fPFPTrackStartDirectionX[iPfp]=track->StartDirection().X();
368  fPFPTrackStartDirectionY[iPfp]=track->StartDirection().Y();
369  fPFPTrackStartDirectionZ[iPfp]=track->StartDirection().Z();
370  fPFPTrackVertexDirectionX[iPfp]=track->VertexDirection().X();
371  fPFPTrackVertexDirectionY[iPfp]=track->VertexDirection().Y();
372  fPFPTrackVertexDirectionZ[iPfp]=track->VertexDirection().Z();
373  fPFPTrackEndDirectionX[iPfp]=track->EndDirection().X();
374  fPFPTrackEndDirectionY[iPfp]=track->EndDirection().Y();
375  fPFPTrackEndDirectionZ[iPfp]=track->EndDirection().Z();
376  fPFPTrackChi2[iPfp]=track->Chi2();
377  fPFPTrackNdof[iPfp]=track->Ndof();
378 
380 
381  fPFPNHits[iPfp]=pfpHits.size();
382  std::vector<art::Ptr<recob::Hit> > pfpHitsView0 = dune_ana::DUNEAnaPFParticleUtils::GetViewHits(pfp,e,fPFParticleLabel, 0);
383  fPFPNHitsView[iPfp][0] = pfpHitsView0.size();
384  std::vector<art::Ptr<recob::Hit> > pfpHitsView1 = dune_ana::DUNEAnaPFParticleUtils::GetViewHits(pfp,e,fPFParticleLabel, 1);
385  fPFPNHitsView[iPfp][1] = pfpHitsView1.size();
386  std::vector<art::Ptr<recob::Hit> > pfpHitsView2 = dune_ana::DUNEAnaPFParticleUtils::GetViewHits(pfp,e,fPFParticleLabel, 2);
387  fPFPNHitsView[iPfp][2] = pfpHitsView2.size();
388 
389  if(!e.isRealData()) {
391  if (TruthMatchUtils::Valid(g4ID)){
392  fPFPTrueParticleMatchedID[iPfp] = g4ID;
393 
394  int pos(999999); for(int unsigned ipos=0; ipos<fNMCParticles; ipos++) {
395  if(fMCParticleTrackID[ipos]==g4ID)pos=ipos;
396  }
398 
399  }
401  if (TruthMatchUtils::Valid(g4ID))
402  {
403  fPFPTrueParticleMatchedIDView[iPfp][0] = g4IDView0;
404  for(int unsigned ipos=0; ipos<fNMCParticles; ipos++)
405  {
406  if (fMCParticleTrackID[ipos] != g4IDView0)
407  continue;
408  fPFPTrueParticleMatchedPositionView[iPfp][0] = ipos;
409  break;
410  }
411  }
413  if (TruthMatchUtils::Valid(g4ID))
414  {
415  fPFPTrueParticleMatchedIDView[iPfp][1] = g4IDView1;
416  for(int unsigned ipos=0; ipos<fNMCParticles; ipos++)
417  {
418  if (fMCParticleTrackID[ipos] != g4IDView1)
419  continue;
420  fPFPTrueParticleMatchedPositionView[iPfp][1] = ipos;
421  break;
422  }
423  }
425  if (TruthMatchUtils::Valid(g4ID))
426  {
427  fPFPTrueParticleMatchedIDView[iPfp][2] = g4IDView2;
428  for(int unsigned ipos=0; ipos<fNMCParticles; ipos++)
429  {
430  if (fMCParticleTrackID[ipos] != g4IDView2)
431  continue;
432  fPFPTrueParticleMatchedPositionView[iPfp][2] = ipos;
433  break;
434  }
435  }
436 
437  }
438  }
439 
441  fPFPIsShower[iPfp]=true;
443  fPFPShowerID[iPfp]=shower->ID();
444  fPFPShowerBestPlane[iPfp]=shower->best_plane();
445  fPFPShowerDirectionX[iPfp]=shower->Direction().X();
446  fPFPShowerDirectionY[iPfp]=shower->Direction().Y();
447  fPFPShowerDirectionZ[iPfp]=shower->Direction().Z();
448  fPFPShowerDirectionErrX[iPfp]=shower->DirectionErr().X();
449  fPFPShowerDirectionErrY[iPfp]=shower->DirectionErr().Y();
450  fPFPShowerDirectionErrZ[iPfp]=shower->DirectionErr().Z();
451  fPFPShowerStartX[iPfp]=shower->ShowerStart().X();
452  fPFPShowerStartY[iPfp]=shower->ShowerStart().Y();
453  fPFPShowerStartZ[iPfp]=shower->ShowerStart().Z();
454  fPFPShowerStartErrX[iPfp]=shower->ShowerStartErr().X();
455  fPFPShowerStartErrY[iPfp]=shower->ShowerStartErr().Y();
456  fPFPShowerStartErrZ[iPfp]=shower->ShowerStartErr().Z();
457  fPFPShowerLength[iPfp]=shower->Length();
458  fPFPShowerOpenAngle[iPfp]=shower->OpenAngle();
459 
461  fPFPNHits[iPfp]=pfpHits.size();
462  std::vector<art::Ptr<recob::Hit> > pfpHitsView0 = dune_ana::DUNEAnaPFParticleUtils::GetViewHits(pfp,e,fPFParticleLabel, 0);
463  fPFPNHitsView[iPfp][0] = pfpHitsView0.size();
464  std::vector<art::Ptr<recob::Hit> > pfpHitsView1 = dune_ana::DUNEAnaPFParticleUtils::GetViewHits(pfp,e,fPFParticleLabel, 1);
465  fPFPNHitsView[iPfp][1] = pfpHitsView1.size();
466  std::vector<art::Ptr<recob::Hit> > pfpHitsView2 = dune_ana::DUNEAnaPFParticleUtils::GetViewHits(pfp,e,fPFParticleLabel, 2);
467  fPFPNHitsView[iPfp][2] = pfpHitsView2.size();
468 
469  if(!e.isRealData()) {
471  if (TruthMatchUtils::Valid(g4ID)){
472  fPFPTrueParticleMatchedID[iPfp] = g4ID;
473  int pos(999999); for(int unsigned ipos=0; ipos<fNMCParticles; ipos++) {
474  if(fMCParticleTrackID[ipos]==g4ID)pos=ipos;
475  }
477  }
479  if (TruthMatchUtils::Valid(g4ID))
480  {
481  fPFPTrueParticleMatchedIDView[iPfp][0] = g4IDView0;
482  for(int unsigned ipos=0; ipos<fNMCParticles; ipos++)
483  {
484  if (fMCParticleTrackID[ipos] != g4IDView0)
485  continue;
486  fPFPTrueParticleMatchedPositionView[iPfp][0] = ipos;
487  break;
488  }
489  }
491  if (TruthMatchUtils::Valid(g4ID))
492  {
493  fPFPTrueParticleMatchedIDView[iPfp][1] = g4IDView1;
494  for(int unsigned ipos=0; ipos<fNMCParticles; ipos++)
495  {
496  if (fMCParticleTrackID[ipos] != g4IDView1)
497  continue;
498  fPFPTrueParticleMatchedPositionView[iPfp][1] = ipos;
499  break;
500  }
501  }
503  if (TruthMatchUtils::Valid(g4ID))
504  {
505  fPFPTrueParticleMatchedIDView[iPfp][2] = g4IDView2;
506  for(int unsigned ipos=0; ipos<fNMCParticles; ipos++)
507  {
508  if (fMCParticleTrackID[ipos] != g4IDView2)
509  continue;
510  fPFPTrueParticleMatchedPositionView[iPfp][2] = ipos;
511  break;
512  }
513  }
514 
515  }
516  }
517 
518  if(!e.isRealData()) {
519  //Fill shared MC particle to hits map for this specific Pfp
520  for (const auto& hit: pfpHits){
522  if (TruthMatchUtils::Valid(g4ID)){
524  if(g4ID==fPFPTrueParticleMatchedID[iPfp] && hit->View()==0)++fPFPNSharedTrueParticleHitsView[iPfp][0];
525  if(g4ID==fPFPTrueParticleMatchedID[iPfp] && hit->View()==1)++fPFPNSharedTrueParticleHitsView[iPfp][1];
526  if(g4ID==fPFPTrueParticleMatchedID[iPfp] && hit->View()==2)++fPFPNSharedTrueParticleHitsView[iPfp][2];
527  }
528  }
529 
530  if(fPFPNHits[iPfp] > 0 && fPFPNHits[iPfp] < 999999) fPFPPurity[iPfp] = (float)fPFPNSharedTrueParticleHits[iPfp] / fPFPNHits[iPfp];
531  if(fPFPNHitsView[iPfp][0] > 0 && fPFPNHitsView[iPfp][0] < 999999) fPFPPurityView[iPfp][0] = (float)fPFPNSharedTrueParticleHitsView[iPfp][0] / fPFPNHitsView[iPfp][0];
532  if(fPFPNHitsView[iPfp][1] > 0 && fPFPNHitsView[iPfp][1] < 999999) fPFPPurityView[iPfp][1] = (float)fPFPNSharedTrueParticleHitsView[iPfp][1] / fPFPNHitsView[iPfp][1];
533  if(fPFPNHitsView[iPfp][2] > 0 && fPFPNHitsView[iPfp][2] < 999999) fPFPPurityView[iPfp][2] = (float)fPFPNSharedTrueParticleHitsView[iPfp][2] / fPFPNHitsView[iPfp][2];
534 
539 
540  }
541  iPfp++;
542  }
543  fTree->Fill();
544 }
545 
547 {
548 
549  //deep clean the variables
550  reset(true);
551  // Implementation of optional member function here.
553  fTree = tfs->make<TTree>("pandoraOutput","Pandora Output Tree");
554 
555  //Event branches
556  fTree->Branch("eventID",&fEventID,"eventID/i");
557  fTree->Branch("runID",&fRunID,"runID/i");
558  fTree->Branch("subrunID",&fSubRunID,"subrunID/i");
559  fTree->Branch("nMCParticles",&fNMCParticles,"nMCParticles/i");
560  fTree->Branch("nPFParticles",&fNPFParticles,"nPFParticles/i");
561 
562  //MC truth branches
563  //fTree->Branch("mcIsMCPrimary",&fMCIsPrimary);
564  fTree->Branch("mcIsMCPrimary",&fMCIsPrimary,"MCIsPrimary[nMCParticles]/O");
565  fTree->Branch("mcParticlePdgCode",&fMCParticlePdgCode,"MCParticlePdgCode[nMCParticles]/I");
566  fTree->Branch("mcParticleTrueEnergy",&fMCParticleTrueEnergy,"MCParticleTrueEnergy[nMCParticles]/D");
567  fTree->Branch("mcParticleTrackID",&fMCParticleTrackID,"MCParticleTrackID[nMCParticles]/I");
568  fTree->Branch("mcParticleParentTrackID",&fMCParticleParentTrackID,"MCParticleParentTrackID[nMCParticles]/I");
569  fTree->Branch("mcParticleStartProcess",&fMCParticleStartProcess,"MCParticleStartProcess[nMCParticles]/C");
570  fTree->Branch("mcParticleEndProcess",&fMCParticleEndProcess, "MCParticleEndProcess[nMCParticles]/C");
571  fTree->Branch("mcParticleNTrajectoryPoints",&fMCParticleNTrajectoryPoint, "MCParticleNTrajectoryPoint[nMCParticles]/I");
572  fTree->Branch("mcParticleStartPositionX",&fMCParticleStartPositionX,"MCParticleStartPositionX[nMCParticles]/D");
573  fTree->Branch("mcParticleStartPositionY",&fMCParticleStartPositionY,"MCParticleStartPositionY[nMCParticles]/D");
574  fTree->Branch("mcParticleStartPositionZ",&fMCParticleStartPositionZ,"MCParticleStartPositionZ[nMCParticles]/D");
575  fTree->Branch("mcParticleStartPositionT",&fMCParticleStartPositionT,"MCParticleStartPositionT[nMCParticles]/D");
576  fTree->Branch("mcParticleStartMomentumX",&fMCParticleStartMomentumX, "MCParticleStartMomentumX[nMCParticles]/D");
577  fTree->Branch("mcParticleStartMomentumY",&fMCParticleStartMomentumY, "MCParticleStartMomentumY[nMCParticles]/D");
578  fTree->Branch("mcParticleStartMomentumZ",&fMCParticleStartMomentumZ, "MCParticleStartMomentumZ[nMCParticles]/D");
579  fTree->Branch("mcParticleStartMomentumE",&fMCParticleStartMomentumE, "MCParticleStartMomentumE[nMCParticles]/D");
580  fTree->Branch("mcParticleEndPositionX",&fMCParticleEndPositionX, "MCParticleEndPositionX[nMCParticles]/D");
581  fTree->Branch("mcParticleEndPositionY",&fMCParticleEndPositionY, "MCParticleEndPositionY[nMCParticles]/D");
582  fTree->Branch("mcParticleEndPositionZ",&fMCParticleEndPositionZ, "MCParticleEndPositionZ[nMCParticles]/D");
583  fTree->Branch("mcParticleEndPositionT",&fMCParticleEndPositionT, "MCParticleEndPositionT[nMCParticles]/D");
584  fTree->Branch("mcParticleEndMomentumX",&fMCParticleEndMomentumX, "MCParticleEndMomentumX[nMCParticles]/D");
585  fTree->Branch("mcParticleEndMomentumY",&fMCParticleEndMomentumY, "MCParticleEndMomentumY[nMCParticles]/D");
586  fTree->Branch("mcParticleEndMomentumZ",&fMCParticleEndMomentumZ, "MCParticleEndMomentumZ[nMCParticles]/D");
587  fTree->Branch("mcParticleEndMomentumE",&fMCParticleEndMomentumE, "MCParticleEndMomentumE[nMCParticles]/D");
588  fTree->Branch("mcParticleVertexTime",&fMCParticleVertexTime, "MCParticleVertexTime[nMCParticles]/D");
589  fTree->Branch("mcParticleEndTime",&fMCParticleEndTime, "MCParticleEndTime[nMCParticles]/D");
590  fTree->Branch("mcParticleNHits", &fMCParticleNHits, "MCParticleNHits[nMCParticles]/I");
591  fTree->Branch("mcParticleNHitsView", &fMCParticleNHitsView, "MCParticleNHitsView[nMCParticles][3]/I");
592  //fTree->Branch("mcPfoMatchedPosition", &fMCPfoMatchedPosition, "fMCPfoMatchedPosition[nMCParticles]/I");
593 
594  //PFP branches
595  fTree->Branch("pfpTrueParticleMatchedID",&fPFPTrueParticleMatchedID,"PFPTrueParticleMatchedID[nPFParticles]/I");
596  fTree->Branch("pfpTrueParticleMatchedPosition",&fPFPTrueParticleMatchedPosition,"PFPTrueParticleMatchedPosition[nPFParticles]/I");
597  fTree->Branch("pfpIsPrimary",&fPFPIsPrimary,"PFPIsPrimary[nPFParticles]/O");
598  fTree->Branch("pfpID",&fPFPID, "PFPID[nPFParticles]/I");
599  fTree->Branch("pfpParentID",&fPFPParentID, "PFPParentID[nPFParticles]/I");
600  fTree->Branch("pfpPdgCode",&fPFPPdgCode, "PFPPdgCode[nPFParticles]/I");
601  fTree->Branch("pfpNChildren",&fPFPNChildren,"PFPNChildren[nPFParticles]/I");
602  fTree->Branch("pfpNClusters",&fPFPNClusters,"PFPNClusters[nPFParticles]/I");
603  fTree->Branch("pfpNHits",&fPFPNHits,"PFPNHits[nPFParticles]/I");
604  fTree->Branch("pfpNHitsView",&fPFPNHitsView,"PFPNHitsView[nPFParticles][3]/I");
605  fTree->Branch("pfpNSharedTrueParticleHits",&fPFPNSharedTrueParticleHits,"PFPNSharedTrueParticleHits[nPFParticles]/I");
606  fTree->Branch("pfpNSharedTrueParticleHitsView",&fPFPNSharedTrueParticleHitsView,"PFPNSharedTrueParticleHitsView[nPFParticles][3]/I");
607  fTree->Branch("pfpTrueParticleMatchedIDView",&fPFPTrueParticleMatchedIDView,"PFPTrueParticleMatchedIDView[nPFParticles][3]/I");
608  fTree->Branch("pfpTrueParticleMatchedPositionView",&fPFPTrueParticleMatchedPositionView,"PFPTrueParticleMatchedPositionView[nPFParticles][3]/I");
609  fTree->Branch("pfpIsTrack",&fPFPIsTrack,"PFPIsTrack[nPFParticles]/O");
610  fTree->Branch("pfpIsShower",&fPFPIsShower,"PFPIsShower[nPFParticles]/O");
611  fTree->Branch("pfpTrackID", &fPFPTrackID,"PFPNClusters[nPFParticles]/I");
612  fTree->Branch("pfpTrackLength",&fPFPTrackLength,"PFPTrackLength[nPFParticles]/D");
613  fTree->Branch("pfpTrackStartX",&fPFPTrackStartX,"PFPTrackStartX[nPFParticles]/D");
614  fTree->Branch("pfpTrackStartY",&fPFPTrackStartY,"PFPTrackStartY[nPFParticles]/D");
615  fTree->Branch("pfpTrackStartZ",&fPFPTrackStartZ,"PFPTrackStartZ[nPFParticles]/D");
616  fTree->Branch("pfpTrackVertexX",&fPFPTrackVertexX,"PFPTrackVertexX[nPFParticles]/D");
617  fTree->Branch("pfpTrackVertexY",&fPFPTrackVertexY,"PFPTrackVertexY[nPFParticles]/D");
618  fTree->Branch("pfpTrackVertexZ",&fPFPTrackVertexZ,"PFPTrackVertexZ[nPFParticles]/D");
619  fTree->Branch("pfpTrackEndX",&fPFPTrackEndX,"PFPTrackEndX[nPFParticles]/D");
620  fTree->Branch("pfpTrackEndY",&fPFPTrackEndY,"PFPTrackEndY[nPFParticles]/D");
621  fTree->Branch("pfpTrackEndZ",&fPFPTrackEndZ,"PFPTrackEndZ[nPFParticles]/D");
622  fTree->Branch("pfpTrackTheta",&fPFPTrackTheta,"PFPTrackTheta[nPFParticles]/D");
623  fTree->Branch("pfpTrackPhi",&fPFPTrackPhi,"PFPTrackPhi[nPFParticles]/D");
624  fTree->Branch("pfpTrackZenithAngle",&fPFPTrackZenithAngle,"PFPTrackZenithAngle[nPFParticles]/D");
625  fTree->Branch("pfpTrackAzimuthAngle",&fPFPTrackAzimuthAngle,"PFPTrackAzimuthAngle[nPFParticles]/D");
626  fTree->Branch("pfpTrackStartDirectionX",&fPFPTrackStartDirectionX,"PFPTrackStartDirectionX[nPFParticles]/D");
627  fTree->Branch("pfpTrackStartDirectionY",&fPFPTrackStartDirectionY,"PFPTrackStartDirectionY[nPFParticles]/D");
628  fTree->Branch("pfpTrackStartDirectionZ",&fPFPTrackStartDirectionZ,"PFPTrackStartDirectionZ[nPFParticles]/D");
629  fTree->Branch("pfpTrackVertexDirectionX",&fPFPTrackVertexDirectionX,"PFPTrackVertexDirectionX[nPFParticles]/D");
630  fTree->Branch("pfpTrackVertexDirectionY",&fPFPTrackVertexDirectionY,"PFPTrackVertexDirectionY[nPFParticles]/D");
631  fTree->Branch("pfpTrackVertexDirectionZ",&fPFPTrackVertexDirectionZ,"PFPTrackVertexDirectionZ[nPFParticles]/D");
632  fTree->Branch("pfpTrackEndDirectionX",&fPFPTrackEndDirectionX,"PFPTrackEndDirectionX[nPFParticles]/D");
633  fTree->Branch("pfpTrackEndDirectionY",&fPFPTrackEndDirectionY,"PFPTrackEndDirectionY[nPFParticles]/D");
634  fTree->Branch("pfpTrackEndDirectionZ",&fPFPTrackEndDirectionZ,"PFPTrackEndDirectionZ[nPFParticles]/D");
635  fTree->Branch("pfpTrackChi2",&fPFPTrackChi2,"PFPTrackChi2[nPFParticles]/F");
636  fTree->Branch("pfpTrackStartNdof",&fPFPTrackNdof,"PFPTrackNdof[nPFParticles]/I");
637 
638  fTree->Branch("pfpCluPlane",fPFPCluPlane,"PFPCluPlane[nPFParticles][100]/I");
639  fTree->Branch("pfpCluView",fPFPCluView,"PFPCluView[nPFParticles][100]/I");
640  fTree->Branch("pfpCluNHits",fPFPCluNHits,"PFPCluNHits[nPFParticles][100]/I");
641  fTree->Branch("pfpCluIntegral",fPFPCluIntegral,"PFPCluIntegral[nPFParticles][100]/D");
642 
643  fTree->Branch("pfpShowerID",&fPFPShowerID,"PFPShowerID[nPFParticles]/I");
644  fTree->Branch("pfpShowerBestPlane",&fPFPShowerBestPlane,"PFPShowerBestPlane[nPFParticles]/I");
645  fTree->Branch("pfpShowerDirectionX",&fPFPShowerDirectionX,"PFPShowerDirectionX[nPFParticles]/D");
646  fTree->Branch("pfpShowerDirectionY",&fPFPShowerDirectionY,"PFPShowerDirectionY[nPFParticles]/D");
647  fTree->Branch("pfpShowerDirectionZ",&fPFPShowerDirectionZ,"PFPShowerDirectionZ[nPFParticles]/D");
648  fTree->Branch("pfpShowerDirectionErrX",&fPFPShowerDirectionErrX,"PFPShowerDirectionErrX[nPFParticles]/D");
649  fTree->Branch("pfpShowerDirectionErrY",&fPFPShowerDirectionErrY,"PFPShowerDirectionErrY[nPFParticles]/D");
650  fTree->Branch("pfpShowerDirectionErrZ",&fPFPShowerDirectionErrZ,"PFPShowerDirectionErrZ[nPFParticles]/D");
651  fTree->Branch("pfpShowerStartX",&fPFPShowerStartX,"PFPShowerStartX[nPFParticles]/D");
652  fTree->Branch("pfpShowerStartY",&fPFPShowerStartY,"PFPShowerStartY[nPFParticles]/D");
653  fTree->Branch("pfpShowerStartZ",&fPFPShowerStartZ,"PFPShowerStartZ[nPFParticles]/D");
654  fTree->Branch("pfpShowerStartErrX",&fPFPShowerStartErrX,"PFPShowerStartErrX[nPFParticles]/D");
655  fTree->Branch("pfpShowerStartErrY",&fPFPShowerStartErrY,"PFPShowerStartErrY[nPFParticles]/D");
656  fTree->Branch("pfpShowerStartErrZ",&fPFPShowerStartErrZ,"PFPShowerStartErrZ[nPFParticles]/D");
657  fTree->Branch("pfpShowerLength",&fPFPShowerLength,"PFPShowerLength[nPFParticles]/D");
658  fTree->Branch("pfpShowerOpeningAngle",&fPFPShowerOpenAngle,"PFPShowerOpenAngle[nPFParticles]/D");
659 
660  fTree->Branch("pfpCompleteness", &fPFPCompleteness, "PFPCompleteness[nPFParticles]/D");
661  fTree->Branch("pfpCompletenessView", &fPFPCompletenessView, "PFPCompletenessView[nPFParticles][3]/D");
662  fTree->Branch("pfpPurity", &fPFPPurity, "PFPPurity[nPFParticles]/D");
663  fTree->Branch("pfpPurityView", &fPFPPurityView, "PFPPurityView[nPFParticles][3]/D");
664 }
666 {
667  // Implementation of optional member function here.
668 }
669 
670 void test::pandoraAnalysis::reset(bool deepClean)
671 {
672  for(unsigned int iMc=0; iMc<(deepClean ? kNMaxMCParticles : fNMCParticles); iMc++){
673  fMCIsPrimary[iMc]=0;
674  fMCParticlePdgCode[iMc]=0;
675  fMCParticleTrueEnergy[iMc]=-999999;
676  fMCParticleTrackID[iMc]=999999;
677  fMCParticleParentTrackID[iMc]=999999;
678  fMCParticleStartProcess[iMc]="";
679  fMCParticleEndProcess[iMc]="";
680  fMCParticleNTrajectoryPoint[iMc]=999999;
681  fMCParticleStartPositionX[iMc]=999999;
682  fMCParticleStartPositionY[iMc]=999999;
683  fMCParticleStartPositionZ[iMc]=999999;
684  fMCParticleStartPositionT[iMc]=999999;
685  fMCParticleStartMomentumX[iMc]=999999;
686  fMCParticleStartMomentumY[iMc]=999999;
687  fMCParticleStartMomentumZ[iMc]=999999;
688  fMCParticleStartMomentumE[iMc]=999999;
689  fMCParticleEndPositionX[iMc]=999999;
690  fMCParticleEndPositionY[iMc]=999999;
691  fMCParticleEndPositionZ[iMc]=999999;
692  fMCParticleEndPositionT[iMc]=999999;
693  fMCParticleEndMomentumX[iMc]=999999;
694  fMCParticleEndMomentumY[iMc]=999999;
695  fMCParticleEndMomentumZ[iMc]=999999;
696  fMCParticleEndMomentumE[iMc]=999999;
697  fMCParticleVertexTime[iMc]=999999;
698  fMCParticleEndTime[iMc]=999999;
699  fMCParticleNHits[iMc]=999999;
700  fMCParticleNHitsView[iMc][0]=999999;
701  fMCParticleNHitsView[iMc][1]=999999;
702  fMCParticleNHitsView[iMc][2]=999999;
703  //fMCPfoMatchedPosition[iMc]=999999;
704  }
705  fNMCParticles = 0;
706 
707  for(unsigned int iPfp=0; iPfp<(deepClean ? kNMaxPFParticles : fNPFParticles); iPfp++){
708 
709  fPFPID[iPfp]=999999;
710  fPFPTrueParticleMatchedID[iPfp]=999999;
711  fPFPTrueParticleMatchedPosition[iPfp]=999999;
712 
713  fPFPNHits[iPfp]=999999;
715 
716  fPFPNClusters[iPfp]=999999;
717  fPFPIsTrack[iPfp]=0;
718  fPFPIsShower[iPfp]=0;
719 
720  fPFPTrackID[iPfp]=999999;
721  fPFPTrackLength[iPfp]=999999;
722  fPFPTrackStartX[iPfp]=999999;
723  fPFPTrackStartY[iPfp]=999999;
724  fPFPTrackStartZ[iPfp]=999999;
725  fPFPTrackVertexX[iPfp]=999999;
726  fPFPTrackVertexY[iPfp]=999999;
727  fPFPTrackVertexZ[iPfp]=999999;
728  fPFPTrackEndX[iPfp]=999999;
729  fPFPTrackEndY[iPfp]=999999;
730  fPFPTrackEndZ[iPfp]=999999;
731  fPFPTrackTheta[iPfp]=999999;
732  fPFPTrackPhi[iPfp]=999999;
733  fPFPTrackZenithAngle[iPfp]=999999;
734  fPFPTrackAzimuthAngle[iPfp]=999999;
735  fPFPTrackStartDirectionX[iPfp]=999999;
736  fPFPTrackStartDirectionY[iPfp]=999999;
737  fPFPTrackStartDirectionZ[iPfp]=999999;
738  fPFPTrackVertexDirectionX[iPfp]=999999;
739  fPFPTrackVertexDirectionY[iPfp]=999999;
740  fPFPTrackVertexDirectionZ[iPfp]=999999;
741  fPFPTrackEndDirectionX[iPfp]=999999;
742  fPFPTrackEndDirectionY[iPfp]=999999;
743  fPFPTrackEndDirectionZ[iPfp]=999999;
744  fPFPTrackChi2[iPfp]=999999;
745  fPFPTrackNdof[iPfp]=999999;
746 
747  fPFPShowerID[iPfp]=999999;
748  fPFPShowerBestPlane[iPfp]=999999;
749  fPFPShowerDirectionX[iPfp]=999999;
750  fPFPShowerDirectionY[iPfp]=999999;
751  fPFPShowerDirectionZ[iPfp]=999999;
752  fPFPShowerDirectionErrX[iPfp]=999999;
753  fPFPShowerDirectionErrY[iPfp]=999999;
754  fPFPShowerDirectionErrZ[iPfp]=999999;
755  fPFPShowerStartX[iPfp]=999999;
756  fPFPShowerStartY[iPfp]=999999;
757  fPFPShowerStartZ[iPfp]=999999;
758  fPFPShowerStartErrX[iPfp]=999999;
759  fPFPShowerStartErrY[iPfp]=999999;
760  fPFPShowerStartErrZ[iPfp]=999999;
761  fPFPShowerLength[iPfp]=999999;
762  fPFPShowerOpenAngle[iPfp]=999999;
763 
764  for(int iClu=0; iClu<kNMaxPFPClusters; iClu++){
765  fPFPCluPlane[iPfp][iClu]=999999;
766  fPFPCluView[iPfp][iClu]=999999;
767  fPFPCluNHits[iPfp][iClu]=999999;
768  fPFPCluIntegral[iPfp][iClu]=999999;
769  }
770 
771  fPFPCompleteness[iPfp]=999999;
772  fPFPPurity[iPfp]=999999;
773 
774  for (unsigned int iView = 0; iView < kNViews; iView++)
775  {
776  fPFPNHitsView[iPfp][iView] = 999999;
777  fPFPNSharedTrueParticleHitsView[iPfp][iView]=0;
778  fPFPTrueParticleMatchedIDView[iPfp][iView] = 999999;
779  fPFPTrueParticleMatchedPositionView[iPfp][iView] = 999999;
780  fPFPPurityView[iPfp][iView]=999999;
781  fPFPCompletenessView[iPfp][iView]=999999;
782  }
783  }
784  fNPFParticles = 0;
785 
786  return;
787 }
788 
double E(const int i=0) const
Definition: MCParticle.h:233
int best_plane() const
Definition: Shower.h:200
bool fPFPIsShower[kNMaxPFParticles]
static art::Ptr< recob::Track > GetTrack(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel)
Get the track associated to this particle. Should only be called if IsTrack method succeeds...
int fPFPTrueParticleMatchedIDView[kNMaxPFParticles][kNViews]
unsigned int NumberTrajectoryPoints() const
Definition: MCParticle.h:218
const TVector3 & ShowerStart() const
Definition: Shower.h:192
const TLorentzVector & Position(const int i=0) const
Definition: MCParticle.h:219
int PdgCode() const
Definition: MCParticle.h:212
double fPFPTrackStartX[kNMaxPFParticles]
double fPFPShowerDirectionErrZ[kNMaxPFParticles]
int fPFPParentID[kNMaxPFParticles]
double fPFPTrackLength[kNMaxPFParticles]
float fPFPTrackChi2[kNMaxPFParticles]
const TLorentzVector & EndPosition() const
Definition: MCParticle.h:225
double fMCParticleEndMomentumX[kNMaxMCParticles]
double fMCParticleEndPositionT[kNMaxMCParticles]
int fPFPNClusters[kNMaxPFParticles]
bool fPFPIsTrack[kNMaxPFParticles]
double Length() const
Definition: Shower.h:201
Utility containing helpful functions for end users to access information about Tracks.
double fPFPTrackEndX[kNMaxPFParticles]
double fMCParticleEndMomentumY[kNMaxMCParticles]
int fPFPID[kNMaxPFParticles]
double fPFPTrackStartDirectionX[kNMaxPFParticles]
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
std::string string
Definition: nybbler.cc:12
double fPFPTrackAzimuthAngle[kNMaxPFParticles]
int Mother() const
Definition: MCParticle.h:213
double fPFPTrackTheta[kNMaxPFParticles]
double fPFPTrackEndDirectionY[kNMaxPFParticles]
static bool IsShower(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel)
Check if this particle has an associated shower.
bool fPFPIsPrimary[kNMaxPFParticles]
G4ID TrueParticleID(detinfo::DetectorClocksData const &clockData, const art::Ptr< recob::Hit > &pHit, const bool rollupUnsavedIDs)
The G4 ID of the true particle which deposits the most energy in the recob::Hit.
double fPFPTrackEndDirectionX[kNMaxPFParticles]
float Chi2() const
Definition: Track.h:168
Vector_t VertexDirection() const
Definition: Track.h:132
double fPFPShowerDirectionErrY[kNMaxPFParticles]
double fPFPTrackEndY[kNMaxPFParticles]
int fPFPTrueParticleMatchedPosition[kNMaxPFParticles]
const TVector3 & ShowerStartErr() const
Definition: Shower.h:193
double ZenithAngle() const
Definition: Track.h:180
int fPFPNChildren[kNMaxPFParticles]
static std::vector< art::Ptr< recob::Hit > > GetViewHits(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &label, const unsigned short &view)
Get the hits associated to this particle in a given view.
double fPFPPurityView[kNMaxMCParticles][kNViews]
double fMCParticleEndPositionY[kNMaxMCParticles]
int fMCParticleNTrajectoryPoint[kNMaxMCParticles]
int fPFPPdgCode[kNMaxPFParticles]
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
std::string Process() const
Definition: MCParticle.h:215
double fMCParticleEndTime[kNMaxMCParticles]
void reset(bool deepClean=false)
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::Track > &pTrack, const art::Event &evt, const std::string &label)
Get the hits associated with the track.
Particle class.
double fPFPTrackStartDirectionZ[kNMaxPFParticles]
int fPFPTrueParticleMatchedID[kNMaxPFParticles]
double fPFPTrackVertexZ[kNMaxPFParticles]
std::string fMCParticleEndProcess[kNMaxMCParticles]
double fMCParticleStartPositionX[kNMaxMCParticles]
int fPFPTrueParticleMatchedPositionView[kNMaxPFParticles][kNViews]
const geo::Geometry * fGeom
static art::Ptr< recob::Shower > GetShower(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &showerLabel)
Get the shower associated to this particle. Should only be called if IsShower method succeeds...
RunNumber_t run() const
Definition: EventID.h:98
double fPFPCluIntegral[kNMaxPFParticles][kNMaxPFPClusters]
art framework interface to geometry description
int TrackId() const
Definition: MCParticle.h:210
int fMCParticleParentTrackID[kNMaxMCParticles]
double fPFPShowerStartZ[kNMaxPFParticles]
double fPFPShowerStartErrZ[kNMaxPFParticles]
double fMCParticleStartMomentumZ[kNMaxMCParticles]
double fPFPShowerStartErrY[kNMaxPFParticles]
bool isRealData() const
double fPFPTrackVertexY[kNMaxPFParticles]
int fMCParticlePdgCode[kNMaxMCParticles]
double Phi() const
Definition: Track.h:178
double fPFPShowerDirectionY[kNMaxPFParticles]
Vector_t StartDirection() const
Access to track direction at different points.
Definition: Track.h:131
const double e
double Length(size_t p=0) const
Access to various track properties.
Definition: Track.h:167
double fMCParticleStartPositionZ[kNMaxMCParticles]
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
double fPFPTrackStartZ[kNMaxPFParticles]
std::string EndProcess() const
Definition: MCParticle.h:216
Utilities for matching a recob::Hit or vector of recob::Hit to the ID of the most significantly contr...
Point_t const & Start() const
Access to track position at different points.
Definition: Track.h:123
double fPFPShowerDirectionX[kNMaxPFParticles]
Utility containing helpful functions for end users to access information about Showers.
double fMCParticleEndPositionX[kNMaxMCParticles]
double Theta() const
Access to spherical or geographical angles at vertex or at any point.
Definition: Track.h:176
std::string fMCParticleStartProcess[kNMaxMCParticles]
double fPFPPurity[kNMaxMCParticles]
static const int kNMaxPFPClusters
double OpenAngle() const
Definition: Shower.h:202
Point_t const & Vertex() const
Definition: Track.h:124
int fPFPNSharedTrueParticleHits[kNMaxPFParticles]
int fPFPShowerBestPlane[kNMaxPFParticles]
double fPFPTrackEndZ[kNMaxPFParticles]
double fMCParticleEndMomentumZ[kNMaxMCParticles]
pandoraAnalysis(fhicl::ParameterSet const &p)
double T(const int i=0) const
Definition: MCParticle.h:224
int fPFPTrackID[kNMaxPFParticles]
double fPFPShowerDirectionErrX[kNMaxPFParticles]
Utility containing helpful functions for end users to access information about PFParticles.
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
double fMCParticleStartPositionT[kNMaxMCParticles]
p
Definition: test.py:223
const TVector3 & DirectionErr() const
Definition: Shower.h:190
double fMCParticleStartMomentumE[kNMaxMCParticles]
double fPFPTrackVertexX[kNMaxPFParticles]
Utility containing helpful functions for end users to access products from events.
const TVector3 & Direction() const
Definition: Shower.h:189
double fPFPTrackZenithAngle[kNMaxPFParticles]
int fMCParticleNHitsView[kNMaxMCParticles][kNViews]
int fPFPTrackNdof[kNMaxPFParticles]
double fPFPTrackEndDirectionZ[kNMaxPFParticles]
double EndT() const
Definition: MCParticle.h:229
The geometry of one entire detector, as served by art.
Definition: Geometry.h:196
int fPFPShowerID[kNMaxPFParticles]
double fPFPTrackVertexDirectionZ[kNMaxPFParticles]
int fMCParticleTrackID[kNMaxMCParticles]
double fPFPTrackStartDirectionY[kNMaxPFParticles]
int Ndof() const
Definition: Track.h:170
Detector simulation of raw signals on wires.
bool Valid(const G4ID g4ID) noexcept
Test whether a G4ID returned by the TruthMatchUtils functions is valid.
double fMCParticleEndMomentumE[kNMaxMCParticles]
double fPFPCompleteness[kNMaxMCParticles]
double fPFPShowerOpenAngle[kNMaxPFParticles]
int fPFPNSharedTrueParticleHitsView[kNMaxPFParticles][kNViews]
int ID() const
Definition: Track.h:198
Declaration of signal hit object.
double fPFPTrackVertexDirectionY[kNMaxPFParticles]
double fPFPShowerStartX[kNMaxPFParticles]
static const int kNMaxPFParticles
static std::vector< art::Ptr< recob::Hit > > GetHits(const art::Ptr< recob::Shower > &pShower, const art::Event &evt, const std::string &label)
Get the hits associated with the shower.
double fMCParticleTrueEnergy[kNMaxMCParticles]
double AzimuthAngle() const
Definition: Track.h:182
Vector_t EndDirection() const
Definition: Track.h:133
const TLorentzVector & Momentum(const int i=0) const
Definition: MCParticle.h:220
double fPFPTrackVertexDirectionX[kNMaxPFParticles]
Provides recob::Track data product.
double fMCParticleVertexTime[kNMaxMCParticles]
bool fMCIsPrimary[kNMaxMCParticles]
double fPFPTrackStartY[kNMaxPFParticles]
G4ID TrueParticleIDFromTotalRecoHits(detinfo::DetectorClocksData const &clockData, const std::vector< art::Ptr< recob::Hit >> &pHits, const bool rollupUnsavedIDs)
The G4 ID of the true particle who has been truth-matched to the most hits in a recob::Hit vector...
EventNumber_t event() const
Definition: EventID.h:116
Point_t const & End() const
Definition: Track.h:125
static bool IsTrack(const art::Ptr< recob::PFParticle > &pParticle, const art::Event &evt, const std::string &pParticleLabel, const std::string &trackLabel)
Check if this particle has an associated track.
double fPFPShowerStartErrX[kNMaxPFParticles]
double fPFPCompletenessView[kNMaxMCParticles][kNViews]
void analyze(art::Event const &e) override
double fPFPShowerLength[kNMaxPFParticles]
double fMCParticleEndPositionZ[kNMaxMCParticles]
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
double fMCParticleStartMomentumX[kNMaxMCParticles]
pandoraAnalysis & operator=(pandoraAnalysis const &)=delete
int fPFPCluPlane[kNMaxPFParticles][kNMaxPFPClusters]
int fPFPNHitsView[kNMaxPFParticles][kNViews]
int fPFPCluView[kNMaxPFParticles][kNMaxPFPClusters]
helper function for LArPandoraInterface producer module
Utility functions to extract information from recob::Track
static std::vector< art::Ptr< recob::PFParticle > > GetPFParticles(const art::Event &evt, const std::string &label)
Get the particles from the event.
int ID() const
Definition: Shower.h:187
int fMCParticleNHits[kNMaxMCParticles]
const TLorentzVector & EndMomentum() const
Definition: MCParticle.h:240
SubRunNumber_t subRun() const
Definition: EventID.h:110
static const int kNMaxMCParticles
EventID id() const
Definition: Event.cc:34
int fPFPCluNHits[kNMaxPFParticles][kNMaxPFPClusters]
double fPFPShowerDirectionZ[kNMaxPFParticles]
QTextStream & endl(QTextStream &s)
double fPFPShowerStartY[kNMaxPFParticles]
bool isValid() const
Definition: Handle.h:330
double fMCParticleStartPositionY[kNMaxMCParticles]
double fPFPTrackPhi[kNMaxPFParticles]
double fMCParticleStartMomentumY[kNMaxMCParticles]
int fPFPNHits[kNMaxPFParticles]