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

Comparing UserCode/HbbAnalysis/src/Objects.cc (file contents):
Revision 1.1 by amagnan, Fri Oct 2 11:06:56 2009 UTC vs.
Revision 1.5 by amagnan, Wed Sep 22 12:21:44 2010 UTC

# Line 21 | Line 21 | namespace HbbAnalysis {
21      return sqrt(dEta*dEta+dPhi*dPhi);
22    }
23  
24 +  double DeltaR(const BaseVars & v1, const GenVars & v2)
25 +  {
26 +    
27 +    double dEta = v1.eta - v2.eta;
28 +    double dPhi = v1.phi - v2.phi;
29 +    if (dPhi<0) dPhi += 2*TMath::Pi();
30 +
31 +    return sqrt(dEta*dEta+dPhi*dPhi);
32 +  }
33 +
34    double SameSign(const BaseVars & v1, const BaseVars & v2)
35    {
36      
# Line 58 | Line 68 | namespace HbbAnalysis {
68      double et = leg1.pT + leg2.pT + TMath::Sqrt(mEx*mEx + mEy*mEy);
69      double mt2 = et*et - (px*px + py*py);
70      if ( mt2 < 0 ) {
71 <      std::cout << " --- WARNING : mt2 = " << mt2 << " is negative... Set to 0.";
71 >      //std::cout << " --- WARNING : mt2 = " << mt2 << " is negative... Set to 0.";
72        return 0.;
73      }
74      return sqrt(mt2);
# Line 73 | Line 83 | namespace HbbAnalysis {
83      double et = leg1.pT + TMath::Sqrt(mEx*mEx + mEy*mEy);
84      double mt = et*et - (px*px + py*py);
85      if ( mt < 0 ) {
86 <      std::cout << " --- WARNING : mt = " << mt << " is negative... Set to 0.";
86 >      //std::cout << " --- WARNING : mt = " << mt << " is negative... Set to 0.";
87        return 0.;
88      }
89      return sqrt(mt);
# Line 101 | Line 111 | namespace HbbAnalysis {
111      double py1 = leg1.pT*sin(leg1.phi);
112      double py2 = leg2.pT*sin(leg2.phi);
113  
104
114      double x1_numerator = px1*py2 - px2*py1;
115      double x1_denominator = py2*(px1 + mEx) - px2*(py1 + mEy);
116      double x1 = ( x1_denominator != 0. ) ? x1_numerator/x1_denominator : -1.;
# Line 119 | Line 128 | namespace HbbAnalysis {
128      }
129    }
130  
131 +
132 +  double EtaDetector(const BaseVars & v1){
133 +    double pDet[3];
134 +    pDet[0] = v1.pT*cos(v1.phi) + v1.vx;
135 +    pDet[1] = v1.pT*sin(v1.phi) + v1.vy;
136 +
137 +    double theta = 2*atan(exp(-v1.eta));
138 +    if (pDet[1]<0) theta = TMath::Pi()+theta;
139 +
140 +    if (tan(theta)!=0) pDet[2] = v1.pT/tan(theta) + v1.vz;
141 +    else return -10;
142 +
143 +    double pTDet = sqrt(pDet[0]*pDet[0] + pDet[1]*pDet[1]);
144 +    double pDetNorm = sqrt(pDet[0]*pDet[0] + pDet[1]*pDet[1] + pDet[2]*pDet[2]);
145 +    double thetaDet = 0;
146 +    double cosThetaDet = 0;
147 +    if (pDetNorm!=0) cosThetaDet = pDet[2]/pDetNorm;
148 +    else return -10;
149 +    if (pDet[2]!=0) thetaDet = atan(pTDet/pDet[2]);
150 +    else return -10;
151 +    if (cosThetaDet<0) thetaDet += TMath::Pi();
152 +    
153 +    return -log(tan(thetaDet/2.));
154 +  }
155 +
156 +  double EtaDetector(const GenVars & v1){
157 +    double pDet[3];
158 +    pDet[0] = v1.pT*cos(v1.phi) + v1.vx;
159 +    pDet[1] = v1.pT*sin(v1.phi) + v1.vy;
160 +
161 +    double theta = 2*atan(exp(-v1.eta));
162 +    if (pDet[1]<0) theta = TMath::Pi()+theta;
163 +
164 +    if (tan(theta)!=0) pDet[2] = v1.pT/tan(theta) + v1.vz;
165 +    else return -10;
166 +
167 +    double pTDet = sqrt(pDet[0]*pDet[0] + pDet[1]*pDet[1]);
168 +    double pDetNorm = sqrt(pDet[0]*pDet[0] + pDet[1]*pDet[1] + pDet[2]*pDet[2]);
169 +    double thetaDet = 0;
170 +    double cosThetaDet = 0;
171 +    if (pDetNorm!=0) cosThetaDet = pDet[2]/pDetNorm;
172 +    else return -10;
173 +    if (pDet[2]!=0) thetaDet = atan(pTDet/pDet[2]);
174 +    else return -10;
175 +    if (cosThetaDet<0) thetaDet += TMath::Pi();
176 +    
177 +    return -log(tan(thetaDet/2.));
178 +  }
179 +
180 +
181 +
182   }//namespace
183  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines