40 if (!isPropagationSuccessful)
41 return std::vector<SteppingHelixStateInfo>();
43 std::vector<SteppingHelixStateInfo> complicatePoints;
46 return complicatePoints;
68 float r11 = r22 * r33 - r23 *
r32;
69 float r12 = r23 * r31;
70 float r13 = -r22 * r31;
83 edm::LogWarning(
"TrackAssociator") <<
"An exception is caught during the track propagation\n" 84 <<
state.momentum().x() <<
", " <<
state.momentum().y() <<
", " 85 <<
state.momentum().z();
90 state.getFreeState(fts);
102 edm::LogWarning(
"TrackAssociator") <<
"An exception is caught during the track propagation\n" 103 <<
state.momentum().x() <<
", " <<
state.momentum().y() <<
", " 104 <<
state.momentum().z();
109 state.getFreeState(fts);
118 <<
"Reseting all trajectories. Please call reset_trajectory() explicitely to avoid this message";
126 throw cms::Exception(
"FatalError") <<
"Track propagator is not defined\n";
131 LogTrace(
"TrackAssociator") <<
"[propagateAll] Propagate outward from (rho, r, z, phi) (" 136 LogTrace(
"TrackAssociator") <<
"Failed to propagate the track; moving on\n";
139 LogTrace(
"TrackAssociator") <<
"\treached (rho, r, z, phi) (" << currentState.
position().
perp() <<
", " 148 previousState = currentState2;
150 if (!currentState2.
isValid()) {
151 LogTrace(
"TrackAssociator") <<
"Failed to propagate the track; moving on\n";
156 <<
"Error: TrackAssociator has propogated the particle past the point of closest approach to IP" << std::endl;
159 LogTrace(
"TrackAssociator") <<
"[propagateAll] Propagated inward from (rho, r, z, phi) (" 173 LogTrace(
"TrackAssociator") <<
"Done with the track propagation in the detector. Number of steps: " 190 const float matchingDistance = 1;
194 int closestPointOnLeft = 0;
198 LogTrace(
"TrackAssociator") <<
"Track didn't cross the plane:\n\tleft distance: " <<
distance(plane, leftIndex)
199 <<
"\n\tright distance: " <<
distance(plane, rightIndex);
203 while (leftIndex + 1 < rightIndex) {
204 closestPointOnLeft =
int((leftIndex + rightIndex) / 2);
205 float dist =
distance(plane, closestPointOnLeft);
208 if (fabs(dist) < matchingDistance) {
210 if (closestPointOnLeft > 0 &&
sign(
distance(plane, closestPointOnLeft - 1)) * dist == -1)
211 closestPointOnLeft--;
217 rightIndex = closestPointOnLeft;
219 leftIndex = closestPointOnLeft;
226 LogTrace(
"TrackAssociator") <<
"closestPointOnLeft: " << closestPointOnLeft <<
"\n\ttrajectory point (z,R,eta,phi): " 231 <<
"\n\tplane center (z,R,eta,phi): " << plane->
position().
z() <<
", " 243 edm::LogWarning(
"TrackAssociator") <<
"An exception is caught during the track propagation\n" 244 <<
state.momentum().x() <<
", " <<
state.momentum().y() <<
", " 245 <<
state.momentum().z();
248 return state.getStateOnSurface(*plane);
264 std::pair<float, float>
result(0, 0);
266 edm::LogWarning(
"TrackAssociator") <<
"State at IP is not known set. Cannot estimate trajectory change. " 267 <<
"Trajectory change is not taken into account in matching";
270 switch (trajectoryType) {
273 edm::LogWarning(
"TrackAssociator") <<
"ECAL trajector is empty. Cannot estimate trajectory change. " 274 <<
"Trajectory change is not taken into account in matching";
283 edm::LogWarning(
"TrackAssociator") <<
"HCAL trajector is empty. Cannot estimate trajectory change. " 284 <<
"Trajectory change is not taken into account in matching";
293 edm::LogWarning(
"TrackAssociator") <<
"HO trajector is empty. Cannot estimate trajectory change. " 294 <<
"Trajectory change is not taken into account in matching";
303 edm::LogWarning(
"TrackAssociator") <<
"Full trajector is empty. Cannot estimate trajectory change. " 304 <<
"Trajectory change is not taken into account in matching";
313 <<
"Unkown or not supported trajector type. Cannot estimate trajectory change. " 314 <<
"Trajectory change is not taken into account in matching";
320 const double& theta2,
322 const double& phi2) {
323 std::pair<float, float>
result(theta2 - theta1, phi2 - phi1);
338 throw cms::Exception(
"FatalError") <<
"trajectory is not defined yet. Please use propagateAll first.";
340 LogTrace(
"TrackAssociator") <<
"Trajectory is empty. Move on";
344 LogTrace(
"TrackAssociator") <<
"no trajectory is expected to be found since the fiducial volume is not valid";
349 int closestPointOnLeft = -1;
356 LogTrace(
"TrackAssociator") <<
"Track didn't cross the region (R1,R2,L1,L2): " << volume.
minR() <<
", " 357 << volume.
maxR() <<
", " << volume.
minZ() <<
", " << volume.
maxZ();
371 int firstPointInside(-1);
378 if (
dR > 0 ||
dZ > 0) {
380 firstPointInside =
i;
381 closestPointOnLeft =
i - 1;
383 firstPointInside = 0;
384 closestPointOnLeft = 0;
389 if (closestPointOnLeft == -1)
390 throw cms::Exception(
"FatalError") <<
"This shouls never happen - internal logic error";
401 if (firstPointInside != closestPointOnLeft) {
413 trajectory.push_back(currentState);
415 LogTrace(
"TrackAssociator") <<
"Weird message\n";
421 LogTrace(
"TrackAssociator") <<
"Failed to propagate the track; moving on\n";
427 trajectory.push_back(currentState);
444 LogTrace(
"TrackAssociator") <<
"getting trajectory in ECAL";
450 LogTrace(
"TrackAssociator") <<
"getting trajectory in Preshower";
462 LogTrace(
"TrackAssociator") <<
"getting trajectory in HCAL";
470 LogTrace(
"TrackAssociator") <<
"getting trajectory in HO";
479 std::vector<GlobalPoint>* wideTrajectory =
nullptr;
480 switch (wideTrajectoryType) {
482 LogTrace(
"TrackAssociator") <<
"Filling ellipses in Ecal trajectory";
486 LogTrace(
"TrackAssociator") <<
"Filling ellipses in Hcal trajectory";
490 LogTrace(
"TrackAssociator") <<
"Filling ellipses in HO trajectory";
497 for (std::vector<SteppingHelixStateInfo>::const_iterator
state = states.begin();
state != states.end();
state++) {
507 float r11 = r22 * r33 - r23 *
r32;
508 float r12 = r23 * r31;
509 float r13 = -r22 * r31;
516 if (!tsos.isValid()) {
517 LogTrace(
"TrackAssociator") <<
"[getWideTrajectory] TSOS not valid";
520 if (!tsos.hasError()) {
521 LogTrace(
"TrackAssociator") <<
"[getWideTrajectory] TSOS does not have Errors";
524 LocalError localErr = tsos.localError().positionError();
526 float xx = localErr.
xx();
527 float xy = localErr.
xy();
528 float yy = localErr.
yy();
539 float semi1 =
sqrt(rotErr.
xx());
540 float semi2 =
sqrt(rotErr.
yy());
559 wideTrajectory->push_back(
state->position());
567 return wideTrajectory;
SteppingHelixStateInfo getStateAtHO()
LocalError scale(float s) const
bool fullTrajectoryFilled_
virtual std::string explainSelf() const
SteppingHelixStateInfo stateAtIP_
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
std::vector< SteppingHelixStateInfo > ecalTrajectory_
void findPreshowerTrajectory(const FiducialVolume &)
const Propagator * propagator_
void setMinDetectorLength(float l=0.)
Geom::Phi< T > phi() const
std::vector< SteppingHelixStateInfo > propagateThoughFromIP(const SteppingHelixStateInfo &state, const Propagator *prop, const FiducialVolume &volume, int nsteps, float step, float minR, float minZ, float maxR, float maxZ)
void setMinDetectorRadius(float r=0.)
Sin< T >::type sin(const T &t)
void setPropagationStep(float s=20.)
double maxZ(bool withTolerance=true) const
void getTrajectory(std::vector< SteppingHelixStateInfo > &, const FiducialVolume &, int steps=4)
std::string const & category() const
std::vector< GlobalPoint > wideHcalTrajectory_
void findHcalTrajectory(const FiducialVolume &)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
std::vector< GlobalPoint > wideEcalTrajectory_
GlobalPoint position() const
SteppingHelixStateInfo getStateAtPreshower()
static PlanePointer build(Args &&... args)
std::vector< SteppingHelixStateInfo > hoTrajectory_
std::vector< GlobalPoint > wideHOTrajectory_
bool propagateAll(const SteppingHelixStateInfo &initialState)
propagate through the whole detector, returns true if successful
float distance(const Plane *plane, int index)
SteppingHelixStateInfo getInnerState()
Cos< T >::type cos(const T &t)
bool isValid() const
check whether the volume is properly defined
const std::vector< SteppingHelixStateInfo > & getPreshowerTrajectory() const
const std::vector< SteppingHelixStateInfo > & getEcalTrajectory() const
std::pair< float, float > trajectoryDelta(TrajectorType)
std::vector< SteppingHelixStateInfo > preshowerTrajectory_
Point3DBase< float, GlobalTag > PositionType
std::vector< GlobalPoint > * getWideTrajectory(const std::vector< SteppingHelixStateInfo > &, WideTrajectoryType)
SteppingHelixStateInfo getOuterState()
const std::vector< SteppingHelixStateInfo > & getHcalTrajectory() const
void setPropagator(const Propagator *ptr)
const PositionType & position() const
std::pair< float, float > delta(const double &theta1, const double &theta2, const double &phi1, const double &phi2)
void propagate(SteppingHelixStateInfo &state, const Plane &plane)
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
std::deque< SteppingHelixStateInfo > fullTrajectory_
void findEcalTrajectory(const FiducialVolume &)
GlobalVector momentum() const
SteppingHelixStateInfo getStateAtEcal()
static int position[264][3]
TkRotation< float > RotationType
const std::vector< SteppingHelixStateInfo > & getHOTrajectory() const
void findHOTrajectory(const FiducialVolume &)
FreeTrajectoryState const * freeState(bool withErrors=true) const
double minR(bool withTolerance=true) const
Point2DBase< float, LocalTag > Local2DPoint
void propagateForward(SteppingHelixStateInfo &state, float distance)
Log< level::Warning, false > LogWarning
void setStateAtIP(const SteppingHelixStateInfo &state)
static int sign(float number)
double maxR(bool withTolerance=true) const
void setMaxDetectorLength(float l=2200.)
SteppingHelixStateInfo getStateAtHcal()
double minZ(bool withTolerance=true) const
std::vector< SteppingHelixStateInfo > hcalTrajectory_
Geom::Theta< T > theta() const
void setMaxDetectorRadius(float r=800.)