All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
simfilter::FilterNoDirtNeutrinos Class Reference
Inheritance diagram for simfilter::FilterNoDirtNeutrinos:

Public Member Functions

 FilterNoDirtNeutrinos (fhicl::ParameterSet const &pset)
 

Private Member Functions

bool filter (art::Event &) override
 

Private Attributes

std::string fLArG4ModuleLabel
 
std::string fGenModuleLabel
 
bool fKeepCryostatNeutrinos
 

Detailed Description

Definition at line 33 of file FilterNoDirtNeutrinos_module.cc.

Constructor & Destructor Documentation

simfilter::FilterNoDirtNeutrinos::FilterNoDirtNeutrinos ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 54 of file FilterNoDirtNeutrinos_module.cc.

54  : EDFilter{pset},
55  fLArG4ModuleLabel (pset.get< std::string > ("LArG4ModuleLabel" , "NoLabel") )
56  , fGenModuleLabel (pset.get< std::string > ("GenModuleLabel" , "NoLabel") )
57  , fKeepCryostatNeutrinos (pset.get< bool > ("KeepCryostatNeutrinos", false) )
58  {
59  }

Member Function Documentation

bool simfilter::FilterNoDirtNeutrinos::filter ( art::Event &  evt)
overrideprivate

Definition at line 62 of file FilterNoDirtNeutrinos_module.cc.

63  {
64  bool interactionDesired(false);
65  //get the list of particles from this event
66  art::ServiceHandle<geo::Geometry const> geom;
67 
68  // * MC truth information
69  art::Handle< std::vector<simb::MCTruth> > mctruthListHandle;
70  std::vector<art::Ptr<simb::MCTruth> > mclist;
71  art::Handle<std::vector<simb::MCParticle> > mcpHandle;
72 
73 
74 
75  if (evt.getByLabel(fGenModuleLabel,mctruthListHandle))
76  art::fill_ptr_vector(mclist, mctruthListHandle);
77  evt.getByLabel(fLArG4ModuleLabel,mcpHandle);
78 
79  // std::cout << "FilterNoDirtNeutrinos: mclist.size() is " << mclist.size()<< std::endl ;
80 
81  std::set<art::Ptr<simb::MCTruth> > mctSetGENIE;
82  for(size_t i=0; i<mctruthListHandle->size(); ++i)
83  {
84  art::Ptr<simb::MCTruth> mct_ptr(mctruthListHandle,i);
85  if( mctSetGENIE.find(mct_ptr) == mctSetGENIE.end() ) mctSetGENIE.insert(mct_ptr);
86  }
87 
88  // Get the MCTruths from associations to our particles
89  art::FindOneP<simb::MCTruth> assMCT(mcpHandle, evt, "largeant");
90 
91  double xmin;
92  double xmax;
93  double ymin;
94  double ymax;
95  double zmin;
96  double zmax;
97 
99  {
100  // Get cryostat (box) volume boundary.
101  xmin = geom->DetHalfWidth() - geom->CryostatHalfWidth();
102  xmax = geom->DetHalfWidth() + geom->CryostatHalfWidth();
103  ymin = -geom->CryostatHalfHeight();
104  ymax = geom->CryostatHalfHeight();
105  zmin = geom->DetLength()/2. - geom->DetLength()/2.;
106  zmax = geom->DetLength()/2. + geom->DetLength()/2.;
107  }
108  else
109  {
110  // Get fiducial volume boundary.
111  xmin = 0.;
112  xmax = 2.*geom->DetHalfWidth();
113  ymin = -geom->DetHalfHeight();
114  ymax = geom->DetHalfHeight();
115  zmin = 0.;
116  zmax = geom->DetLength();
117  }
118 
119  // std::cout << "FilterNoDirtNeutrinos: mcpHandle->size() is " << mcpHandle->size()<< std::endl ;
120  // Now let's loop over G4 MCParticle list and track back MCTruth
121  bool inTPC (false);
122  for(size_t i=0; i < mcpHandle->size() && !inTPC; ++i)
123  {
124  const art::Ptr<simb::MCParticle> mcp_ptr(mcpHandle,i);
125  const art::Ptr<simb::MCTruth> &mct = assMCT.at(i);
126  if( mctSetGENIE.find(mct) == mctSetGENIE.end() )
127  {
128  // This is non-genie
129  continue;
130  }
131  else
132  {
133  // This is genie
134 
135  const simb::MCParticle* part(&mcpHandle->at(i));
136  // for c2: pdg and trackID no longer used
137  //int pdg = part->PdgCode();
138  //int trackID = part->TrackId();
139 
140  // std::cout << "FilterNoDirtNeutrinos: i is " << i << std::endl ;
141  // Now walk through trajectory and see if it enters the TPC
142  int n = part->NumberTrajectoryPoints();
143  for(int j = 0; j < n && !inTPC; ++j)
144  {
145  // std::cout << "FilterNoDirtNeutrinos: Loop counter on NumTrajPt j is " << j << std::endl ;
146 
147  TVector3 pos = part->Position(j).Vect();
148  if(pos.X() >= xmin &&
149  pos.X() <= xmax &&
150  pos.Y() >= ymin &&
151  pos.Y() <= ymax &&
152  pos.Z() >= zmin &&
153  pos.Z() <= zmax)
154  {
155  interactionDesired = true;
156  // std::cout << "FilterNoDirtNeutrinos: Genie daughter found in TPC. G4Particle " << i << " , TrackID/pdg " << trackID << "/ " << pdg << " is discovered." << std::endl ;
157  std::cout << "FilterNoDirtNeutrinos: Genie daughter found in TPC. G4Particle " << std::endl ;
158  inTPC=true;
159  }
160  } // trajectory loop
161  } // end Genie particle
162  } // loop on MCPHandle
163 
164  return interactionDesired;
165 
166  } // end FilterNoDirtNeutrinos()function
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
TCEvent evt
Definition: DataStructs.cxx:8
BEGIN_PROLOG could also be cout

Member Data Documentation

std::string simfilter::FilterNoDirtNeutrinos::fGenModuleLabel
private

Definition at line 43 of file FilterNoDirtNeutrinos_module.cc.

bool simfilter::FilterNoDirtNeutrinos::fKeepCryostatNeutrinos
private

Definition at line 44 of file FilterNoDirtNeutrinos_module.cc.

std::string simfilter::FilterNoDirtNeutrinos::fLArG4ModuleLabel
private

Definition at line 42 of file FilterNoDirtNeutrinos_module.cc.


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