23 if (not theComponents) {
24 auto temp = std::make_unique<std::vector<const GeometricSearchDet*>>();
26 for (
auto c: theComps)
temp->push_back(
c);
27 std::vector<const GeometricSearchDet*>* expected =
nullptr;
28 if(theComponents.compare_exchange_strong(expected,
temp.get())) {
33 return *theComponents;
40 float ringMinZ =
std::abs( ringDisk.position().z()) - ringDisk.bounds().thickness()/2.;
41 float ringMaxZ =
std::abs( ringDisk.position().z()) + ringDisk.bounds().thickness()/2.;
45 tempPar.
theRingR=( ringDisk.innerRadius() +
46 ringDisk.outerRadius())/2.;
47 ringPars.push_back(tempPar);
54 theComponents{
nullptr}
60 LogDebug(
"TkDetLayers") <<
"Number of rings in Phase2 OT EC layer is " <<
theRingSize << std::endl;
63 for(
unsigned int i=0;
i!=rings.size(); ++
i) {
72 LogDebug(
"TkDetLayers") <<
"==== DEBUG Phase2EndcapLayer =====" ;
73 LogDebug(
"TkDetLayers") <<
"r,zed pos , thickness, innerR, outerR: " 76 << this->specificSurface().bounds().thickness() <<
" , " 77 << this->specificSurface().innerRadius() <<
" , " 78 << this->specificSurface().outerRadius() ;
85 float theRmin = rings.front()->specificSurface().innerRadius();
86 float theRmax = rings.front()->specificSurface().outerRadius();
87 float theZmin = rings.front()->position().z() -
88 rings.front()->surface().bounds().thickness()/2;
89 float theZmax = rings.front()->position().z() +
90 rings.front()->surface().bounds().thickness()/2;
92 for (vector<const Phase2EndcapRing*>::const_iterator
i = rings.begin();
i != rings.end();
i++) {
93 float rmin = (**i).specificSurface().innerRadius();
94 float rmax = (**i).specificSurface().outerRadius();
95 float zmin = (**i).position().z() - (**i).surface().bounds().thickness()/2.;
96 float zmax = (**i).position().z() + (**i).surface().bounds().thickness()/2.;
97 theRmin =
min( theRmin, rmin);
98 theRmax =
max( theRmax, rmax);
99 theZmin =
min( theZmin, zmin);
100 theZmax =
max( theZmax, zmax);
103 float zPos = (theZmax+theZmin)/2.;
108 theZmin-zPos, theZmax-zPos));
125 std::vector<DetGroup> &
result)
const 128 if ( ringIndices[0]==-1 || ringIndices[1] ==-1 || ringIndices[2] == -1 ) {
129 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
138 std::fill(ringOrder.begin(), ringOrder.end(), 1);
142 if(
i % 2 == 0) ringOrder[
i] = 0;
145 std::fill(ringOrder.begin(), ringOrder.end(), 0);
147 if(
i % 2 == 0) ringOrder[
i] = 1;
150 throw DetLayerException(
"Rings in Endcap Layer have same z position, no idea how to order them!");
154 auto index = [&ringIndices,& ringOrder](
int i) {
return ringOrder[ringIndices[
i]];};
156 std::vector<DetGroup> closestResult;
157 theComps[ringIndices[0]]->groupedCompatibleDetsV( startingState, prop, est, closestResult);
159 if ( closestResult.empty() ){
160 theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, result);
165 float rWindow =
computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
169 bool ring1ok = ringIndices[1] != -1 &&
overlapInR(closestGel.trajectoryState(),ringIndices[1],rWindow);
170 bool ring2ok = ringIndices[2] != -1 &&
overlapInR(closestGel.trajectoryState(),ringIndices[2],rWindow);
188 << ringIndices[0] <<
" " 189 << ringIndices[1] <<
" " 190 << ringIndices[2] <<
" in one plane. Only the first two will be considered";
196 std::vector<DetGroup> ring1res;
197 theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, ring1res);
201 std::vector<DetGroup> ring2res;
202 theComps[ringIndices[2]]->groupedCompatibleDetsV( startingState, prop, est, ring2res);
207 result.swap(closestResult);
213 std::vector<DetGroup> ring2res;
214 theComps[ringIndices[2]]->groupedCompatibleDetsV( startingState, prop, est, ring2res);
218 std::vector<DetGroup> ring1res;
219 theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, ring1res);
224 result.swap(closestResult);
229 std::vector<DetGroup> ring12res;
231 std::vector<DetGroup> ring1res;
232 theComps[ringIndices[1]]->groupedCompatibleDetsV( startingState, prop, est, ring1res);
233 ring12res.swap(ring1res);
236 std::vector<DetGroup> ring2res;
237 theComps[ringIndices[2]]->groupedCompatibleDetsV( startingState, prop, est, ring2res);
240 if(!ring12res.empty()) {
245 result.swap(closestResult);
267 Crossing myXing( startPos, startDir,
rho, propDir );
269 std::vector<GlobalPoint> ringCrossings;
275 pair<bool,double> pathlen = myXing.pathLength( theRing);
276 if ( pathlen.first ) {
277 ringCrossings.push_back(
GlobalPoint( myXing.position(pathlen.second )));
305 return maxDistance.
y();
311 std::array<int,3> theBins={{-1,-1,-1}};
313 float initialR =
ringPars[0].theRingR;
314 float rDiff0 =
std::abs( ringCrossing[0].
perp() - initialR);
320 if ( testDiff<rDiff0 ) {
324 theBins[2] = theBins[1];
325 theBins[1] = theBins[0];
329 if ( rDiff1 < 0 || testDiff<rDiff1 ) {
332 theBins[2] = theBins[1];
336 if ( rDiff2 < 0 || testDiff<rDiff2 ) {
TkRotation< Scalar > RotationType
std::vector< const Phase2EndcapRing * > theComps
void fillRingPars(int i) __attribute__((cold))
std::array< int, 3 > findThreeClosest(std::vector< GlobalPoint >) const __attribute__((hot))
Global3DPoint GlobalPoint
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
bool overlapInR(const TrajectoryStateOnSurface &tsos, int i, double ymax) const __attribute__((hot))
std::atomic< std::vector< const GeometricSearchDet * > * > theComponents
GlobalPoint globalPosition() const
Vector2DBase< float, LocalTag > Local2DVector
~Phase2EndcapLayer() override __attribute__((cold))
const Plane & surface() const
The nominal surface of the GeomDet.
Point3DBase< Scalar, GlobalTag > PositionType
static void addSameLevel(std::vector< DetGroup > &&gvec, std::vector< DetGroup > &result)
virtual PropagationDirection propagationDirection() const final
BoundDisk * computeDisk(const std::vector< const Phase2EndcapRing * > &rings) const __attribute__((cold))
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
Abs< T >::type abs(const T &t)
Phase2EndcapLayer(std::vector< const Phase2EndcapRing * > &rings, const bool isOT) __attribute__((cold))
GeometricSearchDet::DetWithState DetWithState
std::vector< GeomDet const * > theBasicComps
const std::vector< const GeomDet * > & basicComponents() const override
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
std::array< int, 3 > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
std::vector< RingPar > ringPars
T perp() const
Magnitude of transverse component.
GlobalVector globalMomentum() const
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const =0
static int position[264][3]
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
static void orderAndMergeTwoLevels(std::vector< DetGroup > &&one, std::vector< DetGroup > &&two, std::vector< DetGroup > &result, int firstIndex, int firstCrossed)
double transverseCurvature() const