]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
New definition of name ofobject in TMap tables. Fixing conding convention violations
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Jul 2004 16:28:10 +0000 (16:28 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Jul 2004 16:28:10 +0000 (16:28 +0000)
MUON/AliMUONSegmentIndex.cxx
MUON/AliMUONSegmentIndex.h
MUON/AliMUONSegmentManuIndex.cxx
MUON/AliMUONSegmentManuIndex.h
MUON/AliMUONSegmentPosition.cxx
MUON/AliMUONSegmentPosition.h
MUON/AliMUONSegmentationDetectionElement.cxx
MUON/AliMUONSegmentationDetectionElement.h

index d3845c7fe4d9696b1547cbf08e40f740f1ef24e0..3e3ec094324ae8c77af98f2d66c25ec0d3926c59 100644 (file)
@@ -25,6 +25,8 @@
 //  Detailed information in Alice Technical Note xxxxxxxx (2004)
 //====================================================================
 
+#include <TString.h>
+
 #include "AliMUONSegmentIndex.h"
 
 //___________________________________________
@@ -34,6 +36,7 @@ ClassImp(AliMUONSegmentIndex)
 //___________________________________________
 AliMUONSegmentIndex::AliMUONSegmentIndex() : TNamed()
 {
+  // Constructor by default
   fChannelId = 0;
   fPadX = 0;
   fPadY = 0;
@@ -42,10 +45,9 @@ AliMUONSegmentIndex::AliMUONSegmentIndex() : TNamed()
 //___________________________________________
 AliMUONSegmentIndex::AliMUONSegmentIndex(const Int_t channelId, const Int_t padX, const Int_t padY, const Int_t cathode) : TNamed()
 {
-  char name[10];
-  sprintf(name,"%d-%d",padX,padY);
-  fName = name;
-  fTitle = name;
+  // Constructor to be used
+  fName  = Name(padX, padY, cathode).Data();
+  fTitle = Name(padX, padY, cathode).Data();
   fChannelId = channelId;
   fPadX = padX;
   fPadY = padY;
@@ -54,16 +56,27 @@ AliMUONSegmentIndex::AliMUONSegmentIndex(const Int_t channelId, const Int_t padX
 //_______________________________________________
 AliMUONSegmentIndex::~AliMUONSegmentIndex()
 {
-
+  // Destructor
 }
 //___________________________________________
 Int_t AliMUONSegmentIndex::Compare(const TObject *obj) const
 {
+  // Comparison of two AliMUONSegmentIndex objects
   AliMUONSegmentIndex * myobj = ( AliMUONSegmentIndex *) obj;
   return (fChannelId > myobj->GetChannelId()) ? 1 : -1;
 }
+//___________________________________________
+TString AliMUONSegmentIndex::Name(Int_t padx, Int_t pady, Int_t cathode)
+{
+  // Definition of the name of the object
+  char name[15];
+  sprintf(name,"%d-%d-%d",padx,pady,cathode);
+  return TString(name);
+}
+
 //___________________________________________
 void AliMUONSegmentIndex::Print() const
 {
-  printf("%s id=%d ix=%d iy=%d cathode=%d\n",fName.Data(),fChannelId,fPadX,fPadY,fCathode);   
+  // Printing information of AliMUONSegmentIndex
+  Info("Print", "Name=%s Id=%d PadX=%d PadY=%d Cathode=%d\n",fName.Data(),fChannelId,fPadX,fPadY,fCathode);   
 }
index 1060a82b99555588b386f0350aa24425761b0ae1..01397d39376cdeae1ddb4010928f2707e420da4b 100644 (file)
@@ -16,6 +16,7 @@
 //====================================================================
 
 #include <TNamed.h>
+#include <TString.h>
 
 class AliMUONSegmentIndex : public TNamed {
  public:
@@ -30,13 +31,14 @@ class AliMUONSegmentIndex : public TNamed {
   Int_t GetPadY()      const {return fPadX;} 
   Int_t GetCathode()   const {return fCathode;} 
   
+  static TString Name(Int_t padx, Int_t pady, Int_t cathode) ;
   void Print() const;
 
  private:
   Int_t fChannelId; // Id of the channel within the detection element
-  Int_t fPadX;
-  Int_t fPadY;
-  Int_t fCathode;
+  Int_t fPadX;      // pad index in the X direction
+  Int_t fPadY;      // pad index in the y direction
+  Int_t fCathode;   // cathode plane 0 bending 1 non bending
   
   ClassDef(AliMUONSegmentIndex,1) // Segmenation for MUON detection elements   
 };
index 05a9cd317f48c3490ba998aae93cd2caf0a0ee57..038922d91d1a1d50f0243688d8a3ac6d5647469f 100644 (file)
@@ -25,6 +25,7 @@
 //  Detailed information in Alice Technical Note xxxxxxxx (2004)
 //====================================================================
 
+#include <TString.h>
 
 #include "AliMUONSegmentManuIndex.h"
 
@@ -35,6 +36,7 @@ ClassImp(AliMUONSegmentManuIndex)
 //___________________________________________
 AliMUONSegmentManuIndex::AliMUONSegmentManuIndex() 
 {
+  //Default constructor
   fChannelId= 0;; // Id of the channel within the detection element
   fManuId= 0;; // Manu id in the detection element
   fBusPatchId= 0;; // BusPatchId in the detection element up to 4 for slats
@@ -43,10 +45,9 @@ AliMUONSegmentManuIndex::AliMUONSegmentManuIndex()
 //___________________________________________
 AliMUONSegmentManuIndex::AliMUONSegmentManuIndex(const Int_t channelId, const Int_t manuId, const Int_t busPatchId,  Int_t manuChannelId) : TNamed()
 {  
-  char name[10];
-  sprintf(name,"%d-%d",manuId,manuChannelId);
-  fName=name;
-  fTitle=name;
+  // Constructor to be used
+  fName = Name(manuId, manuChannelId).Data();
+  fTitle= Name(manuId, manuChannelId).Data();
   fChannelId     = channelId;
   fManuId        = manuId;
   fBusPatchId    = busPatchId;
@@ -55,16 +56,27 @@ AliMUONSegmentManuIndex::AliMUONSegmentManuIndex(const Int_t channelId, const In
 //_______________________________________________
 AliMUONSegmentManuIndex::~AliMUONSegmentManuIndex()
 {
-
+  // Destructor
 }
 //___________________________________________
 Int_t AliMUONSegmentManuIndex::Compare(const TObject *obj) const
 {
+  // Comparison of two AliMUONSegmentManuIndex objects
  AliMUONSegmentManuIndex * myobj = ( AliMUONSegmentManuIndex *) obj;
   return (fChannelId > myobj->GetChannelId()) ? 1 : -1;
 }
 //___________________________________________
+TString AliMUONSegmentManuIndex::Name(Int_t manuid, Int_t manuchannel) 
+{
+  // Definition of the name for TMap indexing
+  char name[15];
+  Int_t absid = manuid*64 + manuchannel;
+  sprintf(name,"%d",absid);
+  return TString(name);
+}
+//___________________________________________
 void AliMUONSegmentManuIndex::Print() const
 {
-  printf("%s id=%d ManuId=%d BusPatch=%d ManuChannelId=%d\n",fName.Data(),fChannelId,fManuId,fBusPatchId,fManuChannelId);   
+  // Printing AliMUONSegmentManuIndex information
+  Info("Print","Name=%s Id=%d BusPatch=%d ManuId=%d ManuChannelId=%d\n",fName.Data(),fChannelId,fBusPatchId,fManuId,fManuChannelId);   
 }
index 6309b81e2ed805b1b3da848cb3c95177acb364e3..5a5633969d47fdc0bcc6a90a7e8c40c38252acaa 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <TNamed.h>
 
+class TString;
 
 class AliMUONSegmentManuIndex : public TNamed {
  public:
@@ -31,8 +32,10 @@ class AliMUONSegmentManuIndex : public TNamed {
   Int_t GetManuId()        const{return fManuId;}
   Int_t GetBusPatchId()    const{return fBusPatchId;}
   Int_t GetManuChannelId() const{return fManuChannelId;}
+
+  static TString Name(Int_t manuId, Int_t manuchannel);
   
-  void Print() const;
+  void   Print() const;
 
  private:
   Int_t fChannelId; // Id of the channel within the detection element
index 9f9a26e1623e6a970c458e0ca2a3611b72cf9ea5..4ffddf602c50ac40d95f3326080f50db46898698 100644 (file)
@@ -25,6 +25,8 @@
 //  Detailed information in Alice Technical Note xxxxxxxx (2004)
 //====================================================================
 
+#include <TMath.h>
+
 #include "AliMUONSegmentPosition.h"
 
 //___________________________________________
@@ -34,6 +36,7 @@ ClassImp(AliMUONSegmentPosition)
 //___________________________________________
 AliMUONSegmentPosition::AliMUONSegmentPosition() : TNamed()
 {
+//Default constructor
   fChannelId = 0;
   fX = 0.;
   fY = 0.;  
@@ -41,10 +44,9 @@ AliMUONSegmentPosition::AliMUONSegmentPosition() : TNamed()
 //___________________________________________
 AliMUONSegmentPosition::AliMUONSegmentPosition(const Int_t channelId, const Float_t x, const Float_t y, const Int_t cathode) : TNamed()
 {
-  char name[10];
-  sprintf(name,"%5.2f-%5.2f",x,y);
-  fName = name;
-  fTitle= name;
+  // Constructor to be used
+  fName = Name(x,y,cathode);
+  fTitle= Name(x,y,cathode);
   fChannelId = channelId;
   fX = x;
   fY = y;
@@ -53,16 +55,33 @@ AliMUONSegmentPosition::AliMUONSegmentPosition(const Int_t channelId, const Floa
 //_______________________________________________
 AliMUONSegmentPosition::~AliMUONSegmentPosition()
 {
-
+ // Destructor
 }
 //___________________________________________
 Int_t AliMUONSegmentPosition::Compare(const TObject *obj) const
 {
+  // Comparison of two AliMUONSegmentPosition objects
   AliMUONSegmentPosition * myobj = ( AliMUONSegmentPosition *) obj;
   return (fChannelId > myobj->GetChannelId()) ? 1 : -1;
 }
 //___________________________________________
+TString AliMUONSegmentPosition::Name(Float_t x, Float_t y, Int_t cathode) 
+{
+  // Definition of the name of AliMUONSegmentPosition
+  // Our convention since the smaller pad pich is 5 mm is to choice a 3mm unit:
+  // So for a position pair x,y and cathode plane icathode the name will be:
+  // xp = TMath::Nint(x*10./3.);
+  // yp = TMath::Nint(y+10./3.);
+  // sprintf(name,"%d-%d-%d",xp,yp,cathode);
+  Int_t xp = TMath::Nint(x*10./3.);
+  Int_t yp = TMath::Nint(y*10./3.);
+  char name[15];
+  sprintf(name,"%d-%d-%d",xp,yp,cathode);
+  return TString(name);
+}
+//___________________________________________
 void AliMUONSegmentPosition::Print() const
 {
-  printf("%s id=%d x=%f y=%f cathode=%d\n",fName.Data(),fChannelId, fX, fY,fCathode);   
+  // Printing AliMUONSegmentManuIndex information
+  Info("Print","Name=%s Id=%d X=%f Y=%f Cathode=%d\n",fName.Data(),fChannelId, fX, fY,fCathode);   
 }
index 7d2cc6afd2f95983015afa9ee515073415cbec1e..90a3f6a5c1bbf6d0bd13acfd0de2d9bc34175182 100644 (file)
@@ -15,7 +15,9 @@
 //  Detailed information in Alice Technical Note xxxxxxxx (2004)
 //====================================================================
 
+
 #include <TNamed.h>
+#include <TString.h>
 
 class AliMUONSegmentPosition : public TNamed
 {
@@ -30,12 +32,15 @@ class AliMUONSegmentPosition : public TNamed
     Float_t GetYlocal()   const {return fY;}
     Int_t   GetCathode()  const {return fCathode;}
 
-    void Print() const;
+
+    static TString Name(Float_t x, Float_t y, Int_t cathode) ;
+    void    Print() const;
+
  private:
-    Int_t fChannelId;   // Id of the channel within the detection element
-    Float_t fX;
-    Float_t fY;
-    Int_t fCathode;
+    Int_t   fChannelId;   // Id of the channel within the detection element
+    Float_t fX;           // Position X of the center of the segment (pad, strip, etc...)
+    Float_t fY;           // Position Y of the center of the segment (pad, strip, etc...)
+    Int_t   fCathode;     // Cathode Side Bending 1  or non bending 0 
      
     ClassDef(AliMUONSegmentPosition,1) // Loal positions of segments
        
index d110706b89d46ce3858d10d2a5ed99a2df37f535..ee10b58375ae8e94b9bac97adb75663fba7430f1 100644 (file)
@@ -39,7 +39,6 @@
 #include "AliMUONSegmentPosition.h"
 #include "AliMUONSegmentIndex.h"
 
-
 //___________________________________________
 ClassImp(AliMUONSegmentationDetectionElement)
 
@@ -56,11 +55,11 @@ const TString AliMUONSegmentationDetectionElement::fgkNonBendingExt = ".NonBendi
 
 AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement() : TObject()
 {
+  //Default constructor
   fMapManuIndexIndex= 0x0;
   fMapIndexManuIndex= 0x0;
   fMapIndexPosition= 0x0;
-  fXlocalSegmentPositions= 0x0;
-  fYlocalSegmentPositions= 0x0;
+  fMapPositionIndex=0X0;
 }
 
 
@@ -70,8 +69,6 @@ AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement() : TOb
 //   fMapManuIndexIndex= 0x0;
 //   fMapIndexManuIndex= 0x0;
 //   fMapIndexPosition= 0x0;
-//   fXlocalSegmentPositions= 0x0;
-//   fYlocalSegmentPositions= 0x0;
 // }
 
 //________________________________________________
@@ -83,16 +80,26 @@ AliMUONSegmentationDetectionElement::AliMUONSegmentationDetectionElement(const A
 }
 //_________________________________________________
 AliMUONSegmentationDetectionElement::~AliMUONSegmentationDetectionElement(){
+  //Class destructor
   fListOfIndexes->Delete();
   fListOfManuIndexes->Delete();
   fListOfPositions->Delete();
   fMapManuIndexIndex->Clear();
   fMapIndexManuIndex->Clear();
   fMapIndexPosition->Clear();
+  fMapPositionIndex->Clear();
+}
+
+//_________________________________________________
+AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndex(Int_t manu, Int_t channel) const
+{
+  // Getting AliMUONSegmentIndex from ManuIndex
+  return GetIndex( AliMUONSegmentManuIndex::Name(manu, channel).Data() ) ;
 }
 //_________________________________________________
-AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndex( const char * SegmentManuIndexName)
+AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndex( const char * SegmentManuIndexName) const
 {
+  // Getting AliMUONSegmentIndex from name of AliMUONSegmentManuIndex
   if (fMapManuIndexIndex) return  (AliMUONSegmentIndex*)  fMapManuIndexIndex->GetValue(SegmentManuIndexName);
   else {
     Warning("GetIndex","SegmentManuIndex %s out of DetectionElement Mapping %s",
@@ -100,10 +107,16 @@ AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndex( const char
     return 0x0;
   }
 }
-
 //_________________________________________________
-AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::GetManuIndex( const char * SegmentIndexName)
+AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::GetManuIndex(Int_t padx, Int_t pady, Int_t cathode ) const
+{
+  // Getting ManuIndex from Index
+  return GetManuIndex( AliMUONSegmentIndex::Name(padx, pady, cathode).Data() ); 
+}
+//_________________________________________________
+AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::GetManuIndex( const char * SegmentIndexName) const
 {
+  // Getting ManuIndex from manuname
   if (fMapIndexManuIndex) return (AliMUONSegmentManuIndex*) fMapIndexManuIndex->GetValue(SegmentIndexName);
   else {
     Warning("GetManuIndex","SegmentIndex %s out of Detection Element mapping %s",
@@ -111,10 +124,16 @@ AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::GetManuIndex( con
     return 0x0;
   }
 }
-
 //_________________________________________________
-AliMUONSegmentPosition  * AliMUONSegmentationDetectionElement::GetPosition( const char * SegmentIndexName)
+AliMUONSegmentPosition  * AliMUONSegmentationDetectionElement::GetPosition(Int_t padx, Int_t pady, Int_t cathode ) const
+{
+  //Getting position from index
+  return GetPosition(  AliMUONSegmentIndex::Name(padx, pady, cathode).Data() ); 
+}
+//_________________________________________________
+AliMUONSegmentPosition  * AliMUONSegmentationDetectionElement::GetPosition( const char * SegmentIndexName) const
 {
+  // Getting position from indexname
   if (fMapIndexPosition) return (AliMUONSegmentPosition*) fMapIndexPosition->GetValue(SegmentIndexName);
   else {
     Warning("GetPosition","SegmentIndex %s out of DetectionElement mapping %s",
@@ -122,10 +141,28 @@ AliMUONSegmentPosition  * AliMUONSegmentationDetectionElement::GetPosition( cons
     return 0x0;
   }
 }
+//_________________________________________________
+AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndexFromPosition(Float_t x, Float_t y, Int_t cathode) const
+{
+  // Getting Index from position if position is a center pad position
+  return GetIndexFromPosition( AliMUONSegmentPosition::Name(x,y, cathode).Data() );
+}
+//_________________________________________________
+AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::GetIndexFromPosition( const char * PositionName) const
+{
+  // Getting index form positionname
+  if (fMapPositionIndex) return  (AliMUONSegmentIndex*)  fMapPositionIndex->GetValue(PositionName);
+  else {
+    Warning("GetIndexFromPosition","SegmentPosition %s out of DetectionElement Mapping %s",
+           PositionName,fDetectionElementType.Data());
+    return 0x0;
+  }
+}
 
 //_________________________________________________
-AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::FindManuIndex(const char* ManuIndexName)
+AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::FindManuIndex( const char* ManuIndexName)const
 {
+  // Getting AliMUONSegmentManuIndex objecto from manu index
   if (fMapManuIndexIndex) return (AliMUONSegmentManuIndex*) fMapManuIndexIndex->FindObject(ManuIndexName);
   else  {
     Warning("FindManuIndex","SegmentManuIndex %s out of DetectionElement mapping %s",
@@ -135,33 +172,85 @@ AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::FindManuIndex(con
 }
 
 //_________________________________________________
-AliMUONSegmentManuIndex * AliMUONSegmentationDetectionElement::FindIndex(const char* IndexName)
+AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::FindIndex(const char* IndexName) const
 {
-  if (fMapIndexPosition) return (AliMUONSegmentManuIndex *) fMapIndexPosition->FindObject(IndexName);
+  // Getting 
+  if (fMapIndexPosition) return (AliMUONSegmentIndex *) fMapIndexPosition->FindObject(IndexName);
   else {
     Warning("FindIndex","SegmentIndex %s out of DetectionElement mapping %s",
            IndexName,fDetectionElementType.Data());
     return 0x0;
   }
 }
+//_________________________________________________
+AliMUONSegmentIndex * AliMUONSegmentationDetectionElement::FindIndexFromPosition(Float_t /*x*/, Float_t /*y*/, Int_t /*cathode*/ ) const
+{
 
+ //  char * name = AliMUONSegmentPosition::Name(x,y);
+
+//   if (GetIndexFromPosition( AliMUONSegmentPosition::Name(x,y)) ) 
+//     return GetIndexFromPosition( AliMUONSegmentPosition::Name(x,y) );
+  
+//   Float_t xl= ((Int_t) x*10 )/10.;
+//   Float_t yl= ((Int_t) y*10 )/10.;
+//   Int_t ix,iy, ixp;
+  
+//   for(ix=1; ix<4; ix++) {
+//     xl = ((Int_t) 0.5+10.*(x +  ((Float_t) ix )*0.1))/10.; 
+//     for(iy=-ix; iy<ix+1; iy++) {
+//       printf("A %d and %d and %f and %f \n",ix,iy,xl,yl);
+//       yl = ((Int_t) 10.*(y +  ((Float_t) iy )*0.1))/10. ;
+//       sprintf(name,"%5.1f-%5.1f",xl, yl);
+//       if (GetIndexFromPosition(name)) break;
+//     }
+//     if (GetIndexFromPosition(name)) break;
+    
+
+//     for(ixp=ix-1; ixp>-ix-1; ixp--) {
+//       xl = ((Int_t) 0.5+10.*(x +  ((Float_t) ixp )*0.1))/10. ;
+//       printf("B %d and %d and %f and %f \n",ixp,ix, xl, yl);
+//       sprintf(name,"%5.1f-%5.1f",xl, yl);
+//       if (GetIndexFromPosition(name)) break;
+//     }
+//     if (GetIndexFromPosition(name)) break;
+    
+//     for(iy=ix-1; iy>-ix-1; iy--) {
+//       yl = ((Int_t) 0.5+10.*(y +  ((Float_t) iy )*0.1))/10. ;
+//       printf("C %d and %d and %f and %f \n",-ix,iy,xl,yl);
+//       sprintf(name,"%5.1f-%5.1f",xl, yl);
+//       if (GetIndexFromPosition(name)) break;
+//     }
+//     if (GetIndexFromPosition(name)) break;
+    
+//     for(ixp=-ix+1; ixp<ix+1; ixp++) {
+//       xl = ((Int_t) 0.5+10.*(x +  ((Float_t) ixp )*0.1))/10. ;
+//       printf("D %d and %d and %f and %f \n",ixp,-ix,xl,yl);
+//       sprintf(name,"%5.1f-%5.1f",xl, yl);
+//       if (GetIndexFromPosition(name)) break;
+//     }
+//     if (GetIndexFromPosition(name)) break;
+//   }
+//   return GetIndexFromPosition(name);
+  return 0x0;
+}
 //_________________________________________________
 void    AliMUONSegmentationDetectionElement::Init(const char * DetectionElementType)
 {
-  TString ElementType(DetectionElementType);
-  fSegmentationMappingFile_Bending = fgkDefaultTop+fgkStationDir+"345"
-    +fgkBendingDir+"/"+ElementType+fgkBendingExt+fgkFileExt;
-  printf("file is %s\n", fSegmentationMappingFile_Bending.Data());
-  fSegmentationMappingFile_NonBending = fgkDefaultTop+fgkStationDir+"345"
-    +fgkNonBendingDir+"/"+ElementType+fgkNonBendingExt+fgkFileExt;
+  TString elementType(DetectionElementType);
+  fSegmentationMappingFileBending = fgkDefaultTop+fgkStationDir+"345"
+    +fgkBendingDir+"/"+elementType+fgkBendingExt+fgkFileExt;
+  printf("file is %s\n", fSegmentationMappingFileBending.Data());
+  fSegmentationMappingFileNonBending = fgkDefaultTop+fgkStationDir+"345"
+    +fgkNonBendingDir+"/"+elementType+fgkNonBendingExt+fgkFileExt;
 
   if (fMapManuIndexIndex==0x0) { 
-    fListOfIndexes = new TObjArray(10000);
-    fListOfManuIndexes =new TObjArray(10000);
-    fListOfPositions =new TObjArray(10000);
+    fListOfIndexes = new TObjArray(15000);
+    fListOfManuIndexes =new TObjArray(15000);
+    fListOfPositions =new TObjArray(15000);
     fMapManuIndexIndex= new TMap();
     fMapIndexManuIndex = new TMap();
     fMapIndexPosition = new TMap();
+    fMapPositionIndex = new TMap();
   }
   else {
     fListOfIndexes->Delete();
@@ -170,17 +259,15 @@ void    AliMUONSegmentationDetectionElement::Init(const char * DetectionElementT
     fMapManuIndexIndex->Clear();
     fMapIndexManuIndex->Clear();
     fMapIndexPosition->Clear();
+    fMapPositionIndex->Clear();
   }
-
-
-
   Int_t icathode;
   //Bendingplane
   icathode=0;
-  ReadingSegmentationMappingFile(fSegmentationMappingFile_Bending ,icathode);
+  ReadingSegmentationMappingFile(fSegmentationMappingFileBending ,icathode);
   //NonBendingplane
   icathode=1;
-  ReadingSegmentationMappingFile(fSegmentationMappingFile_NonBending,icathode);
+  ReadingSegmentationMappingFile(fSegmentationMappingFileNonBending,icathode);
   
 }
 //_______________________________________________________________
@@ -195,9 +282,7 @@ void AliMUONSegmentationDetectionElement::ReadingSegmentationMappingFile(TString
     Float_t x, y;
     while ( !in.eof()) {
       in >> id >> ix >> iy >> x >> y >> idmanu >> idchannel;
-      char name[10];
-      sprintf(name,"%d%d",ix,iy);
-      printf("%s id=%d ix=%d iy=%d x=%f y=%f idmanu=%d and idchannel=%d\n",name,id, ix, iy,  x, y,idmanu, idchannel);
+      printf("id=%d ix=%d iy=%d x=%f y=%f idmanu=%d and idchannel=%d\n",id, ix, iy,  x, y,idmanu, idchannel);
       
       fListOfIndexes->AddAt(     new AliMUONSegmentIndex(id,ix,iy,cathode), id);
       fListOfManuIndexes->AddAt( new AliMUONSegmentManuIndex(id,idmanu,0,idchannel), id);;
@@ -210,6 +295,7 @@ void AliMUONSegmentationDetectionElement::ReadingSegmentationMappingFile(TString
       fMapManuIndexIndex->Add( fListOfManuIndexes->At(id), fListOfIndexes->At(id));
       fMapIndexManuIndex->Add( fListOfIndexes->At(id),     fListOfManuIndexes->At(id));
       fMapIndexPosition->Add(  fListOfIndexes->At(id),     fListOfPositions->At(id));
+      fMapPositionIndex->Add(  fListOfPositions->At(id), fListOfIndexes->At(id) );
     } 
   }
   in.close();
index 1dc9f312b391bd8126207a3597df5716ebb72cdf..13b933b5b1cb5231715eb25d5d078e54ca22d089 100644 (file)
@@ -38,16 +38,26 @@ class AliMUONSegmentationDetectionElement : public TObject {
   AliMUONSegmentationDetectionElement();
   //AliMUONSegmentationDetectionElement(const char* ElementType="");
   virtual ~AliMUONSegmentationDetectionElement();
+
+  // User functions
+  AliMUONSegmentIndex     * GetIndex(Int_t manu, Int_t channel) const;
+  AliMUONSegmentIndex     * GetIndexFromPosition(Float_t x, Float_t y, Int_t icathode) const;
+  AliMUONSegmentManuIndex * GetManuIndex( Int_t padx, Int_t pady, Int_t cathode) const ;
+  AliMUONSegmentPosition  * GetPosition(Int_t padx, Int_t pady, Int_t cathode) const ;
+
   
-  AliMUONSegmentIndex     * GetIndex( const char * SegmentManuIndexName);
-  AliMUONSegmentManuIndex * GetManuIndex( const char * SegmentIndexName);
-  AliMUONSegmentPosition  * GetPosition( const char * SegmentIndexName);
+  AliMUONSegmentIndex     * GetIndex( const char * SegmentManuIndexName)const;
+  AliMUONSegmentIndex     * GetIndexFromPosition( const char * PositionName)const;
+  AliMUONSegmentManuIndex * GetManuIndex( const char * SegmentIndexName) const;
+  AliMUONSegmentPosition  * GetPosition( const char * SegmentIndexName) const;
   TObjArray *            ListOfIndexes() {return fListOfIndexes;}
   TObjArray *            ListOfManuIndexes() {return fListOfIndexes;}
   TObjArray *            ListOfPositions() {return fListOfIndexes;}
  
-  AliMUONSegmentManuIndex * FindManuIndex(const char* ManuIndexName="");
-  AliMUONSegmentManuIndex * FindIndex(const char* IndexName="");
+  AliMUONSegmentManuIndex * FindManuIndex(const char* ManuIndexName="") const;
+  AliMUONSegmentIndex * FindIndex(const char* IndexName="") const;
+
+  AliMUONSegmentIndex * FindIndexFromPosition(Float_t x, Float_t y, Int_t cathode) const;
   
   void     Init(const char * DetectionElementType="slat220000N");
 
@@ -58,8 +68,8 @@ class AliMUONSegmentationDetectionElement : public TObject {
   
  private:
   // static data members  
-  static const TString fgkDefaultTop;  // 
-  static const TString fgkStationDir;  // 
+  static const TString fgkDefaultTop;  // Top directory of $Alice_ROOT/MUON/mapping
+  static const TString fgkStationDir;  // Directory for station station1, station2, station345
   static const TString fgkBendingDir;    //bending plane directory
   static const TString fgkNonBendingDir; //non-bending plane directory
   static const TString fgkFileExt;  // File extention
@@ -68,16 +78,15 @@ class AliMUONSegmentationDetectionElement : public TObject {
 
   // data members
   TString   fDetectionElementType;               //  Type of detection element St1Sector, slat220000N, etc ....
-  TString   fSegmentationMappingFile_Bending;    //  Segmentation & mapping file for bending plane
-  TString   fSegmentationMappingFile_NonBending; //  Segmentation & mapping file for non bending plane
-  TObjArray * fListOfIndexes;
-  TObjArray * fListOfManuIndexes;
-  TObjArray * fListOfPositions;
+  TString   fSegmentationMappingFileBending;    //  Segmentation & mapping file for bending plane
+  TString   fSegmentationMappingFileNonBending; //  Segmentation & mapping file for non bending plane
+  TObjArray * fListOfIndexes;        // TObject Array fo AliMUONSegmentIndex
+  TObjArray * fListOfManuIndexes;   // TObject Array fo AliMUONSegmentManuIndex
+  TObjArray * fListOfPositions;  // TObject Array fo AliMUONSegmentPositions
   TMap *    fMapManuIndexIndex;  // Map with key ManuIndex and value = Index
   TMap *    fMapIndexManuIndex;// Map with key ManuIndexIndex and value = ManuIndex
   TMap *    fMapIndexPosition;// Map with key Index and value = Position
-  TArrayF * fXlocalSegmentPositions; // Array of posible values of Xlocal
-  TArrayF * fYlocalSegmentPositions;// Array of posible values of Ylocal
+  TMap *    fMapPositionIndex;// Map with key Index and value = Position
   
 
   ClassDef(AliMUONSegmentationDetectionElement,1) // Segmentation for MUON detection elements