ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/L1ObjColl.cc
Revision: 1.3
Committed: Mon Oct 29 12:41:10 2012 UTC (12 years, 6 months ago) by konec
Content type: text/plain
Branch: MAIN
Changes since 1.2: +9 -0 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 konec 1.1 #include "UserCode/L1RpcTriggerAnalysis/interface/L1ObjColl.h"
2 konec 1.2 #include <iostream>
3 konec 1.1
4     ClassImp(L1Obj)
5     ClassImp(L1ObjColl)
6    
7 konec 1.3 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 konec 1.2
17 konec 1.1 std::vector<L1Obj> L1ObjColl::getL1ObjsMatched(double ptMin) const
18     {
19     std::vector<L1Obj> result;
20     unsigned int nObj = theL1Obj.size();
21     unsigned int nCom = theL1Matching.size();
22    
23     for (unsigned int i=0; i<nObj && i<nCom; ++i)
24     if (theL1Matching[i] && theL1Obj[i].pt >= ptMin) result.push_back(theL1Obj[i]);
25    
26     return result;
27     }
28 konec 1.2
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     }