CMS 3D CMS Logo

Classes | Public Types | Static Public Member Functions

pat::Flags Class Reference

Flags used in PAT, and static translator from flags to strings. More...

#include <Flags.h>

List of all members.

Classes

struct  Core
struct  Isolation
struct  Overlap
struct  Selection

Public Types

enum  CleanerFlags {
  AllBits = 0xFFFFFFFF, CoreBits = 0x0000000F, SelectionBits = 0x0000FFF0, OverlapBits = 0x00FF0000,
  IsolationBits = 0xFF000000
}

Static Public Member Functions

static const std::string & bitToString (uint32_t bit)
static uint32_t get (const std::string &str)
static uint32_t get (const std::vector< std::string > &str)
static std::string maskToString (uint32_t bit)
static bool test (uint32_t val, uint32_t mask)
static bool test (const reco::Candidate &c, uint32_t mask)

Detailed Description

Flags used in PAT, and static translator from flags to strings.

Author:
Steven Lowette
Version:
Id:
Flags.h,v 1.4 2008/12/05 20:55:50 hegner Exp

Definition at line 21 of file Flags.h.


Member Enumeration Documentation

Enumerator:
AllBits 
CoreBits 
SelectionBits 
OverlapBits 
IsolationBits 

Definition at line 22 of file Flags.h.

                          {
            AllBits       = 0xFFFFFFFF,
            CoreBits      = 0x0000000F,
            SelectionBits = 0x0000FFF0,
            OverlapBits   = 0x00FF0000,
            IsolationBits = 0xFF000000

        };

Member Function Documentation

const std::string & Flags::bitToString ( uint32_t  bit) [static]

Definition at line 6 of file Flags.cc.

References pat::Flags::Core::bitToString(), pat::Flags::Selection::bitToString(), pat::Flags::Isolation::bitToString(), pat::Flags::Overlap::bitToString(), CoreBits, IsolationBits, OverlapBits, SelectionBits, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by maskToString(), and pat::helper::MultiIsolator::print().

                               {
    static const std::string UNDEFINED_UNDEFINED = "Undefined/Undefined";
    if      (bit & CoreBits      ) return Core::bitToString( Core::Bits(bit) );
    else if (bit & SelectionBits ) return Selection::bitToString( Selection::Bits(bit) );
    else if (bit & OverlapBits   ) return Overlap::bitToString( Overlap::Bits(bit) );
    else if (bit & IsolationBits ) return Isolation::bitToString( Isolation::Bits(bit) );
    else return UNDEFINED_UNDEFINED;
}
uint32_t Flags::get ( const std::string &  str) [static]

Definition at line 28 of file Flags.cc.

References pat::Flags::Core::get(), pat::Flags::Isolation::get(), pat::Flags::Selection::get(), pat::Flags::Overlap::get(), UserOptions_cff::idx, and AlCaHLTBitMon_QueryRunRegistry::string.

                                  {
    size_t idx = str.find_first_of("/");
    if (idx != std::string::npos) {
        std::string set = str.substr(0, idx);
        if (set == "Core")      return Core::get(     str.substr(idx+1));
        if (set == "Overlap")   return Overlap::get(  str.substr(idx+1));
        if (set == "Isolation") return Isolation::get(str.substr(idx+1));
        if (set == "Selection") return Selection::get(str.substr(idx+1)); 
    }
    return 0;
}
uint32_t Flags::get ( const std::vector< std::string > &  str) [static]

Definition at line 41 of file Flags.cc.

References run_regression::ret.

                                              {
    uint32_t ret = 0;
    for (std::vector<std::string>::const_iterator it = strs.begin(), ed = strs.end(); it != ed; ++it) {
        ret |= get( *it );
    }
    return ret;
}
std::string Flags::maskToString ( uint32_t  bit) [static]

Definition at line 15 of file Flags.cc.

References bitToString(), first, i, run_regression::ret, and AlCaHLTBitMon_QueryRunRegistry::string.

                                              {
    std::string ret;
    bool first = false;
    for (uint32_t i = 1; i != 0; i <<= 1) {
        if ( mask & i ) {
            if (first) { first = false;  } else { ret += " + "; }
            ret += bitToString ( mask & i );
        }
    }
    return ret;
}
static bool pat::Flags::test ( uint32_t  val,
uint32_t  mask 
) [inline, static]

Definition at line 30 of file Flags.h.

Referenced by TtSemiLepSignalSelMVATrainer::analyze(), pat::SelectorByFlags::operator()(), and TtSemiLepSignalSelMVAComputer::produce().

{ return (val & mask) == 0; }
static bool pat::Flags::test ( const reco::Candidate c,
uint32_t  mask 
) [inline, static]

Definition at line 31 of file Flags.h.

References reco::Candidate::status(), and test().

Referenced by test().

{ return test(c.status(), mask); }