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

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
 

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
 

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::vector< unsigned int > fBadEvents
list of bad events
if &&[-z"$BASH_VERSION"] then echo Attempting to switch to bash bash shellSwitch exit fi &&["$1"= 'shellSwitch'] shift declare a IncludeDirectives for Dir in
std::vector< unsigned int > fSelRuns
list of selected runs
std::vector< unsigned int > fBadRuns
list of bad runs
std::vector< unsigned int > fSelEvents
list of selected events

Member Function Documentation

bool filter::EventFilter::filter ( art::Event &  evt)
override

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 }
unsigned int event
Definition: DataStructs.h:634
std::vector< unsigned int > fSelSubRuns
list of selected runs
unsigned int run
Definition: DataStructs.h:635
std::vector< unsigned int > SetOfBadRuns() const
std::vector< unsigned int > SetOfBadEvents() const
std::vector< unsigned int > fSelRuns
list of selected runs
unsigned int subRun
Definition: DataStructs.h:636
TCEvent evt
Definition: DataStructs.cxx:8
std::vector< unsigned int > fSelEvents
list of selected events
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: