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

Public Member Functions

 FSPEventFilter (fhicl::ParameterSet const &)
 
 FSPEventFilter (FSPEventFilter const &)=delete
 
 FSPEventFilter (FSPEventFilter &&)=delete
 
FSPEventFilteroperator= (FSPEventFilter const &)=delete
 
FSPEventFilteroperator= (FSPEventFilter &&)=delete
 
bool filter (art::Event &evt)
 
void beginJob ()
 
- 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 isMatched (std::vector< int > const &a, std::vector< int > const &b) const
 

Private Attributes

std::string fGeneratorLabel
 
std::vector< int > fPDG
 

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 34 of file FSPEventFilter_module.cc.

Constructor & Destructor Documentation

gar::filt::FSPEventFilter::FSPEventFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 59 of file FSPEventFilter_module.cc.

60  : EDFilter{pset}
61  {
62  fGeneratorLabel = pset.get< std::string >("GeneratorModuleLabel", "generator");
63  fPDG = pset.get< std::vector<int> >("PDG");
64  }
std::string string
Definition: nybbler.cc:12
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
gar::filt::FSPEventFilter::FSPEventFilter ( FSPEventFilter const &  )
delete
gar::filt::FSPEventFilter::FSPEventFilter ( FSPEventFilter &&  )
delete

Member Function Documentation

void gar::filt::FSPEventFilter::beginJob ( )
virtual

Reimplemented from art::EDFilter.

Definition at line 67 of file FSPEventFilter_module.cc.

68  {
69 
70  }
bool gar::filt::FSPEventFilter::filter ( art::Event evt)
virtual

Implements art::EDFilter.

Definition at line 73 of file FSPEventFilter_module.cc.

74  {
75  auto mcthandlelist = evt.getHandle< std::vector<simb::MCTruth> >(fGeneratorLabel);
76  if (!mcthandlelist) {
77  throw cet::exception("FSPEventFilter") << " No simb::MCTruth branch."
78  << " Line " << __LINE__ << " in file " << __FILE__ << std::endl;
79  }
80 
81  art::Ptr<simb::MCTruth> mcp(mcthandlelist, 0);
82  std::vector<int> FSP;
83 
84  for(int i = 0; i < mcp->NParticles(); ++i){
85  simb::MCParticle part(mcp->GetParticle(i));
86 
87  if (part.StatusCode()== 1)
88  FSP.push_back(part.PdgCode());
89  }
90 
91  return isMatched(fPDG, FSP); // returns true if the user-defined fPDG exist(s) in the final state particles
92  }
Handle< PROD > getHandle(SelectorBase const &) const
Definition: DataViewImpl.h:382
bool isMatched(std::vector< int > const &a, std::vector< int > const &b) const
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
bool gar::filt::FSPEventFilter::isMatched ( std::vector< int > const &  a,
std::vector< int > const &  b 
) const
private

Definition at line 95 of file FSPEventFilter_module.cc.

96  {
97  for (auto const a_int : a) {
98  for (auto const b_int : b) {
99  if (a_int == b_int) {
100  return true;
101  }
102  }
103  }
104  return false;
105  }
FSPEventFilter& gar::filt::FSPEventFilter::operator= ( FSPEventFilter const &  )
delete
FSPEventFilter& gar::filt::FSPEventFilter::operator= ( FSPEventFilter &&  )
delete

Member Data Documentation

std::string gar::filt::FSPEventFilter::fGeneratorLabel
private

Definition at line 51 of file FSPEventFilter_module.cc.

std::vector<int> gar::filt::FSPEventFilter::fPDG
private

Definition at line 52 of file FSPEventFilter_module.cc.


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