41 void mergeOutward(std::array<vector<DetGroup>,3> & groups,
42 std::vector<DetGroup> &
result ) {
44 Merger::orderAndMergeTwoLevels(std::move(groups[0]),
45 std::move(groups[1]),result,1,1);
46 if(!groups[2].
empty()) {
47 std::vector<DetGroup>
tmp;
49 Merger::orderAndMergeTwoLevels(std::move(tmp),std::move(groups[2]),result,1,1);
55 void mergeInward(std::array<vector<DetGroup>,3> & groups,
56 std::vector<DetGroup> & result ) {
58 Merger::orderAndMergeTwoLevels(std::move(groups[2]),
59 std::move(groups[1]),result,1,1);
60 if(!groups[0].
empty()) {
61 std::vector<DetGroup>
tmp;
63 Merger::orderAndMergeTwoLevels(std::move(tmp),std::move(groups[0]),result,1,1);
72 std::array<vector<DetGroup>,3> & groups,
73 std::vector<DetGroup> & result ) {
78 mergeOutward(groups,result);
80 mergeInward(groups,result);
84 mergeOutward(groups,result);
86 mergeInward(groups,result);
95 static std::vector<const GeometricSearchDet*> crap;
96 for (
auto c: theComps) crap.push_back(
c);
104 float ringMinZ = fabs( ringDisk.position().z()) - ringDisk.bounds().thickness()/2.;
105 float ringMaxZ = fabs( ringDisk.position().z()) + ringDisk.bounds().thickness()/2.;
106 ringPars[
i].thetaRingMin = ringDisk.innerRadius()/ ringMaxZ;
107 ringPars[
i].thetaRingMax = ringDisk.outerRadius()/ ringMinZ;
108 ringPars[
i].theRingR=( ringDisk.innerRadius() +
109 ringDisk.outerRadius())/2.;
119 if ( rings.size() != 3)
throw DetLayerException(
"Number of rings in TID layer is not equal to 3 !!");
122 for(
int i=0;
i!=3; ++
i) {
131 LogDebug(
"TkDetLayers") <<
"==== DEBUG TIDLayer =====" ;
132 LogDebug(
"TkDetLayers") <<
"r,zed pos , thickness, innerR, outerR: "
135 << this->specificSurface().bounds().thickness() <<
" , "
136 << this->specificSurface().innerRadius() <<
" , "
137 << this->specificSurface().outerRadius() ;
144 float theRmin = rings.front()->specificSurface().innerRadius();
145 float theRmax = rings.front()->specificSurface().outerRadius();
146 float theZmin = rings.front()->position().z() -
147 rings.front()->surface().bounds().thickness()/2;
148 float theZmax = rings.front()->position().z() +
149 rings.front()->surface().bounds().thickness()/2;
151 for (vector<const TIDRing*>::const_iterator
i = rings.begin();
i != rings.end();
i++) {
152 float rmin = (**i).specificSurface().innerRadius();
153 float rmax = (**i).specificSurface().outerRadius();
154 float zmin = (**i).position().z() - (**i).surface().bounds().thickness()/2.;
155 float zmax = (**i).position().z() + (**i).surface().bounds().thickness()/2.;
156 theRmin =
min( theRmin, rmin);
157 theRmax =
max( theRmax, rmax);
158 theZmin =
min( theZmin, zmin);
159 theZmax =
max( theZmax, zmax);
162 float zPos = (theZmax+theZmin)/2.;
167 theZmin-zPos, theZmax-zPos));
182 std::vector<DetGroup> &
result)
const
185 if ( ringIndices[0]==-1 ) {
186 edm::LogError(
"TkDetLayers") <<
"TkRingedForwardLayer::groupedCompatibleDets : error in CrossingProximity";
190 std::array<vector<DetGroup>,3> groupsAtRingLevel;
194 auto index = [&ringIndices,& ringOrder](
int i) {
return ringOrder[ringIndices[
i]];};
196 auto & closestResult = groupsAtRingLevel[
index(0)];
198 if ( closestResult.empty() ){
204 float rWindow =
computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
206 if(!
overlapInR(closestGel.trajectoryState(),ringIndices[1],rWindow)) {
207 result.swap(closestResult);
212 auto & nextResult = groupsAtRingLevel[
index(1)];
214 if(nextResult.empty()) {
215 result.swap(closestResult);
219 if(!
overlapInR(closestGel.trajectoryState(),ringIndices[2],rWindow) ) {
221 orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,
result);
225 auto & nextNextResult = groupsAtRingLevel[
index(2)];
227 if(nextNextResult.empty()) {
229 orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,
result);
234 orderAndMergeLevels(closestGel.trajectoryState(),prop,groupsAtRingLevel,
result);
253 Crossing myXing( startPos, startDir,
rho, propDir );
258 for (
int i = 0;
i < 3 ;
i++ ) {
260 pair<bool,double> pathlen = myXing.pathLength( theRing);
261 if ( pathlen.first ) {
262 ringCrossings[
i] =
GlobalPoint( myXing.position(pathlen.second ));
274 if ( closestIndex<0 || nextIndex<0 )
return std::array<int,3>{{-1,-1,-1}};
275 int nextNextIndex = -1;
276 for(
int i=0;
i<3 ;
i++){
277 if(
i!= closestIndex &&
i!=nextIndex) {
283 std::array<int,3> indices{{closestIndex,nextIndex,nextNextIndex}};
298 return maxDistance.
y();
307 float rDiff = fabs( ringCrossing[0].
perp() - initialR);
308 for (
int i = 1;
i < 3 ;
i++){
310 float testDiff = fabs( ringCrossing[
i].
perp() - ringR);
311 if ( testDiff<rDiff ) {
323 int firstIndexToCheck = (closest != 0)? 0 : 1;
325 float rDiff = fabs( ringCrossing[0].
perp() - initialR);
326 int theBin = firstIndexToCheck;
327 for (
int i = firstIndexToCheck+1;
i < 3 ;
i++){
330 float testDiff = fabs( ringCrossing[
i].
perp() - ringR);
331 if ( testDiff<rDiff ) {
TkRotation< Scalar > RotationType
virtual const std::vector< const GeometricSearchDet * > & components() const __attribute__((cold))
virtual PropagationDirection propagationDirection() const
std::vector< GeomDet const * > theBasicComps
Global3DPoint GlobalPoint
std::array< int, 3 > ringIndicesByCrossingProximity(const TrajectoryStateOnSurface &startingState, const Propagator &prop) const
GlobalPoint globalPosition() const
Vector2DBase< float, LocalTag > Local2DVector
const Plane & surface() const
The nominal surface of the GeomDet.
Point3DBase< Scalar, GlobalTag > PositionType
virtual const std::vector< const GeomDet * > & basicComponents() const
TIDLayer(std::vector< const TIDRing * > &rings) __attribute__((cold))
~TIDLayer() __attribute__((cold))
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
virtual const BoundSurface & surface() const
The surface of the GeometricSearchDet.
void fillRingPars(int i) __attribute__((cold))
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
bool overlapInR(const TrajectoryStateOnSurface &tsos, int i, double ymax) const __attribute__((hot))
std::vector< std::vector< double > > tmp
T perp() const
Magnitude of transverse component.
GlobalVector globalMomentum() const
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))
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
int findNextIndex(const GlobalPoint[3], int) const __attribute__((hot))
void groupedCompatibleDetsV(const TrajectoryStateOnSurface &tsos, const Propagator &prop, const MeasurementEstimator &est, std::vector< DetGroup > &result) const __attribute__((hot))
double transverseCurvature() const