73 std::vector< std::vector<double> >* AllLayerZs,
74 std::vector< std::vector<double> >* AllLayerPhis,
75 std::vector< std::vector<int> >* AllSliceWidths,
77 std::vector<long>* FilledLayerIndices )
80 for (
int filledLayer = 0; filledLayer < FilledLayerTotal; filledLayer++ )
83 int layerIndex = ( *FilledLayerIndices )[ filledLayer ];
86 ( *AllLayerRhos )[ layerIndex ].insert(
87 ( *AllLayerRhos )[ layerIndex ].end(),
92 ( *AllLayerZs )[ layerIndex ].insert(
93 ( *AllLayerZs )[ layerIndex ].end(),
98 ( *AllLayerPhis )[ layerIndex ].insert(
99 ( *AllLayerPhis )[ layerIndex ].end(),
104 int previousTotal = ( *AllSliceWidths )[ layerIndex ][
m_sliceIndex ];
182 std::vector<double>* WeightHistogram,
183 std::vector<long>* OtherChargeHitHistogram,
184 std::vector<double>* OtherChargeWeightHistogram,
185 const std::vector< std::vector<long> >& ExtraSlices,
186 const long PhiToSubtract,
188 const int TripletMode,
189 const bool ChargeAware,
190 std::vector< std::vector<long> >* AllHits,
191 std::vector< std::vector<double> >* AllWeights )
200 for (
int innerFilledLayer = 0; innerFilledLayer < InnerLayerLimit; innerFilledLayer++ )
203 int innerLayerIndex = ( *m_filledLayerIndices )[ innerFilledLayer ];
206 for (
unsigned int innerPointIndex =
m_sliceStart[ innerLayerIndex ]; innerPointIndex <
m_sliceEnd[ innerLayerIndex ]; innerPointIndex++ )
209 double innerPointZ = ( *m_allLayerZs )[ innerLayerIndex ][ innerPointIndex ];
210 double innerPointRho = ( *m_allLayerRhos )[ innerLayerIndex ][ innerPointIndex ];
211 double innerPointPhi = ( *m_allLayerPhis )[ innerLayerIndex ][ innerPointIndex ];
214 for (
int outerFilledLayer = innerFilledLayer + 1; outerFilledLayer <
m_filledLayerTotal; outerFilledLayer++ )
217 int outerLayerIndex = ( *m_filledLayerIndices )[ outerFilledLayer ];
220 int neighbourNumber = ExtraSlices[ innerLayerIndex ][ outerLayerIndex ];
223 neighbourNumber -= PhiToSubtract;
225 if ( neighbourNumber < 1 )
232 if ( minimumSlice < 0 )
236 unsigned int maximumSlice =
m_sliceIndex + neighbourNumber + 1;
239 maximumSlice = ( *m_allSliceWidths )[ outerLayerIndex ].size() - 1;
243 int minimumPointIndex = ( *m_allSliceWidths )[ outerLayerIndex ][ minimumSlice ];
244 int maximumPointIndex = ( *m_allSliceWidths )[ outerLayerIndex ][ maximumSlice ];
247 for (
int outerPointIndex = minimumPointIndex; outerPointIndex < maximumPointIndex; outerPointIndex++ )
250 double outerPointZ = ( *m_allLayerZs )[ outerLayerIndex ][ outerPointIndex ];
251 double outerPointRho = ( *m_allLayerRhos )[ outerLayerIndex ][ outerPointIndex ];
252 double outerPointPhi = ( *m_allLayerPhis )[ outerLayerIndex ][ outerPointIndex ];
255 double invDeltaRho = 1.0 / ( innerPointRho - outerPointRho );
256 double axisZ = ( outerPointZ * innerPointRho - innerPointZ * outerPointRho ) * invDeltaRho;
268 double kValue = ( outerPointPhi - innerPointPhi ) * invDeltaRho;
269 double pValue = ( outerPointPhi * innerPointRho - innerPointPhi * outerPointRho ) * invDeltaRho;
273 int tripletsFound =
FindTriplet( outerFilledLayer, outerPointIndex,
274 axisZ, kValue, pValue,
275 ExtraSlices, PhiToSubtract, ( TripletMode == 1 ), outerSliceIndex );
295 if ( AllHits && AllWeights )
297 FillNeighbours( innerLayerIndex, outerSliceIndex, tripletsFound, axisZIndex, axisZ,
298 ExtraSlices, PhiToSubtract, ChargeAware,
299 AllHits, AllWeights );
304 if ( !ChargeAware || outerSliceIndex <=
m_sliceIndex + 1 )
306 ( *HitHistogram )[ axisZIndex ] += tripletsFound;
307 ( *WeightHistogram )[ axisZIndex ] += axisZ * ( double )tripletsFound;
309 if ( ChargeAware && outerSliceIndex >=
m_sliceIndex - 1 )
311 ( *OtherChargeHitHistogram )[ axisZIndex ] += tripletsFound;
312 ( *OtherChargeWeightHistogram )[ axisZIndex ] += axisZ * ( double )tripletsFound;
324 if ( AllHits && AllWeights )
326 FillNeighbours( innerLayerIndex, outerSliceIndex, 1, axisZIndex, axisZ,
327 ExtraSlices, PhiToSubtract, ChargeAware,
328 AllHits, AllWeights );
333 if ( !ChargeAware || outerSliceIndex <=
m_sliceIndex + 1 )
335 ( *HitHistogram )[ axisZIndex ]++;
336 ( *WeightHistogram )[ axisZIndex ] += axisZ;
338 if ( ChargeAware && outerSliceIndex >=
m_sliceIndex - 1 )
340 ( *OtherChargeHitHistogram )[ axisZIndex ]++;
341 ( *OtherChargeWeightHistogram )[ axisZIndex ] += axisZ;
354 double CurrentZValue,
355 double CurrentKValue,
356 double CurrentPValue,
357 const std::vector< std::vector<long> >& ExtraSlices,
358 const long PhiToSubtract,
bool FastTriplet,
int OuterSliceIndex )
363 int outerLayerIndex = ( *m_filledLayerIndices )[ OuterFilledLayer ];
366 double outerPointZ = ( *m_allLayerZs )[ outerLayerIndex ][ OuterPointIndex ];
367 double outerPointRho = ( *m_allLayerRhos )[ outerLayerIndex ][ OuterPointIndex ];
368 double outerPointPhi = ( *m_allLayerPhis )[ outerLayerIndex ][ OuterPointIndex ];
371 for (
int tripletFilledLayer = OuterFilledLayer + 1; tripletFilledLayer <
m_filledLayerTotal; tripletFilledLayer++ )
374 int tripletLayerIndex = ( *m_filledLayerIndices )[ tripletFilledLayer ];
377 int neighbourNumber = ExtraSlices[ outerLayerIndex ][ tripletLayerIndex ];
380 neighbourNumber -= PhiToSubtract;
382 if ( neighbourNumber < 1 )
388 int minimumSlice = OuterSliceIndex - neighbourNumber;
392 minimumSlice = OuterSliceIndex - 1;
394 if ( minimumSlice < 0 )
400 unsigned int maximumSlice = OuterSliceIndex + neighbourNumber + 1;
404 maximumSlice = OuterSliceIndex + 2;
408 maximumSlice = ( *m_allSliceWidths )[ tripletLayerIndex ].size() - 1;
412 int minimumPointIndex = ( *m_allSliceWidths )[ tripletLayerIndex ][ minimumSlice ];
413 int maximumPointIndex = ( *m_allSliceWidths )[ tripletLayerIndex ][ maximumSlice ];
416 for (
int tripletPointIndex = minimumPointIndex; tripletPointIndex < maximumPointIndex; tripletPointIndex++ )
419 double tripletPointZ = ( *m_allLayerZs )[ tripletLayerIndex ][ tripletPointIndex ];
420 double tripletPointRho = ( *m_allLayerRhos )[ tripletLayerIndex ][ tripletPointIndex ];
421 double tripletPointPhi = ( *m_allLayerPhis )[ tripletLayerIndex ][ tripletPointIndex ];
424 double invDeltaRho = 1.0 / ( outerPointRho - tripletPointRho );
425 double tripletZValue = ( tripletPointZ * outerPointRho - outerPointZ * tripletPointRho ) * invDeltaRho;
426 if ( fabs( tripletZValue - CurrentZValue ) >
m_zTolerance )
432 double tripletKValue = ( tripletPointPhi - outerPointPhi ) * invDeltaRho;
433 if ( fabs( tripletKValue - CurrentKValue ) >
m_kTolerance )
439 double tripletPValue = ( tripletPointPhi * outerPointRho - outerPointPhi * tripletPointRho ) * invDeltaRho;
440 if ( fabs( tripletPValue - CurrentPValue ) <
m_pTolerance )
463 const std::vector< std::vector<long> >& ExtraSlices,
464 const long PhiToSubtract,
465 const bool ChargeAware,
466 std::vector< std::vector<long> >* AllHits,
467 std::vector< std::vector<double> >* AllWeights )
470 int neighbourMaximum = 0;
471 if ( InnerLayerIndex > 0 )
473 neighbourMaximum = ExtraSlices[0][ InnerLayerIndex ];
477 neighbourMaximum -= PhiToSubtract;
479 if ( neighbourMaximum < 1 )
481 neighbourMaximum = 1;
484 int neighbourMinimum = neighbourMaximum;
485 if ( ChargeAware && InnerLayerIndex > 0 )
487 neighbourMinimum = 1;
492 if ( startNeighbour1 < 0 )
497 if ( endNeighbour1 > (
int)( AllHits[0].size() - 1 ) )
499 endNeighbour1 = AllHits[0].size() - 1;
502 if ( startNeighbour2 < 0 )
507 if ( endNeighbour2 > (
int)( AllHits[0].size() - 1 ) )
509 endNeighbour2 = AllHits[0].size() - 1;
513 if ( !ChargeAware || OuterSliceIndex <=
m_sliceIndex + 1 )
515 for (
int neighbourIndex = startNeighbour1; neighbourIndex <= endNeighbour1; neighbourIndex++ )
517 AllHits[0][ neighbourIndex ][ AxisZIndex ] += TripletsFound;
518 AllWeights[0][ neighbourIndex ][ AxisZIndex ] += AxisZ * ( double )TripletsFound;
521 if ( ChargeAware && OuterSliceIndex >=
m_sliceIndex - 1 )
523 for (
int neighbourIndex = startNeighbour2; neighbourIndex <= endNeighbour2; neighbourIndex++ )
525 AllHits[1][ neighbourIndex ][ AxisZIndex ] += TripletsFound;
526 AllWeights[1][ neighbourIndex ][ AxisZIndex ] += AxisZ * ( double )TripletsFound;
void GetHistogram(std::vector< long > *HitHistogram, std::vector< double > *WeightHistogram, std::vector< long > *OtherChargeHitHistogram, std::vector< double > *OtherChargeWeightHistogram, const std::vector< std::vector< long > > &ExtraSlices, const long PhiToSubtract, int InnerLayerLimit, const int TripletMode, const bool ChargeAware, std::vector< std::vector< long > > *AllHits=0, std::vector< std::vector< double > > *AllWeights=0)
void FillNeighbours(int InnerLayerIndex, int OuterSliceIndex, int TripletsFound, int AxisZIndex, double AxisZ, const std::vector< std::vector< long > > &ExtraSlices, const long PhiToSubtract, const bool ChargeAware, std::vector< std::vector< long > > *AllHits, std::vector< std::vector< double > > *AllWeights)