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.4 by konec, Tue Oct 30 11:13:16 2012 UTC vs.
Revision 1.5 by konec, Tue Nov 6 12:56:51 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::selectByPtMin( double ptMin) 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) ) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
20 +  return result;
21 + }
22 +
23 + L1ObjColl L1ObjColl::selectByEta( double etaMin, double etaMax) const
24 + {
25 +  L1ObjColl result;
26 +  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]);
27 +  return result;
28 + }
29 +
30 + L1ObjColl L1ObjColl::selectByBx( int bxMin, int bxMax) const
31 + {
32 +  L1ObjColl result;
33 +  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]);
34 +  return result;
35 + }
36 +
37 + L1ObjColl L1ObjColl::selectByQuality( int qMin, int qMax) const
38 + {
39 +  L1ObjColl result;
40 +  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]);
41 +  return result;
42 + }
43 +
44 + L1ObjColl L1ObjColl::selectByMatched() const
45 + {
46 +  L1ObjColl result;
47 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if (theL1Matching[i]) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
48 +  return result;
49 + }
50 +
51 + L1ObjColl L1ObjColl::selectByDeltaR( double deltaRMax) const
52 + {
53 +  L1ObjColl result;
54 +  for (unsigned int i=0; i<theL1Obj.size(); i++) if ( theDeltaR[i] <= deltaRMax) result.push_back( theL1Obj[i], theL1Matching[i], theDeltaR[i]);
55 +  return result;
56 + }
57 +
58 + L1ObjColl L1ObjColl::operator+(const L1ObjColl &o) const
59 + {
60 +  L1ObjColl result = *this;
61 +  for (unsigned int i=0; i<o.theL1Obj.size(); i++) result.push_back( o.theL1Obj[i], o.theL1Matching[i], o.theDeltaR[i]);
62 +  return result;
63 + }
64 +
65 + void L1ObjColl::push_back(const L1Obj & obj, bool match, double deltaR)
66 + {
67 +  theL1Obj.push_back(obj);
68 +  theL1Matching.push_back(match);
69 +  theDeltaR.push_back(deltaR);
70 + }
71 +
72 +
73 +
74 +
75 +
76   std::vector<L1Obj> L1ObjColl::typeSelector(const  std::vector<L1Obj> & col,  
77   TYPE t1, TYPE t2, TYPE t3, TYPE t4)
78   {
# Line 56 | Line 125 | std::vector<L1Obj> L1ObjColl::getL1ObjsS
125    return result;
126   }
127  
128 < void L1ObjColl::print() const
129 < {
130 <  for (unsigned int i=0; i<theL1Obj.size(); ++i) {
131 <    std::cout <<"("<<i<<")";theL1Obj[i].print();
132 <    if (theL1Matching.size()>i) std::cout<<" matched: "<<theL1Matching[i]<<" deltaR: "<<theDeltaR[i];
133 <    std::cout <<std::endl;
128 >
129 > ostream & operator<< (ostream &out, const L1ObjColl &col)
130 > {
131 >  for (unsigned int i=0; i< col.theL1Obj.size(); ++i) {
132 >    out <<"("<<i<<")"<<col.theL1Obj[i];
133 >    out <<" matched: "<< col.theL1Matching[i]<<" deltaR: "<< col.theDeltaR[i];
134 >    if (i !=  col.theL1Obj.size()-1) out <<std::endl;
135    }
136 +   return out;
137 + }
138 +
139 + ostream & operator<< (ostream &out, const L1Obj &o)
140 + {
141 +  out<<"L1Obj: ";
142 +  switch (o.type) {
143 +    case L1Obj::RPCb:     { out <<"RPCb    "; break; }
144 +    case L1Obj::RPCf:     { out <<"RPCf    "; break; }
145 +    case L1Obj::DT:       { out <<"DT      "; break; }
146 +    case L1Obj::CSC:      { out <<"CSC     "; break; }
147 +    case L1Obj::GMT:      { out <<"GMT     "; break; }
148 +    case L1Obj::RPCb_emu: { out <<"RPCb_emu"; break; }
149 +    case L1Obj::RPCf_emu: { out <<"RPCf_emu"; break; }
150 +    case L1Obj::GMT_emu:  { out <<"GMT_emu "; break; }
151 +    case L1Obj::NONE   :  { out <<"NONE    "; break; }
152 +    default: out <<"Unknown";
153 +  };
154 +  out <<" pt: "<<o.pt<<", eta: "<<o.eta<<", phi: "<<o.phi<<", q: "<<o.q<<", bx: "<<o.bx;
155 +  return out;
156   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines