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

Public Member Functions

 EventFilter (fhicl::ParameterSet const &)
 
bool filter (art::Event &evt) override
 
std::vector< unsigned int > SetOfBadEvents () const
 
std::vector< unsigned int > SetOfBadRuns () const
 
- 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< unsigned int > fBadEvents
 list of bad events More...
 
std::vector< unsigned int > fBadRuns
 list of bad runs More...
 
std::vector< unsigned int > fSelEvents
 list of selected events More...
 
std::vector< unsigned int > fSelRuns
 list of selected runs More...
 
std::vector< unsigned int > fSelSubRuns
 list of selected runs More...
 
std::string fEventList
 
int fSelection
 

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 18 of file EventFilter_module.cc.

Constructor & Destructor Documentation

filter::EventFilter::EventFilter ( fhicl::ParameterSet const &  pset)
explicit

Definition at line 48 of file EventFilter_module.cc.

49  : EDFilter{pset}
50 {
51  fBadEvents = pset.get < std::vector <unsigned int> >("BadEvents");
52  fBadRuns = pset.get < std::vector <unsigned int> >("BadRuns");
53 
54  fSelection = pset.get< int >("Selection");
55  fEventList = pset.get< std::string >("EventList");
56  fSelEvents.clear();
57  fSelRuns.clear();
58  std::ifstream in;
59  in.open(fEventList.c_str());
60  char line[1024];
61  while(1){
62  in.getline(line,1024);
63  if (!in.good()) break;
64  unsigned int n0, n1, n2;
65  sscanf(line,"%u %u %u",&n0,&n1,&n2);
66  fSelRuns.push_back(n0);
67  fSelSubRuns.push_back(n1);
68  fSelEvents.push_back(n2);
69  }
70  in.close();
71 }
std::vector< unsigned int > fSelSubRuns
list of selected runs
std::string string
Definition: nybbler.cc:12
std::vector< unsigned int > fBadEvents
list of bad events
std::vector< unsigned int > fSelRuns
list of selected runs
void line(double t, double *p, double &x, double &y, double &z)
std::vector< unsigned int > fBadRuns
list of bad runs
EDFilter(fhicl::ParameterSet const &pset)
Definition: EDFilter.h:21
std::vector< unsigned int > fSelEvents
list of selected events

Member Function Documentation

bool filter::EventFilter::filter ( art::Event evt)
overridevirtual

Implements art::EDFilter.

Definition at line 73 of file EventFilter_module.cc.

74 {
75  unsigned int evtNo = (unsigned int) evt.id().event();
76  unsigned int runNo = (unsigned int) evt.run();
77  unsigned int subrunNo = (unsigned int) evt.subRun();
78  if (fSelection==0){
79  std::vector <unsigned int> sobe = SetOfBadEvents();
80  std::vector <unsigned int> sobr = SetOfBadRuns();
81  if (sobe.size() != sobr.size()) {
82  throw cet::exception("EventFilter.cxx: ") << " BadEvent and BadRun list must be same length. Line " <<__LINE__ << ", " << __FILE__ << "\n";
83  }
84 
85  for (unsigned int ii=0; ii<sobe.size(); ++ii){
86  if(sobe.at(ii)==evtNo && sobr.at(ii)==runNo)
87  {
88  mf::LogInfo("EventFilter: ") << "\t\n Skipping run/event " << runNo <<"/"<< evtNo << " by request.\n";
89  return false;
90  }
91  }
92  return true;
93  }
94  else{
95  for (unsigned int ii = 0; ii<fSelRuns.size(); ii++){
96  if (fSelRuns[ii] == runNo && fSelSubRuns[ii] == subrunNo && fSelEvents[ii] == evtNo){
97  //std::cout<<"true"<<std::endl;
98  if (fSelection>0){
99  return true;
100  }
101  else{
102  return false;
103  }
104  }
105  }
106  if (fSelection>0){
107  return false;
108  }
109  else {
110  return true;
111  }
112  }
113 }
std::vector< unsigned int > fSelSubRuns
list of selected runs
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< unsigned int > SetOfBadRuns() const
std::vector< unsigned int > SetOfBadEvents() const
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
RunNumber_t run() const
Definition: DataViewImpl.cc:71
std::vector< unsigned int > fSelRuns
list of selected runs
EventNumber_t event() const
Definition: EventID.h:116
std::vector< unsigned int > fSelEvents
list of selected events
EventID id() const
Definition: Event.cc:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
std::vector< unsigned int > filter::EventFilter::SetOfBadEvents ( ) const
inline

Definition at line 26 of file EventFilter_module.cc.

26 { return fBadEvents;}
std::vector< unsigned int > fBadEvents
list of bad events
std::vector< unsigned int > filter::EventFilter::SetOfBadRuns ( ) const
inline

Definition at line 27 of file EventFilter_module.cc.

27 { return fBadRuns; }
std::vector< unsigned int > fBadRuns
list of bad runs

Member Data Documentation

std::vector< unsigned int > filter::EventFilter::fBadEvents
private

list of bad events

Definition at line 31 of file EventFilter_module.cc.

std::vector< unsigned int > filter::EventFilter::fBadRuns
private

list of bad runs

Definition at line 32 of file EventFilter_module.cc.

std::string filter::EventFilter::fEventList
private

Definition at line 37 of file EventFilter_module.cc.

int filter::EventFilter::fSelection
private

Definition at line 38 of file EventFilter_module.cc.

std::vector< unsigned int > filter::EventFilter::fSelEvents
private

list of selected events

Definition at line 34 of file EventFilter_module.cc.

std::vector< unsigned int > filter::EventFilter::fSelRuns
private

list of selected runs

Definition at line 35 of file EventFilter_module.cc.

std::vector< unsigned int > filter::EventFilter::fSelSubRuns
private

list of selected runs

Definition at line 36 of file EventFilter_module.cc.


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