2 |
|
#define L1ObjColl_H |
3 |
|
|
4 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/L1Obj.h" |
5 |
+ |
#include "DataFormats/Math/interface/deltaR.h" |
6 |
|
#include <vector> |
7 |
+ |
#include <cmath> |
8 |
|
|
9 |
|
class L1ObjColl : public TObject { |
10 |
|
|
16 |
|
void set(const std::vector<L1Obj> & obj) { theL1Obj = obj; } |
17 |
|
void set(const std::vector<bool> & comp) { theL1Matching = comp; } |
18 |
|
void set(const std::vector<double> & dr) { theDeltaR = dr; } |
19 |
+ |
void push_back(const L1Obj & obj, bool match, double deltaR); |
20 |
|
|
21 |
|
const std::vector<L1Obj> & getL1Objs() const { return theL1Obj; } |
22 |
|
const std::vector<bool> & getL1ObjsMatching() const { return theL1Matching; } |
23 |
|
const std::vector<double> & getL1ObjDeltaR() const { return theDeltaR; } |
24 |
+ |
|
25 |
+ |
L1ObjColl l1RpcColl() const { |
26 |
+ |
return selectByType(L1Obj::RPCb)+selectByType(L1Obj::RPCf); |
27 |
+ |
} |
28 |
+ |
L1ObjColl l1RpcCollEmu() const { |
29 |
+ |
return selectByType(L1Obj::RPCb_emu)+selectByType(L1Obj::RPCf_emu); |
30 |
+ |
} |
31 |
+ |
L1ObjColl l1OthColl() const { |
32 |
+ |
return selectByType(L1Obj::DT)+selectByType(L1Obj::CSC); |
33 |
+ |
} |
34 |
+ |
|
35 |
+ |
L1ObjColl selectByType( TYPE t1) const; |
36 |
+ |
L1ObjColl selectByPt( double ptMin = 0., double ptMax = 161.) const; |
37 |
+ |
L1ObjColl selectByPtMin( double ptMin = 0.) const; |
38 |
+ |
L1ObjColl selectByEta( double etaMin = -1.61, double etaMax = 1.61) const; |
39 |
+ |
L1ObjColl selectByBx( int bxMin = 0, int bxMax = 0) const; |
40 |
+ |
L1ObjColl selectByQuality( int qMin = 0, int qMax = 7) const; |
41 |
+ |
L1ObjColl selectByMatched() const; |
42 |
+ |
L1ObjColl selectByDeltaR( double deltaRMax) const; |
43 |
+ |
L1ObjColl operator+(const L1ObjColl &o) const; |
44 |
+ |
operator bool() const {return !theL1Obj.empty(); } |
45 |
+ |
bool operator!() const {return theL1Obj.empty(); } |
46 |
+ |
|
47 |
+ |
inline bool isMatching_DRBx_At(double deltaR, int bx, double ptMin, double eta, double phi) const { |
48 |
+ |
for (unsigned int i=0; i< theL1Obj.size(); i++) if ( (bx == theL1Obj[i].bx) && ( reco::deltaR(theL1Obj[i].eta, theL1Obj[i].phi, eta, phi) < deltaR) && (theL1Obj[i].pt >= ptMin) ) return true; |
49 |
+ |
return false; |
50 |
+ |
} |
51 |
+ |
inline bool isMatching_DRBx(double deltaR, int bx, double ptMin = 0.) const { |
52 |
+ |
for (unsigned int i=0; i< theL1Obj.size(); i++) if ( (bx == theL1Obj[i].bx) && ( theDeltaR[i] < deltaR) && (theL1Obj[i].pt >= ptMin) ) return true; |
53 |
+ |
return false; |
54 |
+ |
} |
55 |
+ |
|
56 |
+ |
inline bool isMatching_PtminPtmaxBx(double ptMin, double ptMax, int bx, bool firstBXonly) const { |
57 |
+ |
bool firstBX = true; |
58 |
+ |
bool result = false; |
59 |
+ |
for (unsigned int i=0; i< theL1Obj.size(); i++) { |
60 |
+ |
if (theL1Obj[i].bx < bx && theL1Obj[i].pt >= ptMin) firstBX = false; |
61 |
+ |
if ( (theL1Obj[i].pt >= ptMin && theL1Obj[i].pt < ptMax) && (bx == theL1Obj[i].bx) ) result = true; |
62 |
+ |
} |
63 |
+ |
return firstBXonly ? (result && firstBX) : result; |
64 |
+ |
} |
65 |
|
|
66 |
|
/* |
67 |
< |
L1ObjColl selectByType( TYPE t1=L1Obj::NONE, TYPE t2=L1Obj::NONE, TYPE t3=L1Obj::NONE, TYPE t4=L1Obj::NONE); |
68 |
< |
L1ObjColl selectByPtMin( double ptMin = 0.); |
69 |
< |
L1ObjColl selectByEta( double etaMin = -2.5, double etaMax = 2.5); |
70 |
< |
L1ObjColl selectByBx( int bxMin = 0, int bxMax = 0); |
71 |
< |
L1ObjColl selectByQuality( int qMin = 0, int qMax = 7); |
72 |
< |
L1ObjColl operator+(const L1ObjColl& , const L1ObjColl&) const; |
67 |
> |
inline bool isMatching_PtminPtmaxBx(double ptMin, double ptMax, int bx, bool firstBXonly) const { |
68 |
> |
bool firstBX = true; |
69 |
> |
bool result = false; |
70 |
> |
for (unsigned int i=0; i< theL1Obj.size(); i++) { |
71 |
> |
if (theL1Obj[i].bx < bx) firstBX = false; |
72 |
> |
if ( (theL1Obj[i].pt >= ptMin && theL1Obj[i].pt < ptMax) && (bx == theL1Obj[i].bx) ) result = true; |
73 |
> |
} |
74 |
> |
return firstBXonly ? (result && firstBX) : result; |
75 |
> |
} |
76 |
|
*/ |
77 |
|
|
78 |
< |
void print() const; |
78 |
> |
friend ostream & operator<< (ostream &out, const L1ObjColl&s); |
79 |
|
|
80 |
|
//tmp |
81 |
|
std::vector<L1Obj> getL1ObjsMatched(double ptMin = 0) const; |
87 |
|
double phiMin = 0., double phiMax = 7., |
88 |
|
int qMin = 0, int qMax = 7) const; |
89 |
|
static std::vector<L1Obj> typeSelector(const std::vector<L1Obj> & col, TYPE t1=L1Obj::NONE, TYPE t2=L1Obj::NONE, TYPE t3=L1Obj::NONE, TYPE t4=L1Obj::NONE); |
43 |
– |
|
90 |
|
|
91 |
|
private: |
92 |
|
std::vector<L1Obj> theL1Obj; |