#include <Selections.h>
Public Types | |
typedef std::vector< Selection > ::iterator | iterator |
Public Member Functions | |
iterator | begin () |
iterator | end () |
void | print () |
Selections (const edm::ParameterSet &iConfig) | |
Private Attributes | |
std::map< std::string, Filter * > | filters_ |
edm::ParameterSet | filtersPSet_ |
edm::ParameterSet | selectionPSet_ |
std::vector< Selection > | selections_ |
Definition at line 269 of file Selections.h.
typedef std::vector<Selection>::iterator Selections::iterator |
Definition at line 271 of file Selections.h.
Selections::Selections | ( | const edm::ParameterSet & | iConfig | ) | [inline] |
Definition at line 273 of file Selections.h.
References begin(), end(), Filter_cff::Filter, ExpressReco_HICollisions_FallBack::filterNames, filters_, Selection< C, Selector, StoreContainer >::filters_, filtersPSet_, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSetNames(), Association::map, CrabTask::pset, asciidump::s, elec_selection::selection(), selectionPSet_, and selections_.
: filtersPSet_(iConfig.getParameter<edm::ParameterSet>("filters")), selectionPSet_(iConfig.getParameter<edm::ParameterSet>("selections")) { //FIXME. what about nested filters //make all configured filters std::vector<std::string> filterNames; unsigned int nF=filtersPSet_.getParameterSetNames(filterNames); for (unsigned int iF=0;iF!=nF;iF++){ edm::ParameterSet pset = filtersPSet_.getParameter<edm::ParameterSet>(filterNames[iF]); filters_.insert(std::make_pair(filterNames[iF],new Filter(filterNames[iF],pset))); } //parse all configured selections std::vector<std::string> selectionNames; std::map<std::string, std::vector<std::string> > selectionFilters; unsigned int nS=selectionPSet_.getParameterSetNames(selectionNames); for (unsigned int iS=0;iS!=nS;iS++){ edm::ParameterSet pset=selectionPSet_.getParameter<edm::ParameterSet>(selectionNames[iS]); selections_.push_back(Selection(selectionNames[iS],pset)); // selections_.insert(std::make_pair(selectionNames[iS],Selection(selectionNames[iS],pset))); //keep track of list of filters for this selection for further dependency resolution selectionFilters[selectionNames[iS]]=pset.getParameter<std::vector<std::string> >("filterOrder"); } //watch out of recursive dependency // unsigned int nestedDepth=0; //FIXME not taken care of //resolving dependencies for (std::map<std::string, std::vector<std::string> >::iterator sIt= selectionFilters.begin();sIt!=selectionFilters.end();++sIt) { //parse the vector of filterNames for (std::vector<std::string>::iterator fOrS=sIt->second.begin();fOrS!=sIt->second.end();++fOrS) { if (filters_.find(*fOrS)==filters_.end()) { //not a know filter names uncountered : either Selection of _OR_. if (fOrS->find("_OR_") != std::string::npos){ filters_.insert(std::make_pair((*fOrS),new FilterOR((*fOrS),filters_))); }//_OR_ filter else{ // look for a selection name std::map<std::string, std::vector<std::string> >::iterator s=selectionFilters.find(*fOrS); if (s==selectionFilters.end()){ //error. edm::LogError("SelectionHelper")<<"unresolved filter/selection name: "<<*fOrS; }//not a Selection name. else{ //remove the occurence std::vector<std::string>::iterator newLoc=sIt->second.erase(fOrS); //insert the list of filters corresponding to this selection in there sIt->second.insert(newLoc,s->second.begin(),s->second.end()); //decrement selection iterator to come back to it sIt--; break; }//a Selection name } }//the name is not a simple filter name : either Selection of _OR_. }//loop over the strings in "filterOrder" }//loop over all defined Selection //finally, configure the Selections //loop the selections instanciated // for (std::map<std::string, Selection>::iterator sIt=selections_.begin();sIt!=selections_.end();++sIt) // const std::string & sName=sIt->first; //Selection & selection =sIt->second; for (std::vector<Selection>::iterator sIt=selections_.begin();sIt!=selections_.end();++sIt){ const std::string & sName=sIt->name(); Selection & selection =*sIt; //parse the vector of filterNames std::vector<std::string> & listOfFilters=selectionFilters[sName]; for (std::vector<std::string>::iterator fIt=listOfFilters.begin();fIt!=listOfFilters.end();++fIt) { std::map<std::string, Filter*>::iterator filterInstance=filters_.find(*fIt); if (filterInstance==filters_.end()){ //error edm::LogError("Selections")<<"cannot resolve: "<<*fIt; } else{ //actually increment the filter selection.filters_.push_back(filterInstance->second); } } } for (iterator sIt = begin(); sIt!=end();++sIt) sIt->printDetailledPrintoutHeader(); }
iterator Selections::begin | ( | void | ) | [inline] |
Definition at line 366 of file Selections.h.
References selections_.
Referenced by ConfigurableAnalysis::filter(), and Selections().
{return selections_.begin(); }
iterator Selections::end | ( | void | ) | [inline] |
Definition at line 367 of file Selections.h.
References selections_.
Referenced by ConfigurableAnalysis::filter(), and Selections().
{ return selections_.end();}
void Selections::print | ( | void | ) | [inline] |
Definition at line 370 of file Selections.h.
References selections_.
Referenced by ConfigurableAnalysis::endJob().
{ for (std::vector<Selection>::iterator sIt=selections_.begin();sIt!=selections_.end();++sIt) sIt->print();}
std::map<std::string, Filter*> Selections::filters_ [private] |
Definition at line 374 of file Selections.h.
Referenced by Selections().
edm::ParameterSet Selections::filtersPSet_ [private] |
Definition at line 373 of file Selections.h.
Referenced by Selections().
edm::ParameterSet Selections::selectionPSet_ [private] |
Definition at line 376 of file Selections.h.
Referenced by Selections().
std::vector<Selection> Selections::selections_ [private] |
Definition at line 378 of file Selections.h.
Referenced by begin(), end(), print(), and Selections().