Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:18

0001 #ifndef DataFormats_PatCandidates_interface_Flags_h
0002 #define DataFormats_PatCandidates_interface_Flags_h
0003 //
0004 //
0005 
0006 /**
0007   \class    pat::Flags Flag.h "DataFormats/PatCandidates/interface/Flags.h"
0008   \brief    Flags used in PAT, and static translator from flags to strings 
0009 
0010   \author   Steven Lowette
0011 */
0012 
0013 #include "DataFormats/Candidate/interface/Candidate.h"
0014 #include <string>
0015 #include <vector>
0016 #include <cstdint>
0017 
0018 namespace pat {
0019   struct Flags {
0020     enum CleanerFlags {
0021       AllBits = 0xFFFFFFFF,
0022       CoreBits = 0x0000000F,
0023       SelectionBits = 0x0000FFF0,
0024       OverlapBits = 0x00FF0000,
0025       IsolationBits = 0xFF000000
0026 
0027     };
0028     inline static bool test(uint32_t val, uint32_t mask) { return (val & mask) == 0; }
0029     inline static bool test(const reco::Candidate &c, uint32_t mask) { return test(c.status(), mask); }
0030 
0031     static const std::string &bitToString(uint32_t bit);
0032     static std::string maskToString(uint32_t bit);
0033     static uint32_t get(const std::string &str);
0034     static uint32_t get(const std::vector<std::string> &str);
0035 
0036     struct Core {
0037       enum { Shift = 0 };
0038       enum Bits {
0039         All = 0x0000000F,
0040         Duplicate = 0x00000001,     // internal duplication
0041         Preselection = 0x00000002,  // base preselection 1 (e.g. pt, eta cuts)
0042         Vertexing = 0x00000004,     // vertex association cuts
0043         Overflow = 0x00000008,      // if one requests to save "at most X items",
0044                                     // the overflowing ones will have this bit set
0045         Undefined = 0x00000000
0046       };
0047       static const std::string &bitToString(Bits bit);
0048       static Bits get(const std::string &str);
0049       static uint32_t get(const std::vector<std::string> &str);
0050     };
0051 
0052     struct Overlap {
0053       enum { Shift = 16 };
0054       enum Bits {
0055         All = 0x00FF0000,
0056         Jets = 0x00010000,
0057         Electrons = 0x00020000,
0058         Muons = 0x00040000,
0059         Taus = 0x00080000,
0060         Photons = 0x00100000,
0061         User = 0X00E00000,
0062         User1 = 0x00200000,
0063         User2 = 0x00400000,
0064         User3 = 0x00800000,
0065         Undefined = 0x00000000
0066       };
0067       static const std::string &bitToString(Bits bit);
0068       static Bits get(const std::string &str);
0069       static uint32_t get(const std::vector<std::string> &str);
0070     };
0071 
0072     struct Selection {
0073       enum { Shift = 4 };
0074       enum Bits {
0075         All = 0x0000FFF0,
0076         Bit0 = 0x00000010,
0077         Bit1 = 0x00000020,
0078         Bit2 = 0x00000040,
0079         Bit3 = 0x00000080,
0080         Bit4 = 0x00000100,
0081         Bit5 = 0x00000200,
0082         Bit6 = 0x00000400,
0083         Bit7 = 0x00000800,
0084         Bit8 = 0x00001000,
0085         Bit9 = 0x00002000,
0086         Bit10 = 0x00004000,
0087         Bit11 = 0x00008000,
0088         Undefined = 0x00000000
0089       };
0090       static const std::string &bitToString(Bits bit);
0091       static Bits get(int8_t bit);
0092       static Bits get(const std::string &str);
0093       static uint32_t get(const std::vector<std::string> &str);
0094     };
0095     struct Isolation {
0096       enum { Shift = 24 };
0097       enum Bits {
0098         All = 0xFF000000,
0099         Tracker = 0x01000000,
0100         ECal = 0x02000000,
0101         HCal = 0x04000000,
0102         Calo = 0x06000000,
0103         User = 0xF8000000,
0104         User1 = 0x08000000,
0105         User2 = 0x10000000,
0106         User3 = 0x20000000,
0107         User4 = 0x40000000,
0108         User5 = 0x80000000,
0109         Undefined = 0x00000000
0110       };
0111       static const std::string &bitToString(Bits bit);
0112       static Bits get(const std::string &str);
0113       static uint32_t get(const std::vector<std::string> &str);
0114     };
0115   };
0116 }  // namespace pat
0117 
0118 #endif