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.3 by amagnan, Fri Mar 26 15:26:10 2010 UTC vs.
Revision 1.6 by amagnan, Fri Jun 24 14:49:11 2011 UTC

# Line 6 | Line 6 | namespace HbbAnalysis {
6    {
7      
8      double dPhi = phi1 - phi2;
9    if (dPhi<0) dPhi += 2*TMath::Pi();
10
11    return dPhi;
12  }
13
14  double DeltaR(const BaseVars & v1, const BaseVars & v2)
15  {
9      
10 <    double dEta = v1.eta - v2.eta;
18 <    double dPhi = v1.phi - v2.phi;
19 <    if (dPhi<0) dPhi += 2*TMath::Pi();
20 <
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);
10 >    return dPhi;
11    }
12  
13    double SameSign(const BaseVars & v1, const BaseVars & v2)
# Line 68 | Line 47 | namespace HbbAnalysis {
47      double et = leg1.pT + leg2.pT + TMath::Sqrt(mEx*mEx + mEy*mEy);
48      double mt2 = et*et - (px*px + py*py);
49      if ( mt2 < 0 ) {
50 <      std::cout << " --- WARNING : mt2 = " << mt2 << " is negative... Set to 0.";
50 >      //std::cout << " --- WARNING : mt2 = " << mt2 << " is negative... Set to 0.";
51        return 0.;
52      }
53      return sqrt(mt2);
# Line 83 | Line 62 | namespace HbbAnalysis {
62      double et = leg1.pT + TMath::Sqrt(mEx*mEx + mEy*mEy);
63      double mt = et*et - (px*px + py*py);
64      if ( mt < 0 ) {
65 <      std::cout << " --- WARNING : mt = " << mt << " is negative... Set to 0.";
65 >      //std::cout << " --- WARNING : mt = " << mt << " is negative... Set to 0.";
66        return 0.;
67      }
68      return sqrt(mt);
# Line 128 | Line 107 | namespace HbbAnalysis {
107      }
108    }
109  
110 +
111 +  double EtaDetector(const BaseVars & v1){
112 +    double pDet[3];
113 +    pDet[0] = v1.pT*cos(v1.phi) + v1.vx;
114 +    pDet[1] = v1.pT*sin(v1.phi) + v1.vy;
115 +
116 +    double theta = 2*atan(exp(-v1.eta));
117 +    if (pDet[1]<0) theta = TMath::Pi()+theta;
118 +
119 +    if (tan(theta)!=0) pDet[2] = v1.pT/tan(theta) + v1.vz;
120 +    else return -10;
121 +
122 +    double pTDet = sqrt(pDet[0]*pDet[0] + pDet[1]*pDet[1]);
123 +    double pDetNorm = sqrt(pDet[0]*pDet[0] + pDet[1]*pDet[1] + pDet[2]*pDet[2]);
124 +    double thetaDet = 0;
125 +    double cosThetaDet = 0;
126 +    if (pDetNorm!=0) cosThetaDet = pDet[2]/pDetNorm;
127 +    else return -10;
128 +    if (pDet[2]!=0) thetaDet = atan(pTDet/pDet[2]);
129 +    else return -10;
130 +    if (cosThetaDet<0) thetaDet += TMath::Pi();
131 +    
132 +    return -log(tan(thetaDet/2.));
133 +  }
134 +
135 +  double EtaDetector(const GenVars & v1){
136 +    double pDet[3];
137 +    pDet[0] = v1.pT*cos(v1.phi) + v1.vx;
138 +    pDet[1] = v1.pT*sin(v1.phi) + v1.vy;
139 +
140 +    double theta = 2*atan(exp(-v1.eta));
141 +    if (pDet[1]<0) theta = TMath::Pi()+theta;
142 +
143 +    if (tan(theta)!=0) pDet[2] = v1.pT/tan(theta) + v1.vz;
144 +    else return -10;
145 +
146 +    double pTDet = sqrt(pDet[0]*pDet[0] + pDet[1]*pDet[1]);
147 +    double pDetNorm = sqrt(pDet[0]*pDet[0] + pDet[1]*pDet[1] + pDet[2]*pDet[2]);
148 +    double thetaDet = 0;
149 +    double cosThetaDet = 0;
150 +    if (pDetNorm!=0) cosThetaDet = pDet[2]/pDetNorm;
151 +    else return -10;
152 +    if (pDet[2]!=0) thetaDet = atan(pTDet/pDet[2]);
153 +    else return -10;
154 +    if (cosThetaDet<0) thetaDet += TMath::Pi();
155 +    
156 +    return -log(tan(thetaDet/2.));
157 +  }
158 +
159 +
160 +
161   }//namespace
162  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines