CMS 3D CMS Logo

Flags.h
Go to the documentation of this file.
1 #ifndef DataFormats_PatCandidates_interface_Flags_h
2 #define DataFormats_PatCandidates_interface_Flags_h
3 //
4 //
5 
14 #include <string>
15 #include <vector>
16 #include <cstdint>
17 
18 namespace pat {
19  struct Flags {
20  enum CleanerFlags {
21  AllBits = 0xFFFFFFFF,
22  CoreBits = 0x0000000F,
23  SelectionBits = 0x0000FFF0,
24  OverlapBits = 0x00FF0000,
25  IsolationBits = 0xFF000000
26 
27  };
28  inline static bool test(uint32_t val, uint32_t mask) { return (val & mask) == 0; }
29  inline static bool test(const reco::Candidate &c, uint32_t mask) { return test(c.status(), mask); }
30 
31  static const std::string &bitToString(uint32_t bit);
32  static std::string maskToString(uint32_t bit);
33  static uint32_t get(const std::string &str);
34  static uint32_t get(const std::vector<std::string> &str);
35 
36  struct Core {
37  enum { Shift = 0 };
38  enum Bits {
39  All = 0x0000000F,
40  Duplicate = 0x00000001, // internal duplication
41  Preselection = 0x00000002, // base preselection 1 (e.g. pt, eta cuts)
42  Vertexing = 0x00000004, // vertex association cuts
43  Overflow = 0x00000008, // if one requests to save "at most X items",
44  // the overflowing ones will have this bit set
45  Undefined = 0x00000000
46  };
47  static const std::string &bitToString(Bits bit);
48  static Bits get(const std::string &str);
49  static uint32_t get(const std::vector<std::string> &str);
50  };
51 
52  struct Overlap {
53  enum { Shift = 16 };
54  enum Bits {
55  All = 0x00FF0000,
56  Jets = 0x00010000,
57  Electrons = 0x00020000,
58  Muons = 0x00040000,
59  Taus = 0x00080000,
60  Photons = 0x00100000,
61  User = 0X00E00000,
62  User1 = 0x00200000,
63  User2 = 0x00400000,
64  User3 = 0x00800000,
65  Undefined = 0x00000000
66  };
67  static const std::string &bitToString(Bits bit);
68  static Bits get(const std::string &str);
69  static uint32_t get(const std::vector<std::string> &str);
70  };
71 
72  struct Selection {
73  enum { Shift = 4 };
74  enum Bits {
75  All = 0x0000FFF0,
76  Bit0 = 0x00000010,
77  Bit1 = 0x00000020,
78  Bit2 = 0x00000040,
79  Bit3 = 0x00000080,
80  Bit4 = 0x00000100,
81  Bit5 = 0x00000200,
82  Bit6 = 0x00000400,
83  Bit7 = 0x00000800,
84  Bit8 = 0x00001000,
85  Bit9 = 0x00002000,
86  Bit10 = 0x00004000,
87  Bit11 = 0x00008000,
88  Undefined = 0x00000000
89  };
90  static const std::string &bitToString(Bits bit);
91  static Bits get(int8_t bit);
92  static Bits get(const std::string &str);
93  static uint32_t get(const std::vector<std::string> &str);
94  };
95  struct Isolation {
96  enum { Shift = 24 };
97  enum Bits {
98  All = 0xFF000000,
99  Tracker = 0x01000000,
100  ECal = 0x02000000,
101  HCal = 0x04000000,
102  Calo = 0x06000000,
103  User = 0xF8000000,
104  User1 = 0x08000000,
105  User2 = 0x10000000,
106  User3 = 0x20000000,
107  User4 = 0x40000000,
108  User5 = 0x80000000,
109  Undefined = 0x00000000
110  };
111  static const std::string &bitToString(Bits bit);
112  static Bits get(const std::string &str);
113  static uint32_t get(const std::vector<std::string> &str);
114  };
115  };
116 } // namespace pat
117 
118 #endif
pat::Flags::Overlap::Bits
Bits
Definition: Flags.h:54
pat::Flags::Core
Definition: Flags.h:36
pat::Flags::test
static bool test(const reco::Candidate &c, uint32_t mask)
Definition: Flags.h:29
pat::Flags::Selection
Definition: Flags.h:72
pat::Flags::Isolation::Calo
Definition: Flags.h:102
pat::Flags::Isolation::User1
Definition: Flags.h:104
pat::Flags::Isolation::bitToString
static const std::string & bitToString(Bits bit)
Definition: Flags.cc:255
pat::Flags::Core::Preselection
Definition: Flags.h:41
pat::Flags::Selection::Bit1
Definition: Flags.h:77
pat::Flags::Selection::Bit10
Definition: Flags.h:86
pat::Flags::AllBits
Definition: Flags.h:21
pat::Flags::Overlap::User3
Definition: Flags.h:64
pat::Flags::Isolation::Shift
Definition: Flags.h:96
pat::Flags::Core::Undefined
Definition: Flags.h:45
pat::Flags::Overlap::User1
Definition: Flags.h:62
pat::Flags::Isolation::User2
Definition: Flags.h:105
pat::Flags::Overlap::All
Definition: Flags.h:55
pat::Flags
Flags used in PAT, and static translator from flags to strings.
Definition: Flags.h:19
pat::Flags::Core::get
static Bits get(const std::string &str)
pat::Flags::Selection::Bit4
Definition: Flags.h:80
pat::Flags::Core::Vertexing
Definition: Flags.h:42
pat::Flags::Overlap::Photons
Definition: Flags.h:60
pat::Flags::Isolation::Tracker
Definition: Flags.h:99
pat::Flags::Selection::Bit11
Definition: Flags.h:87
pat::Flags::Isolation::Bits
Bits
Definition: Flags.h:97
pat::Flags::Isolation::User4
Definition: Flags.h:107
pat::Flags::Overlap::Shift
Definition: Flags.h:53
pat::Flags::Core::bitToString
static const std::string & bitToString(Bits bit)
Definition: Flags.cc:59
pat::Flags::Selection::Bit0
Definition: Flags.h:76
pat::Flags::bitToString
static const std::string & bitToString(uint32_t bit)
Definition: Flags.cc:5
pat::Flags::Core::Shift
Definition: Flags.h:37
pat::Flags::test
static bool test(uint32_t val, uint32_t mask)
Definition: Flags.h:28
pat::Flags::Core::Duplicate
Definition: Flags.h:40
pat::Flags::Selection::Shift
Definition: Flags.h:73
pat::Flags::Selection::Bit9
Definition: Flags.h:85
str
#define str(s)
Definition: TestProcessor.cc:48
pat::Flags::Selection::Bit5
Definition: Flags.h:81
pat::Flags::Overlap::Muons
Definition: Flags.h:58
pat::Flags::CoreBits
Definition: Flags.h:22
pat::Flags::Selection::Bit7
Definition: Flags.h:83
pat::Flags::Core::Bits
Bits
Definition: Flags.h:38
pat::Flags::Selection::Bit6
Definition: Flags.h:82
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pat::Flags::Isolation::Undefined
Definition: Flags.h:109
pat::Flags::SelectionBits
Definition: Flags.h:23
pat::Flags::Isolation::HCal
Definition: Flags.h:101
pat::Flags::Selection::Undefined
Definition: Flags.h:88
pat::Flags::Selection::bitToString
static const std::string & bitToString(Bits bit)
Definition: Flags.cc:104
pat::Flags::Selection::Bit3
Definition: Flags.h:79
pat::Flags::Isolation::get
static Bits get(const std::string &str)
pat::Flags::IsolationBits
Definition: Flags.h:25
pat::Flags::Selection::All
Definition: Flags.h:75
pat::Flags::Isolation::User
Definition: Flags.h:103
pat::Flags::Overlap::Electrons
Definition: Flags.h:57
pat
Definition: HeavyIon.h:7
pat::Flags::Core::Overflow
Definition: Flags.h:43
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
pat::Flags::Overlap::User2
Definition: Flags.h:63
pat::Flags::Selection::Bit2
Definition: Flags.h:78
pat::Flags::Selection::Bits
Bits
Definition: Flags.h:74
pat::Flags::Overlap
Definition: Flags.h:52
reco::Candidate
Definition: Candidate.h:27
pat::Flags::Overlap::bitToString
static const std::string & bitToString(Bits bit)
Definition: Flags.cc:190
pat::Flags::OverlapBits
Definition: Flags.h:24
pat::Flags::CleanerFlags
CleanerFlags
Definition: Flags.h:20
heppy_batch.val
val
Definition: heppy_batch.py:351
pat::Flags::Selection::get
static Bits get(int8_t bit)
Definition: Flags.cc:142
pat::Flags::Overlap::Taus
Definition: Flags.h:59
pat::Flags::Overlap::User
Definition: Flags.h:61
pat::Flags::Overlap::get
static Bits get(const std::string &str)
pat::Flags::Overlap::Undefined
Definition: Flags.h:65
pat::Flags::Core::All
Definition: Flags.h:39
pat::Flags::maskToString
static std::string maskToString(uint32_t bit)
Definition: Flags.cc:19
pat::Flags::Isolation::ECal
Definition: Flags.h:100
pat::Flags::Isolation::User3
Definition: Flags.h:106
pat::Flags::Isolation
Definition: Flags.h:95
Candidate.h
pat::Flags::Isolation::User5
Definition: Flags.h:108
pat::Flags::Isolation::All
Definition: Flags.h:98
pat::Flags::Overlap::Jets
Definition: Flags.h:56
pat::Flags::Selection::Bit8
Definition: Flags.h:84
pat::Flags::get
static uint32_t get(const std::string &str)
Definition: Flags.cc:35