9 #include "art/Framework/Core/ModuleMacros.h"
10 #include "art/Framework/Core/EDFilter.h"
11 #include "art/Framework/Principal/Event.h"
12 #include "fhiclcpp/ParameterSet.h"
13 #include "messagefacility/MessageLogger/MessageLogger.h"
51 fBadEvents = pset.get < std::vector <unsigned int> >(
"BadEvents");
52 fBadRuns = pset.get < std::vector <unsigned int> >(
"BadRuns");
54 fSelection = pset.get<
int >(
"Selection");
55 fEventList = pset.get< std::string >(
"EventList");
59 in.open(fEventList.c_str());
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);
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();
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";
85 for (
unsigned int ii=0; ii<sobe.size(); ++ii){
86 if(sobe.at(ii)==evtNo && sobr.at(ii)==runNo)
88 mf::LogInfo(
"EventFilter: ") <<
"\t\n Skipping run/event " << runNo <<
"/"<< evtNo <<
" by request.\n";
95 for (
unsigned int ii = 0; ii<fSelRuns.size(); ii++){
96 if (fSelRuns[ii] == runNo && fSelSubRuns[ii] == subrunNo && fSelEvents[ii] == evtNo){
std::vector< unsigned int > fSelSubRuns
list of selected runs
std::vector< unsigned int > SetOfBadRuns() const
std::vector< unsigned int > fBadEvents
list of bad events
std::vector< unsigned int > SetOfBadEvents() const
bool filter(art::Event &evt) override
EventFilter(fhicl::ParameterSet const &)
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