All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
simfilter::FilterPrimaryPDG Class Reference
Inheritance diagram for simfilter::FilterPrimaryPDG:

Public Member Functions

 FilterPrimaryPDG (fhicl::ParameterSet const &pset)
 

Private Member Functions

bool filter (art::Event &) override
 

Private Attributes

std::string fG4ModuleLabel
 
std::vector< int > fPrimaryVec
 

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  {}

Member Function Documentation

bool simfilter::FilterPrimaryPDG::filter ( art::Event &  evt)
overrideprivate

Definition at line 50 of file FilterPrimaryPDG_module.cc.

51  {
52 
53  //get the list of particles from this event
54  art::ServiceHandle<cheat::ParticleInventoryService const> pi_serv;
55  art::ServiceHandle<geo::Geometry const> geom;
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  }
var pdg
Definition: selectors.fcl:14
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60

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: