CMS 3D CMS Logo

Classes | Functions
lst_math Namespace Reference

Classes

class  Helix
 
class  Hit
 

Functions

float ATan2 (float y, float x)
 
Hit getCenterFromThreePoints (Hit &hitA, Hit &hitB, Hit &hitC)
 
float Phi_mpi_pi (float x)
 
float ptEstimateFromRadius (float radius)
 

Function Documentation

◆ ATan2()

float lst_math::ATan2 ( float  y,
float  x 
)
inline

Definition at line 23 of file lst_math.h.

References Matriplex::atan2(), M_PI, and x.

Referenced by CosmicGenFilterHelix::monitorEnd(), CosmicGenFilterHelix::monitorStart(), lst_math::Hit::setDerivedQuantities(), and metsig::significanceAlgo::significance().

23  {
24  if (x != 0)
25  return atan2(y, x);
26  if (y == 0)
27  return 0;
28  if (y > 0)
29  return M_PI / 2;
30  else
31  return -M_PI / 2;
32  };
#define M_PI
float x
MPlex< T, D1, D2, N > atan2(const MPlex< T, D1, D2, N > &y, const MPlex< T, D1, D2, N > &x)
Definition: Matriplex.h:648

◆ getCenterFromThreePoints()

Hit lst_math::getCenterFromThreePoints ( Hit hitA,
Hit hitB,
Hit hitC 
)
inline

Definition at line 154 of file lst_math.h.

References gather_cfg::cout, or, x, lst_math::Hit::x(), and lst_math::Hit::y().

Referenced by setGnnNtupleBranches().

154  {
155  // C
156  //
157  //
158  //
159  // B d <-- find this point that makes the arc that goes throw a b c
160  //
161  //
162  // A
163 
164  // Steps:
165  // 1. Calculate mid-points of lines AB and BC
166  // 2. Find slopes of line AB and BC
167  // 3. construct a perpendicular line between AB and BC
168  // 4. set the two equations equal to each other and solve to find intersection
169 
170  float xA = hitA.x();
171  float yA = hitA.y();
172  float xB = hitB.x();
173  float yB = hitB.y();
174  float xC = hitC.x();
175  float yC = hitC.y();
176 
177  float x_mid_AB = (xA + xB) / 2.;
178  float y_mid_AB = (yA + yB) / 2.;
179 
180  //float x_mid_BC = (xB + xC) / 2.;
181  //float y_mid_BC = (yB + yC) / 2.;
182 
183  bool slope_AB_inf = (xB - xA) == 0;
184  bool slope_BC_inf = (xC - xB) == 0;
185 
186  bool slope_AB_zero = (yB - yA) == 0;
187  bool slope_BC_zero = (yC - yB) == 0;
188 
189  float slope_AB = slope_AB_inf ? 0 : (yB - yA) / (xB - xA);
190  float slope_BC = slope_BC_inf ? 0 : (yC - yB) / (xC - xB);
191 
192  float slope_perp_AB = slope_AB_inf or slope_AB_zero ? 0. : -1. / (slope_AB);
193  //float slope_perp_BC = slope_BC_inf or slope_BC_zero ? 0. : -1. / (slope_BC);
194 
195  if ((slope_AB - slope_BC) == 0) {
196  std::cout << " slope_AB_zero: " << slope_AB_zero << std::endl;
197  std::cout << " slope_BC_zero: " << slope_BC_zero << std::endl;
198  std::cout << " slope_AB_inf: " << slope_AB_inf << std::endl;
199  std::cout << " slope_BC_inf: " << slope_BC_inf << std::endl;
200  std::cout << " slope_AB: " << slope_AB << std::endl;
201  std::cout << " slope_BC: " << slope_BC << std::endl;
202  std::cout << "MathUtil::getCenterFromThreePoints() function the three points are in straight line!" << std::endl;
203  return Hit();
204  }
205 
206  float x =
207  (slope_AB * slope_BC * (yA - yC) + slope_BC * (xA + xB) - slope_AB * (xB + xC)) / (2. * (slope_BC - slope_AB));
208  float y = slope_perp_AB * (x - x_mid_AB) + y_mid_AB;
209 
210  return Hit(x, y, 0);
211  };
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
SeedingHitSet::ConstRecHitPointer Hit
float x

◆ Phi_mpi_pi()

float lst_math::Phi_mpi_pi ( float  x)
inline

◆ ptEstimateFromRadius()

float lst_math::ptEstimateFromRadius ( float  radius)
inline

Definition at line 34 of file lst_math.h.

References CosmicsPD_Skims::radius.

Referenced by setGnnNtupleBranches().

34 { return 2.99792458e-3 * 3.8 * radius; };