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());
561 wideTrajectory->push_back(
target->toGlobal(bounds[
index]));
567 return wideTrajectory;