NB: quicker to simply subtract m_zMinimum from each spacepoint at the start and simply add m_zMinimum to the final vertices after calculation.
the coordinates by m_invZBinWidth, then you have "vertex Z positions" already in the "binning" space and you need only take the int(..)
This would avoids calculating the subtraction, and the multiplication for every double/triplet etc - something to bare in mind for the future I think
192{
193
195 {
197 }
198
199
200 for ( int innerFilledLayer = 0; innerFilledLayer < InnerLayerLimit; innerFilledLayer++ )
201 {
202
203 int innerLayerIndex = ( *m_filledLayerIndices )[ innerFilledLayer ];
204
205
206 for (
unsigned int innerPointIndex =
m_sliceStart[ innerLayerIndex ]; innerPointIndex <
m_sliceEnd[ innerLayerIndex ]; innerPointIndex++ )
207 {
208
209 double innerPointZ = ( *m_allLayerZs )[ innerLayerIndex ][ innerPointIndex ];
210 double innerPointRho = ( *m_allLayerRhos )[ innerLayerIndex ][ innerPointIndex ];
211 double innerPointPhi = ( *m_allLayerPhis )[ innerLayerIndex ][ innerPointIndex ];
212
213
214 for (
int outerFilledLayer = innerFilledLayer + 1; outerFilledLayer <
m_filledLayerTotal; outerFilledLayer++ )
215 {
216
217 int outerLayerIndex = ( *m_filledLayerIndices )[ outerFilledLayer ];
218
219
220 int neighbourNumber = ExtraSlices[ innerLayerIndex ][ outerLayerIndex ];
222 {
223 neighbourNumber -= PhiToSubtract;
224 }
225 if ( neighbourNumber < 1 )
226 {
227 neighbourNumber = 1;
228 }
229
230
232 if ( minimumSlice < 0 )
233 {
234 minimumSlice = 0;
235 }
236 unsigned int maximumSlice =
m_sliceIndex + neighbourNumber + 1;
238 {
239 maximumSlice = ( *m_allSliceWidths )[ outerLayerIndex ].size() - 1;
240 }
241
242
243 int minimumPointIndex = ( *m_allSliceWidths )[ outerLayerIndex ][ minimumSlice ];
244 int maximumPointIndex = ( *m_allSliceWidths )[ outerLayerIndex ][ maximumSlice ];
245
246
247 for ( int outerPointIndex = minimumPointIndex; outerPointIndex < maximumPointIndex; outerPointIndex++ )
248 {
249
250 double outerPointZ = ( *m_allLayerZs )[ outerLayerIndex ][ outerPointIndex ];
251 double outerPointRho = ( *m_allLayerRhos )[ outerLayerIndex ][ outerPointIndex ];
252 double outerPointPhi = ( *m_allLayerPhis )[ outerLayerIndex ][ outerPointIndex ];
253
254
255 double invDeltaRho = 1.0 / ( innerPointRho - outerPointRho );
256 double axisZ = ( outerPointZ * innerPointRho - innerPointZ * outerPointRho ) * invDeltaRho;
257
258
260 {
261
263
264
265 if ( TripletMode )
266 {
267
268 double kValue = ( outerPointPhi - innerPointPhi ) * invDeltaRho;
269 double pValue = ( outerPointPhi * innerPointRho - innerPointPhi * outerPointRho ) * invDeltaRho;
270
271
272
273 int tripletsFound =
FindTriplet( outerFilledLayer, outerPointIndex,
274 axisZ, kValue, pValue,
275 ExtraSlices, PhiToSubtract, ( TripletMode == 1 ), outerSliceIndex );
276
277
278 if ( tripletsFound )
279 {
293
294
295 if ( AllHits && AllWeights )
296 {
297 FillNeighbours( innerLayerIndex, outerSliceIndex, tripletsFound, axisZIndex, axisZ,
298 ExtraSlices, PhiToSubtract, ChargeAware,
299 AllHits, AllWeights );
300 }
301 else
302 {
303
304 if ( !ChargeAware || outerSliceIndex <=
m_sliceIndex + 1 )
305 {
306 ( *HitHistogram )[ axisZIndex ] += tripletsFound;
307 ( *WeightHistogram )[ axisZIndex ] += axisZ * (
double )tripletsFound;
308 }
309 if ( ChargeAware && outerSliceIndex >=
m_sliceIndex - 1 )
310 {
311 ( *OtherChargeHitHistogram )[ axisZIndex ] += tripletsFound;
312 ( *OtherChargeWeightHistogram )[ axisZIndex ] += axisZ * (
double )tripletsFound;
313 }
314 }
315 }
316 }
317 else
318 {
319
321
322
323
324 if ( AllHits && AllWeights )
325 {
326 FillNeighbours( innerLayerIndex, outerSliceIndex, 1, axisZIndex, axisZ,
327 ExtraSlices, PhiToSubtract, ChargeAware,
328 AllHits, AllWeights );
329 }
330 else
331 {
332
333 if ( !ChargeAware || outerSliceIndex <=
m_sliceIndex + 1 )
334 {
335 ( *HitHistogram )[ axisZIndex ]++;
336 ( *WeightHistogram )[ axisZIndex ] += axisZ;
337 }
338 if ( ChargeAware && outerSliceIndex >=
m_sliceIndex - 1 )
339 {
340 ( *OtherChargeHitHistogram )[ axisZIndex ]++;
341 ( *OtherChargeWeightHistogram )[ axisZIndex ] += axisZ;
342 }
343 }
344 }
345 }
346 }
347 }
348 }
349 }
350}
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)
int FindTriplet(int OuterFilledLayer, int OuterPointIndex, double CurrentZValue, double CurrentKValue, double CurrentPValue, const std::vector< std::vector< long > > &ExtraSlices, const long PhiToSubtract, bool FastTriplet, int OuterSliceIndex)