]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes towards speeding up the code. Thanks to Marian Ivanov.
authorkowal2 <kowal2@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Feb 2002 11:02:56 +0000 (11:02 +0000)
committerkowal2 <kowal2@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 25 Feb 2002 11:02:56 +0000 (11:02 +0000)
TPC/AliTPC.cxx
TPC/AliTPC.h
TPC/AliTPCParam.h
TPC/AliTPCParamSR.cxx
TPC/AliTPCParamSR.h

index 5b4d0e2c6ed1ab8a73da8879d8671e1b48321c68..a840e735f7b1255352a86c175588d033fddd9fea 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.52  2002/02/18 09:26:09  kowal2
+Removed compiler warning
+
 Revision 1.51  2002/01/21 17:13:21  kowal2
 New track hits using root containers. Setting active sectors added.
 
@@ -220,6 +223,31 @@ Introduction of the Copyright and cvs Log
 
 ClassImp(AliTPC) 
 
+//_____________________________________________________________________________
+// helper class for fast matrix and vector manipulation - no range checking
+// origin - Marian Ivanov
+
+class AliTPCFastMatrix : public TMatrix {
+public :
+  AliTPCFastMatrix(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb);
+  inline Float_t & UncheckedAt(Int_t rown, Int_t coln) const  {return  (fIndex[coln])[rown];} //fast acces   
+  inline Float_t   UncheckedAtFast(Int_t rown, Int_t coln) const  {return  (fIndex[coln])[rown];} //fast acces   
+};
+
+AliTPCFastMatrix::AliTPCFastMatrix(Int_t row_lwb, Int_t row_upb, Int_t col_lwb, Int_t col_upb):
+  TMatrix(row_lwb, row_upb,col_lwb,col_upb)
+   {
+   };
+//_____________________________________________________________________________
+class AliTPCFastVector : public TVector {
+public :
+  AliTPCFastVector(Int_t size);
+  inline Float_t & UncheckedAt(Int_t index) const  {return  fElements[index];} //fast acces  
+};
+
+AliTPCFastVector::AliTPCFastVector(Int_t size):TVector(size){
+};
+
 //_____________________________________________________________________________
 AliTPC::AliTPC()
 {
@@ -1155,8 +1183,8 @@ void AliTPC::Hits2ExactClustersSector(Int_t isec)
   //  Int_t sector,nhits;
   Int_t ipart;
   const Int_t kcmaxhits=30000;
-  TVector * xxxx = new TVector(kcmaxhits*4);
-  TVector & xxx = *xxxx;
+  AliTPCFastVector * xxxx = new AliTPCFastVector(kcmaxhits*4);
+  AliTPCFastVector & xxx = *xxxx;
   Int_t maxhits = kcmaxhits;
   //construct array for each padrow
   for (Int_t i=0; i<fTPCParam->GetNRow(isec);i++) 
@@ -1749,7 +1777,7 @@ void AliTPC::Hits2DigitsSector(Int_t isec)
 
       //--------------------------------------------------------
       //   Digitize this sector, row by row
-      //   row[i] is the pointer to the TObjArray of TVectors,
+      //   row[i] is the pointer to the TObjArray of AliTPCFastVectors,
       //   each one containing electrons accepted on this
       //   row, assigned into tracks
       //--------------------------------------------------------
@@ -1812,10 +1840,11 @@ void AliTPC::DigitizeRow(Int_t irow,Int_t isec,TObjArray **rows)
   //  Integrated signal for this row
   //  and a single track signal
   //    
-  TMatrix *m1   = new TMatrix(0,nofPads,0,nofTbins); // integrated
-  TMatrix *m2   = new TMatrix(0,nofPads,0,nofTbins); // single
+
+  AliTPCFastMatrix *m1 = new AliTPCFastMatrix(0,nofPads,0,nofTbins); // integrated
+  AliTPCFastMatrix *m2 = new AliTPCFastMatrix(0,nofPads,0,nofTbins); // single
   //
-  TMatrix &total  = *m1;
+  AliTPCFastMatrix &total  = *m1;
 
   //  Array of pointers to the label-signal list
 
@@ -1847,20 +1876,18 @@ void AliTPC::DigitizeRow(Int_t irow,Int_t isec,TObjArray **rows)
   Int_t tracks[3];
 
   AliDigits *dig = fDigitsArray->GetRow(isec,irow);
-  for(Int_t ip=0;ip<nofPads;ip++){
-    for(Int_t it=0;it<nofTbins;it++){
-
-      Float_t q = total(ip,it);
-
-      Int_t gi =it*nofPads+ip; // global index
-
+  Int_t gi=-1;
+  Float_t fzerosup = zerosup+0.5;
+  for(Int_t it=0;it<nofTbins;it++){
+    Float_t *pq = &(total.UncheckedAt(0,it));
+    for(Int_t ip=0;ip<nofPads;ip++){
+      gi++;
+      Float_t q=*pq;      
+      pq++;
       if(fDigitsSwitch == 0){
-
-       //        q = gRandom->Gaus(q,fTPCParam->GetNoise()*fTPCParam->GetNoiseNormFac()); 
        q+=GetNoise();
+        if(q <=fzerosup) continue; // do not fill zeros
         q = TMath::Nint(q);
-
-        if(q <=zerosup) continue; // do not fill zeros
         if(q > fTPCParam->GetADCSat()) q = fTPCParam->GetADCSat();  // saturation
 
       }
@@ -1916,8 +1943,8 @@ void AliTPC::DigitizeRow(Int_t irow,Int_t isec,TObjArray **rows)
 
 //_____________________________________________________________________________
 
-Float_t AliTPC::GetSignal(TObjArray *p1, Int_t ntr, TMatrix *m1, TMatrix *m2,
-                          Int_t *indexRange)
+Float_t AliTPC::GetSignal(TObjArray *p1, Int_t ntr, 
+             AliTPCFastMatrix *m1, AliTPCFastMatrix *m2,Int_t *indexRange)
 {
 
   //---------------------------------------------------------------
@@ -1931,10 +1958,10 @@ Float_t AliTPC::GetSignal(TObjArray *p1, Int_t ntr, TMatrix *m1, TMatrix *m2,
   // Modified: Marian Ivanov 
   //-----------------------------------------------------------------
 
-  TVector *tv;
-  tv = (TVector*)p1->At(ntr); // pointer to a track
-  TVector &v = *tv;
+  AliTPCFastVector *tv;
+
+  tv = (AliTPCFastVector*)p1->At(ntr); // pointer to a track
+  AliTPCFastVector &v = *tv;
   
   Float_t label = v(0);
   Int_t centralPad = (fTPCParam->GetNPads(fCurrentIndex[1],fCurrentIndex[3])-1)/2;
@@ -1945,10 +1972,8 @@ Float_t AliTPC::GetSignal(TObjArray *p1, Int_t ntr, TMatrix *m1, TMatrix *m2,
   indexRange[2]=9999; //min time
   indexRange[3]=-1; // max time
 
-  //  Float_t IneffFactor = 0.5; // inefficiency in the gain close to the edge, as above
-
-  TMatrix &signal = *m1;
-  TMatrix &total = *m2;
+  AliTPCFastMatrix &signal = *m1;
+  AliTPCFastMatrix &total = *m2;
   //
   //  Loop over all electrons
   //
@@ -1957,22 +1982,28 @@ Float_t AliTPC::GetSignal(TObjArray *p1, Int_t ntr, TMatrix *m1, TMatrix *m2,
     Float_t aval =  v(idx+4);
     Float_t eltoadcfac=aval*fTPCParam->GetTotalNormFac(); 
     Float_t xyz[3]={v(idx+1),v(idx+2),v(idx+3)};
-    Int_t n = fTPCParam->CalcResponse(xyz,fCurrentIndex,fCurrentIndex[3]);
-    
-    if (n>0) for (Int_t i =0; i<n; i++){
-       Int_t *index = fTPCParam->GetResBin(i);        
+    Int_t n = ((AliTPCParamSR*)fTPCParam)->CalcResponseFast(xyz,fCurrentIndex,fCurrentIndex[3]);
+
+    Int_t *index = fTPCParam->GetResBin(0);  
+    Float_t *weight = & (fTPCParam->GetResWeight(0));
+
+    if (n>0) for (Int_t i =0; i<n; i++){       
        Int_t pad=index[1]+centralPad;  //in digit coordinates central pad has coordinate 0
-       if ( ( pad<(fTPCParam->GetNPads(fCurrentIndex[1],fCurrentIndex[3]))) && (pad>=0)) {
+
+         if (pad>=0){
         Int_t time=index[2];    
-        Float_t weight = fTPCParam->GetResWeight(i); //we normalise response to ADC channel
-        weight *= eltoadcfac;
+         Float_t qweight = *(weight)*eltoadcfac;
         
-        if (m1!=0) signal(pad,time)+=weight; 
-        total(pad,time)+=weight;
-        indexRange[0]=TMath::Min(indexRange[0],pad);
-        indexRange[1]=TMath::Max(indexRange[1],pad);
-        indexRange[2]=TMath::Min(indexRange[2],time);
-        indexRange[3]=TMath::Max(indexRange[3],time); 
+        if (m1!=0) signal.UncheckedAt(pad,time)+=qweight;
+         total.UncheckedAt(pad,time)+=qweight;
+        if (indexRange[0]>pad) indexRange[0]=pad;
+        if (indexRange[1]<pad) indexRange[1]=pad;
+        if (indexRange[2]>time) indexRange[2]=time;
+        if (indexRange[3]<time) indexRange[3]=time;
+
+        index+=3;
+        weight++;      
+
        }        
     }
   } // end of loop over electrons
@@ -1981,8 +2012,8 @@ Float_t AliTPC::GetSignal(TObjArray *p1, Int_t ntr, TMatrix *m1, TMatrix *m2,
 }
 
 //_____________________________________________________________________________
-void AliTPC::GetList(Float_t label,Int_t np,TMatrix *m,Int_t *indexRange,
-                     Float_t **pList)
+void AliTPC::GetList(Float_t label,Int_t np,AliTPCFastMatrix *m,
+                     Int_t *indexRange, Float_t **pList)
 {
   //----------------------------------------------------------------------
   //  Updates the list of tracks contributing to digits for a given row
@@ -1992,7 +2023,7 @@ void AliTPC::GetList(Float_t label,Int_t np,TMatrix *m,Int_t *indexRange,
   // Origin: Marek Kowalski  IFJ, Krakow, Marek.Kowalski@ifj.edu.pl
   //-----------------------------------------------------------------
 
-  TMatrix &signal = *m;
+  AliTPCFastMatrix &signal = *m;
 
   // lop over nonzero digits
 
@@ -2100,12 +2131,13 @@ void AliTPC::MakeSector(Int_t isec,Int_t nrows,TTree *TH,
  
   //----------------------------------------------
   // Create TObjArray-s, one for each row,
-  // each TObjArray will store the TVectors
-  // of electrons, one TVector per each track.
+  // each TObjArray will store the AliTPCFastVectors
+  // of electrons, one AliTPCFastVectors per each track.
   //---------------------------------------------- 
     
   Int_t *nofElectrons = new Int_t [nrows]; // electron counter for each row
-  TVector **tracks = new TVector* [nrows]; //pointers to the track vectors
+  AliTPCFastVector **tracks = new AliTPCFastVector* [nrows]; //pointers to the track vectors
+
   for(i=0; i<nrows; i++){
     row[i] = new TObjArray;
     nofElectrons[i]=0;
@@ -2156,19 +2188,19 @@ void AliTPC::MakeSector(Int_t isec,Int_t nrows,TTree *TH,
           for(i=0;i<nrows;i++){
              if(previousTrack != -1){
               if(nofElectrons[i]>0){
-                TVector &v = *tracks[i];
+                 AliTPCFastVector &v = *tracks[i];
                 v(0) = previousTrack;
                  tracks[i]->ResizeTo(4*nofElectrons[i]+1); // shrink if necessary
                 row[i]->Add(tracks[i]);                     
               }
                else{
-                 delete tracks[i]; // delete empty TVector
+                 delete tracks[i]; // delete empty AliTPCFastVector
                  tracks[i]=0;
               }
             }
 
              nofElectrons[i]=0;
-             tracks[i] = new TVector(481); // TVectors for the next fTrack
+             tracks[i] = new AliTPCFastVector(481); // AliTPCFastVectors for the next fTrack
 
           } // end of loop over rows
               
@@ -2225,13 +2257,11 @@ void AliTPC::MakeSector(Int_t isec,Int_t nrows,TTree *TH,
            }
          }
          
-         TVector &v = *tracks[rowNumber];
+          AliTPCFastVector &v = *tracks[rowNumber];
          Int_t idx = 4*nofElectrons[rowNumber]-3;
-
-         v(idx)=  xyz[0];   // X - pad row coordinate
-         v(idx+1)=xyz[1];   // Y - pad coordinate (along the pad-row)
-          v(idx+2)=xyz[2];   // Z - time bin coordinate
-         v(idx+3)=xyz[3];   // avalanche size  
+         Real_t * position = &(((AliTPCFastVector&)v).UncheckedAt(idx)); //make code faster
+         memcpy(position,xyz,4*sizeof(Float_t));
        } // end of loop over electrons
 
         tpcHit = (AliTPChit*)NextHit();
@@ -2245,7 +2275,7 @@ void AliTPC::MakeSector(Int_t isec,Int_t nrows,TTree *TH,
 
      for(i=0;i<nrows;i++){
        if(nofElectrons[i]>0){
-          TVector &v = *tracks[i];
+          AliTPCFastVector &v = *tracks[i];
          v(0) = previousTrack;
           tracks[i]->ResizeTo(4*nofElectrons[i]+1); // shrink if necessary
          row[i]->Add(tracks[i]);  
@@ -2960,8 +2990,8 @@ void AliTPC::FindTrackHitsIntersection(TClonesArray * arr)
   Int_t ipart;
   
   const Int_t kcmaxhits=30000;
-  TVector * xxxx = new TVector(kcmaxhits*4);
-  TVector & xxx = *xxxx;
+  AliTPCFastVector * xxxx = new AliTPCFastVector(kcmaxhits*4);
+  AliTPCFastVector & xxx = *xxxx;
   Int_t maxhits = kcmaxhits;
       
   //
index ec067c7817b4bed418f34efb0a4a30279ee92aa5..e223b3a46f4985b85f2bb1f62e043231fad7c82e 100644 (file)
@@ -14,6 +14,9 @@
 
 
 class TMatrix;
+class AliTPCFastMatrix;  //MI change
+class AliTPCFastVector;  //MI change
+
 class TTree;
 
 class TFile;
@@ -136,9 +139,9 @@ private:
    Bool_t  TrackInVolume(Int_t id,Int_t track);  //return true if current track is in volume
   void SetDefaults();
   void DigitizeRow(Int_t irow,Int_t isec,TObjArray **rowTriplet);
-  Float_t GetSignal(TObjArray *p1, Int_t ntr, TMatrix *m1, TMatrix *m2,
-                    Int_t *IndexRange);
-  void GetList (Float_t label,Int_t np,TMatrix *m,Int_t *IndexRange,
+  Float_t GetSignal(TObjArray *p1, Int_t ntr, AliTPCFastMatrix *m1, 
+                   AliTPCFastMatrix *m2,Int_t *IndexRange);
+  void GetList (Float_t label,Int_t np,AliTPCFastMatrix *m,Int_t *IndexRange,
                 Float_t **pList);
   void MakeSector(Int_t isec,Int_t nrows,TTree *TH,Stat_t ntracks,TObjArray **row);
   void TransportElectron(Float_t *xyz, Int_t *index);
@@ -151,7 +154,7 @@ private:
   Int_t      fCurrentNoise; //!index of the noise in  the noise table 
   Bool_t*    fActiveSectors; //!bool indicating which sectors are active
 
-  ClassDef(AliTPC,5)  // Time Projection Chamber class
+  ClassDef(AliTPC,6)  // Time Projection Chamber class
 };
 
 
index b0307964add9185999c1ee5ef1ec90ae53fd1f6e..e4b7570cf5dc5278e5fe80bd3ee799a902f29e67 100644 (file)
@@ -277,7 +277,7 @@ public:
   //  
   Int_t * GetResBin(Int_t i);  
   //return response bin i  - bin given by  padrow [0] pad[1] timebin[2] 
-  Float_t GetResWeight(Int_t i);
+  Float_t GetResWeight(Int_t i);
   //return  weight of response bin i
 protected :
 
@@ -391,11 +391,11 @@ inline Int_t * AliTPCParam::GetResBin(Int_t i)
   else return 0;
 };
   
-inline Float_t AliTPCParam::GetResWeight(Int_t i)
+inline Float_t &AliTPCParam::GetResWeight(Int_t i)
 {
   //return  weight of response bin i
   if (i<fCurrentMax) return fResponseWeight[i];
-  else return 0;
+  else return fResponseWeight[i];
 }
 
 
index 84f9e1f411a0428f5c1143c75852491270776323..bb758fff41bbd1adab601540109aed81c67dc6dc 100644 (file)
@@ -15,6 +15,9 @@
 
 /*
 $Log$
+Revision 1.5  2001/12/06 07:49:30  kowal2
+corrected number of pads calculation
+
 Revision 1.4  2000/11/02 07:33:15  kowal2
 Improvements of the code.
 
@@ -56,7 +59,7 @@ New Detector parameters handling class
 #include <AliTPCParamSR.h>
 #include "AliTPCPRF2D.h"
 #include "AliTPCRF1D.h"
-
+#include "TH1.h"
 
 
 ClassImp(AliTPCParamSR)
@@ -130,7 +133,14 @@ Int_t  AliTPCParamSR::CalcResponse(Float_t* xyz, Int_t * index, Int_t row)
   Int_t lpad    = TMath::Min(TMath::Nint(xyz[1]+sfpad),fpad+19);     //last pad
   Int_t ltime   = TMath::Min(TMath::Nint(xyz[2]+GetZOffset()/GetZWidth()+sftime),ftime+19);    // last time
   ltime         = TMath::Min(ltime,GetMaxTBin()-1); 
+  // 
+  Int_t npads = GetNPads(index[1],row);
+  if (fpad<-npads/2) 
+    fpad = -npads/2;
+  if (lpad>npads/2) 
+    lpad= npads/2;
+  if (ftime<0) ftime=0;
+  // 
   if (row>=0) { //if we are interesting about given pad row
     if (fpadrow<=row) fpadrow =row;
     else 
@@ -408,7 +418,131 @@ void AliTPCParamSR::Streamer(TBuffer &R__b)
       AliTPCParam::Streamer(R__b);    
    }
 }
+Int_t  AliTPCParamSR::CalcResponseFast(Float_t* xyz, Int_t * index, Int_t row)
+{
+  //
+  //calculate bin response as function of the input position -x 
+  //return number of valid response bin
+  //
+  //we suppose that coordinate is expressed in float digits 
+  // it's mean coordinate system 8
+  //xyz[0] - float padrow xyz[1] is float pad  (center pad is number 0) and xyz[2] is float time bin
+  if ( (fInnerPRF==0)||(fOuterPRF==0)||(fTimeRF==0) ){ 
+    Error("AliTPCParamSR", "response function was not adjusted");
+    return -1;
+  }
+  
+  const Int_t padn =  500;
+  const Float_t fpadn =  500.;
+  const Int_t timen = 500;
+  const Float_t ftimen = 500.;
+  const Int_t padrn = 500;
+  const Float_t fpadrn = 500.;
+
 
+  static Float_t prfinner[2*padrn][5*padn];  //pad divided by 50
+  static Float_t prfouter[2*padrn][5*padn];  //prfouter division
+  
+  static Float_t rftime[5*timen];         //time division
+  static Int_t blabla=0;
+  static Float_t zoffset=0;
+  static Float_t zwidth=0;
+  static Float_t zoffset2=0;
+  static TH1F * hdiff=0;
+  static TH1F * hdiff1=0;
+  static TH1F * hdiff2=0;
+  
+  if (blabla==0) {  //calculate Response function - only at the begginning
+    hdiff =new TH1F("prf_diff","prf_diff",10000,-1,1);
+    hdiff1 =new TH1F("no_repsonse1","no_response1",10000,-1,1);
+    hdiff2 =new TH1F("no_response2","no_response2",10000,-1,1);
+    
+    blabla=1;
+    zoffset = GetZOffset();
+    zwidth  = fZWidth;
+    zoffset2 = zoffset/zwidth;
+    for (Int_t i=0;i<5*timen;i++){
+      rftime[i] = fTimeRF->GetRF(((i-2.5*ftimen)/ftimen)*zwidth+zoffset);
+    }
+    for (Int_t i=0;i<5*padn;i++){    
+      for (Int_t j=0;j<2*padrn;j++){
+       prfinner[j][i] =
+         fInnerPRF->GetPRF((i-2.5*fpadn)/fpadn
+                           *fInnerPadPitchWidth,(j-fpadrn)/fpadrn*fInnerPadPitchLength);
+       prfouter[j][i] =
+         fOuterPRF->GetPRF((i-2.5*fpadn)/fpadn
+                           *fOuterPadPitchWidth,(j-fpadrn)/fpadrn*fOuterPadPitchLength);
+      }
+    }      
+  }
+  // calculate central padrow, pad, time
+  Int_t npads = GetNPads(index[1],index[2]);
+  Int_t cpadrow = index[2];
+  Int_t cpad    = TMath::Nint(xyz[1]);
+  Int_t ctime   = TMath::Nint(xyz[2]+zoffset2);
+  //calulate deviation
+  Float_t dpadrow = xyz[0];
+  Float_t dpad    = xyz[1]-cpad;
+  Float_t dtime   = xyz[2]+zoffset2-ctime;
+  Int_t cindex =0;
+  Int_t cindex3 =0;
+  Int_t maxt =GetMaxTBin();
+
+  Int_t fpadrow;
+  Int_t lpadrow;
+
+  if (row>=0) { //if we are interesting about given pad row
+    fpadrow = row-cpadrow;
+    lpadrow = row-cpadrow;
+  }else{
+    fpadrow = (index[2]>1) ? -1 :0;
+    lpadrow = (index[2]<GetNRow(index[1])-1) ? 1:0;
+  }
+  Int_t fpad =  (cpad > -npads/2+1) ? -2: -npads/2-cpad;
+  Int_t lpad =  (cpad < npads/2-1)  ?  2: npads/2-cpad;
+  Int_t ftime =  (ctime>1) ? -2: -ctime;
+  Int_t ltime =  (ctime<maxt-2) ? 2: maxt-ctime-1;
+
+  Int_t apadrow= TMath::Nint((dpadrow-fpadrow)*fpadrn+fpadrn);
+  //Int_t apadrow= TMath::Nint((-dpadrow-fpadrow)*fpadrn+fpadrn);
+  
+  for (Int_t ipadrow = fpadrow; ipadrow<=lpadrow;ipadrow++){
+    if ( (apadrow<0) || (apadrow>=2*padrn)) 
+      continue;
+    Int_t apad= TMath::Nint((dpad-fpad)*fpadn+2.5*fpadn);
+    for (Int_t ipad = fpad; ipad<=lpad;ipad++){
+       Float_t cweight;
+       if (index[1]<fNInnerSector)
+         cweight=prfinner[apadrow][apad];
+       else
+         cweight=prfouter[apadrow][apad];
+       //      if (cweight<fResponseThreshold) continue;
+       Int_t atime = TMath::Nint((dtime-ftime)*ftimen+2.5*ftimen);
+       for (Int_t itime = ftime;itime<=ltime;itime++){ 
+         Float_t cweight2 = cweight*rftime[atime];
+         if (cweight2>fResponseThreshold) {
+           fResponseBin[cindex3++]=cpadrow+ipadrow;
+           fResponseBin[cindex3++]=cpad+ipad;
+           fResponseBin[cindex3++]=ctime+itime;
+           fResponseWeight[cindex++]=cweight2;
+           
+           if (cweight2>100) 
+             {
+               printf("Pici pici %d %f %d\n",ipad,dpad,apad);
+             }
+           
+         }
+         atime-=timen;
+       }
+       apad-= padn;    
+    }
+    apadrow-=padrn;
+  }
+  fCurrentMax=cindex;  
+  return fCurrentMax;    
+  
+}
 
 
 
index 11adf50e3762aefb39d809b84c0a833acaf89bb2..6f78f91f9c360fe278706e04b3c322474af30727 100644 (file)
@@ -17,9 +17,12 @@ class AliTPCParamSR : public AliTPCParam {
 public:
   AliTPCParamSR();
   virtual ~AliTPCParamSR();
+
   Int_t  CalcResponse(Float_t* x, Int_t * index, Int_t row);
+  Int_t CalcResponseFast(Float_t* x, Int_t * index, Int_t row);
   //calculate bin response as function of the input position -x 
   //return number of valid response bin
+
   
   void XYZtoCRXYZ(Float_t *xyz, 
                  Int_t &sector, Int_t &padrow, Int_t option=3) const;