CMS 3D CMS Logo

Functions
fw Namespace Reference

Functions

double estimate_field (const reco::Track &track, bool highQuality=false)
 
double estimate_field (double vx1, double vy1, double vx2, double vy2, double px, double py)
 

Function Documentation

double fw::estimate_field ( const reco::Track track,
bool  highQuality = false 
)

Definition at line 11 of file estimate_field.cc.

References reco::Track::extra(), reco::Track::innerPosition(), edm::Ref< C, T, F >::isAvailable(), reco::Track::outerMomentum(), reco::Track::outerPosition(), funct::pow(), reco::TrackBase::pt(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::vx(), and reco::TrackBase::vy().

Referenced by FWTrackProxyBuilder::build(), FWMuonBuilder::calculateField(), FWPFTrackUtils::setupLegoTrack(), and FWPFTrackUtils::setupTrack().

11  {
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 }
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:605
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:62
bool isAvailable() const
Definition: Ref.h:537
double estimate_field(const reco::Track &track, bool highQuality=false)
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
double pt() const
track transverse momentum
Definition: TrackBase.h:602
bool highQuality(const reco::TrackBase::TrackAlgorithm &)
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:65
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:623
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
double py() const
y coordinate of momentum vector
Definition: TrackBase.h:608
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:620
double fw::estimate_field ( double  vx1,
double  vy1,
double  vx2,
double  vy2,
double  px,
double  py 
)

Definition at line 43 of file estimate_field.cc.

References mathSSE::sqrt().

43  {
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 }
T sqrt(T t)
Definition: SSEVec.h:19
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31