23 if (not theComponents) {
24 std::unique_ptr<std::vector<const GeometricSearchDet*>>
temp(
new 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.;
42 ringPars[
i].thetaRingMin = ringDisk.innerRadius()/ ringMaxZ;
43 ringPars[
i].thetaRingMax = ringDisk.outerRadius()/ ringMinZ;
44 ringPars[
i].theRingR=( ringDisk.innerRadius() +
45 ringDisk.outerRadius())/2.;
52 theComponents{
nullptr}
58 setSurface( computeDisk( rings ) );
63 theBasicComps.insert(theBasicComps.end(),
64 (*rings[
i]).basicComponents().begin(),
65 (*rings[
i]).basicComponents().end());
69 LogDebug(
"TkDetLayers") <<
"==== DEBUG Phase2OTECRingedLayer =====" ;
70 LogDebug(
"TkDetLayers") <<
"r,zed pos , thickness, innerR, outerR: "
73 << this->specificSurface().bounds().thickness() <<
" , "
74 << this->specificSurface().innerRadius() <<
" , "
75 << this->specificSurface().outerRadius() ;
82 float theRmin = rings.front()->specificSurface().innerRadius();
83 float theRmax = rings.front()->specificSurface().outerRadius();
84 float theZmin = rings.front()->position().z() -
85 rings.front()->surface().bounds().thickness()/2;
86 float theZmax = rings.front()->position().z() +
87 rings.front()->surface().bounds().thickness()/2;
89 for (vector<const Phase2OTECRing*>::const_iterator
i = rings.begin();
i != rings.end();
i++) {
90 float rmin = (**i).specificSurface().innerRadius();
91 float rmax = (**i).specificSurface().outerRadius();
92 float zmin = (**i).position().z() - (**i).surface().bounds().thickness()/2.;
93 float zmax = (**i).position().z() + (**i).surface().bounds().thickness()/2.;
94 theRmin =
min( theRmin, rmin);
95 theRmax =
max( theRmax, rmax);
96 theZmin =
min( theZmin, zmin);
97 theZmax =
max( theZmax, zmax);
100 float zPos = (theZmax+theZmin)/2.;
105 theZmin-zPos, theZmax-zPos));
122 std::vector<DetGroup> &
result)
const
125 if ( ringIndices[0]==-1 || ringIndices[1] ==-1 || ringIndices[2] == -1 ) {
126 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
131 constexpr int ringOrder[
NOTECRINGS]{0,1,0,1,0,1,0,1,0,1,0,1,0,1,0};
132 auto index = [&ringIndices,& ringOrder](
int i) {
return ringOrder[ringIndices[
i]];};
134 std::vector<DetGroup> closestResult;
137 if ( closestResult.empty() ){
143 float rWindow =
computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
147 bool ring1ok = ringIndices[1] != -1 &&
overlapInR(closestGel.trajectoryState(),ringIndices[1],rWindow);
148 bool ring2ok = ringIndices[2] != -1 &&
overlapInR(closestGel.trajectoryState(),ringIndices[2],rWindow);
166 << ringIndices[0] <<
" "
167 << ringIndices[1] <<
" "
168 << ringIndices[2] <<
" in one plane. Only the first two will be considered";
174 std::vector<DetGroup> ring1res;
179 std::vector<DetGroup> ring2res;
185 result.swap(closestResult);
191 std::vector<DetGroup> ring2res;
196 std::vector<DetGroup> ring1res;
202 result.swap(closestResult);
207 std::vector<DetGroup> ring12res;
209 std::vector<DetGroup> ring1res;
211 ring12res.swap(ring1res);
214 std::vector<DetGroup> ring2res;
218 if(!ring12res.empty()) {
223 result.swap(closestResult);
245 Crossing myXing( startPos, startDir,
rho, propDir );
252 pair<bool,double> pathlen = myXing.pathLength( theRing);
253 if ( pathlen.first ) {
254 ringCrossings[
i] =
GlobalPoint( myXing.position(pathlen.second ));
282 return maxDistance.
y();
288 std::array<int,3> theBins={{-1,-1,-1}};
291 float rDiff0 =
std::abs( ringCrossing[0].
perp() - initialR);
297 if ( testDiff<rDiff0 ) {
301 theBins[2] = theBins[1];
302 theBins[1] = theBins[0];
306 if ( rDiff1 < 0 || testDiff<rDiff1 ) {
309 theBins[2] = theBins[1];
313 if ( rDiff2 < 0 || testDiff<rDiff2 ) {
TkRotation< Scalar > RotationType
void fillRingPars(int i) __attribute__((cold))
virtual PropagationDirection propagationDirection() const
const Phase2OTECRing * theComps[15]
virtual const std::vector< const GeometricSearchDet * > & components() const __attribute__((cold))
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
Vector2DBase< float, LocalTag > Local2DVector
std::array< int, 3 > findThreeClosest(const GlobalPoint[15]) const __attribute__((hot))
const Plane & surface() const
The nominal surface of the GeomDet.
BoundDisk * computeDisk(const std::vector< const Phase2OTECRing * > &rings) const __attribute__((cold))
Point3DBase< Scalar, GlobalTag > PositionType
static void addSameLevel(std::vector< DetGroup > &&gvec, std::vector< DetGroup > &result)
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
Phase2OTECRingedLayer(std::vector< const Phase2OTECRing * > &rings) __attribute__((cold))
Abs< T >::type abs(const T &t)
bool overlapInR(const TrajectoryStateOnSurface &tsos, int i, double ymax) const __attribute__((hot))
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
std::array< int, 3 > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
std::atomic< std::vector< const GeometricSearchDet * > * > theComponents
T perp() const
Magnitude of transverse component.
GlobalVector globalMomentum() const
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
~Phase2OTECRingedLayer() __attribute__((cold))