test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
ECALPositionCalculator Class Reference

#include <ECALPositionCalculator.h>

Public Member Functions

double ecalEta (const math::XYZVector &momentum, const math::XYZPoint &vertex)
 
double ecalPhi (const MagneticField *magField, const math::XYZVector &momentum, const math::XYZPoint &vertex, const int charge)
 
 ECALPositionCalculator ()
 

Detailed Description

Definition at line 9 of file ECALPositionCalculator.h.

Constructor & Destructor Documentation

ECALPositionCalculator::ECALPositionCalculator ( )
inline

Definition at line 12 of file ECALPositionCalculator.h.

12 { };

Member Function Documentation

double ECALPositionCalculator::ecalEta ( const math::XYZVector momentum,
const math::XYZPoint vertex 
)

Definition at line 69 of file ECALPositionCalculator.cc.

References ETA, etaBarrelEndcap, dqm-mbProfile::log, Geom::pi(), R_ECAL, funct::tan(), theta(), and Z_Endcap.

70 {
71 
72  // Get kinematic variables
73 
74  float etaParticle = momentum.eta();
75  float vZ = vertex.z();
76  float vRho = vertex.Rho();
77 
78  if (etaParticle != 0.0)
79  {
80  float theta = 0.0;
81  float zEcal = (R_ECAL-vRho)*sinh(etaParticle)+vZ;
82 
83  if(zEcal != 0.0) theta = atan(R_ECAL/zEcal);
84  if(theta < 0.0) theta = theta + Geom::pi() ;
85 
86  float ETA = - log(tan(0.5*theta));
87 
88  if( fabs(ETA) > etaBarrelEndcap )
89  {
90  float Zend = Z_Endcap ;
91  if(etaParticle < 0.0 ) Zend = - Zend;
92  float Zlen = Zend - vZ ;
93  float RR = Zlen/sinh(etaParticle);
94  theta = atan((RR+vRho)/Zend);
95  if(theta < 0.0) theta = theta+Geom::pi();
96  ETA = -log(tan(0.5*theta));
97  }
98  return ETA;
99 
100  } else {
101  edm::LogWarning("") << "[EcalPositionFromTrack::etaTransformation] Warning: "
102  << "Eta equals to zero, not correcting";
103  return etaParticle;
104  }
105 
106 }
Geom::Theta< T > theta() const
#define ETA
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
static const float etaBarrelEndcap
static const float Z_Endcap
static const float R_ECAL
constexpr double pi()
Definition: Pi.h:31
double ECALPositionCalculator::ecalPhi ( const MagneticField magField,
const math::XYZVector momentum,
const math::XYZPoint vertex,
const int  charge 
)

Definition at line 14 of file ECALPositionCalculator.cc.

References RecoTauCleanerPlugins::charge, etaBarrelEndcap, MagneticField::inTesla(), phi, Geom::pi(), Geom::twoPi(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by HLTEgamma::CalculateDetaDphi(), and EgammaHLTElectronDetaDphiProducer::calDEtaDPhiSCTrk().

15 {
16 
17  // Get kinematic variables
18 
19  float ptParticle = momentum.Rho();
20  float etaParticle = momentum.eta();
21  float phiParticle = momentum.phi();
22  float vRho = vertex.Rho();
23 
24  // Magnetic field
25 
26  const float RBARM = 1.357 ; // was 1.31 , updated on 16122003
27  const float ZENDM = 3.186 ; // was 3.15 , updated on 16122003
28 
29  float rbend = RBARM-(vRho/100.0); //Assumed vRho in cm
30  float bend = 0.3 * magField->inTesla(GlobalPoint(0.,0.,0.)).z() * rbend / 2.0;
31  float phi = 0.0;
32 
33  if( fabs(etaParticle) <= etaBarrelEndcap)
34  {
35  if (fabs(bend/ptParticle) <= 1.)
36  {
37  phi = phiParticle - asin(bend/ptParticle)*charge;
38  if(phi > Geom::pi()) phi = phi - Geom::twoPi();
39  if(phi < -Geom::pi()) phi = phi + Geom::twoPi();
40  } else {
41  edm::LogWarning("") << "[EcalPositionFromTrack::phiTransformation] Warning: "
42  << "Too low Pt, giving up";
43  return phiParticle;
44  }
45 
46  } // end if in the barrel
47 
48  if(fabs(etaParticle) > etaBarrelEndcap)
49  {
50  float rHit = 0.0;
51  rHit = ZENDM / sinh(fabs(etaParticle));
52  if (fabs(((rHit-(vRho/100.0))/rbend)*bend/ptParticle) <= 1.0)
53  {
54  phi = phiParticle - asin(((rHit-(vRho/100.0)) / rbend)*bend/ptParticle)*charge;
55  if(phi > Geom::pi()) phi = phi - Geom::twoPi();
56  if(phi < -Geom::pi()) phi = phi + Geom::twoPi();
57  } else {
58  edm::LogWarning("") << "[EcalPositionFromTrack::phiTransformation] Warning: "
59  << "Too low Pt, giving up";
60  return phiParticle;
61  }
62 
63  } // end if in the endcap
64 
65  return phi;
66 
67 }
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T z() const
Definition: PV3DBase.h:64
static const float etaBarrelEndcap
constexpr double pi()
Definition: Pi.h:31
constexpr double twoPi()
Definition: Pi.h:32