1 #ifndef PhysicsTools_SelectorUtils_Selector_h 2 #define PhysicsTools_SelectorUtils_Selector_h 30 typedef std::map<index_type, int>
int_map;
106 void set(index_type
const &
i,
bool val =
true) {
114 void set(index_type
const &
i,
int cut,
bool val =
true) {
123 void set(index_type
const &
i,
double cut,
bool val =
true) {
166 for ( std::vector<std::string>::const_iterator ignoreBegin = bitsToIgnore.begin(),
167 ignoreEnd = bitsToIgnore.end(), ibit = ignoreBegin;
168 ibit != ignoreEnd; ++ibit ) {
181 for ( cut_flow_map::iterator cutsBegin =
cutFlow_.begin(),
182 cutsEnd =
cutFlow_.end(), icut = cutsBegin;
183 icut != cutsEnd && found == cutsEnd; ++icut ) {
184 if ( icut->first == i ) {
192 int cut( index_type
const & i,
int val )
const {
196 double cut( index_type
const & i,
double val )
const {
213 for ( cut_flow_map::const_iterator cutsBegin =
cutFlow_.begin(),
214 cutsEnd =
cutFlow_.end(), icut = cutsBegin;
215 icut != cutsEnd; ++icut ) {
216 if (
ignoreCut(icut->first) ) ret[icut->first] =
true;
223 for ( cut_flow_map::const_iterator cutsBegin =
cutFlow_.begin(),
224 cutsEnd =
cutFlow_.end(), icut = cutsBegin;
225 icut != cutsEnd; ++icut ) {
226 if (
ignoreCut(icut->first) ) ret[icut->first] =
true;
232 for ( cut_flow_map::const_iterator cutsBegin =
cutFlow_.begin(),
233 cutsEnd =
cutFlow_.end(), icut = cutsBegin;
234 icut != cutsEnd; ++icut ) {
237 sprintf(buff,
"%6lu : %20s %10lu",
238 static_cast<unsigned long>(icut - cutsBegin),
239 icut->first.str().c_str(),
240 static_cast<unsigned long>(icut->second) );
242 sprintf(buff,
"%6lu : %20s %10s",
243 static_cast<unsigned long>(icut - cutsBegin),
244 icut->first.str().c_str(),
247 out << buff << std::endl;
253 bool already_printed_one =
false;
254 for ( cut_flow_map::const_iterator cutsBegin =
cutFlow_.begin(),
255 cutsEnd =
cutFlow_.end(), icut = cutsBegin;
256 icut != cutsEnd; ++icut ) {
258 if( already_printed_one ) out <<
", ";
260 already_printed_one =
true;
272 for ( cut_flow_map::const_iterator cutsBegin =
cutFlow_.begin(),
273 cutsEnd =
cutFlow_.end(), icut = cutsBegin;
274 icut != cutsEnd && found == cutsEnd; ++icut ) {
275 if ( icut->first == i ) {
279 return found->second;
bool considerCut(std::string const &s) const
consider the cut at index "s"
virtual bool operator()(T const &t, edm::EventBase const &e)
This provides an alternative signature that includes extra information.
virtual bool operator()(T const &t, pat::strbitset &ret)=0
This provides the interface for base classes to select objects.
bool considerCut(index_type const &i) const
std::map< index_type, int > int_map
virtual bool operator()(T const &t, edm::EventBase const &e, pat::strbitset &ret)
This provides an alternative signature that includes extra information.
double cut(index_type const &i, double val) const
Access the double cut values at index "s".
void passCut(pat::strbitset &ret, index_type const &i)
pat::strbitset::index_type index_type
void setIgnored(pat::strbitset &ret)
set ignored bits
void printActiveCuts(std::ostream &out) const
Print the cuts being considered.
pat::strbitset retInternal_
internal ret if users don't care about return bits
std::pair< index_type, size_t > cut_flow_item
void clear(std::string const &s)
Turn off a given selection cut.
virtual void push_back(std::string const &s, double cut)
This is the registration of an individual cut string, with a double cut value.
bool ignoreCut(index_type const &i) const
int cut(std::string s, int val) const
Access the int cut values at index "s".
pat::strbitset bits_
the bitset indexed by strings
void clear(index_type const &i)
void passCut(pat::strbitset &ret, std::string const &s)
Passing cuts.
double getPasses(index_type const &i) const
bool ignoreCut(std::string const &s) const
ignore the cut at index "s"
std::vector< cut_flow_item > cut_flow_map
virtual void push_back(std::string const &s)
This is the registration of an individual cut string.
Functor that operates on <T>
cut_flow_map cutFlow_
map of cut flows in "human" order
void clear()
clear the bitset and map
Selector()
Constructor clears the bits.
void print(std::ostream &out) const
Print the cut flow.
std::map< index_type, double > double_map
strbitset & set(bool val=true)
set method of all bits
pat::strbitset getBitTemplate() const
Get an empty bitset with the proper names.
double cut(std::string s, double val) const
Access the double cut values at index "s".
virtual bool operator()(T const &t)
This provides an alternative signature without the second ret.
bool operator[](std::string const &s) const
void setIgnoredCuts(std::vector< std::string > const &bitsToIgnore)
set the bits to ignore from a vector
double_map doubleCuts_
the double-value cut map
virtual void push_back(std::string const &s, int cut)
This is the registration of an individual cut string, with an int cut value.
void push_back(std::string s)
int_map intCuts_
the int-value cut map
int cut(index_type const &i, int val) const
Access the int cut values at index "s".
double getPasses(std::string const &s) const
Return the number of passing cases.