1 |
|
#include "UserCode/L1RpcTriggerAnalysis/interface/L1ObjColl.h" |
2 |
+ |
#include <iostream> |
3 |
|
|
4 |
|
ClassImp(L1Obj) |
5 |
|
ClassImp(L1ObjColl) |
6 |
|
|
7 |
+ |
std::vector<L1Obj> L1ObjColl::typeSelector(const std::vector<L1Obj> & col, |
8 |
+ |
TYPE t1, TYPE t2, TYPE t3, TYPE t4) |
9 |
+ |
{ |
10 |
+ |
std::vector<L1Obj> result; |
11 |
+ |
for (std::vector<L1Obj>::const_iterator it= col.begin(); it != col.end(); ++it) { |
12 |
+ |
if ( it->type == t1 || it->type == t2 || it->type == t3 ||it->type == t4 ) result.push_back(*it); |
13 |
+ |
} |
14 |
+ |
return result; |
15 |
+ |
} |
16 |
+ |
|
17 |
|
std::vector<L1Obj> L1ObjColl::getL1ObjsMatched(double ptMin) const |
18 |
|
{ |
19 |
|
std::vector<L1Obj> result; |
25 |
|
|
26 |
|
return result; |
27 |
|
} |
28 |
+ |
|
29 |
+ |
std::vector<L1Obj> L1ObjColl::getL1ObjsSelected( |
30 |
+ |
bool requireMatched, |
31 |
+ |
bool requireNonMatched, |
32 |
+ |
double ptMin, double ptMax, |
33 |
+ |
int bxMin, int bxMax, |
34 |
+ |
double etaMin, double etaMax, |
35 |
+ |
double phiMin, double phiMax, |
36 |
+ |
int qMin, int qMax) const |
37 |
+ |
{ |
38 |
+ |
std::vector<L1Obj> result; |
39 |
+ |
unsigned int nMS = theL1Matching.size(); |
40 |
+ |
for (unsigned int i=0; i<theL1Obj.size(); ++i) { |
41 |
+ |
bool isMatched = ( (i<nMS) && theL1Matching[i] ); |
42 |
+ |
if (requireMatched && !isMatched ) continue; |
43 |
+ |
if (requireNonMatched && isMatched) continue; |
44 |
+ |
if (theL1Obj[i].pt < ptMin) continue; |
45 |
+ |
if (theL1Obj[i].pt > ptMax) continue; |
46 |
+ |
if (theL1Obj[i].bx < bxMin) continue; |
47 |
+ |
if (theL1Obj[i].bx > bxMax) continue; |
48 |
+ |
if (theL1Obj[i].eta < etaMin) continue; |
49 |
+ |
if (theL1Obj[i].eta > etaMax) continue; |
50 |
+ |
if (theL1Obj[i].phi < phiMin) continue; |
51 |
+ |
if (theL1Obj[i].phi > phiMax) continue; |
52 |
+ |
if (theL1Obj[i].q < qMin) continue; |
53 |
+ |
if (theL1Obj[i].q > qMax) continue; |
54 |
+ |
result.push_back(theL1Obj[i]); |
55 |
+ |
} |
56 |
+ |
return result; |
57 |
+ |
} |
58 |
+ |
|
59 |
+ |
void L1ObjColl::print() const |
60 |
+ |
{ |
61 |
+ |
for (unsigned int i=0; i<theL1Obj.size(); ++i) { |
62 |
+ |
std::cout <<"("<<i<<")";theL1Obj[i].print(); |
63 |
+ |
if (theL1Matching.size()>i) std::cout<<" matched: "<<theL1Matching[i]; |
64 |
+ |
std::cout <<std::endl; |
65 |
+ |
} |
66 |
+ |
} |