]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSt1Response.cxx
Reverted direct flow parameters
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1Response.cxx
index 0f0aa448900f06e5b9e688616bf789cc935d7b1e..fc2464c7743cd564c62d99555b8221e76e9c357b 100644 (file)
 // Response class for station 1 including electronics and detector response. 
 // Individual pedestals or noise levels can be controlled separately. 
 // The current pulse height responses do not contain any physics
+// Included in AliRoot 2003/01/28
 
-#include <vector>
 #include <TMath.h>
 #include <TRandom.h>
 #include <TSystem.h>
 #include <Riostream.h>
+
 #include "AliMpIntPair.h"
-#include "AliMpPlaneSegmentation.h"
+#include "AliMpSectorSegmentation.h"
 #include "AliMpPad.h"
 #include "AliMpMotifMap.h"
 #include "AliMpSector.h"
-#include "AliMpPlane.h"
 #include "AliMpZone.h"
 #include "AliMpSubZone.h"
 #include "AliMpVRowSegment.h"
+
 #include "AliMUONSt1Response.h"
 #include "AliMUONSt1ResponseParameter.h"
 #include "AliMUONSt1ResponseRule.h"
 #include "AliMUONSt1IniReader.h"
 #include "AliMUONSt1Decoder.h"
 #include "AliMUONTransientDigit.h"
+#include "AliMUONGeometrySegmentation.h"
+#include "AliMUONSt12QuadrantSegmentation.h"
+#include "AliMUONChamber.h"
+#include "AliLog.h"
 
-ClassImp(AliMUONSt1Response);
+ClassImp(AliMUONSt1Response)
 
 const TString AliMUONSt1Response::fgkTopDir = getenv("ALICE_ROOT");
 const TString AliMUONSt1Response::fgkDataDir = "/MUON/data/";
@@ -77,11 +82,20 @@ const TString AliMUONSt1Response::fgkNofSigmaName ="nofSigma";
 
 
 //__________________________________________________________________________
-AliMUONSt1Response::AliMUONSt1Response(Int_t chamber)
-  :AliMUONResponseV0()
-  ,fChamber(chamber),fParams(),fRegions(),fTrashList()
+AliMUONSt1Response::AliMUONSt1Response(AliMUONChamber* chamber)
+  : AliMUONResponseV0(),
+    fReadFiles(kTRUE),
+    fCountNofCalls(0),
+    fCountUnknownZone(0),
+    fCountUnknownIndices(0),
+    fChamber(chamber),
+    fParams(),
+    fRegions(),
+    fTrashList()
   
 {
+// Standard constructor
+
    // default pedestal value
    fCountNofCalls=0;
    fCountUnknownZone=0;
@@ -90,8 +104,6 @@ AliMUONSt1Response::AliMUONSt1Response(Int_t chamber)
    Int_t i;
    for (i=0;i<2;i++){
      fIniFileName[i]="";
-     fPlane[0]=0;
-     fPlaneSegmentation[i]=0;
      for (Int_t j=0;j<fgkNofZones;j++)
      {
        fDefaultParameters[i][j]=0;
@@ -101,18 +113,70 @@ AliMUONSt1Response::AliMUONSt1Response(Int_t chamber)
 }
 
 
+//__________________________________________________________________________
+AliMUONSt1Response::AliMUONSt1Response()
+  : AliMUONResponseV0(),
+    fReadFiles(kTRUE),
+    fCountNofCalls(0),
+    fCountUnknownZone(0),
+    fCountUnknownIndices(0),
+    fChamber(0),
+    fParams(),
+    fRegions(),
+    fTrashList()
+  
+{
+// Standard constructor
+
+   Int_t i;
+   for (i=0;i<2;i++){
+     fIniFileName[i]="";
+     for (Int_t j=0;j<fgkNofZones;j++)
+     {
+       fDefaultParameters[i][j]=0;
+     }
+   }
+   fTrashList.SetOwner(kTRUE);
+}
+
+
+//__________________________________________________________________________
+AliMUONSt1Response::AliMUONSt1Response(const AliMUONSt1Response& rhs)
+  : AliMUONResponseV0(rhs)
+{
+// Copy constructor
+
+  AliFatal("Copy constructor is not implemented.");
+}
+
 //__________________________________________________________________________
 AliMUONSt1Response::~AliMUONSt1Response()
 {
 //destructor
   Int_t i;
   for (i=0;i<2;i++){
-    if (fPlaneSegmentation[i]) delete fPlaneSegmentation[i];
-    if (fPlane[i]) delete fPlane[i];
     fTrashList.Delete();
   }
 }
 
+//
+// operators
+//
+
+//______________________________________________________________________________
+AliMUONSt1Response& 
+AliMUONSt1Response::operator=(const AliMUONSt1Response& rhs)
+{
+// Copy operator 
+
+  // check assignement to self
+  if (this == &rhs) return *this;
+
+  AliFatal("Assignment operator is not implemented.");
+    
+  return *this;  
+}
+
 //__________________________________________________________________________
 void AliMUONSt1Response::SetIniFileName(Int_t plane,const TString& fileName)
 {
@@ -122,23 +186,59 @@ void AliMUONSt1Response::SetIniFileName(Int_t plane,const TString& fileName)
 
 
 //__________________________________________________________________________
-void AliMUONSt1Response::ReadCouplesOfIntRanges(const string& value,TList* list,AliMUONSt1ElectronicElement::TDescription descr) 
+const AliMUONGeometrySegmentation* 
+AliMUONSt1Response::GetGeometrySegmentation(Int_t cathod)
+{
+// Get geometry segmentation for given cathod plane
+
+  if (!fChamber->SegmentationModel2(cathod))
+    AliFatal(Form("Geometry segmentation for cathod %d not defined.", cathod));
+
+  return fChamber->SegmentationModel2(cathod);
+}  
+
+//__________________________________________________________________________
+const AliMpSectorSegmentation* 
+AliMUONSt1Response::GetMpSegmentation(Int_t detElemId, Int_t cathod)
+{
+// Get mapping segmentation for given detection elemnt
+
+  const AliMUONVGeometryDESegmentation* deSegmentation
+    = GetGeometrySegmentation(cathod)->GetDESegmentation(detElemId);
+
+  if (!deSegmentation) {
+    AliFatal(Form("DE segmentation for detElemId= %d not defined.",
+                  detElemId));
+  }
+  
+  const AliMUONSt12QuadrantSegmentation* quadrantSegmentation
+    = static_cast<const AliMUONSt12QuadrantSegmentation*>(deSegmentation);
+  
+  return quadrantSegmentation->GetMpSegmentation();
+}         
+
+
+//__________________________________________________________________________
+void AliMUONSt1Response::ReadCouplesOfIntRanges(const string& value,
+                             TList* list,
+                            AliMUONSt1ElectronicElement::TDescription descr) 
 {
 // Decode couplets of integer ranges (enclosed within parenthesis and 
 // separated by a comma, eg. (12/20,33/60) for ranges 12 to 20 and 33 to 60) 
 // and save these ranges in <list> 
-  vector<string> lstCpl = decoder::SplitNtuples(value);
-  for (unsigned int n=0;n<lstCpl.size();n++){ // for each (..,..) couplet
-    vector<string> lst = decoder::SplitList(lstCpl[n],","); 
+
+  StringVector lstCpl = decoder::SplitNtuples(value);
+  for (UInt_t n=0;n<lstCpl.size();n++){ // for each (..,..) couplet
+    StringVector lst = decoder::SplitList(lstCpl[n],","); 
                                               // should have 2 elements
     if (lst.size() != 2) {
-      Warning("ReadIniFile","Bad pad definition");
+      AliWarning("Bad pad definition");
       continue;
     }
-    vector<pair <int,int> > lst1 = decoder::DecodeListOfIntRanges(lst[0],";");
-    vector<pair <int,int> > lst2 = decoder::DecodeListOfIntRanges(lst[1],";");
-    for (unsigned int u1=0;u1<lst1.size();u1++){
-      for (unsigned int u2=0;u2<lst2.size();u2++){
+    IntPairVector lst1 = decoder::DecodeListOfIntRanges(lst[0],";");
+    IntPairVector lst2 = decoder::DecodeListOfIntRanges(lst[1],";");
+    for (UInt_t u1=0;u1<lst1.size();u1++){
+      for (UInt_t u2=0;u2<lst2.size();u2++){
        AliMUONSt1ElectronicElement* elem 
          = new AliMUONSt1ElectronicElement(descr);
        fTrashList.Add(elem);
@@ -152,23 +252,25 @@ void AliMUONSt1Response::ReadCouplesOfIntRanges(const string& value,TList* list,
 
 
 //__________________________________________________________________________
-void AliMUONSt1Response::ReadCouplesOfFloatRanges(const string& value,TList* list)
+void AliMUONSt1Response::ReadCouplesOfFloatRanges(const string& value,
+                                                  TList* list)
 {
 // Decode couplets of floating point ranges (enclosed within parenthesis and 
 // separated by a comma, eg. (12./20.,33./60.) for ranges 12. to 20. and 33. to 60.) 
 // and save these ranges in <list> 
-  vector<string> lstCpl = decoder::SplitNtuples(value);
-  for (unsigned int n=0;n<lstCpl.size();n++){ // for each (..,..) couplets
-    vector<string> lst = decoder::SplitList(lstCpl[n],","); 
+
+  StringVector lstCpl = decoder::SplitNtuples(value);
+  for (UInt_t n=0;n<lstCpl.size();n++){ // for each (..,..) couplets
+    StringVector lst = decoder::SplitList(lstCpl[n],","); 
                                               // should have 2 elements
     if (lst.size() != 2) {
-      Warning("ReadIniFile","Bad pad definition");
+      AliWarning("Bad pad definition");
       continue;
     }
-    vector<pair <double,double> > lst1 = decoder::DecodeListOfFloatRanges(lst[0],";");
-    vector<pair <double,double> > lst2 = decoder::DecodeListOfFloatRanges(lst[1],";");
-    for (unsigned int u1=0;u1<lst1.size();u1++){
-      for (unsigned int u2=0;u2<lst2.size();u2++){
+    DoublePairVector lst1 = decoder::DecodeListOfFloatRanges(lst[0],";");
+    DoublePairVector lst2 = decoder::DecodeListOfFloatRanges(lst[1],";");
+    for (UInt_t u1=0;u1<lst1.size();u1++){
+      for (UInt_t u2=0;u2<lst2.size();u2++){
        AliMUONSt1ElectronicElement* elem 
          = new AliMUONSt1ElectronicElement(AliMUONSt1ElectronicElement::kXY);
        fTrashList.Add(elem);
@@ -182,15 +284,17 @@ void AliMUONSt1Response::ReadCouplesOfFloatRanges(const string& value,TList* lis
 
 
 //__________________________________________________________________________
-void AliMUONSt1Response::SetPairToParam(const string& name,const string& value,AliMUONSt1ResponseParameter* param) const
+void AliMUONSt1Response::SetPairToParam(const string& name, const string& value,
+                                        AliMUONSt1ResponseParameter* param) const
 {
 // set a (name,value) pair to <param>
+
   TString path = fgkTopDir + fgkDataDir ;
   const char* nm = name.c_str();
   if (fgkStateName.CompareTo(nm,TString::kIgnoreCase)==0){
     param->SetState(atoi(value.c_str()));
   } else if (fgkPedestalName.CompareTo(nm,TString::kIgnoreCase)==0){
-    vector<string> lst = decoder::SplitList(value," ");
+    StringVector lst = decoder::SplitList(value," ");
     if ((lst.size()>0) && (fgkNotName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
       param->UnSetPedestal();
     } else if ((lst.size()>1) && (fgkValueName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
@@ -201,7 +305,7 @@ void AliMUONSt1Response::SetPairToParam(const string& name,const string& value,A
       param->SetPedestal(atof(lst[1].c_str()),atof(lst[2].c_str()));
     }
   } else if (fgkNoiseName.CompareTo(nm,TString::kIgnoreCase)==0){
-    vector<string> lst = decoder::SplitList(value," ");
+    StringVector lst = decoder::SplitList(value," ");
     if ((lst.size()>1) && (fgkValueName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
       param->SetNoise(atof(lst[1].c_str()));
     } else if ((lst.size()>1) && (fgkFileName.CompareTo(lst[0].c_str(),TString::kIgnoreCase)==0)){
@@ -212,16 +316,16 @@ void AliMUONSt1Response::SetPairToParam(const string& name,const string& value,A
   } else if (fgkNofSigmaName.CompareTo(nm,TString::kIgnoreCase)==0){
     param->SetNofSigma(atoi(value.c_str()));
   } else if (fgkStickyOnName.CompareTo(nm,TString::kIgnoreCase)==0){
-    vector< pair<int,int> > lst = decoder::DecodeListOfIntRanges(value);
-    for (unsigned int i=0;i<lst.size();i++){
-      for (int j=lst[i].first;(j<12) && (j<=lst[i].second);j++){
+    IntPairVector lst = decoder::DecodeListOfIntRanges(value);
+    for (UInt_t i=0;i<lst.size();i++){
+      for (Int_t j=lst[i].first;(j<12) && (j<=lst[i].second);j++){
        param->SetStickyBitOn(j);
       }
     }
   } else if (fgkStickyOffName.CompareTo(nm,TString::kIgnoreCase)==0){
-    vector< pair<int,int> > lst = decoder::DecodeListOfIntRanges(value);
-    for (unsigned int i=0;i<lst.size();i++){
-      for (int j=lst[i].first;(j<12) && (j<=lst[i].second);j++){
+    IntPairVector lst = decoder::DecodeListOfIntRanges(value);
+    for (UInt_t i=0;i<lst.size();i++){
+      for (Int_t j=lst[i].first;(j<12) && (j<=lst[i].second);j++){
        param->SetStickyBitOff(j);
       }
     }
@@ -230,9 +334,11 @@ void AliMUONSt1Response::SetPairToParam(const string& name,const string& value,A
 
 
 //__________________________________________________________________________
-void AliMUONSt1Response::SetPairToListElem(const string& name,const string& value,TList* list)
+void AliMUONSt1Response::SetPairToListElem(const string& name, 
+                                const string& value, TList* list)
 {
 // set a (name,value) pair to <list>
+
   const char* nm = name.c_str();
   if (fgkIJName.CompareTo(nm,TString::kIgnoreCase)==0){
     ReadCouplesOfIntRanges(value,list,AliMUONSt1ElectronicElement::kIJ);
@@ -241,8 +347,8 @@ void AliMUONSt1Response::SetPairToListElem(const string& name,const string& valu
   } else if (fgkMGName.CompareTo(nm,TString::kIgnoreCase)==0){
     ReadCouplesOfIntRanges(value,list,AliMUONSt1ElectronicElement::kMG);
   } else if (fgkMName.CompareTo(nm,TString::kIgnoreCase)==0){
-    vector< pair<int,int> > lst = decoder::DecodeListOfIntRanges(value);
-    for (unsigned int i=0;i<lst.size();i++){
+    IntPairVector lst = decoder::DecodeListOfIntRanges(value);
+    for (UInt_t i=0;i<lst.size();i++){
       AliMUONSt1ElectronicElement* elem 
         = new AliMUONSt1ElectronicElement(AliMUONSt1ElectronicElement::kM);
       fTrashList.Add(elem);
@@ -259,11 +365,13 @@ void AliMUONSt1Response::SetPairToListElem(const string& name,const string& valu
 void AliMUONSt1Response::ReadIniFile(Int_t plane)
 {
   //Read the ini file and fill the <plane>th structures 
+
+  cout << "ReadIniFile now ..." << endl;
+
   TString path = fgkTopDir + fgkDataDir ;
   //read .ini file
   if (gSystem->AccessPathName(path+fIniFileName[plane],kReadPermission)){
-    Fatal("ReadIniFile",
-          Form("Unable to Read the file %s",fIniFileName[plane].Data()));
+    AliFatal(Form("Unable to Read the file %s",fIniFileName[plane].Data()));
     return;
   }
   fRegions.clear();
@@ -274,14 +382,15 @@ void AliMUONSt1Response::ReadIniFile(Int_t plane)
 
 //__________________________________________________________________________
 void AliMUONSt1Response::ReadIniFile(Int_t plane,const TString& fileName,
-                                    Bool_t rdParam,Bool_t rdRegion,Bool_t rdRule)
+                                     Bool_t rdParam,Bool_t rdRegion,Bool_t rdRule)
 {
   //Read the given ini file and fill the <plane>th structures 
+
   cout<<"Reading parameter file "<<fileName<<endl;
   AliMUONSt1IniReader iniFile(fileName.Data());
-  AliMUONSt1IniReader::TChapter chap;
-  AliMUONSt1IniReader::TValueList vals;
-  AliMUONSt1IniReader::TValueList::iterator itValue;
+  AliMUONSt1IniReader::Chapter chap;
+  AliMUONSt1IniReader::ValueList vals;
+  AliMUONSt1IniReader::ValueList::iterator itValue;
   while (!iniFile.Eof()){
     chap = iniFile.MakeCurrentChapter();
     TString chapName = chap.first.c_str();
@@ -291,13 +400,13 @@ void AliMUONSt1Response::ReadIniFile(Int_t plane,const TString& fileName,
         string name =  (*itValue).first;
         string value = (*itValue).second;
         if (fgkIncludeName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
-          vector<string> lst = decoder::SplitList(value,":");
+          StringVector lst = decoder::SplitList(value,":");
           if (lst.size()>0){
             TString inFileName = TString(gSystem->DirName(fileName))+"/" + lst[0].c_str();
             Bool_t inParam=kFALSE,inRegion=kFALSE,inRule=kFALSE;
             if (lst.size()>1) {
-              vector<string> lst2 = decoder::SplitList(lst[1],",");
-              for (unsigned int k=0;k<lst2.size();k++){
+              StringVector lst2 = decoder::SplitList(lst[1],",");
+              for (UInt_t k=0;k<lst2.size();k++){
                 if (fgkParameterName.CompareTo(lst2[k].c_str(),TString::kIgnoreCase)==0){
                   inParam=kTRUE;
                 } else if (fgkRegionName.CompareTo(lst2[k].c_str(),TString::kIgnoreCase)==0){
@@ -352,14 +461,14 @@ void AliMUONSt1Response::ReadIniFile(Int_t plane,const TString& fileName,
         string name =  (*itValue).first;
         string value = (*itValue).second;
         if (fgkZoneName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
-          vector< pair<int,int> > lst = decoder::DecodeListOfIntRanges(value);
-          for (unsigned int i=0;i<lst.size();i++){
-            for (int j=lst[i].first;(j<=fgkNofZones) && (j<=lst[i].second);j++) {
+          IntPairVector lst = decoder::DecodeListOfIntRanges(value);
+          for (UInt_t i=0;i<lst.size();i++){
+            for (Int_t j=lst[i].first;(j<=fgkNofZones) && (j<=lst[i].second);j++) {
               if (j>0) zones[j-1] = kTRUE;
             }
           }
         } else if (fgkRegionName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
-          TListMap::iterator it = fRegions.find(value);
+          ListMap::iterator it = fRegions.find(value);
           if (it != fRegions.end()){
             if (!rule) {
              rule = new AliMUONSt1ResponseRule();
@@ -370,27 +479,27 @@ void AliMUONSt1Response::ReadIniFile(Int_t plane,const TString& fileName,
             while ((el = static_cast<AliMUONSt1ElectronicElement*>(next()))){
               rule->AddElement(el);
             }
-          } else Warning("ReadIniFile",Form("Can't find region named %s",value.c_str()));
+          } else AliWarning(Form("Can't find region named %s",value.c_str()));
         }
       }
       for (itValue = vals.begin() ; itValue != vals.end(); ++itValue){
         string name =  (*itValue).first;
         string value = (*itValue).second;
         if (fgkParameterName.CompareTo(name.c_str(),TString::kIgnoreCase)==0){
-          TParamsMap::iterator it = fParams.find(value);
+          ParamsMap::iterator it = fParams.find(value);
           if (it != fParams.end()){
             AliMUONSt1ResponseParameter* param = (*it).second;
             for (i=0;i<fgkNofZones;i++) if (zones[i]) {
               fDefaultParameters[plane][i]=param;
             }
             if (rule) rule->AddParameter(param);
-          } else Warning("ReadIniFile",Form("Can't find parameter named %s",value.c_str()));
+          } else AliWarning(Form("Can't find parameter named %s",value.c_str()));
         }
       }
       if (rule) fRulesList[plane].AddFirst(rule);
     }
   }
-  for (TListMap::iterator it = fRegions.begin() ; it != fRegions.end(); ++it) delete (*it).second;
+  for (ListMap::iterator it = fRegions.begin() ; it != fRegions.end(); ++it) delete (*it).second;
 }
 
 
@@ -399,6 +508,7 @@ void AliMUONSt1Response::ReadFiles()
 {
 // Define the current response rules with respect to the description
 // given in the "configChamber1.ini" and "configChamber2.ini" files.
+
   Int_t i;
   TString path = fgkTopDir + fgkDataDir ;
 
@@ -421,18 +531,18 @@ void AliMUONSt1Response::ReadFiles()
     }
   }
   //book memory and fill them with .ini files
-  fPlane[0]=AliMpPlane::Create(kBendingPlane);
-  fPlane[1]=AliMpPlane::Create(kNonBendingPlane);
   for (i=0;i<2;i++){
-    fPlaneSegmentation[i]= new AliMpPlaneSegmentation(fPlane[i]);
     ReadIniFile(i);
   }
+  
+  fReadFiles = kFALSE;
 }
 
 //__________________________________________________________________________
 Float_t AliMUONSt1Response::IntPH(Float_t eloss)
 {
   // Calculate charge from given ionization energy lost.
+
   Int_t nel;
   nel= Int_t(eloss*1.e9/20); 
   Float_t charge=0;
@@ -447,9 +557,10 @@ Float_t AliMUONSt1Response::IntPH(Float_t eloss)
 
 
 //__________________________________________________________________________
-AliMpZone* AliMUONSt1Response::FindZone(AliMpSector* sector,Int_t posId)
+AliMpZone* AliMUONSt1Response::FindZone(const AliMpSector* sector, Int_t posId) const
 {
 // to be moved to AliMpSector::
+
   for (Int_t izone=1;izone<=sector->GetNofZones();izone++){
     AliMpZone* zone = sector->GetZone(izone);
     for (Int_t isub=0;isub<zone->GetNofSubZones();isub++){
@@ -464,8 +575,7 @@ AliMpZone* AliMUONSt1Response::FindZone(AliMpSector* sector,Int_t posId)
 
 
 //__________________________________________________________________________
-
-Int_t  AliMUONSt1Response::DigitResponse(Int_t digit,AliMUONTransientDigit* where)
+Int_t  AliMUONSt1Response::DigitResponse(Int_t digit, AliMUONTransientDigit* where)
 {
   // returns the electronic response of pad located at <where>, when
   // a charge <digit> is present
@@ -474,30 +584,38 @@ Int_t  AliMUONSt1Response::DigitResponse(Int_t digit,AliMUONTransientDigit* wher
     //                          <<" on plane "<<where->Cathode()<<endl;
     
     //read the files the first time this function is called
-    if (!fPlane[0]) ReadFiles();
+    if (fReadFiles) ReadFiles();
 
     fCountNofCalls++;
     
+    const AliMpSectorSegmentation* segmentation 
+      = GetMpSegmentation(where->DetElemId(), where->Cathode());
+    const AliMpSector* sector = segmentation->GetSector();
+       
     AliMpIntPair indices(where->PadX(),where->PadY());
-    AliMpPad pad = fPlaneSegmentation[where->Cathode()]->PadByIndices(indices,kFALSE);
-    Int_t GC=0;
+    AliMpPad pad = segmentation->PadByIndices(indices,kFALSE);
+    Int_t gc=0;
     Int_t numZone=0;
     AliMpZone* zone=0;
+    cout << "Digit: DE=" << where->DetElemId()
+         << "  cathod=" <<  where->Cathode() << endl;
+    cout << "Found pad: " << pad << endl;
 
     if (pad.IsValid()) {
       AliMpIntPair location = pad.GetLocation();
       //cout<<location.GetFirst()<<endl;
       Int_t posId=abs(location.GetFirst());
+/*
       AliMpSector* sector=0;
       if (fPlane[0]->GetFrontSector()->GetMotifMap()->FindMotifPosition(posId))
                sector=(AliMpSector*)fPlane[0]->GetFrontSector();
       else if (fPlane[0]->GetBackSector()->GetMotifMap()->FindMotifPosition(posId))
                sector=(AliMpSector*)fPlane[0]->GetBackSector();
-
+*/
       if (sector) zone=FindZone(sector,posId);
       if (zone){
        numZone=zone->GetID()-1;
-       GC=location.GetSecond();
+       gc=location.GetSecond();
       } else {
        fCountUnknownZone++;
       }
@@ -505,19 +623,23 @@ Int_t  AliMUONSt1Response::DigitResponse(Int_t digit,AliMUONTransientDigit* wher
       fCountUnknownIndices++;
     }
 
+    cout << "Zone: " << zone << endl;
+
     if (!zone) {
       cout<<"Probleme electronic of pad "<<where->PadX()<<' '<<where->PadY()
          <<" on plane "<<where->Cathode()<<endl;
       return 6666;
     }
+    cout << "Loop1: " << endl;
     TList listParams;
-    TIter next(&fRulesList[where->Cathode()]);
+    TIter next(&fRulesList[where->Cathode()-1]);
     AliMUONSt1ResponseRule* rule;
     while ( (rule = static_cast<AliMUONSt1ResponseRule*>(next())))
       if (rule->Contains(pad)) listParams.AddAll(rule->GetParameters());
-    if (fDefaultParameters[where->Cathode()][numZone])
-      listParams.Add(fDefaultParameters[where->Cathode()][numZone]);
+    if (fDefaultParameters[where->Cathode()-1][numZone])
+      listParams.Add(fDefaultParameters[where->Cathode()-1][numZone]);
 
+    cout << "Loop2: " << endl;
     AliMUONSt1ResponseParameter* param;
     TIter nextParam(&listParams);
     while ( (param = static_cast<AliMUONSt1ResponseParameter*>(nextParam()))){
@@ -525,10 +647,11 @@ Int_t  AliMUONSt1Response::DigitResponse(Int_t digit,AliMUONTransientDigit* wher
         return 0;
       }
     }
+    cout << "Loop3: " << endl;
     nextParam.Reset();
     while ( (param = static_cast<AliMUONSt1ResponseParameter*>(nextParam()))){
       if (param->HasPedestal()) {
-        digit  = param->ApplyPedestal(digit,GC);
+        digit  = param->ApplyPedestal(digit,gc);
         break; // Apply pedestals just once -->  break the loop once a pedestal 
 //                                               rule is applied
       }
@@ -549,6 +672,7 @@ Int_t  AliMUONSt1Response::DigitResponse(Int_t digit,AliMUONTransientDigit* wher
 void AliMUONSt1Response::PrintStatistics() const
 {
 // Show the results of the statistics
+
   cout<<"The DigitResponse() method was called "<<fCountNofCalls<<" times"<<endl;
   cout<<" it was unable to find the pad corresponding to the given indices "
       <<fCountUnknownIndices<<" times ("