CMS 3D CMS Logo

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