1 |
#ifndef SELECTION_STATUS
|
2 |
#define SELECTION_STATUS
|
3 |
|
4 |
#include <bitset>
|
5 |
#include "TROOT.h"
|
6 |
|
7 |
class SelectionStatus {
|
8 |
|
9 |
public :
|
10 |
|
11 |
static const unsigned FAIL = 0x0;
|
12 |
static const unsigned PRESELECTION = 0x1;
|
13 |
static const unsigned LOOSEISO = 0x2;
|
14 |
static const unsigned TIGHTISO = 0x4;
|
15 |
static const unsigned LOOSEID = 0x8;
|
16 |
static const unsigned TIGHTID = 0x10;
|
17 |
static const unsigned UNDEFINED = 0x20;
|
18 |
static const unsigned TIGHTIDANDPRE = PRESELECTION|TIGHTID;
|
19 |
static const unsigned LOOSEIDANDPRE = PRESELECTION|LOOSEID;
|
20 |
static const unsigned TIGHTISOANDPRE = PRESELECTION|TIGHTISO;
|
21 |
static const unsigned LOOSEISOANDPRE = PRESELECTION|LOOSEISO;
|
22 |
static const unsigned TIGHTSELECTION = PRESELECTION|TIGHTID|TIGHTISO;
|
23 |
static const unsigned LOOSESELECTION = PRESELECTION|LOOSEID|LOOSEISO;
|
24 |
static const unsigned EVTPASS = PRESELECTION|LOOSEID|LOOSEISO|TIGHTID|TIGHTISO;
|
25 |
|
26 |
std::bitset<20> selectionBits;
|
27 |
double idMVA,isoMVA,isoPF04;
|
28 |
double chisoPF04,gaisoPF04,neisoPF04;
|
29 |
SelectionStatus():status(0),idMVA(-999),isoMVA(-999),isoPF04(-999),
|
30 |
chisoPF04(-999),gaisoPF04(-999),neisoPF04(-999){};
|
31 |
SelectionStatus(unsigned thestatus):status(thestatus) { };
|
32 |
|
33 |
inline bool passPre() { return ( (status&PRESELECTION) == PRESELECTION ) ;}
|
34 |
inline bool passLooseIso() { return ( (status&LOOSEISO) == LOOSEISO ) ;}
|
35 |
inline bool tight() { return ( (status&TIGHTSELECTION) == TIGHTSELECTION ) ;}
|
36 |
inline bool loose() { return ( (status&LOOSESELECTION) == LOOSESELECTION ) ;}
|
37 |
inline bool tightID() { return ( (status&TIGHTID) == TIGHTID ) ;}
|
38 |
inline bool looseID() { return ( (status&LOOSEID) == LOOSEID ) ;}
|
39 |
inline bool tightIDAndPre() { return ( (status&TIGHTIDANDPRE) == TIGHTIDANDPRE ) ;}
|
40 |
inline bool looseIDAndPre() { return ( (status&LOOSEIDANDPRE) == LOOSEIDANDPRE ) ;}
|
41 |
inline bool tightIsoAndPre() { return ( (status&TIGHTISOANDPRE) == TIGHTISOANDPRE ) ;}
|
42 |
inline bool looseIsoAndPre() { return ( (status&LOOSEISOANDPRE) == LOOSEISOANDPRE ) ;}
|
43 |
inline bool pass() { return (tight()||loose()); }
|
44 |
inline bool passID() { return (tightID()||looseID()); }
|
45 |
inline bool passIDAndPre() { return (tightIDAndPre()||looseIDAndPre()); }
|
46 |
inline void orStatus(unsigned thestatus) { status |= thestatus;}
|
47 |
inline void setStatus(unsigned thestatus) { status = thestatus;}
|
48 |
inline unsigned getStatus() { return status; }
|
49 |
SelectionStatus& operator |=(const SelectionStatus &rhs ) {
|
50 |
status |= rhs.status;
|
51 |
if( rhs.idMVA != -999 ) idMVA = rhs.idMVA;
|
52 |
if( rhs.isoMVA != -999 ) isoMVA = rhs.isoMVA;
|
53 |
if( rhs.isoPF04 != -999 ) {
|
54 |
isoPF04 = rhs.isoPF04;
|
55 |
}
|
56 |
if( rhs.chisoPF04 != -999 ) {
|
57 |
chisoPF04 = rhs.chisoPF04;
|
58 |
}
|
59 |
if( rhs.gaisoPF04 != -999 ) {
|
60 |
gaisoPF04 = rhs.gaisoPF04;
|
61 |
}
|
62 |
if( rhs.neisoPF04 != -999 ) {
|
63 |
neisoPF04 = rhs.neisoPF04;
|
64 |
}
|
65 |
|
66 |
};
|
67 |
SelectionStatus& operator &=(const SelectionStatus &rhs ) {
|
68 |
status &= rhs.status;
|
69 |
};
|
70 |
|
71 |
protected:
|
72 |
unsigned status;
|
73 |
};
|
74 |
|
75 |
#endif
|