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 
11 double
13 {
14  if ( !track.extra().isAvailable() ) return -1;
15  // We have 3 states so we can form 3 pairs to check for curvature
16  // In practice we want to avoid estimates over lost of material and
17  // in regions with small field. Therefore we should look at the pair
18  // based on POCA and closest state to it. Than we will estimate the
19  // filed inside the solenoid.
20  double estimate = -1;
21  if ( pow(track.outerPosition().x()-track.vx(),2)+pow(track.outerPosition().y()-track.vy(),2) <
22  pow(track.innerPosition().x()-track.vx(),2)+pow(track.innerPosition().y()-track.vy(),2) )
23  {
24  estimate = estimate_field( track.outerPosition().x(),
25  track.outerPosition().y(),
26  track.vx(),
27  track.vy(),
28  track.px(),
29  track.py() );
30  }
31  else
32  {
33  estimate = estimate_field( track.innerPosition().x(),
34  track.innerPosition().y(),
35  track.vx(),
36  track.vy(),
37  track.px(),
38  track.py() );
39  }
40 
41  if ( highQuality ){
42  if ( fabs( track.outerMomentum().rho()/track.pt()-1 )<0.1 &&
43  track.innerPosition().rho()<129 &&
44  track.outerPosition().rho()<129 ){
45  /*printf("outer-poca: \tPOCA Pt: %0.2f, \tinner Rho: %0.1f, \touter Rho: %0.1f, \tchange in pt: %0.1f%%, \testimate: %0.2f\n",
46  track.pt(), track.innerPosition().rho(), track.outerPosition().rho(),
47  fabs( track.outerMomentum().rho()/track.pt()-1 )*100, estimate);*/
48  return estimate;
49  } else {
50  return -1;
51  }
52  } else
53  return estimate;
54 }
55 
56 double
57 fw::estimate_field( double vx1, double vy1, double vx2, double vy2, double px, double py )
58 {
59  math::XYZVector displacement(vx2-vx1, vy2-vy1, 0);
60  math::XYZVector transverseMomentum(px, py, 0);
61  double cosAlpha = transverseMomentum.Dot(displacement)/transverseMomentum.r()/displacement.r();
62  return 200*sqrt(1-cosAlpha*cosAlpha)/0.2998*transverseMomentum.r()/displacement.r();
63 }
bool isAvailable() const
Definition: Ref.h:576
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:189
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:622
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
double estimate_field(const reco::Track &track, bool highQuality=false)
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
T sqrt(T t)
Definition: SSEVec.h:18
double pt() const
track transverse momentum
Definition: TrackBase.h:616
bool highQuality(const reco::TrackBase::TrackAlgorithm &)
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:658
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:628
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:652