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

◆ estimate_field() [1/2]

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

Definition at line 11 of file estimate_field.cc.

References PFTrackAlgoTools::highQuality(), funct::pow(), and HLT_2024v13_cff::track.

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 }
double estimate_field(const reco::Track &track, bool highQuality=false)
bool highQuality(const reco::TrackBase::TrackAlgorithm &)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29

◆ estimate_field() [2/2]

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 multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, and 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