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.3 by konec, Mon Oct 29 12:41:10 2012 UTC vs.
Revision 1.6 by konec, Tue Nov 27 16:16:48 2012 UTC

# Line 4 | Line 4
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   {
# Line 13 | Line 89 | std::vector<L1Obj> L1ObjColl::typeSelect
89    }
90    return result;
91   }
16
92   std::vector<L1Obj> L1ObjColl::getL1ObjsMatched(double ptMin) const
93   {
94    std::vector<L1Obj> result;
# Line 56 | Line 131 | std::vector<L1Obj> L1ObjColl::getL1ObjsS
131    return result;
132   }
133  
134 < void L1ObjColl::print() const
135 < {
136 <  for (unsigned int i=0; i<theL1Obj.size(); ++i) {
137 <    std::cout <<"("<<i<<")";theL1Obj[i].print();
138 <    if (theL1Matching.size()>i) std::cout<<" matched: "<<theL1Matching[i];
139 <    std::cout <<std::endl;
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