- if (TMath::Abs(hI-1.5)<0.01 || TMath::Abs(hI-3.5)<0.01) {
- Double_t rs=0.5*(fgLayers[i-step].GetR() + r);
- Double_t d=0.0034, x0=38.6;
- if (TMath::Abs(hI-1.5)<0.01) {rs=9.; d=0.0097; x0=42;}
- if (!t->PropagateTo(rs,-step*d,x0)) {
- return kFALSE;
- }
+ if (TMath::Abs(hI-1.5)<0.01 || TMath::Abs(hI-3.5)<0.01) {
+ Int_t iLay = i-step;
+ Double_t rs = 0.;
+ if(iLay<0 || iLay>= AliITSgeomTGeo::kNLayers){
+ AliError(Form("Invalid layer %d ",iLay));
+ return kFALSE;
+ }
+ else{
+ rs=0.5*(fgLayers[i-step].GetR() + r);
+ }
+ Double_t d=0.0034, x0=38.6;
+ if (TMath::Abs(hI-1.5)<0.01) {rs=9.; d=0.0097; x0=42;}
+ if (!t->PropagateTo(rs,-step*d,x0)) {
+ return kFALSE;
+ }