6 const double toleranceInSigmas,
8 std::vector<GlobalPoint> pointBuffer;
11 bool xLess(
false), xIn(
false), xMore(
false);
12 bool yLess(
false), yIn(
false), yMore(
false);
13 bool zLess(
false), zIn(
false), zMore(
false);
23 for (std::vector<GlobalPoint>::const_iterator it =
points.first; it !=
points.second; ++it) {
49 if (((xLess && !xIn && !xMore) || (!xLess && !xIn && xMore)) ||
50 ((yLess && !yIn && !yMore) || (!yLess && !yIn && yMore)) ||
51 ((zLess && !zIn && !zMore) || (!zLess && !zIn && zMore)))
62 float r11 = r22 * r33 - r23 *
r32;
63 float r12 = r23 * r31;
64 float r13 = -r22 * r31;
68 double absoluteTolerance = -1;
69 if (toleranceInSigmas > 0 && initialState) {
73 localErr.
scale(toleranceInSigmas);
74 float xx = localErr.
xx();
75 float xy = localErr.
xy();
76 float yy = localErr.
yy();
87 float semi1 =
sqrt(rotErr.
xx());
88 float semi2 =
sqrt(rotErr.
yy());
89 absoluteTolerance =
std::max(semi1, semi2);
94 double trajectorySegmentLength = (point2 - point1).
mag();
99 bool allBehind =
true;
100 bool allTooFar =
true;
101 std::vector<GlobalPoint>::const_iterator
p =
points.first;
103 edm::LogWarning(
"TrackAssociator") <<
"calo geometry for element " <<
id.rawId() <<
"is empty. Ignored";
109 if (localPoint.
z() < 0)
113 if (localPoint.
z() < trajectorySegmentLength)
118 localPoint = plane->toLocal(*
p);
119 double localPhi = localPoint.
phi();
120 if (localPoint.
z() < 0)
124 if (localPoint.
z() < trajectorySegmentLength)
135 double delta1 = fabs(localPhi -
maxPhi);
136 double delta2 = fabs(localPhi - 2 *
M_PI -
minPhi);
144 double delta1 = fabs(localPhi -
minPhi);
145 double delta2 = fabs(localPhi + 2 *
M_PI -
maxPhi);
153 <<
"Algorithm logic error - this should never happen. Problems with trajectory-volume matching.";
164 if (absoluteTolerance < 0)
166 double distanceToClosestLineSegment = 1e9;
167 std::vector<GlobalPoint>::const_iterator
i,
j;
174 double side1squared =
p1.perp2();
175 double side2squared =
p2.perp2();
176 double side3squared = (
p2.x() -
p1.x()) * (
p2.x() -
p1.x()) + (
p2.y() -
p1.y()) * (
p2.y() -
p1.y());
177 double area = fabs(
p1.x() *
p2.y() -
p2.x() *
p1.y()) / 2;
180 if (side1squared + side2squared > side3squared && side2squared + side3squared > side1squared &&
181 side1squared + side3squared > side1squared) {
183 if (
h < distanceToClosestLineSegment)
184 distanceToClosestLineSegment =
h;
186 if (
sqrt(side1squared) < distanceToClosestLineSegment)
187 distanceToClosestLineSegment =
sqrt(side1squared);
188 if (
sqrt(side2squared) < distanceToClosestLineSegment)
189 distanceToClosestLineSegment =
sqrt(side2squared);
192 if (distanceToClosestLineSegment < absoluteTolerance)
208 if (subDectorIndex != 0)
210 <<
"Calo sub-dectors are all handle as one sub-system, but subDetectorIndex is not zero.\n";
215 const DetId&
id, std::vector<GlobalPoint>&
points)
const {
218 LogDebug(
"TrackAssociator") <<
"Cannot find sub-detector geometry for " <<
id.rawId() <<
"\n";
219 return std::pair<const_iterator, const_iterator>(
dummy_.end(),
dummy_.end());
223 LogDebug(
"TrackAssociator") <<
"Cannot find CaloCell geometry for " <<
id.rawId() <<
"\n";
224 return std::pair<const_iterator, const_iterator>(
dummy_.end(),
dummy_.end());
227 return std::pair<const_iterator, const_iterator>(cor.begin(), cor.end());
LocalError scale(float s) const
TrajectoryStateOnSurface getStateOnSurface(const Surface &surf, bool returnTangentPlane=false) const
const LocalTrajectoryError & localError() const
LocalError rotate(float x, float y) const
Return a new LocalError, rotated by an angle defined by the direction (x,y)
constexpr SubDetector subDetGeom[21]
Geom::Phi< T > phi() const
LocalError positionError() const
GlobalPoint getPosition(const DetId &id) const override
void swap(Association< C > &lhs, Association< C > &rhs)
static PlanePointer build(Args &&... args)
void check_setup() const override
Basic3DVector unit() const
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::vector< GlobalPoint > dummy_
const CaloGeometry * geometry_
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
void getValidDetIds(unsigned int subDetectorIndex, std::vector< DetId > &) const override
std::vector< DetId > getValidDetIds() const
Get the list of all valid detector ids.
std::pair< const_iterator, const_iterator > getDetIdPoints(const DetId &id, std::vector< GlobalPoint > &points) const override
Log< level::Warning, false > LogWarning
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
bool crossedElement(const GlobalPoint &, const GlobalPoint &, const DetId &id, const double tolerance=-1, const SteppingHelixStateInfo *=nullptr) const override
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Power< A, B >::type pow(const A &a, const B &b)
virtual void check_setup() const