@@ -442,11 +442,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
442442 inputTrack.getXYZGlo (posIni);
443443 const float initialRadius = std::hypot (posIni[0 ], posIni[1 ]);
444444 const float kTrackingMargin = 0.1 ;
445- const int kMaxNumberOfDetectors = 20 ;
446- if (kMaxNumberOfDetectors < layers.size ()) {
447- LOG (fatal) << " Too many layers in FastTracker, increase kMaxNumberOfDetectors" ;
448- return -1 ; // too many layers
449- }
445+
450446 int firstActiveLayer = -1 ; // first layer that is not inert
451447 for (size_t i = 0 ; i < layers.size (); ++i) {
452448 if (!layers[i].isInert ()) {
@@ -461,8 +457,12 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
461457 const int xrhosteps = 100 ;
462458 const bool applyAngularCorrection = true ;
463459
460+ // Delphes sets this to 20 instead of the number of layers,
461+ // but does not count all points in the tpc as layers which we do here
462+ // Loop over all the added layers to prevent crash when adding the tpc
463+ // Should not affect efficiency calculation
464464 goodHitProbability.clear ();
465- for (int i = 0 ; i < kMaxNumberOfDetectors ; ++i) {
465+ for (size_t i = 0 ; i < layers. size () ; ++i) {
466466 goodHitProbability.push_back (-1 .);
467467 }
468468 goodHitProbability[0 ] = 1 .; // we use layer zero to accumulate
@@ -650,7 +650,7 @@ int FastTracker::FastTrack(o2::track::TrackParCov inputTrack, o2::track::TrackPa
650650
651651 // generate efficiency
652652 float eff = 1 .;
653- for (int i = 0 ; i < kMaxNumberOfDetectors ; i++) {
653+ for (size_t i = 0 ; i < layers. size () ; i++) {
654654 float iGoodHit = goodHitProbability[i];
655655 if (iGoodHit <= 0 )
656656 continue ;
0 commit comments