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

Public Member Functions

 FilterPrimaryPDG (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 fG4ModuleLabel
 
std::vector< int > fPrimaryVec
 

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 26 of file FilterPrimaryPDG_module.cc.

Constructor & Destructor Documentation

simfilter::FilterPrimaryPDG::FilterPrimaryPDG ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 45 of file FilterPrimaryPDG_module.cc.

46  : EDFilter{pset}, fPrimaryVec{pset.get<std::vector<int> >("PrimaryParticles")}
47  {}
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21

Member Function Documentation

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

Implements art::EDFilter.

Definition at line 50 of file FilterPrimaryPDG_module.cc.

51  {
52 
53  //get the list of particles from this event
56 
57  // get the particles from the back tracker
58  const sim::ParticleList& Particles = pi_serv->ParticleList();
59  std::vector<const simb::MCParticle*> pvec;
60  pvec.reserve(Particles.size());
61  for (const auto& PartPair: Particles) {
62  pvec.push_back(PartPair.second);
63  // fPDGCodes->Fill(PartPair.second->PdgCode());
64  }
65 
66  bool pdgDesired(false);
67  for(unsigned int i = 0; i < pvec.size(); ++i)
68  {
69  for (int pdg : fPrimaryVec)
70  {
71  const std::string sprim("primary");
72  if(pvec[i]->PdgCode() == pdg)
73  {
74  Char_t tProcess[50];
75  for(unsigned int s = 0; s < pvec[i]->Process().length(); ++s)
76  *(tProcess+s) = pvec[i]->Process()[s];
77  std::string sProcess(tProcess);
78  if (!sProcess.compare(sprim))
79  {
80  mf::LogInfo("FilterPrimaryPDG") << " Found a primary " << pdg << " in event.";
81  pdgDesired = true;
82  }
83  }
84  }
85 
86  }
87 
88  return pdgDesired;
89  }
std::string string
Definition: nybbler.cc:12
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
int PdgCode(Resonance_t res, int Q)
(resonance id, charge) -> PDG code
const sim::ParticleList & ParticleList() const
static QCString * s
Definition: config.cpp:1042

Member Data Documentation

std::string simfilter::FilterPrimaryPDG::fG4ModuleLabel
private

Definition at line 35 of file FilterPrimaryPDG_module.cc.

std::vector<int> simfilter::FilterPrimaryPDG::fPrimaryVec
private

Definition at line 36 of file FilterPrimaryPDG_module.cc.


The documentation for this class was generated from the following file: