10 #include "art/Framework/Core/EDFilter.h"
11 #include "art/Framework/Core/ModuleMacros.h"
14 #include "art/Framework/Principal/Event.h"
15 #include "art/Framework/Principal/Handle.h"
16 #include "canvas/Utilities/Exception.h"
17 #include "fhiclcpp/ParameterSet.h"
23 #include "nusimdata/SimulationBase/MCTruth.h"
35 bool filter(art::Event&)
override;
45 , fKeepNusInCryostat{pset.get<
bool>(
"KeepNusInCryostat",
false)}
52 auto const& geom = *(lar::providerFrom<geo::Geometry>());
56 auto allmclists = evt.getMany<std::vector<simb::MCTruth>>();
58 bool inCryostatNu =
false;
59 for (
auto const& mclistHandle : allmclists) {
60 for (simb::MCTruth
const& mct : *mclistHandle) {
63 for (
int ipart = 0; ipart < mct.NParticles(); ipart++) {
64 auto const& part = mct.GetParticle(ipart);
65 auto const absPDGID =
std::abs(part.PdgCode());
66 if (absPDGID == 12 || absPDGID == 14 || absPDGID == 16) {
67 const TLorentzVector& end4 = part.EndPosition();
68 if (geom.PositionToCryostatPtr({end4.X(), end4.Y(), end4.Z()}) !=
79 return fKeepNusInCryostat ^ (!inCryostatNu);
Utilities related to art service access.
Access the description of detector geometry.
FilterCryostatNus(fhicl::ParameterSet const &pset)
bool filter(art::Event &) override
art framework interface to geometry description