CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GflashTrajectory Class Reference

#include <GflashTrajectory.h>

Public Member Functions

void _cacheSinesAndCosines (double s) const
 
void _refreshCache () const
 
double getCosPhi0 () const
 
double getCosTheta () const
 
double getCotTheta () const
 
double getCurvature () const
 
double getD0 () const
 
HepGeom::Vector3D< double > getDirection (double s=0.0) const
 
void getGflashTrajectoryPoint (GflashTrajectoryPoint &point, double s) const
 
double getL2DAtR (double r) const
 
double getPathLengthAtRhoEquals (double rho) const
 
double getPathLengthAtZ (double z) const
 
double getPhi0 () const
 
HepGeom::Point3D< double > getPosition (double s=0.0) const
 
double getSinPhi0 () const
 
double getSinTheta () const
 
double getZ0 () const
 
double getZAtR (double r) const
 
 GflashTrajectory ()
 
void initializeTrajectory (const HepGeom::Vector3D< double > &, const HepGeom::Point3D< double > &, double q, double Field)
 
void setCotTheta (double cotTheta)
 
void setCurvature (double curvature)
 
void setD0 (double d0)
 
void setPhi0 (double phi0)
 
void setZ0 (double z0)
 
 ~GflashTrajectory ()
 

Private Attributes

double _aa
 
double _cc
 
double _cosPhi0
 
double _cosTheta
 
double _cotTheta
 
double _curvature
 
double _d0
 
bool _isStale
 
double _phi0
 
double _s
 
double _sinPhi0
 
double _sinTheta
 
double _ss
 
double _z0
 

Detailed Description

Definition at line 6 of file GflashTrajectory.h.

Constructor & Destructor Documentation

◆ GflashTrajectory()

GflashTrajectory::GflashTrajectory ( )

Definition at line 5 of file GflashTrajectory.cc.

6  : _cotTheta(0.0),
7  _curvature(0.0),
8  _z0(0.0),
9  _d0(0.0),
10  _phi0(0.0),
11  _isStale(true),
12  _sinPhi0(2),
13  _cosPhi0(2),
14  _sinTheta(2),
15  _cosTheta(2),
16  _s(-999.999),
17  _aa(2),
18  _ss(2),
19  _cc(2) {
20  // detault constructor
21 }

◆ ~GflashTrajectory()

GflashTrajectory::~GflashTrajectory ( )

Definition at line 87 of file GflashTrajectory.cc.

87 {}

Member Function Documentation

◆ _cacheSinesAndCosines()

void GflashTrajectory::_cacheSinesAndCosines ( double  s) const

Definition at line 247 of file GflashTrajectory.cc.

247  {
248  _refreshCache();
249  if (_s != s) {
250  _s = s;
251  _aa = 2.0 * _s * _curvature * _sinTheta;
252  if (_aa == 0.0) {
253  _ss = 0.0;
254  _cc = 1.0;
255  } else {
256  _ss = sin(_aa);
257  _cc = cos(_aa);
258  }
259  }
260 }

References _aa, _cc, _curvature, _refreshCache(), _s, _sinTheta, _ss, funct::cos(), alignCSCRings::s, and funct::sin().

Referenced by getDirection(), getGflashTrajectoryPoint(), and getPosition().

◆ _refreshCache()

void GflashTrajectory::_refreshCache ( ) const

Definition at line 217 of file GflashTrajectory.cc.

217  {
218  if (_isStale) {
219  _isStale = false;
220  double theta;
221  if (_cotTheta == 0.0) {
222  theta = M_PI / 2.0;
223  } else {
224  theta = atan(1.0 / _cotTheta);
225  if (theta < 0.0)
226  theta += M_PI;
227  }
228  if (theta == 0.0) {
229  _sinTheta = 0.0;
230  _cosTheta = 1.0;
231  } else {
232  _cosTheta = cos(theta);
234  }
235  if (_phi0 == 0.0) {
236  _sinPhi0 = 0.0;
237  _cosPhi0 = 1.0;
238  } else {
239  _cosPhi0 = cos(_phi0);
240  _sinPhi0 = sin(_phi0);
241  // _sinPhi0 = sqrt(1.0-_cosPhi0*_cosPhi0);
242  // if (_phi0>M_PI) _sinPhi0 = -_sinPhi0;
243  }
244  }
245 }

References _cosPhi0, _cosTheta, _cotTheta, _isStale, _phi0, _sinPhi0, _sinTheta, funct::cos(), M_PI, funct::sin(), mathSSE::sqrt(), and theta().

Referenced by _cacheSinesAndCosines(), getCosPhi0(), getCosTheta(), getSinPhi0(), and getSinTheta().

◆ getCosPhi0()

double GflashTrajectory::getCosPhi0 ( ) const

Definition at line 118 of file GflashTrajectory.cc.

118  {
119  _refreshCache();
120  return _cosPhi0;
121 }

References _cosPhi0, and _refreshCache().

◆ getCosTheta()

double GflashTrajectory::getCosTheta ( ) const

Definition at line 126 of file GflashTrajectory.cc.

126  {
127  _refreshCache();
128  return _cosTheta;
129 }

References _cosTheta, and _refreshCache().

Referenced by getPathLengthAtZ().

◆ getCotTheta()

double GflashTrajectory::getCotTheta ( ) const
inline

Definition at line 19 of file GflashTrajectory.h.

19 { return _cotTheta; }

References _cotTheta.

Referenced by getZAtR().

◆ getCurvature()

double GflashTrajectory::getCurvature ( ) const
inline

Definition at line 20 of file GflashTrajectory.h.

20 { return _curvature; }

References _curvature.

Referenced by getL2DAtR().

◆ getD0()

double GflashTrajectory::getD0 ( ) const
inline

Definition at line 22 of file GflashTrajectory.h.

22 { return _d0; };

References _d0.

Referenced by getL2DAtR().

◆ getDirection()

HepGeom::Vector3D< double > GflashTrajectory::getDirection ( double  s = 0.0) const

Definition at line 144 of file GflashTrajectory.cc.

144  {
146  if (s == 0.0) {
147  return HepGeom::Vector3D<double>(_cosPhi0 * _sinTheta, _sinPhi0 * _sinTheta, _cosTheta);
148  }
149  double xtan = _sinTheta * (_cosPhi0 * _cc - _sinPhi0 * _ss);
150  double ytan = _sinTheta * (_cosPhi0 * _ss + _sinPhi0 * _cc);
151  double ztan = _cosTheta;
152  return HepGeom::Vector3D<double>(xtan, ytan, ztan);
153 }

References _cacheSinesAndCosines(), _cc, _cosPhi0, _cosTheta, _sinPhi0, _sinTheta, _ss, and alignCSCRings::s.

◆ getGflashTrajectoryPoint()

void GflashTrajectory::getGflashTrajectoryPoint ( GflashTrajectoryPoint point,
double  s 
) const

Definition at line 155 of file GflashTrajectory.cc.

155  {
157 
158  double cP0sT = _cosPhi0 * _sinTheta, sP0sT = _sinPhi0 * _sinTheta;
159  if (s && _curvature) {
160  point.getPosition().set((_cosPhi0 * _ss - _sinPhi0 * (2.0 * _curvature * _d0 + 1.0 - _cc)) / (2.0 * _curvature),
161  (_sinPhi0 * _ss + _cosPhi0 * (2.0 * _curvature * _d0 + 1.0 - _cc)) / (2.0 * _curvature),
162  s * _cosTheta + _z0);
163 
164  point.getMomentum().set(cP0sT * _cc - sP0sT * _ss, cP0sT * _ss + sP0sT * _cc, _cosTheta);
165  point.setPathLength(s);
166  } else {
167  point.getPosition().set(-_d0 * _sinPhi0 + s * cP0sT, _d0 * _cosPhi0 + s * sP0sT, _z0 + s * _cosTheta);
168 
169  point.getMomentum().set(cP0sT, sP0sT, _cosTheta);
170 
171  point.setPathLength(s);
172  }
173 }

References _cacheSinesAndCosines(), _cc, _cosPhi0, _cosTheta, _curvature, _d0, _sinPhi0, _sinTheta, _ss, _z0, point, and alignCSCRings::s.

Referenced by HFGflash::gfParameterization(), GflashHadronShowerProfile::hadronicParameterization(), CalorimetryManager::HDShowerSimulation(), GflashHadronShowerProfile::hoProfile(), GflashEMShowerProfile::parameterization(), GflashShowino::simulateFirstInteractionPoint(), and GflashShowino::updateShowino().

◆ getL2DAtR()

double GflashTrajectory::getL2DAtR ( double  r) const

Definition at line 185 of file GflashTrajectory.cc.

185  {
186  double L2D;
187 
188  double c = getCurvature();
189  double d = getD0();
190 
191  if (c != 0.0) {
192  double rad = (rho * rho - d * d) / (1.0 + 2.0 * c * d);
193  double rprime;
194  if (rad < 0.0) {
195  rprime = 0.0;
196  } else {
197  rprime = sqrt(rad);
198  }
199  if (c * rprime > 1.0 || c * rprime < -1.0) {
200  L2D = c * rprime > 0. ? M_PI / c : -M_PI / c;
201  } else
202  L2D = asin(c * rprime) / c;
203  } else {
204  double rad = rho * rho - d * d;
205  double rprime;
206  if (rad < 0.0)
207  rprime = 0.0;
208  else
209  rprime = sqrt(rad);
210 
211  L2D = rprime;
212  }
213  return L2D;
214 }

References HltBtagPostValidation_cff::c, ztail::d, getCurvature(), getD0(), M_PI, rho, and mathSSE::sqrt().

Referenced by getPathLengthAtRhoEquals(), and getZAtR().

◆ getPathLengthAtRhoEquals()

double GflashTrajectory::getPathLengthAtRhoEquals ( double  rho) const

◆ getPathLengthAtZ()

double GflashTrajectory::getPathLengthAtZ ( double  z) const

◆ getPhi0()

double GflashTrajectory::getPhi0 ( ) const
inline

Definition at line 23 of file GflashTrajectory.h.

23 { return _phi0; };

References _phi0.

◆ getPosition()

HepGeom::Point3D< double > GflashTrajectory::getPosition ( double  s = 0.0) const

Definition at line 131 of file GflashTrajectory.cc.

131  {
133  if (s == 0.0 || _curvature == 0.0) {
134  return HepGeom::Point3D<double>(
136  } else {
137  return HepGeom::Point3D<double>(
138  (_cosPhi0 * _ss - _sinPhi0 * (2.0 * _curvature * _d0 + 1.0 - _cc)) / (2.0 * _curvature),
139  (_sinPhi0 * _ss + _cosPhi0 * (2.0 * _curvature * _d0 + 1.0 - _cc)) / (2.0 * _curvature),
140  _s * _cosTheta + _z0);
141  }
142 }

References _cacheSinesAndCosines(), _cc, _cosPhi0, _cosTheta, _curvature, _d0, _s, _sinPhi0, _sinTheta, _ss, _z0, and alignCSCRings::s.

◆ getSinPhi0()

double GflashTrajectory::getSinPhi0 ( ) const

Definition at line 114 of file GflashTrajectory.cc.

114  {
115  _refreshCache();
116  return _sinPhi0;
117 }

References _refreshCache(), and _sinPhi0.

◆ getSinTheta()

double GflashTrajectory::getSinTheta ( ) const

Definition at line 122 of file GflashTrajectory.cc.

122  {
123  _refreshCache();
124  return _sinTheta;
125 }

References _refreshCache(), and _sinTheta.

Referenced by getPathLengthAtRhoEquals().

◆ getZ0()

double GflashTrajectory::getZ0 ( ) const
inline

Definition at line 21 of file GflashTrajectory.h.

21 { return _z0; };

References _z0.

Referenced by getPathLengthAtZ().

◆ getZAtR()

double GflashTrajectory::getZAtR ( double  r) const

Definition at line 183 of file GflashTrajectory.cc.

183 { return _z0 + getCotTheta() * getL2DAtR(rho); }

References _z0, getCotTheta(), getL2DAtR(), and rho.

◆ initializeTrajectory()

void GflashTrajectory::initializeTrajectory ( const HepGeom::Vector3D< double > &  MomentumGev,
const HepGeom::Point3D< double > &  PositionCm,
double  q,
double  Field 
)

Definition at line 27 of file GflashTrajectory.cc.

30  {
31  double CotTheta = 0.0;
32  double W = 0;
33  double Z0 = 0;
34  double D0 = 0;
35  double Phi0 = 0;
36 
37  if (BFieldTesla != 0.0 && q != 0.0) {
38  double CurvatureConstant = 0.0029979;
39  double Helicity = -1.0 * fabs(BFieldTesla) * fabs(q) / (BFieldTesla * q);
40  double Radius = fabs(MomentumGev.perp() / (CurvatureConstant * BFieldTesla * q));
41 
42  if (Radius == 0.0)
43  W = HUGE_VAL;
44  else
45  W = Helicity / Radius;
46  double phi1 = MomentumGev.phi();
47  double x = PositionCm.x(), y = PositionCm.y(), z = PositionCm.z();
48  double sinPhi1 = sin(phi1), cosPhi1 = cos(phi1);
49  double gamma = atan((x * cosPhi1 + y * sinPhi1) / (x * sinPhi1 - y * cosPhi1 - 1 / W));
50  Phi0 = phi1 + gamma;
51  if (Phi0 > M_PI)
52  Phi0 = Phi0 - 2.0 * M_PI;
53  if (Phi0 < -M_PI)
54  Phi0 = Phi0 + 2.0 * M_PI;
55  D0 = ((1 / W + y * cosPhi1 - x * sinPhi1) / cos(gamma) - 1 / W);
56  CotTheta = MomentumGev.z() / MomentumGev.perp();
57  Z0 = z + gamma * CotTheta / W;
58  } else {
59  CLHEP::Hep3Vector direction = MomentumGev.unit();
60  CLHEP::Hep3Vector projectedDirection = CLHEP::Hep3Vector(direction.x(), direction.y(), 0.0).unit();
61  double s = projectedDirection.dot(PositionCm);
62  double sprime = s / sin(direction.theta());
63  Z0 = (PositionCm - sprime * direction).z();
64  Phi0 = MomentumGev.phi();
65  CotTheta = MomentumGev.z() / MomentumGev.perp();
66  W = 0.0;
67  D0 = (PositionCm.y() * cos(Phi0) - PositionCm.x() * sin(Phi0));
68  }
69 
70  _cotTheta = CotTheta;
71  _curvature = W / 2;
72  _z0 = Z0;
73  _d0 = D0;
74  _phi0 = Phi0;
75 
76  _isStale = true;
77  _s = -999.999;
78  _aa = -999.999;
79  _ss = -999.999;
80  _cc = -999.999;
81  _sinPhi0 = 1.0;
82  _cosPhi0 = 1.0;
83  _sinTheta = 1.0;
84  _cosTheta = 1.0;
85 }

References _aa, _cc, _cosPhi0, _cosTheta, _cotTheta, _curvature, _d0, _isStale, _phi0, _s, _sinPhi0, _sinTheta, _ss, _z0, funct::cos(), CustomPhysics_cfi::gamma, M_PI, submitPVResolutionJobs::q, JetPartonCorrections_cff::Radius, alignCSCRings::s, funct::sin(), x, y, z, and Z0.

Referenced by HFGflash::gfParameterization(), and GflashShowino::initialize().

◆ setCotTheta()

void GflashTrajectory::setCotTheta ( double  cotTheta)

Definition at line 89 of file GflashTrajectory.cc.

89  {
90  _cotTheta = cotTheta;
91  _isStale = true;
92 }

References _cotTheta, and _isStale.

◆ setCurvature()

void GflashTrajectory::setCurvature ( double  curvature)

Definition at line 94 of file GflashTrajectory.cc.

94  {
96  _isStale = true;
97 }

References _curvature, _isStale, and PixelRecoUtilities::curvature().

◆ setD0()

void GflashTrajectory::setD0 ( double  d0)

Definition at line 104 of file GflashTrajectory.cc.

104  {
105  _d0 = d0;
106  _isStale = true;
107 }

References _d0, _isStale, and d0.

◆ setPhi0()

void GflashTrajectory::setPhi0 ( double  phi0)

Definition at line 109 of file GflashTrajectory.cc.

109  {
110  _phi0 = phi0;
111  _isStale = true;
112 }

References _isStale, and _phi0.

◆ setZ0()

void GflashTrajectory::setZ0 ( double  z0)

Definition at line 99 of file GflashTrajectory.cc.

99  {
100  _z0 = z0;
101  _isStale = true;
102 }

References _isStale, _z0, and HLTMuonOfflineAnalyzer_cfi::z0.

Member Data Documentation

◆ _aa

double GflashTrajectory::_aa
mutableprivate

Definition at line 66 of file GflashTrajectory.h.

Referenced by _cacheSinesAndCosines(), and initializeTrajectory().

◆ _cc

double GflashTrajectory::_cc
mutableprivate

◆ _cosPhi0

double GflashTrajectory::_cosPhi0
mutableprivate

◆ _cosTheta

double GflashTrajectory::_cosTheta
mutableprivate

◆ _cotTheta

double GflashTrajectory::_cotTheta
private

Definition at line 52 of file GflashTrajectory.h.

Referenced by _refreshCache(), getCotTheta(), initializeTrajectory(), and setCotTheta().

◆ _curvature

double GflashTrajectory::_curvature
private

◆ _d0

double GflashTrajectory::_d0
private

◆ _isStale

bool GflashTrajectory::_isStale
mutableprivate

◆ _phi0

double GflashTrajectory::_phi0
private

Definition at line 56 of file GflashTrajectory.h.

Referenced by _refreshCache(), getPhi0(), initializeTrajectory(), and setPhi0().

◆ _s

double GflashTrajectory::_s
mutableprivate

Definition at line 64 of file GflashTrajectory.h.

Referenced by _cacheSinesAndCosines(), getPosition(), and initializeTrajectory().

◆ _sinPhi0

double GflashTrajectory::_sinPhi0
mutableprivate

◆ _sinTheta

double GflashTrajectory::_sinTheta
mutableprivate

◆ _ss

double GflashTrajectory::_ss
mutableprivate

◆ _z0

double GflashTrajectory::_z0
private
GflashTrajectory::_refreshCache
void _refreshCache() const
Definition: GflashTrajectory.cc:217
GflashTrajectory::getD0
double getD0() const
Definition: GflashTrajectory.h:22
DDAxes::y
GflashTrajectory::_aa
double _aa
Definition: GflashTrajectory.h:66
funct::D0
Divides< arg, void > D0
Definition: Factorize.h:135
GflashTrajectory::_cosTheta
double _cosTheta
Definition: GflashTrajectory.h:63
GflashTrajectory::_phi0
double _phi0
Definition: GflashTrajectory.h:56
CustomPhysics_cfi.gamma
gamma
Definition: CustomPhysics_cfi.py:17
JetPartonCorrections_cff.Radius
Radius
Definition: JetPartonCorrections_cff.py:11
GflashTrajectory::getCurvature
double getCurvature() const
Definition: GflashTrajectory.h:20
DDAxes::x
PixelRecoUtilities::curvature
T curvature(T InversePt, const edm::EventSetup &iSetup)
Definition: PixelRecoUtilities.h:42
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
alignCSCRings.s
s
Definition: alignCSCRings.py:92
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
GflashTrajectory::_cotTheta
double _cotTheta
Definition: GflashTrajectory.h:52
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
GflashTrajectory::_d0
double _d0
Definition: GflashTrajectory.h:55
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
DDAxes::rho
GflashTrajectory::_cosPhi0
double _cosPhi0
Definition: GflashTrajectory.h:61
GflashTrajectory::getZ0
double getZ0() const
Definition: GflashTrajectory.h:21
GflashTrajectory::_sinPhi0
double _sinPhi0
Definition: GflashTrajectory.h:60
GflashTrajectory::_z0
double _z0
Definition: GflashTrajectory.h:54
GflashTrajectory::_cc
double _cc
Definition: GflashTrajectory.h:68
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
GflashTrajectory::_s
double _s
Definition: GflashTrajectory.h:64
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
GflashTrajectory::getCosTheta
double getCosTheta() const
Definition: GflashTrajectory.cc:126
GflashTrajectory::_isStale
bool _isStale
Definition: GflashTrajectory.h:59
GflashTrajectory::_curvature
double _curvature
Definition: GflashTrajectory.h:53
GflashTrajectory::getSinTheta
double getSinTheta() const
Definition: GflashTrajectory.cc:122
GflashTrajectory::_ss
double _ss
Definition: GflashTrajectory.h:67
GflashTrajectory::_sinTheta
double _sinTheta
Definition: GflashTrajectory.h:62
ztail.d
d
Definition: ztail.py:151
GflashTrajectory::_cacheSinesAndCosines
void _cacheSinesAndCosines(double s) const
Definition: GflashTrajectory.cc:247
GflashTrajectory::getL2DAtR
double getL2DAtR(double r) const
Definition: GflashTrajectory.cc:185
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
d0
static constexpr float d0
Definition: L1EGammaCrystalsEmulatorProducer.cc:84
GflashTrajectory::getCotTheta
double getCotTheta() const
Definition: GflashTrajectory.h:19
Z0
static const double Z0
Definition: CastorGeometryData.h:32