33 outfile_.open(
"badHcalLaserList_eventfilter.txt");
36 minRunInFile=999999; maxRunInFile=1;
37 string eventFileName0=ps.
getParameter<
string>(
"eventFileName");
40 if (verbose_)
edm::LogInfo(
"HcalLaserEventFilter2012") <<
"HCAL laser event list from file "<<eventFileName;
41 readEventListFile(eventFileName);
42 std::sort(EventList_.begin(), EventList_.end());
43 if (verbose_)
edm::LogInfo(
"HcalLaserEventFilter2012")<<
" A total of "<<EventList_.size()<<
" listed HCAL laser events found in given run range";
44 if (minrun_==-1 || minrun_<minRunInFile) minrun_=minRunInFile;
45 if (maxrun_==-1 || maxrun_>maxRunInFile) maxrun_=maxRunInFile;
55 size_t found = eventString.find(
":");
56 if (found!=std::string::npos)
57 run=atoi((eventString.substr(0,found)).c_str());
60 edm::LogError(
"HcalLaserEventFilter2012")<<
" Unable to parse Event list input '"<<eventString<<
"' for run number!";
63 size_t found2 = eventString.find(
":",found+1);
64 if (found2!=std::string::npos)
67 ls=atoi((eventString.substr(found+1,(found2-found-1))).c_str());
68 event=atoi((eventString.substr(found2+1)).c_str());
70 if (ls==0 ||
event==0)
edm::LogWarning(
"HcalLaserEventFilter2012")<<
" Strange lumi, event numbers for input '"<<eventString<<
"'";
74 edm::LogError(
"HcalLaserEventFilter2012")<<
"Unable to parse Event list input '"<<eventString<<
"' for run number!";
78 if (minrun_>-1 && run<minrun_)
80 if (verbose_)
edm::LogInfo(
"HcalLaserEventFilter2012") <<
"Skipping Event list input '"<<eventString<<
"' because it is less than minimum run # "<<minrun_;
83 if (maxrun_>-1 && run>maxrun_)
85 if (verbose_)
edm::LogInfo(
"HcalLaserEventFilter2012") <<
"Skipping Event list input '"<<eventString<<
"' because it is greater than maximum run # "<<maxrun_;
88 if (minRunInFile>run) minRunInFile=
run;
89 if (maxRunInFile<run) maxRunInFile=
run;
91 EventList_.push_back(eventString);
98 gzFile
file = gzopen (eventFileName.c_str(),
"r");
100 edm::LogError(
"HcalLaserEventFilter2012")<<
" Unable to open event list file "<<eventFileName;
111 bytes_read = gzread (file, buffer,
LENGTH - 1);
112 buffer[bytes_read] =
'\0';
114 pch = strtok (buffer,
"\n");
115 if (buffer[0] ==
'\n' ) {
123 if (i>b2.size()) b2= pch;
125 if ((buffer[
LENGTH-2] ==
'\n' )|| (buffer[
LENGTH-2] ==
'\0' )){
132 pch = strtok (
NULL,
"\n");
134 if (bytes_read <
LENGTH - 1) {
135 if (gzeof (file))
break;
137 const char * error_string;
138 error_string = gzerror (file, & err);
140 edm::LogError(
"HcalLaserEventFilter2012")<<
"Error while reading gzipped file: "<<error_string;
170 if (minrun_>-1 && run<minrun_)
return true;
171 if (maxrun_>-1 && run>maxrun_)
return true;
174 std::stringstream thisevent;
178 strVecI it = std::lower_bound(EventList_.begin(), EventList_.end(), thisevent.str());
179 if (it == EventList_.end() || thisevent.str() < *it)
return true;
183 if (verbose_)
std::cout <<prefix_<<thisevent.str()<<std::endl;
191 if (forceFilterTrue_)
return true;
198 if (WriteBadToFile_) outfile_.close();
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
HcalLaserEventFilter2012(const edm::ParameterSet &)
edm::LuminosityBlockNumber_t luminosityBlock() const
~HcalLaserEventFilter2012()
void addDefault(ParameterSetDescription const &psetDescription)
void addEventString(const std::string &eventString)
virtual void endJob() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual bool filter(edm::Event &, const edm::EventSetup &) override
std::string fullPath() const
void readEventListFile(const std::string &eventFileName)
std::vector< std::string >::iterator strVecI