TutFilter_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \brief TODO
3 /// \author bckhouse@hep.caltech.edu
4 ////////////////////////////////////////////////////////////////////////
5 
6 #include <string>
7 
8 // Framework includes
14 
15 // NOvASoft includes
16 #include "MCCheater/BackTracker.h"
18 
19 
20 namespace tut
21 {
22  class TutFilter : public art::EDFilter
23  {
24  public:
25  explicit TutFilter(const fhicl::ParameterSet& pset);
26  ~TutFilter();
27 
28  bool filter(art::Event& evt);
29 
30  void reconfigure(const fhicl::ParameterSet& pset);
31 
32  void beginJob();
33 
34  protected:
36  };
37 }
38 
39 ////////////////////////////////////////////////////////////////////////
40 namespace tut
41 {
42  //.......................................................................
44  {
45  reconfigure(pset);
46  }
47 
48  //......................................................................
50  {
51  }
52 
53  //......................................................................
55  {
56  fGeantLabel = pset.get<std::string>("GeantLabel");
57  }
58 
59  //......................................................................
61  {
62  }
63 
64  //......................................................................
66  {
67  // get the BackTracker service and use that to obtain a
68  // ParticleNavigator
70  const sim::ParticleNavigator& nav = bt->ParticleNavigator();
71 
72  // pizero should be a primary
73  for(int primIdx = 0; primIdx < nav.NumberOfPrimaries(); ++primIdx){
74  const sim::Particle* pizero = nav.Primary(primIdx);
75  // look for pi0's only
76  if(pizero->PdgCode() != 111) continue;
77 
78  if(pizero->NumberDaughters() != 2) continue;
79 
80  // Check the daughters are what they should be
81  const sim::Particle* phot0 = nav[pizero->Daughter(0)];
82  if(phot0->PdgCode() != 22) continue;
83  const sim::Particle* phot1 = nav[pizero->Daughter(1)];
84  if(phot1->PdgCode() != 22) continue;
85 
86  // Know we have at least one 2-gamma pi0
87  return true;
88  }
89 
90  // Didn't find any
91  return false;
92  }
93 } // end namespace tut
94 
95 ////////////////////////////////////////////////////////////////////////
96 namespace tut
97 {
99 }
back track the reconstruction to the simulation
int PdgCode() const
Definition: MCParticle.h:211
const sim::ParticleNavigator & ParticleNavigator() const
Get a reference to the ParticleNavigator.
Definition: BackTracker.h:744
TutFilter(const fhicl::ParameterSet &pset)
DEFINE_ART_MODULE(TestTMapFile)
bool filter(art::Event &evt)
int NumberDaughters() const
Definition: MCParticle.h:216
int Daughter(const int i) const
Definition: MCParticle.cxx:112
const sim::Particle * Primary(const int) const
void reconfigure(const fhicl::ParameterSet &pset)
T get(std::string const &key) const
Definition: ParameterSet.h:231
int evt
TODO.
std::string fGeantLabel
enum BeamMode string