41 void mergeOutward(
std::array<vector<DetGroup>,3> & groups,
42 std::vector<DetGroup> &
result ) {
44 Merger::orderAndMergeTwoLevels(
std::move(groups[0]),
46 if(!groups[2].
empty()) {
47 std::vector<DetGroup>
tmp;
55 void mergeInward(
std::array<vector<DetGroup>,3> & groups,
56 std::vector<DetGroup> & result ) {
58 Merger::orderAndMergeTwoLevels(
std::move(groups[2]),
60 if(!groups[0].
empty()) {
61 std::vector<DetGroup>
tmp;
73 std::vector<DetGroup> & result ) {
78 mergeOutward(groups,result);
80 mergeInward(groups,result);
84 mergeOutward(groups,result);
86 mergeInward(groups,result);
95 if( not theComponents) {
96 auto temp = std::make_unique<std::vector<const GeometricSearchDet*>>();
98 for (
auto c: theComps)
temp->push_back(
c);
99 std::vector<const GeometricSearchDet*>* expected =
nullptr;
100 if(theComponents.compare_exchange_strong(expected,
temp.get())) {
106 return *theComponents;
113 float ringMinZ =
std::abs( ringDisk.position().z()) - ringDisk.bounds().thickness()/2.;
114 float ringMaxZ =
std::abs( ringDisk.position().z()) + ringDisk.bounds().thickness()/2.;
115 ringPars[
i].thetaRingMin = ringDisk.innerRadius()/ ringMaxZ;
116 ringPars[
i].thetaRingMax = ringDisk.outerRadius()/ ringMinZ;
117 ringPars[
i].theRingR=( ringDisk.innerRadius() +
118 ringDisk.outerRadius())/2.;
125 theComponents{
nullptr}
130 if ( rings.size() != 3)
throw DetLayerException(
"Number of rings in TID layer is not equal to 3 !!");
133 for(
int i=0;
i!=3; ++
i) {
142 LogDebug(
"TkDetLayers") <<
"==== DEBUG TIDLayer =====" ;
143 LogDebug(
"TkDetLayers") <<
"r,zed pos , thickness, innerR, outerR: " 146 << this->specificSurface().bounds().thickness() <<
" , " 147 << this->specificSurface().innerRadius() <<
" , " 148 << this->specificSurface().outerRadius() ;
155 float theRmin = rings.front()->specificSurface().innerRadius();
156 float theRmax = rings.front()->specificSurface().outerRadius();
157 float theZmin = rings.front()->position().z() -
158 rings.front()->surface().bounds().thickness()/2;
159 float theZmax = rings.front()->position().z() +
160 rings.front()->surface().bounds().thickness()/2;
162 for (vector<const TIDRing*>::const_iterator
i = rings.begin();
i != rings.end();
i++) {
163 float rmin = (**i).specificSurface().innerRadius();
164 float rmax = (**i).specificSurface().outerRadius();
165 float zmin = (**i).position().z() - (**i).surface().bounds().thickness()/2.;
166 float zmax = (**i).position().z() + (**i).surface().bounds().thickness()/2.;
167 theRmin =
min( theRmin, rmin);
168 theRmax =
max( theRmax, rmax);
169 theZmin =
min( theZmin, zmin);
170 theZmax =
max( theZmax, zmax);
173 float zPos = (theZmax+theZmin)/2.;
178 theZmin-zPos, theZmax-zPos));
195 std::vector<DetGroup> &
result)
const 198 if ( ringIndices[0]==-1 ) {
199 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
203 std::array<vector<DetGroup>,3> groupsAtRingLevel;
206 #ifdef __INTEL_COMPILER 207 const int ringOrder[3]{1,2,0};
211 auto index = [&ringIndices,& ringOrder](
int i) {
return ringOrder[ringIndices[
i]];};
213 auto & closestResult = groupsAtRingLevel[
index(0)];
215 if ( closestResult.empty() ){
221 float rWindow =
computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
223 if(!
overlapInR(closestGel.trajectoryState(),ringIndices[1],rWindow)) {
224 result.swap(closestResult);
229 auto & nextResult = groupsAtRingLevel[
index(1)];
231 if(nextResult.empty()) {
232 result.swap(closestResult);
236 if(!
overlapInR(closestGel.trajectoryState(),ringIndices[2],rWindow) ) {
238 orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,
result);
242 auto & nextNextResult = groupsAtRingLevel[
index(2)];
244 if(nextNextResult.empty()) {
246 orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,
result);
251 orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,
result);
270 Crossing myXing( startPos, startDir,
rho, propDir );
275 for (
int i = 0;
i < 3 ;
i++ ) {
277 pair<bool,double> pathlen = myXing.pathLength( theRing);
278 if ( pathlen.first ) {
279 ringCrossings[
i] =
GlobalPoint( myXing.position(pathlen.second ));
291 if ( closestIndex<0 || nextIndex<0 )
return std::array<int,3>{{-1,-1,-1}};
292 int nextNextIndex = -1;
293 for(
int i=0;
i<3 ;
i++){
294 if(
i!= closestIndex &&
i!=nextIndex) {
300 std::array<int,3> indices{{closestIndex,nextIndex,nextNextIndex}};
315 return maxDistance.
y();
324 float rDiff =
std::abs( ringCrossing[0].
perp() - initialR);
325 for (
int i = 1;
i < 3 ;
i++){
328 if ( testDiff<rDiff ) {
340 int firstIndexToCheck = (closest != 0)? 0 : 1;
342 float rDiff =
std::abs( ringCrossing[firstIndexToCheck].
perp() - initialR);
343 int theBin = firstIndexToCheck;
344 for (
int i = firstIndexToCheck+1;
i < 3 ;
i++){
348 if ( testDiff<rDiff ) {
TkRotation< Scalar > RotationType
const std::vector< const GeometricSearchDet * > & components() const override __attribute__((cold))
std::vector< GeomDet const * > theBasicComps
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
Global3DPoint GlobalPoint
std::array< int, 3 > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
GlobalPoint globalPosition() const
Vector2DBase< float, LocalTag > Local2DVector
const BoundSurface & surface() const override
The surface of the GeometricSearchDet.
const Plane & surface() const
The nominal surface of the GeomDet.
Point3DBase< Scalar, GlobalTag > PositionType
virtual PropagationDirection propagationDirection() const final
TIDLayer(std::vector< const TIDRing * > &rings) __attribute__((cold))
Abs< T >::type abs(const T &t)
GeometricSearchDet::DetWithState DetWithState
std::atomic< std::vector< const GeometricSearchDet * > * > theComponents
void fillRingPars(int i) __attribute__((cold))
~TIDLayer() override __attribute__((cold))
bool overlapInR(const TrajectoryStateOnSurface &tsos, int i, double ymax) const __attribute__((hot))
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const override __attribute__((hot))
std::vector< std::vector< double > > tmp
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]
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est) const __attribute__((hot))
BoundDisk * computeDisk(const std::vector< const TIDRing * > &rings) const __attribute__((cold))
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
const TIDRing * theComps[3]
int findClosest(const GlobalPoint[3]) const __attribute__((hot))
int findNextIndex(const GlobalPoint[3], int) const __attribute__((hot))
const std::vector< const GeomDet * > & basicComponents() const override
double transverseCurvature() const