Public Member Functions | Private Member Functions | Private Attributes | List of all members
simfilter::FilterNoDirtNeutrinos Class Reference
Inheritance diagram for simfilter::FilterNoDirtNeutrinos:
art::EDFilter art::detail::Filter art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Member Functions

 FilterNoDirtNeutrinos (fhicl::ParameterSet const &pset)
 
- Public Member Functions inherited from art::EDFilter
 EDFilter (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDFilter (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Filter
virtual ~Filter () noexcept
 
 Filter (fhicl::ParameterSet const &)
 
 Filter (Filter const &)=delete
 
 Filter (Filter &&)=delete
 
Filteroperator= (Filter const &)=delete
 
Filteroperator= (Filter &&)=delete
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
 ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

bool filter (art::Event &) override
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from art::EDFilter
using ModuleType = EDFilter
 
using WorkerType = WorkerT< EDFilter >
 
- Public Types inherited from art::detail::Filter
template<typename UserConfig >
using Table = Modifier::Table< UserConfig >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 
- Static Public Attributes inherited from art::detail::Filter
static constexpr bool Pass {true}
 
static constexpr bool Fail {false}
 
- Protected Member Functions inherited from art::ModuleBase
ConsumesCollectorconsumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

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  }
std::string string
Definition: nybbler.cc:12
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21

Member Function Documentation

bool simfilter::FilterNoDirtNeutrinos::filter ( art::Event evt)
overrideprivatevirtual

Implements art::EDFilter.

Definition at line 62 of file FilterNoDirtNeutrinos_module.cc.

63  {
64  bool interactionDesired(false);
65  //get the list of particles from this event
67 
68  // * MC truth information
69  art::Handle< std::vector<simb::MCTruth> > mctruthListHandle;
70  std::vector<art::Ptr<simb::MCTruth> > mclist;
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
geo::Length_t CryostatHalfHeight(geo::CryostatID const &cid) const
Returns the height of the cryostat (y direction)
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition: DataViewImpl.h:633
geo::Length_t DetHalfHeight(geo::TPCID const &tpcid) const
Returns the half height of the active volume of the specified TPC.
std::void_t< T > n
geo::Length_t DetLength(geo::TPCID const &tpcid) const
Returns the length of the active volume of the specified TPC.
geo::Length_t CryostatHalfWidth(geo::CryostatID const &cid) const
Returns the half width of the cryostat (x direction)
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
Definition: Ptr.h:297
QTextStream & endl(QTextStream &s)

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: