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 13 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().

14 {
15  if ( !track.extra().isAvailable() ) return -1;
16  // We have 3 states so we can form 3 pairs to check for curvature
17  // In practice we want to avoid estimates over lost of material and
18  // in regions with small field. Therefore we should look at the pair
19  // based on POCA and closest state to it. Than we will estimate the
20  // filed inside the solenoid.
21  double estimate = -1;
22  if ( pow(track.outerPosition().x()-track.vx(),2)+pow(track.outerPosition().y()-track.vy(),2) <
23  pow(track.innerPosition().x()-track.vx(),2)+pow(track.innerPosition().y()-track.vy(),2) )
24  {
25  estimate = estimate_field( track.outerPosition().x(),
26  track.outerPosition().y(),
27  track.vx(),
28  track.vy(),
29  track.px(),
30  track.py() );
31  }
32  else
33  {
34  estimate = estimate_field( track.innerPosition().x(),
35  track.innerPosition().y(),
36  track.vx(),
37  track.vy(),
38  track.px(),
39  track.py() );
40  }
41 
42  if ( highQuality ){
43  if ( fabs( track.outerMomentum().rho()/track.pt()-1 )<0.1 &&
44  track.innerPosition().rho()<129 &&
45  track.outerPosition().rho()<129 ){
46  /*printf("outer-poca: \tPOCA Pt: %0.2f, \tinner Rho: %0.1f, \touter Rho: %0.1f, \tchange in pt: %0.1f%%, \testimate: %0.2f\n",
47  track.pt(), track.innerPosition().rho(), track.outerPosition().rho(),
48  fabs( track.outerMomentum().rho()/track.pt()-1 )*100, estimate);*/
49  return estimate;
50  } else {
51  return -1;
52  }
53  } else
54  return estimate;
55 }
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:97
double px() const
x coordinate of momentum vector
Definition: TrackBase.h:133
bool isAvailable() const
Definition: Ref.h:276
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:47
double estimate_field(const reco::Track &track, bool highQuality=false)
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:42
double pt() const
track transverse momentum
Definition: TrackBase.h:131
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:49
double vy() const
y coordinate of the reference point on track
Definition: TrackBase.h:145
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:135
double vx() const
x coordinate of the reference point on track
Definition: TrackBase.h:143
double fw::estimate_field ( double  vx1,
double  vy1,
double  vx2,
double  vy2,
double  px,
double  py 
)

Definition at line 58 of file estimate_field.cc.

References mathSSE::sqrt().

59 {
60  math::XYZVector displacement(vx2-vx1, vy2-vy1, 0);
61  math::XYZVector transverseMomentum(px, py, 0);
62  double cosAlpha = transverseMomentum.Dot(displacement)/transverseMomentum.r()/displacement.r();
63  return 200*sqrt(1-cosAlpha*cosAlpha)/0.2998*transverseMomentum.r()/displacement.r();
64 }
T sqrt(T t)
Definition: SSEVec.h:46
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31