CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/DataFormats/PatCandidates/interface/Flags.h

Go to the documentation of this file.
00001 #ifndef DataFormats_PatCandidates_interface_Flags_h
00002 #define DataFormats_PatCandidates_interface_Flags_h
00003 //
00004 // $Id: Flags.h,v 1.4 2008/12/05 20:55:50 hegner Exp $
00005 //
00006 
00015 #include "DataFormats/Candidate/interface/Candidate.h"
00016 #include <string>
00017 #include <vector>
00018 #include <boost/cstdint.hpp> 
00019 
00020 namespace pat {
00021     struct Flags {
00022         enum CleanerFlags {
00023             AllBits       = 0xFFFFFFFF,
00024             CoreBits      = 0x0000000F,
00025             SelectionBits = 0x0000FFF0,
00026             OverlapBits   = 0x00FF0000,
00027             IsolationBits = 0xFF000000
00028 
00029         };
00030         inline static bool test(uint32_t val, uint32_t mask) { return (val & mask) == 0; }
00031         inline static bool test(const reco::Candidate &c, uint32_t mask) { return test(c.status(), mask); }
00032 
00033         static const std::string & bitToString( uint32_t bit );
00034         static std::string maskToString( uint32_t bit );
00035         static uint32_t  get ( const std::string & str );
00036         static uint32_t  get ( const std::vector<std::string> & str );
00037 
00038         struct Core {
00039             enum { Shift =  0 };
00040             enum Bits {
00041                 All           = 0x0000000F,
00042                 Duplicate     = 0x00000001, // internal duplication
00043                 Preselection  = 0x00000002, // base preselection 1 (e.g. pt, eta cuts)
00044                 Vertexing     = 0x00000004, // vertex association cuts
00045                 Overflow      = 0x00000008, // if one requests to save "at most X items", 
00046                                             // the overflowing ones will have this bit set
00047                 Undefined     = 0x00000000
00048             };
00049             static const std::string & bitToString( Bits bit );
00050             static Bits      get ( const std::string & str );
00051             static uint32_t  get ( const std::vector<std::string> & str );
00052         };
00053 
00054         struct Overlap {
00055             enum { Shift =  16 };
00056             enum Bits {
00057                 All       = 0x00FF0000,
00058                 Jets      = 0x00010000,
00059                 Electrons = 0x00020000,
00060                 Muons     = 0x00040000,
00061                 Taus      = 0x00080000,
00062                 Photons   = 0x00100000,
00063                 User      = 0X00E00000,
00064                 User1     = 0x00200000,
00065                 User2     = 0x00400000,
00066                 User3     = 0x00800000,
00067                 Undefined = 0x00000000
00068             };
00069             static const std::string & bitToString( Bits bit );
00070             static Bits      get ( const std::string & str );
00071             static uint32_t  get ( const std::vector<std::string> & str );
00072         };
00073 
00074         struct Selection {
00075             enum { Shift =  4 };
00076             enum Bits {
00077                 All       = 0x0000FFF0,
00078                 Bit0      = 0x00000010, 
00079                 Bit1      = 0x00000020, 
00080                 Bit2      = 0x00000040, 
00081                 Bit3      = 0x00000080, 
00082                 Bit4      = 0x00000100,
00083                 Bit5      = 0x00000200,
00084                 Bit6      = 0x00000400,
00085                 Bit7      = 0x00000800,
00086                 Bit8      = 0x00001000,
00087                 Bit9      = 0x00002000,
00088                 Bit10     = 0x00004000,
00089                 Bit11     = 0x00008000,
00090                 Undefined = 0x00000000
00091             };
00092             static const std::string & bitToString( Bits bit );
00093             static Bits     get ( int8_t bit );
00094             static Bits     get ( const std::string & str );
00095             static uint32_t get ( const std::vector<std::string> & str );
00096         };
00097         struct Isolation {
00098             enum { Shift =  24 };
00099             enum Bits {
00100                 All       = 0xFF000000,
00101                 Tracker   = 0x01000000,
00102                 ECal      = 0x02000000,
00103                 HCal      = 0x04000000,
00104                 Calo      = 0x06000000,
00105                 User      = 0xF8000000,
00106                 User1     = 0x08000000,
00107                 User2     = 0x10000000,
00108                 User3     = 0x20000000,
00109                 User4     = 0x40000000,
00110                 User5     = 0x80000000,
00111                 Undefined = 0x00000000
00112             };
00113             static const std::string & bitToString( Bits bit );
00114             static Bits      get ( const std::string & str );
00115             static uint32_t  get ( const std::vector<std::string> & str );
00116         };
00117     };
00118 }
00119 
00120 #endif