9 #include "art/Framework/Core/ModuleMacros.h"
10 #include "art/Framework/Core/EDFilter.h"
13 #include "art/Framework/Principal/Event.h"
14 #include "fhiclcpp/ParameterSet.h"
15 #include "art/Framework/Principal/Handle.h"
16 #include "art/Framework/Services/Registry/ServiceHandle.h"
17 #include "canvas/Persistency/Common/Ptr.h"
18 #include "cetlib_except/exception.h"
19 #include "canvas/Persistency/Common/FindOneP.h"
22 #include "nusimdata/SimulationBase/MCParticle.h"
23 #include "nusimdata/SimulationBase/MCTruth.h"
40 bool filter(art::Event&)
override;
55 fLArG4ModuleLabel (pset.get< std::string > (
"LArG4ModuleLabel" ,
"NoLabel") )
56 , fGenModuleLabel (pset.get< std::string > (
"GenModuleLabel" ,
"NoLabel") )
57 , fKeepCryostatNeutrinos (pset.get<
bool > (
"KeepCryostatNeutrinos",
false) )
64 bool interactionDesired(
false);
66 art::ServiceHandle<geo::Geometry const> geom;
69 art::Handle< std::vector<simb::MCTruth> > mctruthListHandle;
70 std::vector<art::Ptr<simb::MCTruth> > mclist;
71 art::Handle<std::vector<simb::MCParticle> > mcpHandle;
76 art::fill_ptr_vector(mclist, mctruthListHandle);
81 std::set<art::Ptr<simb::MCTruth> > mctSetGENIE;
82 for(
size_t i=0; i<mctruthListHandle->size(); ++i)
84 art::Ptr<simb::MCTruth> mct_ptr(mctruthListHandle,i);
85 if( mctSetGENIE.find(mct_ptr) == mctSetGENIE.end() ) mctSetGENIE.insert(mct_ptr);
89 art::FindOneP<simb::MCTruth> assMCT(mcpHandle, evt,
"largeant");
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.;
112 xmax = 2.*geom->DetHalfWidth();
113 ymin = -geom->DetHalfHeight();
114 ymax = geom->DetHalfHeight();
116 zmax = geom->DetLength();
122 for(
size_t i=0; i < mcpHandle->size() && !inTPC; ++i)
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() )
135 const simb::MCParticle* part(&mcpHandle->at(i));
142 int n = part->NumberTrajectoryPoints();
143 for(
int j = 0; j < n && !inTPC; ++j)
147 TVector3 pos = part->Position(j).Vect();
148 if(pos.X() >= xmin &&
155 interactionDesired =
true;
157 std::cout <<
"FilterNoDirtNeutrinos: Genie daughter found in TPC. G4Particle " << std::endl ;
164 return interactionDesired;
170 namespace simfilter {
172 DEFINE_ART_MODULE(FilterNoDirtNeutrinos)
std::string fLArG4ModuleLabel
std::string fGenModuleLabel
process_name pandoraGausCryo1 vertexChargeCryo1 vertexStubCryo1 xmin
bool fKeepCryostatNeutrinos
FilterNoDirtNeutrinos(fhicl::ParameterSet const &pset)
bool filter(art::Event &) override
art framework interface to geometry description
BEGIN_PROLOG could also be cout