CMS 3D CMS Logo

estimate_field.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Tracks
4 // Class : estimate_field
5 //
6 
7 #include "Math/Vector3D.h"
10 
12  if (!track.extra().isAvailable())
13  return -1;
14  // We have 3 states so we can form 3 pairs to check for curvature
15  // In practice we want to avoid estimates over lost of material and
16  // in regions with small field. Therefore we should look at the pair
17  // based on POCA and closest state to it. Than we will estimate the
18  // filed inside the solenoid.
19  double estimate = -1;
20  if (pow(track.outerPosition().x() - track.vx(), 2) + pow(track.outerPosition().y() - track.vy(), 2) <
21  pow(track.innerPosition().x() - track.vx(), 2) + pow(track.innerPosition().y() - track.vy(), 2)) {
22  estimate = estimate_field(
23  track.outerPosition().x(), track.outerPosition().y(), track.vx(), track.vy(), track.px(), track.py());
24  } else {
25  estimate = estimate_field(
26  track.innerPosition().x(), track.innerPosition().y(), track.vx(), track.vy(), track.px(), track.py());
27  }
28 
29  if (highQuality) {
30  if (fabs(track.outerMomentum().rho() / track.pt() - 1) < 0.1 && track.innerPosition().rho() < 129 &&
31  track.outerPosition().rho() < 129) {
32  /*printf("outer-poca: \tPOCA Pt: %0.2f, \tinner Rho: %0.1f, \touter Rho: %0.1f, \tchange in pt: %0.1f%%, \testimate: %0.2f\n",
33  track.pt(), track.innerPosition().rho(), track.outerPosition().rho(),
34  fabs( track.outerMomentum().rho()/track.pt()-1 )*100, estimate);*/
35  return estimate;
36  } else {
37  return -1;
38  }
39  } else
40  return estimate;
41 }
42 
43 double fw::estimate_field(double vx1, double vy1, double vx2, double vy2, double px, double py) {
44  math::XYZVector displacement(vx2 - vx1, vy2 - vy1, 0);
45  math::XYZVector transverseMomentum(px, py, 0);
46  double cosAlpha = transverseMomentum.Dot(displacement) / transverseMomentum.r() / displacement.r();
47  return 200 * sqrt(1 - cosAlpha * cosAlpha) / 0.2998 * transverseMomentum.r() / displacement.r();
48 }
estimate_field.h
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11724
multPhiCorr_741_25nsDY_cfi.py
py
Definition: multPhiCorr_741_25nsDY_cfi.py:12
PFTrackAlgoTools::highQuality
bool highQuality(const reco::TrackBase::TrackAlgorithm &)
Definition: PFTrackAlgoTools.cc:193
Track.h
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::Track
Definition: Track.h:27
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
multPhiCorr_741_25nsDY_cfi.px
px
Definition: multPhiCorr_741_25nsDY_cfi.py:10
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
fw::estimate_field
double estimate_field(const reco::Track &track, bool highQuality=false)
Definition: estimate_field.cc:11