ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/src/L1ObjColl.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/src/L1ObjColl.cc (file contents):
Revision 1.1 by konec, Sun Jun 13 17:27:02 2010 UTC vs.
Revision 1.6 by konec, Tue Nov 27 16:16:48 2012 UTC

# Line 1 | Line 1
1   #include "UserCode/L1RpcTriggerAnalysis/interface/L1ObjColl.h"
2 + #include <iostream>
3  
4   ClassImp(L1Obj)
5   ClassImp(L1ObjColl)
6  
7 +
8 + L1ObjColl L1ObjColl::selectByType( TYPE t) const
9 + {
10 +  L1ObjColl result;
11 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if (theL1Obj[i].type == t) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
12 +  return result;
13 + }
14 +
15 + L1ObjColl L1ObjColl::selectByPt( double ptMin, double ptMax) const
16 + {
17 +  L1ObjColl result;
18 +  const double epsilon = 1.e-9;
19 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if ( theL1Obj[i].pt > (ptMin-epsilon) && theL1Obj[i].pt < (ptMax+epsilon) ) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
20 +  return result;
21 + }
22 + L1ObjColl L1ObjColl::selectByPtMin( double ptMin) const
23 + {
24 +  L1ObjColl result;
25 +  const double epsilon = 1.e-9;
26 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if ( theL1Obj[i].pt > (ptMin-epsilon) ) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
27 +  return result;
28 + }
29 +
30 + L1ObjColl L1ObjColl::selectByEta( double etaMin, double etaMax) const
31 + {
32 +  L1ObjColl result;
33 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if ( etaMin < theL1Obj[i].eta && theL1Obj[i].eta <= etaMax)  result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
34 +  return result;
35 + }
36 +
37 + L1ObjColl L1ObjColl::selectByBx( int bxMin, int bxMax) const
38 + {
39 +  L1ObjColl result;
40 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if ( bxMin <=  theL1Obj[i].bx &&  theL1Obj[i].bx <= bxMax) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
41 +  return result;
42 + }
43 +
44 + L1ObjColl L1ObjColl::selectByQuality( int qMin, int qMax) const
45 + {
46 +  L1ObjColl result;
47 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if ( qMin <=  theL1Obj[i].q &&  theL1Obj[i].q <= qMax) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
48 +  return result;
49 + }
50 +
51 + L1ObjColl L1ObjColl::selectByMatched() const
52 + {
53 +  L1ObjColl result;
54 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if (theL1Matching[i]) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
55 +  return result;
56 + }
57 +
58 + L1ObjColl L1ObjColl::selectByDeltaR( double deltaRMax) const
59 + {
60 +  L1ObjColl result;
61 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if ( theDeltaR[i] <= deltaRMax) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
62 +  return result;
63 + }
64 +
65 + L1ObjColl L1ObjColl::operator+(const L1ObjColl &o) const
66 + {
67 +  L1ObjColl result = *this;
68 +  for (unsigned int i=0; i<o.theL1Obj.size(); i++) result.push_back( o.theL1Obj[i], o.theL1Matching[i], o.theDeltaR[i]);
69 +  return result;
70 + }
71 +
72 + void L1ObjColl::push_back(const L1Obj & obj, bool match, double deltaR)
73 + {
74 +  theL1Obj.push_back(obj);
75 +  theL1Matching.push_back(match);
76 +  theDeltaR.push_back(deltaR);
77 + }
78 +
79 +
80 +
81 +
82 +
83 + std::vector<L1Obj> L1ObjColl::typeSelector(const  std::vector<L1Obj> & col,  
84 + TYPE t1, TYPE t2, TYPE t3, TYPE t4)
85 + {
86 +  std::vector<L1Obj> result;
87 +  for (std::vector<L1Obj>::const_iterator it= col.begin(); it != col.end(); ++it) {
88 +    if ( it->type == t1 || it->type == t2 || it->type == t3 ||it->type == t4 ) result.push_back(*it);
89 +  }
90 +  return result;
91 + }
92   std::vector<L1Obj> L1ObjColl::getL1ObjsMatched(double ptMin) const
93   {
94    std::vector<L1Obj> result;
# Line 14 | Line 100 | std::vector<L1Obj> L1ObjColl::getL1ObjsM
100  
101    return result;
102   }
103 +
104 + std::vector<L1Obj> L1ObjColl::getL1ObjsSelected(
105 +    bool requireMatched,
106 +    bool requireNonMatched,
107 +    double ptMin, double ptMax,
108 +    int bxMin, int bxMax,
109 +    double etaMin, double etaMax,
110 +    double phiMin, double phiMax,
111 +    int qMin, int qMax) const
112 + {
113 +  std::vector<L1Obj> result;
114 +  unsigned int nMS = theL1Matching.size();
115 +  for (unsigned int i=0; i<theL1Obj.size(); ++i) {
116 +          bool isMatched = ( (i<nMS) && theL1Matching[i] );
117 +          if (requireMatched && !isMatched ) continue;
118 +          if (requireNonMatched && isMatched) continue;
119 +          if (theL1Obj[i].pt < ptMin) continue;
120 +          if (theL1Obj[i].pt > ptMax) continue;
121 +          if (theL1Obj[i].bx < bxMin) continue;
122 +          if (theL1Obj[i].bx > bxMax) continue;
123 +          if (theL1Obj[i].eta < etaMin) continue;
124 +          if (theL1Obj[i].eta > etaMax) continue;
125 +          if (theL1Obj[i].phi < phiMin) continue;
126 +          if (theL1Obj[i].phi > phiMax) continue;
127 +          if (theL1Obj[i].q < qMin) continue;
128 +          if (theL1Obj[i].q > qMax) continue;
129 +          result.push_back(theL1Obj[i]);
130 +  }
131 +  return result;
132 + }
133 +
134 +
135 + ostream & operator<< (ostream &out, const L1ObjColl &col)
136 + {
137 +  for (unsigned int i=0; i< col.theL1Obj.size(); ++i) {
138 +    out <<"("<<i<<")"<<col.theL1Obj[i];
139 +    out <<" matched: "<< col.theL1Matching[i]<<" deltaR: "<< col.theDeltaR[i];
140 +    if (i !=  col.theL1Obj.size()-1) out <<std::endl;
141 +  }
142 +   return out;
143 + }
144 +
145 + ostream & operator<< (ostream &out, const L1Obj &o)
146 + {
147 +  out<<"L1Obj: ";
148 +  switch (o.type) {
149 +    case L1Obj::RPCb:     { out <<"RPCb    "; break; }
150 +    case L1Obj::RPCf:     { out <<"RPCf    "; break; }
151 +    case L1Obj::DT:       { out <<"DT      "; break; }
152 +    case L1Obj::CSC:      { out <<"CSC     "; break; }
153 +    case L1Obj::GMT:      { out <<"GMT     "; break; }
154 +    case L1Obj::RPCb_emu: { out <<"RPCb_emu"; break; }
155 +    case L1Obj::RPCf_emu: { out <<"RPCf_emu"; break; }
156 +    case L1Obj::GMT_emu:  { out <<"GMT_emu "; break; }
157 +    case L1Obj::NONE   :  { out <<"NONE    "; break; }
158 +    default: out <<"Unknown";
159 +  };
160 +  out <<" pt: "<<o.pt<<", eta: "<<o.eta<<", phi: "<<o.phi<<", q: "<<o.q<<", bx: "<<o.bx;
161 +  return out;
162 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines