25 PixelForwardLayerPhase1::PixelForwardLayerPhase1(vector<const PixelBlade*>& blades):
27 theComps(blades.
begin(),blades.
end())
29 for(vector<const GeometricSearchDet*>::const_iterator it=theComps.begin();
30 it!=theComps.end();it++){
31 theBasicComps.insert(theBasicComps.end(),
32 (**it).basicComponents().begin(),
33 (**it).basicComponents().end());
38 setSurface( computeSurface() );
48 float theRmin = (*(theComps.begin()))->surface().position().perp();
49 float theRmax = theRmin;
50 for(vector<const GeometricSearchDet*>::const_iterator it=theComps.begin();
51 it!=theComps.end(); it++){
52 theRmin =
std::min( theRmin, (*it)->surface().position().perp());
53 theRmax =
std::max( theRmax, (*it)->surface().position().perp());
55 float split_inner_outer_radius = 0.5 * (theRmin + theRmax);
57 for(vector<const GeometricSearchDet*>::const_iterator it=theComps.begin();
58 it!=theComps.end();it++){
59 if((**it).surface().position().perp() <= split_inner_outer_radius) ++_num_innerpanels;
61 _num_outerpanels = theComps.size() - _num_innerpanels;
66 theBinFinder_inner = BinFinderType( theComps.front()->surface().position().phi(),
68 theBinFinder_outer = BinFinderType( theComps[_num_innerpanels]->surface().
position().
phi(),
73 PixelForwardLayerPhase1::~PixelForwardLayerPhase1(){
74 vector<const GeometricSearchDet*>::const_iterator
i;
75 for (i=theComps.begin(); i!=theComps.end(); i++) {
84 std::vector<DetGroup> &
result)
const {
85 vector<DetGroup> closestResult_inner;
86 vector<DetGroup> closestResult_outer;
87 vector<DetGroup> nextResult_inner;
88 vector<DetGroup> nextResult_outer;
89 vector<DetGroup> result_inner;
90 vector<DetGroup> result_outer;
91 int frontindex_inner = 0;
92 int frontindex_outer = 0;
93 SubTurbineCrossings crossings_inner;
94 SubTurbineCrossings crossings_outer;
98 if (!crossings_inner.isValid){
102 if (!crossings_outer.isValid){
108 Adder::add( *theComps[theBinFinder_inner.binIndex(crossings_inner.closestIndex)],
109 tsos, prop, est, closestResult_inner);
111 if(closestResult_inner.empty()){
112 Adder::add( *theComps[theBinFinder_inner.binIndex(crossings_inner.nextIndex)],
113 tsos, prop, est, result_inner);
114 frontindex_inner = crossings_inner.nextIndex;
116 if (
Adder::add( *theComps[theBinFinder_inner.binIndex(crossings_inner.nextIndex)],
117 tsos, prop, est, nextResult_inner)) {
119 int theHelicity = computeHelicity(theComps[theBinFinder_inner.binIndex(crossings_inner.closestIndex)],
120 theComps[theBinFinder_inner.binIndex(crossings_inner.nextIndex)] );
122 theHelicity, crossingSide);
123 if (theHelicity == crossingSide) frontindex_inner = crossings_inner.closestIndex;
124 else frontindex_inner = crossings_inner.nextIndex;
126 result_inner.swap(closestResult_inner);
127 frontindex_inner = crossings_inner.closestIndex;
130 if(!closestResult_inner.empty()){
133 searchNeighbors( tsos, prop, est, crossings_inner, window, result_inner,
true);
141 Adder::add( *theComps[(theBinFinder_outer.binIndex(crossings_outer.closestIndex)) + _num_innerpanels],
142 tsos, prop, est, closestResult_outer);
144 if(closestResult_outer.empty()){
145 Adder::add( *theComps[theBinFinder_outer.binIndex(crossings_outer.nextIndex) + _num_innerpanels],
146 tsos, prop, est, result_outer);
147 frontindex_outer = crossings_outer.nextIndex;
149 if (
Adder::add( *theComps[theBinFinder_outer.binIndex(crossings_outer.nextIndex) + _num_innerpanels],
150 tsos, prop, est, nextResult_outer)) {
152 int theHelicity = computeHelicity(theComps[theBinFinder_outer.binIndex(crossings_outer.closestIndex) + _num_innerpanels],
153 theComps[theBinFinder_outer.binIndex(crossings_outer.nextIndex) + _num_innerpanels] );
155 theHelicity, crossingSide);
156 if (theHelicity == crossingSide) frontindex_outer = crossings_outer.closestIndex;
157 else frontindex_outer = crossings_outer.nextIndex;
159 result_outer.swap(closestResult_outer);
160 frontindex_outer = crossings_outer.closestIndex;
163 if(!closestResult_outer.empty()){
165 float window =
computeWindowSize( closestGel.det(), closestGel.trajectoryState(), est);
166 searchNeighbors( tsos, prop, est, crossings_inner, window, result_outer,
false);
169 if(result_inner.empty() && result_outer.empty() )
return;
170 if(result_inner.empty()) result.swap(result_outer);
171 else if(result_outer.empty()) result.swap(result_inner);
174 int theHelicity = computeHelicity(theComps[theBinFinder_inner.binIndex(frontindex_inner)],
175 theComps[theBinFinder_outer.binIndex(frontindex_outer) + _num_innerpanels] );
177 theHelicity, crossingSide);
187 const SubTurbineCrossings& crossings,
189 vector<DetGroup>& result,
190 bool innerDisk)
const
196 int negStart =
min( crossings.closestIndex, crossings.nextIndex) - 1;
197 int posStart =
max( crossings.closestIndex, crossings.nextIndex) + 1;
199 int quarter = theComps.size()/4;
200 if(innerDisk) quarter = _num_innerpanels/4;
201 else quarter = _num_outerpanels/4;
203 vector<DetGroup>
tmp;
204 vector<DetGroup> newResult;
205 for (
int idet=negStart; idet >= negStart - quarter+1; idet--) {
212 if (!
Adder::add( *neighbor, tsos, prop, est, tmp))
break;
213 int theHelicity = computeHelicity(theComps[theBinFinder_inner.binIndex(idet)],
214 theComps[theBinFinder_inner.binIndex(idet+1)] );
215 Merger::orderAndMergeTwoLevels( std::move(tmp), std::move(result), newResult, theHelicity, crossingSide);
217 const GeometricSearchDet* neighbor = theComps[(theBinFinder_outer.binIndex(idet)) + _num_innerpanels];
220 if (!
Adder::add( *neighbor, tsos, prop, est, tmp))
break;
221 int theHelicity = computeHelicity(theComps[(theBinFinder_outer.binIndex(idet)) + _num_innerpanels],
222 theComps[(theBinFinder_outer.binIndex(idet+1)) + _num_innerpanels] );
223 Merger::orderAndMergeTwoLevels( std::move(tmp), std::move(result), newResult, theHelicity, crossingSide);
225 result.swap(newResult);
227 for (
int idet=posStart; idet < posStart + quarter-1; idet++) {
234 if (!
Adder::add( *neighbor, tsos, prop, est, tmp))
break;
235 int theHelicity = computeHelicity(theComps[theBinFinder_inner.binIndex(idet-1)],
236 theComps[theBinFinder_inner.binIndex(idet)] );
237 Merger::orderAndMergeTwoLevels( std::move(result), std::move(tmp), newResult, theHelicity, crossingSide);
239 const GeometricSearchDet* neighbor = theComps[(theBinFinder_outer.binIndex(idet)) + _num_innerpanels];
242 if (!
Adder::add( *neighbor, tsos, prop, est, tmp))
break;
243 int theHelicity = computeHelicity(theComps[(theBinFinder_outer.binIndex(idet-1)) + _num_innerpanels],
244 theComps[(theBinFinder_outer.binIndex(idet)) + _num_innerpanels] );
245 Merger::orderAndMergeTwoLevels( std::move(result), std::move(tmp), newResult, theHelicity, crossingSide);
247 result.swap(newResult);
258 PixelForwardLayerPhase1::SubTurbineCrossings
268 HelixArbitraryPlaneCrossing turbineCrossing( startPos, startDir,
rho,
271 pair<bool,double> thePath = turbineCrossing.pathLength( specificSurface() );
273 if (!thePath.first) {
275 return SubTurbineCrossings();
280 int closestIndex = 0;
282 closestIndex = theBinFinder_inner.binIndex(turbinePoint.phi());
284 closestIndex = theBinFinder_outer.binIndex(turbinePoint.phi());
286 HelixArbitraryPlaneCrossing2Order theBladeCrossing(turbinePoint, turbineDir,
rho);
288 float closestDist = 0;
291 const Plane& closestPlane( static_cast<const Plane&>(
292 theComps[closestIndex]->surface()));
294 pair<bool,double> theClosestBladePath = theBladeCrossing.pathLength( closestPlane );
295 LocalPoint closestPos = closestPlane.toLocal(
GlobalPoint(theBladeCrossing.position(theClosestBladePath.second)) );
297 closestDist = closestPos.
x();
299 nextIndex =
PhiLess()( closestPlane.position().phi(), turbinePoint.phi()) ?
300 closestIndex+1 : closestIndex-1;
302 const Plane& closestPlane( static_cast<const Plane&>(
303 theComps[closestIndex + _num_innerpanels]->surface()));
305 pair<bool,double> theClosestBladePath = theBladeCrossing.pathLength( closestPlane );
306 LocalPoint closestPos = closestPlane.toLocal(
GlobalPoint(theBladeCrossing.position(theClosestBladePath.second)) );
308 closestDist = closestPos.
x();
310 nextIndex =
PhiLess()( closestPlane.position().phi(), turbinePoint.phi()) ?
311 closestIndex+1 : closestIndex-1;
316 const Plane& nextPlane( static_cast<const Plane&>(
317 theComps[ theBinFinder_inner.binIndex(nextIndex)]->surface()));
318 pair<bool,double> theNextBladePath = theBladeCrossing.pathLength( nextPlane );
319 LocalPoint nextPos = nextPlane.toLocal(
GlobalPoint(theBladeCrossing.position(theNextBladePath.second)) );
320 nextDist = nextPos.
x();
322 const Plane& nextPlane( static_cast<const Plane&>(
323 theComps[ theBinFinder_outer.binIndex(nextIndex) + _num_innerpanels]->surface()));
324 pair<bool,double> theNextBladePath = theBladeCrossing.pathLength( nextPlane );
325 LocalPoint nextPos = nextPlane.toLocal(
GlobalPoint(theBladeCrossing.position(theNextBladePath.second)) );
326 nextDist = nextPos.
x();
330 return SubTurbineCrossings( closestIndex, nextIndex, nextDist);
333 return SubTurbineCrossings( nextIndex, closestIndex, closestDist);
Global3DPoint GlobalPoint
GlobalPoint globalPosition() const
void add(const std::vector< const T * > &source, std::vector< const T * > &dest)
Vector2DBase< float, LocalTag > Local2DVector
const Plane & surface() const
The nominal surface of the GeomDet.
static int position[TOTALCHAMBERS][3]
virtual PropagationDirection propagationDirection() const GCC11_FINAL
const T & max(const T &a, const T &b)
Abs< T >::type abs(const T &t)
static int endcapSide(const TrajectoryStateOnSurface &startingState, const Propagator &prop)
std::pair< const GeomDet *, TrajectoryStateOnSurface > DetWithState
float computeWindowSize(const GeomDet *det, const TrajectoryStateOnSurface &tsos, const MeasurementEstimator &est)
virtual Local2DVector maximalLocalDisplacement(const TrajectoryStateOnSurface &ts, const Plane &plane) const
virtual const Surface::PositionType & position() const
Returns position of the surface.
std::vector< std::vector< double > > tmp
GlobalVector globalMomentum() const
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