18 if (!iConfig.
empty()){
23 if (iConfig.
exists(
"description"))
64 const std::map<std::string, Filter*> &
filters){
68 ss<<
"Filter doing an OR of: ";
73 size_t orPos = filterORlistCopy.find(
"_OR_");
74 if (orPos == std::string::npos && filterORlistCopy.size()!=0){
75 size=filterORlistCopy.size();
84 filterORlistCopy = filterORlistCopy.substr(0+size+4);
86 std::map<std::string, Filter*>::const_iterator it=filters.find(filter);
87 if (it==filters.end()){
89 <<
" OR expression is: "<<filterORlist;
92 filters_.push_back(std::make_pair(it->first, it->second));
104 std::vector <std::pair<std::string , const Filter * > >
filters_;
118 ntuplize_(iConfig.getParameter<bool>(
"ntuplize")),
127 if (iConfig.
exists(
"nMonitor"))
146 std::map<std::string, bool>
ret;
152 bool decision=(*filter)->accept(iEvent);
154 if (decision) count.
nPass_++;
155 global=global && decision;
161 summary<<std::setw(20)<<
name().substr(0,19)<<
" : "
162 <<std::setw(10)<<iEvent.
id().
run()<<
" : "
163 <<std::setw(10)<<iEvent.
id().
event();
166 summary<<
" : "<<std::setw(10)<<(ret[
fName]?
"pass":
"reject");
177 summary<<std::setw(20)<<
" selection name "<<
" : "
178 <<std::setw(10)<<
" run "<<
" : "
179 <<std::setw(10)<<
" event ";
181 summary<<
" : "<<std::setw(10)<<(*filter)->name().substr(0,9);
190 unsigned int maxFnameSize = 20;
192 if ((*filter)->name().size() > maxFnameSize) maxFnameSize = (*filter)->name().size()+1;
198 summary<<
" Summary table for selection: "<<
name()<<
" with: "<<
nSeen_<<
" events run."<<std::endl;
203 summary<<
"filter: "<<std::right<<std::setw(10)<<fName<<
"\n"
204 <<(*filter)->descriptionText()<<
"\n";
207 summary<<
" filter stand-alone pass: "<<std::endl;
208 summary<<std::right<<std::setw(maxFnameSize)<<
"total read"<<
": "
209 <<std::right<<std::setw(10)<<
nSeen_<<std::endl;
213 summary<<std::right<<std::setw(maxFnameSize)<<fName<<
": "
214 <<std::right<<std::setw(10)<<count.
nPass_<<
" passed events. "
215 <<std::right<<std::setw(10)<<std::setprecision (5)<<(count.
nPass_/(float)count.
nSeen_)*100.<<
" [%]"<<std::endl;
217 summary<<
" filter cumulative pass:"<<std::endl;
218 summary<<std::right<<std::setw(maxFnameSize)<<
"total read"<<
": "
219 <<std::right<<std::setw(10)<<
nSeen_<<std::endl;
220 unsigned int lastCount=
nSeen_;
224 summary<<std::right<<std::setw(maxFnameSize)<<fName<<
": "
225 <<std::right<<std::setw(10)<<count.
nCumulative_<<
" passed events. "
226 <<std::right<<std::setw(10)<<std::setprecision (5)<<(count.
nCumulative_/(float)count.
nSeen_)*100.<<
" [%]";
228 summary<<
" (to previous count) "<<std::right<<std::setw(10)<<std::setprecision (5)<<(count.
nCumulative_/(float)lastCount)*100.<<
" [%]";
233 summary<<
"-------------------------------------\n";
280 std::vector<std::string> filterNames;
282 for (
unsigned int iF=0;iF!=nF;iF++){
284 filters_.insert(std::make_pair(filterNames[iF],
new Filter(filterNames[iF],pset, iC)));
288 std::vector<std::string> selectionNames;
289 std::map<std::string, std::vector<std::string> > selectionFilters;
291 for (
unsigned int iS=0;iS!=nS;iS++){
296 selectionFilters[selectionNames[iS]]=pset.
getParameter<std::vector<std::string> >(
"filterOrder");
307 for (std::vector<std::string>::iterator fOrS=sIt->second.begin();fOrS!=sIt->second.end();++fOrS)
312 if (fOrS->find(
"_OR_") != std::string::npos){
317 std::map<std::string, std::vector<std::string> >
::iterator s=selectionFilters.find(*fOrS);
318 if (s==selectionFilters.end()){
320 edm::LogError(
"SelectionHelper")<<
"unresolved filter/selection name: "<<*fOrS;
324 std::vector<std::string>::iterator newLoc=sIt->second.erase(fOrS);
326 sIt->second.insert(newLoc,s->second.begin(),s->second.end());
347 std::vector<std::string> & listOfFilters=selectionFilters[sName];
348 for (std::vector<std::string>::iterator fIt=listOfFilters.begin();fIt!=listOfFilters.end();++fIt)
350 std::map<std::string, Filter*>::iterator filterInstance=
filters_.find(*fIt);
351 if (filterInstance==
filters_.end()){
357 selection.
filters_.push_back(filterInstance->second);
363 sIt->printDetailledPrintoutHeader();
T getParameter(std::string const &) const
EventNumber_t event() const
std::vector< std::string > description_
std::vector< Filter * > filters_
virtual bool select(const edm::Event &) const =0
decision of the selector module
pair< int, edm::FunctionWithDict > OK
std::vector< Selection > selections_
std::string dump(unsigned int indent=0) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void printDetailledPrintoutHeader()
const_iterator begin() const
std::map< std::string, Filter * > filters_
const std::string & dump()
std::vector< TPRegexp > filters
Selections(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
U second(std::pair< T, U > const &p)
bool makeCumulativePlots_
bool accept(edm::Event &iEvent) const
edm::ParameterSet filtersPSet_
bool makeCumulativePlots()
bool makeDetailledPrintout_
FilterOR(const std::string &filterORlist, const std::map< std::string, Filter * > &filters)
const std::vector< std::string > description()
const std::string & name()
Filter(std::string name, edm::ParameterSet &iConfig, edm::ConsumesCollector &iC)
const std::string & name()
const std::string descriptionText()
unsigned int nCumulative_
EventSelector * selector_
std::vector< std::pair< std::string, const Filter * > > filters_
std::map< std::string, Count > counts_
bool makeAllButOnePlots()
void addUntrackedParameter(std::string const &name, T const &value)
virtual bool accept(edm::Event &iEvent) const
std::vector< Filter * >::iterator iterator
std::vector< Selection >::iterator iterator
edm::ParameterSet selectionPSet_
void print(bool description=true)
volatile std::atomic< bool > shutdown_flag false
size_t getParameterSetNames(std::vector< std::string > &output, bool trackiness=true) const
const_iterator end() const
std::map< std::string, bool > accept(edm::Event &iEvent)
tuple size
Write out results.
T get(const Candidate &c)
Selection(std::string name, const edm::ParameterSet &iConfig)
std::string detailledPrintoutCategory_