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

Public Member Functions

 MissingProductFilter (fhicl::ParameterSet const &pset)
 
virtual ~MissingProductFilter ()
 
void beginJob () override
 
bool filter (art::Event &evt) override
 
void endJob () override
 
- 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 Attributes

std::vector< std::stringfModules
 

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 33 of file MissingProductFilter_module.cc.

Constructor & Destructor Documentation

mpf::MissingProductFilter::MissingProductFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 49 of file MissingProductFilter_module.cc.

49  :
50  EDFilter(pset)
51 {
52  fModules = pset.get<std::vector<std::string>>("Modules");
53 }
std::vector< std::string > fModules
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
mpf::MissingProductFilter::~MissingProductFilter ( )
virtual

Definition at line 56 of file MissingProductFilter_module.cc.

56 {}

Member Function Documentation

void mpf::MissingProductFilter::beginJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 59 of file MissingProductFilter_module.cc.

59 {}
void mpf::MissingProductFilter::endJob ( )
overridevirtual

Reimplemented from art::EDFilter.

Definition at line 104 of file MissingProductFilter_module.cc.

104 {}
bool mpf::MissingProductFilter::filter ( art::Event evt)
overridevirtual

Implements art::EDFilter.

Definition at line 62 of file MissingProductFilter_module.cc.

62  {
63 
64  bool prodMissing = false;
65 
66  // Can we do it all together?
67  for(const std::string &s : fModules){
68 
69  try{
70  if(s == "reco3d"){
71  evt.getValidHandle<std::vector<recob::SpacePoint>>(s);
72  }
73  else if(s == "pandora"){
74  evt.getValidHandle<std::vector<recob::PFParticle>>(s);
75  }
76  else if(s == "pandoraTrack"){
77  evt.getValidHandle<std::vector<recob::Track>>(s);
78  }
79  else if(s == "pandoraShower"){
80  evt.getValidHandle<std::vector<recob::Shower>>(s);
81  }
82  else if(s == "opflash" || s == "opflashInternal" || s == "opflashExternal"){
83  evt.getValidHandle<std::vector<recob::OpFlash>>(s);
84  }
85  else{
86  std::cerr << "Product " << s << " is not considered by the module and will be ignored." << std::endl;
87  }
88  }
89  catch(...){
90  prodMissing = true;
91  std::cout << "Product " << s << " is missing. Event will be filtered out." << std::endl;
92  break;
93  }
94 
95  }
96 
97  if(!prodMissing){
98  std::cout << "All products present, keeping this event" << std::endl;
99  }
100  return !prodMissing;
101 
102 }
std::vector< std::string > fModules
std::string string
Definition: nybbler.cc:12
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
static QCString * s
Definition: config.cpp:1042
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::vector<std::string> mpf::MissingProductFilter::fModules
private

Definition at line 45 of file MissingProductFilter_module.cc.


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