CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
const edm::EventSetup & c
static const std::string & bitToString(uint32_t bit)
Definition: Flags.cc:5
virtual int status() const =0
status word
static bool test(uint32_t val, uint32_t mask)
Definition: Flags.h:28
static const std::string & bitToString(Bits bit)
Definition: Flags.cc:190
static const std::string & bitToString(Bits bit)
Definition: Flags.cc:255
static std::string maskToString(uint32_t bit)
Definition: Flags.cc:19
Flags used in PAT, and static translator from flags to strings.
Definition: Flags.h:19
static bool test(const reco::Candidate &c, uint32_t mask)
Definition: Flags.h:29
static const std::string & bitToString(Bits bit)
Definition: Flags.cc:104
CleanerFlags
Definition: Flags.h:20
#define str(s)
static const std::string & bitToString(Bits bit)
Definition: Flags.cc:59