ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/interface/L1ObjColl.h
Revision: 1.10
Committed: Thu May 23 18:24:03 2013 UTC (11 years, 11 months ago) by konec
Content type: text/plain
Branch: MAIN
CVS Tags: Artur_11_07_2013_B, Artur_11_07_2013_A, Artur_11_07_2013, Artur_28_06_2013, HEAD
Changes since 1.9: +3 -1 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 konec 1.1 #ifndef L1ObjColl_H
2     #define L1ObjColl_H
3    
4     #include "UserCode/L1RpcTriggerAnalysis/interface/L1Obj.h"
5 konec 1.9 #include "DataFormats/Math/interface/deltaR.h"
6 konec 1.1 #include <vector>
7 konec 1.8 #include <cmath>
8 konec 1.1
9     class L1ObjColl : public TObject {
10    
11     public:
12     L1ObjColl() {}
13     virtual ~L1ObjColl(){}
14    
15 konec 1.3 typedef L1Obj::TYPE TYPE;
16 konec 1.1 void set(const std::vector<L1Obj> & obj) { theL1Obj = obj; }
17     void set(const std::vector<bool> & comp) { theL1Matching = comp; }
18 konec 1.4 void set(const std::vector<double> & dr) { theDeltaR = dr; }
19 konec 1.6 void push_back(const L1Obj & obj, bool match, double deltaR);
20 konec 1.5
21 konec 1.1 const std::vector<L1Obj> & getL1Objs() const { return theL1Obj; }
22 konec 1.10 operator const std::vector<L1Obj> & () const { return theL1Obj; }
23    
24 konec 1.1 const std::vector<bool> & getL1ObjsMatching() const { return theL1Matching; }
25 konec 1.5 const std::vector<double> & getL1ObjDeltaR() const { return theDeltaR; }
26 konec 1.6
27     L1ObjColl l1RpcColl() const {
28     return selectByType(L1Obj::RPCb)+selectByType(L1Obj::RPCf);
29     }
30     L1ObjColl l1RpcCollEmu() const {
31     return selectByType(L1Obj::RPCb_emu)+selectByType(L1Obj::RPCf_emu);
32     }
33     L1ObjColl l1OthColl() const {
34     return selectByType(L1Obj::DT)+selectByType(L1Obj::CSC);
35     }
36    
37     L1ObjColl selectByType( TYPE t1) const;
38 konec 1.7 L1ObjColl selectByPt( double ptMin = 0., double ptMax = 161.) const;
39 konec 1.6 L1ObjColl selectByPtMin( double ptMin = 0.) const;
40     L1ObjColl selectByEta( double etaMin = -1.61, double etaMax = 1.61) const;
41     L1ObjColl selectByBx( int bxMin = 0, int bxMax = 0) const;
42     L1ObjColl selectByQuality( int qMin = 0, int qMax = 7) const;
43     L1ObjColl selectByMatched() const;
44     L1ObjColl selectByDeltaR( double deltaRMax) const;
45     L1ObjColl operator+(const L1ObjColl &o) const;
46 konec 1.8 operator bool() const {return !theL1Obj.empty(); }
47     bool operator!() const {return theL1Obj.empty(); }
48    
49 konec 1.9 inline bool isMatching_DRBx_At(double deltaR, int bx, double ptMin, double eta, double phi) const {
50     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;
51 konec 1.8 return false;
52     }
53 konec 1.9 inline bool isMatching_DRBx(double deltaR, int bx, double ptMin = 0.) const {
54     for (unsigned int i=0; i< theL1Obj.size(); i++) if ( (bx == theL1Obj[i].bx) && ( theDeltaR[i] < deltaR) && (theL1Obj[i].pt >= ptMin) ) return true;
55 konec 1.8 return false;
56     }
57 konec 1.5
58 konec 1.9 inline bool isMatching_PtminPtmaxBx(double ptMin, double ptMax, int bx, bool firstBXonly) const {
59     bool firstBX = true;
60     bool result = false;
61     for (unsigned int i=0; i< theL1Obj.size(); i++) {
62     if (theL1Obj[i].bx < bx && theL1Obj[i].pt >= ptMin) firstBX = false;
63     if ( (theL1Obj[i].pt >= ptMin && theL1Obj[i].pt < ptMax) && (bx == theL1Obj[i].bx) ) result = true;
64     }
65     return firstBXonly ? (result && firstBX) : result;
66     }
67    
68     /*
69     inline bool isMatching_PtminPtmaxBx(double ptMin, double ptMax, int bx, bool firstBXonly) const {
70     bool firstBX = true;
71     bool result = false;
72     for (unsigned int i=0; i< theL1Obj.size(); i++) {
73     if (theL1Obj[i].bx < bx) firstBX = false;
74     if ( (theL1Obj[i].pt >= ptMin && theL1Obj[i].pt < ptMax) && (bx == theL1Obj[i].bx) ) result = true;
75     }
76     return firstBXonly ? (result && firstBX) : result;
77     }
78     */
79    
80 konec 1.6 friend ostream & operator<< (ostream &out, const L1ObjColl&s);
81 konec 1.1
82 konec 1.5 //tmp
83 konec 1.1 std::vector<L1Obj> getL1ObjsMatched(double ptMin = 0) const;
84 konec 1.2 std::vector<L1Obj> getL1ObjsSelected(
85     bool requireMatched = true, bool requireNonMatched = false,
86     double ptMin = 0., double ptMax = 161.,
87     int bxMin = 0, int bxMax = 0,
88     double etaMin = -2.5, double etaMax = 2.5,
89     double phiMin = 0., double phiMax = 7.,
90 konec 1.10 int qMin = 0, int qMax = 99) const;
91 konec 1.3 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);
92 konec 1.1
93     private:
94     std::vector<L1Obj> theL1Obj;
95     std::vector<bool> theL1Matching;
96 konec 1.4 std::vector<double> theDeltaR;
97 konec 1.1
98     public:
99     ClassDef(L1ObjColl,1)
100    
101     };
102    
103     #endif