CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 12 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().

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 }
bool isAvailable() const
Definition: Ref.h:576
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:189
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:614
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
double pt() const
track transverse momentum
Definition: TrackBase.h:608
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:650
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:620
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:644
double fw::estimate_field ( double  vx1,
double  vy1,
double  vx2,
double  vy2,
double  px,
double  py 
)

Definition at line 57 of file estimate_field.cc.

References mathSSE::sqrt().

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