9 #include "art/Framework/Core/ModuleMacros.h"
10 #include "art/Framework/Core/SharedFilter.h"
11 #include "art/Framework/Principal/Event.h"
12 #include "art/Framework/Principal/Handle.h"
13 #include "art/Framework/Services/Registry/ServiceHandle.h"
14 #include "fhiclcpp/ParameterSet.h"
18 #include "nusimdata/SimulationBase/MCParticle.h"
31 within(bounds
const& bnds,
double const value)
33 return bnds.minBound < value
and value < bnds.maxBound;
36 class FilterStoppingMuon :
public art::SharedFilter {
38 explicit FilterStoppingMuon(fhicl::ParameterSet
const& pset,
39 art::ProcessingFrame
const&);
42 void beginRun(art::Run&, art::ProcessingFrame
const&)
override;
43 bool filter(art::Event&, art::ProcessingFrame
const&)
override;
44 std::string
const fLArG4ModuleLabel;
52 FilterStoppingMuon::FilterStoppingMuon(fhicl::ParameterSet
const& pset,
53 art::ProcessingFrame
const&)
55 , fLArG4ModuleLabel{pset.get<std::string>(
"LArG4ModuleLabel",
"largeant")}
57 async<art::InEvent>();
61 FilterStoppingMuon::beginRun(art::Run&, art::ProcessingFrame
const& frame)
66 fYBounds = {-geom->DetHalfHeight(), geom->DetHalfHeight()};
67 fZBounds = {0., geom->DetLength()};
76 *evt.getValidHandle<std::vector<simb::MCParticle>>(fLArG4ModuleLabel);
78 for (
auto const& part : mcps) {
80 if (
std::abs(part.PdgCode()) != 13) {
85 if (within(fXBounds, part.EndX())
and within(fYBounds, part.EndY())
and
86 within(fZBounds, part.EndZ())) {
93 std::cout <<
"************* IN TPC *******************" << std::endl;
105 DEFINE_ART_MODULE(FilterStoppingMuon)
geo::Length_t DetHalfWidth(geo::TPCID const &tpcid) const
Returns the half width of the active volume of the specified TPC.
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
The geometry of one entire detector, as served by art.
art framework interface to geometry description
BEGIN_PROLOG could also be cout