25 #include "art_root_io/TFileService.h" 47 #define HolderVal 9999 60 void FillVars( std::vector<int> &TrackIDVec,
int &numParts,
int ThisID );
64 std::map<int, const simb::MCParticle*>
truthmap;
95 std::cout <<
"Your filter is selecting only events with: " 97 <<
"Pions " << fWantPion <<
", " 98 <<
"Pi0s " << fWantPi0 <<
", " 99 <<
"Kaons " << fWantKaon <<
", " 100 <<
"Elecs " << fWantElec <<
"." 111 auto const*
geo = lar::providerFrom<geo::Geometry>();
114 auto truth = e.
getHandle<std::vector<simb::MCParticle> >(
"largeant");
116 for (
size_t i=0; i<truth->size(); i++)
117 truthmap[truth->at(i).TrackId()]=&((*truth)[i]);
121 auto simchannels = e.
getHandle<std::vector<sim::SimChannel> >(
"largeant");
124 std::vector<int> MuonVec, PionVec, Pi0Vec, KaonVec, ElecVec;
127 for (
auto const& simchannel:*simchannels) {
131 for (
auto const& tdcide:simchannel.TDCIDEMap()) {
132 auto const& idevec=tdcide.second;
134 for (
auto const& ide:idevec) {
135 int ideTrackID = ide.trackID;
142 if (!(
geo->HasTPC(tpcid)) ) {
149 bool WrittenOut =
false;
150 while ( ideTrackID != 0 && !WrittenOut ) {
155 if ( (PdgCode == -13 || PdgCode == 13) )
158 else if ( (PdgCode == -211 || PdgCode == 211) && part.
Process() !=
"pi+Inelastic" && part.
Process() !=
"pi-Inelastic" )
161 else if ( PdgCode == 111 )
164 else if ( (PdgCode == 321 || PdgCode == -321) && part.
Process() !=
"kaon+Inelastic" && part.
Process() !=
"kaon-Inelastic" )
167 else if ( (PdgCode == -11 || PdgCode == 11) )
171 ideTrackID = part.
Mother();
186 bool EventPasses =
true;
199 auto const*
geom = lar::providerFrom<geo::Geometry>();
202 const double origin[3] = {0.};
204 TPC.LocalToWorld(origin, center);
205 double tpcDim[3] = {
TPC.HalfWidth(),
TPC.HalfHeight(), 0.5*
TPC.Length() };
213 std::cout <<
"Active Boundaries: " 220 MyOutTree = tfs->make<TTree>(
"FilterTree",
"FilterTree");
233 if ( it==TrackIDVec.end() ) {
234 TrackIDVec.push_back (
abs(ThisID) );
EventNumber_t event() const
std::map< int, const simb::MCParticle * > truthmap
Handle< PROD > getHandle(SelectorBase const &) const
Geometry information for a single TPC.
std::string Process() const
art::ServiceHandle< geo::Geometry > geom
art framework interface to geometry description
void reconfigure(fhicl::ParameterSet const &pset)
int PdgCode(Resonance_t res, int Q)
(resonance id, charge) -> PDG code
#define DEFINE_ART_MODULE(klass)
IteratorBox< TPC_iterator,&GeometryCore::begin_TPC,&GeometryCore::end_TPC > IterateTPCs() const
Enables ranged-for loops on all TPCs of the detector.
NucleonDecayFilter(fhicl::ParameterSet const &pset)
T get(std::string const &key) const
SubRunNumber_t subRun() const
The data type to uniquely identify a TPC.
virtual ~NucleonDecayFilter()
EDFilter(fhicl::ParameterSet const &pset)
void FillVars(std::vector< int > &TrackIDVec, int &numParts, int ThisID)
virtual bool filter(art::Event &e)
LArSoft geometry interface.
constexpr Point origin()
Returns a origin position with a point of the specified type.
QTextStream & endl(QTextStream &s)
Signal from collection planes.