]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Clean-up of the class structure + coding conventions
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Nov 2003 19:00:17 +0000 (19:00 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Nov 2003 19:00:17 +0000 (19:00 +0000)
ITS/AliITSpackageSSD.cxx
ITS/AliITSpackageSSD.h
ITS/AliITSsegmentation.cxx
ITS/AliITSsegmentation.h
ITS/AliITSsegmentationSDD.cxx
ITS/AliITSsegmentationSDD.h
ITS/AliITSsegmentationSPD.cxx
ITS/AliITSsegmentationSPD.h
ITS/AliITSsegmentationSSD.cxx
ITS/AliITSsegmentationSSD.h

index 53ffb770b7c80d115d7effed101e8221a0a055b7..58c52e09dcef6eaf2d9b1febd5e3e19260a41f32 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
 
-//************************************************
-//Piotr Krzysztof Skowronski
-//Warsaw University of Technology
-//skowron@if.pw.edu.pl
-//
-
 #include <Riostream.h>
 #include <TClonesArray.h>
 #include "AliITSpackageSSD.h"
+#include "AliITSclusterSSD.h"
 
 const Bool_t AliITSpackageSSD::fgkSIDEP=kTRUE;
 const Bool_t AliITSpackageSSD::fgkSIDEN=kFALSE;
 
-static const Int_t debug=0;
-
 ClassImp(AliITSpackageSSD)
-
+////////////////////////////////////////////////////////////////////////////
+//Class describing set of AliITSoneSideClusterSSDs, which contact each other.
+//Piotr Krzysztof Skowronski
+//Warsaw University of Technology
+//skowron@if.pw.edu.pl
+//
+//--------------------------------------------------------------------------
 AliITSpackageSSD::AliITSpackageSSD()
 {
+  // constructor
   fNclustersN=0;
   fClusterNIndexes = 0; 
                
   fNclustersP=0;
   fClusterPIndexes = 0;
-  if (debug) cout<<"Default Ctor was used\n>>>>>>>>>>>>>><<<<<<<<<<<<<";
+  if (fgkDebug) cout<<"Default Ctor was used\n>>>>>>>>>>>>>><<<<<<<<<<<<<";
 }
 
 
@@ -48,6 +47,7 @@ AliITSpackageSSD::AliITSpackageSSD()
 AliITSpackageSSD::AliITSpackageSSD
   (TClonesArray *clustersP, TClonesArray *clustersN)
 {
+  // constructor
   fClustersP=clustersP;
   fClustersN=clustersN;
        
@@ -63,8 +63,8 @@ AliITSpackageSSD::AliITSpackageSSD
 
 AliITSpackageSSD::AliITSpackageSSD
   ( Int_t len, TClonesArray *clustersP, TClonesArray *clustersN)
-
 {      
+  // constructor
   fClustersP=clustersP;
   fClustersN=clustersN;
 
@@ -84,6 +84,7 @@ AliITSpackageSSD::~AliITSpackageSSD()
   delete fClusterNIndexes;
   delete fClusterPIndexes;             
 }
+
 /*******************************************************/
 
 AliITSpackageSSD::AliITSpackageSSD(const AliITSpackageSSD &package) : 
@@ -108,7 +109,7 @@ AliITSpackageSSD::AliITSpackageSSD(const AliITSpackageSSD &package) :
       fClusterPIndexes[i]= package.fClusterPIndexes[i]; 
     }
   
-  if (debug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>";
+  if (fgkDebug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>";
   
   return; 
   
@@ -118,153 +119,156 @@ AliITSpackageSSD::AliITSpackageSSD(const AliITSpackageSSD &package) :
 AliITSpackageSSD&  
 AliITSpackageSSD::operator=( const AliITSpackageSSD & package)
 {
-
-Int_t i;  //iterator
-if (this == &package) return *this;
-fClustersN = package.fClustersN;
-fClustersP = package.fClustersP;
-
-fNclustersN= package.fNclustersN;
-fNclustersP= package.fNclustersP;
-
-for ( i =0; i<fNclustersN;i++)
-  {
-    fClusterNIndexes[i]= package.fClusterNIndexes[i]; 
-  }
-
-for ( i =0; i<fNclustersP;i++)
-  {
-    fClusterPIndexes[i]= package.fClusterPIndexes[i]; 
-  }
-
-if (debug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>";
-
-return *this; 
+  //  assignment operator
+  //
+  Int_t i;  //iterator
+  
+  if (this == &package) return *this;
+  fClustersN = package.fClustersN;
+  fClustersP = package.fClustersP;
+  
+  fNclustersN= package.fNclustersN;
+  fNclustersP= package.fNclustersP;
+  
+  for ( i =0; i<fNclustersN;i++)
+    {
+      fClusterNIndexes[i]= package.fClusterNIndexes[i]; 
+    }
+  
+  for ( i =0; i<fNclustersP;i++)
+    {
+      fClusterPIndexes[i]= package.fClusterPIndexes[i]; 
+    }
+  
+  if (fgkDebug) cout << "Copying function was used\n<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>";
+  
+  return *this; 
   
 }
 
-
 /*******************************************************/
 
-Int_t 
-AliITSpackageSSD::GetNSideClusterIdx(Int_t index)
-
+Int_t AliITSpackageSSD::GetNSideClusterIdx(const Int_t index) const
 {
+  // get N-side cluster
+  // 
   if ((index>-1)&&(index<fNclustersN))
     return (*fClusterNIndexes)[index];
   else 
-   {
-    cout << "AliITSpackageSSD::GetNSideClusterIdx  : Out of Range\n";
-    return -1;
-   }
+    {
+      cout << "AliITSpackageSSD::GetNSideClusterIdx  : Out of Range\n";
+      return -1;
+    }
 }
 /*******************************************************/
 
 
-Int_t AliITSpackageSSD::GetPSideClusterIdx(Int_t index)
+Int_t AliITSpackageSSD::GetPSideClusterIdx(const Int_t index) const
 {
+  // get P-side cluster
+  //
   if ((index>-1)&&(index<fNclustersP))
     return (*fClusterPIndexes)[index];
   else 
-  {
-  cout << "AliITSpackageSSD::GetPSideClusterIdx  : Out of Range\n";
-   return -1;
-  } 
+    {
+      cout << "AliITSpackageSSD::GetPSideClusterIdx  : Out of Range\n";
+      return -1;
+    
 }
 /*******************************************************/
 AliITSclusterSSD*  
-AliITSpackageSSD::GetPSideCluster(Int_t index)
+AliITSpackageSSD::GetPSideCluster(const Int_t index)
 {
-
-return (AliITSclusterSSD*)((*fClustersP)[GetPSideClusterIdx(index)]);
+  // get Pside cluster from the TClonesArray of SSD clusters
+  //
+  return (AliITSclusterSSD*)((*fClustersP)[GetPSideClusterIdx(index)]);
 }
 
 /*******************************************************/
 
 AliITSclusterSSD*  
-AliITSpackageSSD::GetNSideCluster(Int_t index)
+AliITSpackageSSD::GetNSideCluster(const Int_t index)
 {
-return (AliITSclusterSSD*)((*fClustersN)[GetNSideClusterIdx(index)]);
+  // get Nside cluster from the TClonesArray of SSD clusters
+  //
+  return (AliITSclusterSSD*)((*fClustersN)[GetNSideClusterIdx(index)]);
 }
 
 
 /*******************************************************/
 
-
-
-Bool_t 
-AliITSpackageSSD::GetClusterWithOneCross
-  (Int_t & index, Bool_t& side)
+Bool_t AliITSpackageSSD::GetClusterWithOneCross
+(Int_t & index, Bool_t& side)
 {
+  // select clusters with on cross 
+  //
+  if((fNclustersP==0)||(fNclustersN==0) )
+    {
+      printf("Empty package ((fNclustersP==0)||(fNclustersN==0))\n");
+      index = -2;
+      return kFALSE;
+    } 
+  Int_t ind;
   
- if((fNclustersP==0)||(fNclustersN==0) )
-  {
-    printf("Empty package ((fNclustersP==0)||(fNclustersN==0))\n");
-    index = -2;
-    return kFALSE;
-  } 
- Int_t ind;
-
- ind =(*fClusterPIndexes)[fNclustersP-1]; 
- if (  ( ((AliITSclusterSSD*)(*fClustersP)[ind]  )->GetCrossNo()  ) ==1 )
-  {
-    //index=ind;
-    index =fNclustersP-1; 
-    side=fgkSIDEP;
-    return kTRUE;
-  }
- ind =(*fClusterNIndexes)[fNclustersN-1]; 
- if (  (  ((AliITSclusterSSD*)(*fClustersN)[ind]  )->GetCrossNo() ) ==1  )
-  {
-    //index=ind;
-    index = fNclustersN-1;
-    side=fgkSIDEN;
-    return kTRUE;
-  }
+  ind =(*fClusterPIndexes)[fNclustersP-1]; 
+  if (  ( ((AliITSclusterSSD*)(*fClustersP)[ind]  )->GetCrossNo()  ) ==1 )
+    {
+      //index=ind;
+      index =fNclustersP-1; 
+      side=fgkSIDEP;
+      return kTRUE;
+    }
   
-
- ind =(*fClusterPIndexes)[0];
- if (  ( ((AliITSclusterSSD*)(*fClustersP)[ind]  )->GetCrossNo() ) ==1 )
-  {
-    //index=ind;
-    index = 0;
-    side=fgkSIDEP;
-    return kTRUE;
-  }
+  ind =(*fClusterNIndexes)[fNclustersN-1]; 
+  if (  (  ((AliITSclusterSSD*)(*fClustersN)[ind]  )->GetCrossNo() ) ==1  )
+    {
+      //index=ind;
+      index = fNclustersN-1;
+      side=fgkSIDEN;
+      return kTRUE;
+    }
   
-
- ind =(*fClusterNIndexes)[0];
- if (  ( ((AliITSclusterSSD*)(*fClustersN)[ind]  )->GetCrossNo()  ) ==1  )
-  {
-//    index=ind;
-    index = 0;  
-    side=fgkSIDEN;
-    return kTRUE;
-  }
+  
+  ind =(*fClusterPIndexes)[0];
+  if (  ( ((AliITSclusterSSD*)(*fClustersP)[ind]  )->GetCrossNo() ) ==1 )
+    {
+      //index=ind;
+      index = 0;
+      side=fgkSIDEP;
+      return kTRUE;
+    }
+  
+  
+  ind =(*fClusterNIndexes)[0];
+  if (  ( ((AliITSclusterSSD*)(*fClustersN)[ind]  )->GetCrossNo()  ) ==1  )
+    {
+      //    index=ind;
+      index = 0;  
+      side=fgkSIDEN;
+      return kTRUE;
+    }
   
   
- //Add for to be shure 
- index = -1;
- return kFALSE;
 //Add for to be shure 
 index = -1;
 return kFALSE;
   
 }
 /*******************************************************/
 
 void AliITSpackageSSD::DelCluster(Int_t index, Bool_t side)
 {
+  // call DelPCluster or DelNCluster depending on side
+  //
   if(side==fgkSIDEP) DelPCluster(index); else DelNCluster(index);
 }
 /*******************************************************/
 void AliITSpackageSSD::DelPCluster(Int_t index)
 {
-
-//it not deletes delete given cluster physically, 
-//but only complytely erase it from package
-//all clusters are deleted automatically when TClonesArray is deleted
-
+  //it not deletes delete given cluster physically, 
+  //but only complytely erase it from package
+  //all clusters are deleted automatically when TClonesArray is deleted
+  
   Int_t i;
   Int_t idx;
   Int_t clToDelIdx = GetPSideClusterIdx(index); //Index of cluster in TClonesArray 
@@ -272,24 +276,24 @@ void AliITSpackageSSD::DelPCluster(Int_t index)
   Int_t ncr = clToDel->GetCrossNo();
   
   for (i =0;i<ncr;i++)
-   {
-    idx = clToDel->GetCross(i);
-    ((AliITSclusterSSD *)((*fClustersN)[idx])   )->DelCross(clToDelIdx);
-   }
- for (i=index;i<fNclustersP-1;i++)
-  {
-       (*fClusterPIndexes)[i]=(*fClusterPIndexes)[i+1];
-  }
- fNclustersP--; 
if (debug) cout<<"Cluster P ("<<index<<") deleted\n";
-
-
- for (i=0;i<fNclustersN;i++)
-  {
-    if ( (GetNSideCluster(i)->GetCrossNo())==0) DelNCluster(i);
-  }
+    {
+      idx = clToDel->GetCross(i);
+      ((AliITSclusterSSD *)((*fClustersN)[idx])   )->DelCross(clToDelIdx);
+    }
+  
+  
 for (i=index;i<fNclustersP-1;i++)
+    {
+      (*fClusterPIndexes)[i]=(*fClusterPIndexes)[i+1];
+    }
 fNclustersP--; 
 if (fgkDebug) cout<<"Cluster P ("<<index<<") deleted\n";
+  
+  
 for (i=0;i<fNclustersN;i++)
+    {
+      if ( (GetNSideCluster(i)->GetCrossNo())==0) DelNCluster(i);
+    }
 }
 
 
@@ -297,11 +301,10 @@ void AliITSpackageSSD::DelPCluster(Int_t index)
 /*******************************************************/
 void AliITSpackageSSD::DelNCluster(Int_t index)
 {
-
-//it not deletes delete given cluster physically, 
-//but only complytely erase it from package
-//all clusters are deleted automatically when TClonesArray is deleted
-
+  //it not deletes delete given cluster physically, 
+  //but only complytely erase it from package
+  //all clusters are deleted automatically when TClonesArray is deleted
+  
   Int_t i;
   Int_t idx;
   Int_t clToDelIdx = GetNSideClusterIdx(index); //Index of cluster in TClonesArray 
@@ -309,24 +312,24 @@ void AliITSpackageSSD::DelNCluster(Int_t index)
   Int_t ncr = clToDel->GetCrossNo();
   
   for (i =0;i<ncr;i++)
-   {
-    idx = clToDel->GetCross(i);
-    ((AliITSclusterSSD *)((*fClustersP)[idx])   )->DelCross(clToDelIdx);
-   }
- for (i=index;i<fNclustersN-1;i++)
-  {
-       (*fClusterNIndexes)[i]=(*fClusterNIndexes)[i+1];
-  }
- fNclustersN--; 
if (debug) cout<<"Cluster N ("<<index<<") deleted\n";
-
- for (i=0;i<fNclustersP;i++)
-  {
-    if ( (GetPSideCluster(i)->GetCrossNo())==0) DelPCluster(i);
-  }
-
+    {
+      idx = clToDel->GetCross(i);
+      ((AliITSclusterSSD *)((*fClustersP)[idx])   )->DelCross(clToDelIdx);
+    }
+  
+  
 for (i=index;i<fNclustersN-1;i++)
+    {
+      (*fClusterNIndexes)[i]=(*fClusterNIndexes)[i+1];
+    }
 fNclustersN--; 
 if (fgkDebug) cout<<"Cluster N ("<<index<<") deleted\n";
+  
 for (i=0;i<fNclustersP;i++)
+    {
+      if ( (GetPSideCluster(i)->GetCrossNo())==0) DelPCluster(i);
+    }
+  
 }
 
 
@@ -334,7 +337,7 @@ void AliITSpackageSSD::DelNCluster(Int_t index)
 
 void AliITSpackageSSD::DelPClusterOI(Int_t index)
 {
-//This function looks like this, 
+  //This function looks like this, 
 //because probably cut cluster is 
 //on the beginning or on the end of package 
  Int_t i;
@@ -410,6 +413,7 @@ void AliITSpackageSSD::DelNClusterOI(Int_t index)
 
 void AliITSpackageSSD::DelClusterOI(Int_t index, Bool_t side)
 {
+  // delete cluster
  if (side == fgkSIDEP)
   {    
     DelPClusterOI(index);
@@ -427,19 +431,19 @@ void AliITSpackageSSD::DelClusterOI(Int_t index, Bool_t side)
 
 void  AliITSpackageSSD::GetAllCombinations(Int_t**array,Int_t &num,Int_t sizet)
 {
-  
+  // get all combinations
   Int_t *takenNcl = new Int_t[fNclustersN];
   
   num=0;
   
-  if (debug) PrintClusters();
+  if (fgkDebug) PrintClusters();
 
   for (Int_t i=0;i<fNclustersP;i++)
    {
      takenNcl[i]=-1;
    }
   //see comment on the beginning of MakeCombin
-  if (debug) cout<<"GetAllCombinations entered";
+  if (fgkDebug) cout<<"GetAllCombinations entered";
   MakeCombin (array,num,0,takenNcl,sizet);
 
   delete []takenNcl; 
@@ -451,7 +455,6 @@ void  AliITSpackageSSD::MakeCombin
    (Int_t**arr,Int_t& nu, Int_t np, Int_t *occup, Int_t sizet)
 
 {
-
 //ATTENTION: anybody watching this function
 //AliITSclusterSSD::GetCrossNo() returns index of cluster in main array belonging to AliITSmodulesSSD
 //however, we have pointer to that array (TClonesArray)
@@ -463,12 +466,12 @@ void  AliITSpackageSSD::MakeCombin
  //this cluster
  AliITSclusterSSD *cl=GetPSideCluster(np);
 
- Int_t NC = cl->GetCrossNo();  //number of crosses for this cluster
+ Int_t nc = cl->GetCrossNo();  //number of crosses for this cluster
  Int_t indcro;                 //index of given cluster on side N that 
                                // this cluster crosses with
    
  if (np == fNclustersP-1) {
-   for (i=0;i<NC;i++) {
+   for (i=0;i<nc;i++) {
      indcro=cl->GetCross(i);
      if(IsFree(indcro,np,occup)) {
         occup[np]=indcro;
@@ -484,7 +487,7 @@ void  AliITSpackageSSD::MakeCombin
      }
    }
   } else {
-    for (i=0;i<NC;i++) {
+    for (i=0;i<nc;i++) {
        indcro=cl->GetCross(i);
        if(IsFree(indcro,np,occup)) {
          occup[np]=indcro;
@@ -498,9 +501,9 @@ void  AliITSpackageSSD::MakeCombin
 }
 
 /**********************************************/
-Bool_t  AliITSpackageSSD::IsFree(Int_t idx, Int_t nn, Int_t *lis)
+Bool_t  AliITSpackageSSD::IsFree(const Int_t idx, const Int_t nn, const Int_t *lis) const
 {
-
+  // 
   for (Int_t i=0;i<nn;i++)
     {
       if (lis[i]==idx) return kFALSE;
@@ -511,7 +514,7 @@ Bool_t  AliITSpackageSSD::IsFree(Int_t idx, Int_t nn, Int_t *lis)
 /**********************************************/
 void AliITSpackageSSD::PrintClusters()
 {
-
+  // print cluster info
 Int_t i,j;
 cout<<"SIDE P\n";
 for (i=0;i<fNclustersP;i++)
@@ -540,29 +543,29 @@ for (i=0;i<fNclustersN;i++)
     cout<<"\n";   
  }
  
 }
+
 /**********************************************/
 void AliITSpackageSSD::ConsumeClusters()
 {
-register Int_t i;
-
-for(i=0;i<fNclustersP;i++)
- {
-   GetPSideCluster(i)->Consume();
- }
-
-for(i=0;i<fNclustersN;i++)
- {
-   GetNSideCluster(i)->Consume();
- }
-
+  // consume cluster
+  register Int_t i;
+  
+  for(i=0;i<fNclustersP;i++)
+    {
+      GetPSideCluster(i)->Consume();
+    }
+  
+  for(i=0;i<fNclustersN;i++)
+    {
+      GetNSideCluster(i)->Consume();
+    }
+  
 }
 
 /**********************************************/
 
-Int_t AliITSpackageSSD::GetNextPIdx(Int_t OI)
+Int_t AliITSpackageSSD::GetNextPIdx(Int_t OI) const
 {
  //Returns index of next P cluster OI in package; OI == Original Inedx (in TClonesArray)
  //if not egsist return -1;
@@ -573,8 +576,9 @@ Int_t AliITSpackageSSD::GetNextPIdx(Int_t OI)
   }
  return -1;
 }
+
 /**********************************************/
-Int_t AliITSpackageSSD::GetPrvPIdx(Int_t OI)
+Int_t AliITSpackageSSD::GetPrvPIdx(Int_t OI) const
 {
  //Returns index of previous P cluster  OI in package; OI == Original Inedx (in TClonesArray)
  //if not egsist return -1;
@@ -587,7 +591,7 @@ Int_t AliITSpackageSSD::GetPrvPIdx(Int_t OI)
   return -1;
 }
 /**********************************************/
-Int_t AliITSpackageSSD::GetNextNIdx(Int_t OI)
+Int_t AliITSpackageSSD::GetNextNIdx(Int_t OI) const
 {
 //Returns index of next N cluster OI in package; OI == Original Inedx (in TClonesArray)
  //if not egsist return -1;
@@ -600,7 +604,7 @@ Int_t AliITSpackageSSD::GetNextNIdx(Int_t OI)
 
 }
 /**********************************************/
-Int_t  AliITSpackageSSD::GetPrvNIdx(Int_t OI)
+Int_t  AliITSpackageSSD::GetPrvNIdx(Int_t OI) const
 {
  //Returns index of previous N cluster OI in package; OI == Original Inedx (in TClonesArray)
  //if not egsist return -1;
@@ -636,7 +640,7 @@ void  AliITSpackageSSD::SplitPackage(Int_t pi, Int_t ni, AliITSpackageSSD* pkg)
        break;
       }
     }  
-  if (debug) {
+  if (fgkDebug) {
     cout<<" p = "<<p<<"  n = "<<n;
   }
   if ((p==-1)||(n==-1)) return;
index 5dba2843cc2e6ce9aead6cf5706e809fee0f752f..fe17fad93d6469d7b4b40e4de2f147368b600a86 100644 (file)
@@ -8,9 +8,12 @@
 #include "TObject.h"
 #include "TArrayI.h"
 
-#include "AliITSclusterSSD.h"
+//#include "AliITSclusterSSD.h"
 
 class AliITS;
+class AliITSclusterSSD;
+
+//-------------------------------------------------------------------
 
 class AliITSpackageSSD : public TObject
 {
@@ -34,25 +37,25 @@ class AliITSpackageSSD : public TObject
                    clindex:(*fClusterPIndexes)[fNclustersP++]=clindex;}
        
 //Returns index of one side cluster in TClonesArray, NOT AliITSclusterSSD
-  Int_t    GetNSideClusterIdx(Int_t index); //input index is number of cluster in this package 
-  Int_t    GetPSideClusterIdx(Int_t index); //returns index in TClonesArray
-  Int_t    GetClusterIdx(Int_t index,Bool_t side)
+  Int_t    GetNSideClusterIdx(const Int_t index) const; //input index is number of cluster in this package 
+  Int_t    GetPSideClusterIdx(const Int_t index) const; //returns index in TClonesArray
+  Int_t    GetClusterIdx(Int_t index,Bool_t side) const 
                {return (side)?GetPSideClusterIdx(index):GetNSideClusterIdx(index);}
  
-  AliITSclusterSSD*    GetNSideCluster(Int_t index);
-  AliITSclusterSSD*    GetPSideCluster(Int_t index); //index is 
+  AliITSclusterSSD*    GetNSideCluster(const Int_t index);
+  AliITSclusterSSD*    GetPSideCluster(const Int_t index); //index is 
   AliITSclusterSSD*    GetCluster(Int_t index, Bool_t side)
                {return (side)?GetPSideCluster(index):GetNSideCluster(index);}
                        
-  Int_t    GetNextPIdx(Int_t OI); //Returns index of next P cluster in package; OI == Original Inedx (in TClonesArray)
-  Int_t    GetPrvPIdx(Int_t OI);  //Returns index of previous P cluster in package; OI == Original Inedx (in TClonesArray)
-  Int_t    GetNextNIdx(Int_t OI); //Returns index of next N cluster in package; OI == Original Inedx (in TClonesArray)
-  Int_t    GetPrvNIdx(Int_t OI);  //Returns index of previous N cluster in package; OI == Original Inedx (in TClonesArray)
-
-  Int_t    GetNumOfClustersN (){return fNclustersN;}  
-  Int_t    GetNumOfClustersP(){return fNclustersP;}   
-  Int_t    GetNumOfClusters() {return fNclustersP+fNclustersN;}  
-  Int_t    GetNumOfClusters(Bool_t side) {return (side)?fNclustersP:fNclustersN;}
+  Int_t    GetNextPIdx(Int_t OI) const; //Returns index of next P cluster in package; OI == Original Inedx (in TClonesArray)
+  Int_t    GetPrvPIdx(Int_t OI) const;  //Returns index of previous P cluster in package; OI == Original Inedx (in TClonesArray)
+  Int_t    GetNextNIdx(Int_t OI) const; //Returns index of next N cluster in package; OI == Original Inedx (in TClonesArray)
+  Int_t    GetPrvNIdx(Int_t OI) const;  //Returns index of previous N cluster in package; OI == Original Inedx (in TClonesArray)
+  
+  Int_t    GetNumOfClustersN() const {return fNclustersN;}  
+  Int_t    GetNumOfClustersP() const {return fNclustersP;}   
+  Int_t    GetNumOfClusters() const {return fNclustersP+fNclustersN;}  
+  Int_t    GetNumOfClusters(const Bool_t side) const {return (side)?fNclustersP:fNclustersN;}
   
   //returns number of clusters belonging to package,
   //that crosses with only one cluster on the other side 
@@ -77,13 +80,14 @@ protected:
   
   TClonesArray *fClustersN;   //Pointer to array of clusters - only to have direct acces to 
   TClonesArray *fClustersP;   //clusters
-  Int_t    fNclustersN;
-  Int_t    fNclustersP;
-  TArrayI *fClusterNIndexes;
-  TArrayI *fClusterPIndexes;
+  Int_t    fNclustersN;       // number of N clusters
+  Int_t    fNclustersP;       // number of P cluster
+  TArrayI *fClusterNIndexes;  // array of pointers to the N clusters
+  TArrayI *fClusterPIndexes;  // array of pointers to the P clusters
 
-  static const Bool_t fgkSIDEP;
-  static const Bool_t fgkSIDEN;
+  static const Bool_t fgkSIDEP;  // boolean for P side 
+  static const Bool_t fgkSIDEN;  // boolean for N side
+  static const Int_t fgkDebug=0;    // debugging flag
 
 
 /***************/
@@ -92,7 +96,7 @@ protected:
 
   
   void    MakeCombin(Int_t**arr, Int_t& nu, Int_t np, Int_t *occup,Int_t size);
-  Bool_t  IsFree(Int_t idx, Int_t nn, Int_t *lis);
+  Bool_t  IsFree(const Int_t idx, const Int_t nn, const Int_t *lis) const;
   
 
                 
index 471dd3ac9f2e0d1a1cade18c1d4cb8c0d241e45b..d5b1b75fb7b6a2f4677efca11a707429df37dd8c 100644 (file)
@@ -1,8 +1,58 @@
 ////////////////////////////////////////////////
 //  Segmentation class for set:ITS            //
+//  All methods implemented in the derived    //
+//  classes are set = 0 in the header file    //
+//  so this class cannot be instantiated      //
+//  methods implemented in a part of the      //
+// derived classes are implemented here as    //
+// TObject::MayNotUse                         // 
 ////////////////////////////////////////////////
 
 #include <TF1.h>
 #include "AliITSsegmentation.h"
 
 ClassImp(AliITSsegmentation)
+
+//_____________________________________________________________
+AliITSsegmentation::AliITSsegmentation(){
+  // Default constructor
+  SetDetSize(0.,0.,0.);
+  fGeom = 0;
+  fCorr = 0;
+}
+
+//_____________________________________________________________
+AliITSsegmentation::~AliITSsegmentation(){
+  // destructor
+  if(fCorr)delete fCorr;
+}
+
+//_____________________________________________________________
+void AliITSsegmentation::Copy(TObject &obj) const {
+  // copy this to obj
+  ((AliITSsegmentation& ) obj).fDz      = fDz;
+  ((AliITSsegmentation& ) obj).fDx      = fDx;
+  ((AliITSsegmentation& ) obj).fDy      = fDy;
+  ((AliITSsegmentation& ) obj).fGeom    = fGeom; // copy only the pointer
+  if(fCorr){
+    ((AliITSsegmentation& ) obj).fCorr    = new TF1(*fCorr); // make a proper copy
+  }
+  else {
+    ((AliITSsegmentation& ) obj).fCorr = 0;
+  }
+}
+//______________________________________________________________________
+AliITSsegmentation& AliITSsegmentation::operator=(
+                        const AliITSsegmentation &source){
+// Operator =
+  if(this != &source){
+    source.Copy(*this);
+  }
+  return *this;
+}
+//______________________________________________________________________
+AliITSsegmentation::AliITSsegmentation(const AliITSsegmentation &source):
+    TObject(source){
+    // copy constructor
+  source.Copy(*this);
+}
index ad9f5906e84d21f01e7bb46d179aefe0433d3731..474d7c58a75b9ffe0de63379aa4ef4bab40fddd7 100644 (file)
@@ -12,100 +12,99 @@ class AliITSgeom;
 class AliITSsegmentation :
 public TObject {
  public:
-    virtual ~AliITSsegmentation() {}
+  AliITSsegmentation();
+  AliITSsegmentation(const AliITSsegmentation& source);
+  virtual ~AliITSsegmentation();
+  AliITSsegmentation& operator=(const AliITSsegmentation &source);
     // Set Detector Segmentation Parameters
     //
     // Detector size  
-    virtual void    SetDetSize(Float_t,Float_t,Float_t) {}
+    virtual void    SetDetSize(Float_t p1,Float_t p2,Float_t p3) 
+                    {fDx=p1; fDz=p2; fDy=p3;}
     // Cell size   
-    virtual void    SetPadSize(Float_t,Float_t) {}
+    virtual void    SetPadSize(Float_t,Float_t) {MayNotUse("SetPadSize");}
     // Maximum number of cells along the two coordinates  
-    virtual void    SetNPads(Int_t,Int_t) {}
+    virtual void    SetNPads(Int_t,Int_t) = 0;
     // Returns the maximum number of cells (digits) posible
-    virtual Int_t   GetNPads(){return 0;}
-    // Set angles - find a generic name fit for other detectors as well
-    // might be useful for beam test setups (3 angles ?)
-    virtual void    SetAngles(Float_t, Float_t) {}
+    virtual Int_t   GetNPads() const = 0;
     // Set layer
-    virtual void SetLayer(Int_t) {}
+    virtual void SetLayer(Int_t) {MayNotUse("SetLayer");}
     // Transform from real to cell coordinates
-    virtual void    GetPadIxz(Float_t,Float_t,Int_t &,Int_t &) {}
+    virtual void    GetPadIxz(Float_t,Float_t,Int_t &,Int_t &) const = 0;
     // Transform from cell to real coordinates
-    virtual void    GetPadCxz(Int_t,Int_t,Float_t &,Float_t &) {}
+    virtual void    GetPadCxz(Int_t,Int_t,Float_t &,Float_t &) const = 0;
     // Transform from real global to local coordinates
-    virtual void    GetLocal(Int_t,Float_t *,Float_t *) {}
+    virtual void    GetLocal(Int_t,Float_t *,Float_t *) const 
+                                                  {MayNotUse("GetLocal");}
     // Transform from real local to global coordinates
-    virtual void    GetGlobal(Int_t,Float_t *,Float_t *) {}
+    virtual void    GetGlobal(Int_t,Float_t *,Float_t *) const 
+                                                  {MayNotUse("GetGlobal");}
     // Local transformation of real local coordinates -
-    virtual void    GetPadTxz(Float_t &,Float_t &) {}
+    virtual void    GetPadTxz(Float_t &,Float_t &) const = 0;
     // Transformation from Geant cm detector center local coordinates
     // to detector segmentation/cell coordiantes starting from (0,0).
-    virtual void    LocalToDet(Float_t,Float_t,Int_t &,Int_t &){}
+    virtual void    LocalToDet(Float_t,Float_t,Int_t &,Int_t &) const = 0;
     // Transformation from detector segmentation/cell coordiantes starting
     // from (0,0) to Geant cm detector center local coordinates.
-    virtual void    DetToLocal(Int_t,Int_t,Float_t &,Float_t &){}
+    virtual void    DetToLocal(Int_t,Int_t,Float_t &,Float_t &) const = 0;
     // Initialisation
-    virtual void Init() {}
+    virtual void Init() = 0;
     //
     // Get member data
     //
     // Detector type geometry
-    virtual AliITSgeom* Geometry() {return 0;}
+    virtual AliITSgeom* Geometry() const {return fGeom;}
     // Detector length
-    virtual Float_t Dx() {return 0.;}
+    virtual Float_t Dx() const {return fDx;}
     // Detector width
-    virtual Float_t Dz() {return 0.;}
+    virtual Float_t Dz() const {return fDz;}
     // Detector thickness
-    virtual Float_t Dy() {return 0.;}
+    virtual Float_t Dy() const {return fDz;}
     // Cell size in x
-    virtual Float_t Dpx(Int_t) {return 0.;}
+    virtual Float_t Dpx(Int_t) const = 0;
     // Cell size in z 
-    virtual Float_t Dpz(Int_t) {return 0.;}
+    virtual Float_t Dpz(Int_t) const = 0;
     // Maximum number of Cells in x
-    virtual Int_t    Npx() {return 0;}
+    virtual Int_t    Npx() const = 0;
     // Maximum number of Cells in z
-    virtual Int_t    Npz() {return 0;}
+    virtual Int_t    Npz() const = 0;
     // Layer
-    virtual Int_t GetLayer() const {return 0;}
-    // Angles 
-    virtual void Angles(Float_t &, Float_t&) {}
-    // Set cell position
-    virtual void     SetPad(Int_t, Int_t) {}
+    virtual Int_t GetLayer() const {MayNotUse("GetLayer"); return 0;}
     // Set hit position
-    virtual void     SetHit(Float_t, Float_t) {}
-    
-    //
-    // Iterate over cells 
-    // Initialiser
-    virtual void  FirstPad(Float_t,Float_t,Float_t,Float_t) {}
-    // Stepper
-    virtual void  NextPad() {}
-    // Condition
-    virtual Int_t MorePads() {return 0;}
+    //    virtual void     SetHit(Float_t, Float_t) {}
+    // angles
+    virtual void Angles(Float_t& /* p */, Float_t& /* n */) const
+                                          {MayNotUse("Angles");}
+
     //
     // Get next neighbours 
-    virtual void Neighbours(Int_t,Int_t,Int_t*,Int_t[10],Int_t[10]) {}
-    //
-    // Current cell cursor during disintegration
-    // x-coordinate
-    virtual Int_t  Ix() {return 0;}
-    // z-coordinate
-    virtual Int_t  Iz() {return 0;}
-    //
-    // Signal Generation Condition during Stepping
-    virtual Int_t SigGenCond(Float_t,Float_t,Float_t) {return 0;}
-    // Initialise signal generation at coord (x,y,z)
-    virtual void  SigGenInit(Float_t,Float_t,Float_t) {}
-    // Current integration limits 
-    virtual void  IntegrationLimits(Float_t&,Float_t&,Float_t&,Float_t&) {}
-    // Test points for auto calibration
-    virtual void GiveTestPoints(Int_t &,Float_t *,Float_t *) {}
+    virtual void Neighbours(Int_t,Int_t,Int_t*,Int_t[10],Int_t[10]) const
+                     {MayNotUse("Neighbours");}
+
     // Function for systematic corrections
     // Set the correction function
-    virtual void SetCorrFunc(Int_t, TF1*) {}
+    virtual void SetCorrFunc(TF1* fc) {fCorr = fc;}
     // Get the correction Function
-    virtual TF1* CorrFunc(Int_t) {return 0;}
-           
-    ClassDef(AliITSsegmentation,1) //Segmentation virtual base class 
+    virtual TF1* CorrFunc() {return fCorr;}
+    // Print Default parameters
+    virtual void PrintDefaultParameters() const = 0;
+
+ protected:
+
+    virtual void Copy(TObject &obj) const;
+
+    Float_t fDx;    //SPD: Full width of the detector (x axis)- microns
+                    //SDD: Drift distance of the 1/2detector (x axis)-microns
+                    //SSD: Full length of the detector (x axis)- microns
+    Float_t fDz;    //SPD: Full length of the detector (z axis)- microns
+                    //SDD: Length of half-detector (z axis) - microns
+                    //SSD: Full width of the detector (z axis)- microns
+    Float_t fDy;    //SPD:  Full thickness of the detector (y axis) -um 
+                    //SDD: Full thickness of the detector (y axis) - microns
+                    //SSD: Full thickness of the detector (y axis) -um 
+    AliITSgeom *fGeom;  //! pointer to the geometry class
+    TF1*       fCorr;   // correction function
+
+    ClassDef(AliITSsegmentation,2) //Segmentation virtual base class 
 };
 #endif
index e1306ba58304edfed1fd4e6bbdcb6f83ee331478..32c8f34a21d4eb931299f8515df0fc57a2583226 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 #include <Riostream.h>
-#include <TF1.h>
 #include <TMath.h>
 
 #include "AliITSsegmentationSDD.h"
-#include "AliITS.h"
+// #include "AliITS.h"
 #include "AliITSgeom.h"
 #include "AliITSgeomSDD.h"
-#include "AliRun.h"
 #include "AliITSresponse.h"
 
+//////////////////////////////////////////////////////
+// Segmentation class for                           //
+// drift detectors                                  //
+//                                                  //
+//////////////////////////////////////////////////////
+
+const Float_t AliITSsegmentationSDD::fgkDxDefault = 35085.;
+const Float_t AliITSsegmentationSDD::fgkDzDefault = 75264.;
+const Float_t AliITSsegmentationSDD::fgkDyDefault = 300.;
+const Float_t AliITSsegmentationSDD::fgkPitchDefault = 294.;
+const Float_t AliITSsegmentationSDD::fgkClockDefault = 40.;
+const Int_t AliITSsegmentationSDD::fgkHalfNanodesDefault = 256; 
+const Int_t AliITSsegmentationSDD::fgkNsamplesDefault = 256;
+
 ClassImp(AliITSsegmentationSDD)
 //----------------------------------------------------------------------
 AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSgeom* geom,
@@ -31,29 +43,54 @@ AliITSsegmentationSDD::AliITSsegmentationSDD(AliITSgeom* geom,
    fGeom=geom;
    fDriftSpeed=resp->DriftSpeed();
    fCorr=0;
-   SetDetSize();
-   SetPadSize();
-   SetNPads();
+   SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault);
+   SetPadSize(fgkPitchDefault,fgkClockDefault);
+   SetNPads(fgkHalfNanodesDefault,fgkNsamplesDefault);
 
 }
 //______________________________________________________________________
-AliITSsegmentationSDD::AliITSsegmentationSDD(){
-  // standard constructor
-   fGeom=0;
+AliITSsegmentationSDD::AliITSsegmentationSDD() : AliITSsegmentation(){
+  // Default constructor
    fDriftSpeed=0;  
-   fCorr=0;
-   SetDetSize();
-   SetPadSize();
-   SetNPads();
+   SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault);
+   SetPadSize(fgkPitchDefault,fgkClockDefault);
+   SetNPads(fgkHalfNanodesDefault,fgkNsamplesDefault);
+
+}
 
+//______________________________________________________________________
+void AliITSsegmentationSDD::Copy(TObject &obj) const {
+  // protected method. copy this to obj
+  AliITSsegmentation::Copy(obj);
+  ((AliITSsegmentationSDD& ) obj).fNsamples = fNsamples;
+  ((AliITSsegmentationSDD& ) obj).fNanodes = fNanodes;
+  ((AliITSsegmentationSDD& ) obj).fPitch = fPitch;
+  ((AliITSsegmentationSDD& ) obj).fTimeStep = fTimeStep;
+  ((AliITSsegmentationSDD& ) obj).fDriftSpeed = fDriftSpeed;
 }
+
+//______________________________________________________________________
+AliITSsegmentationSDD& AliITSsegmentationSDD::operator=(const AliITSsegmentationSDD &source){
+   // = operator
+   if(this==&source) return *this;
+   source.Copy(*this);
+   return *this;
+}
+
+//____________________________________________________________________________
+AliITSsegmentationSDD::AliITSsegmentationSDD(const AliITSsegmentationSDD &source) :
+    AliITSsegmentation(source){
+  // copy constructor
+  source.Copy(*this);
+}
+
 //----------------------------------------------------------------------
 void AliITSsegmentationSDD::Init(){
   // Standard initilisation routine
 
    if(!fGeom) {
+     Fatal("Init","the pointer to the ITS geometry class (AliITSgeom) is null\n");
      return;
-     //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
    }
    AliITSgeomSDD *gsdd = (AliITSgeomSDD *) (fGeom->GetShape(3,1,1));
 
@@ -65,7 +102,7 @@ void AliITSsegmentationSDD::Init(){
 
 //----------------------------------------------------------------------
 void AliITSsegmentationSDD::
-Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
+Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]) const {
   // returns neighbours for use in Cluster Finder routines and the like
 
     if(iX >= fNanodes) printf("iX > fNanodes %d %d\n",iX,fNanodes);
@@ -84,7 +121,7 @@ Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSDD::GetPadIxz(Float_t x,Float_t z,
-                                     Int_t &timebin,Int_t &anode){
+                                     Int_t &timebin,Int_t &anode) const {
 // Returns cell coordinates (time sample,anode) incremented by 1 !!!!! 
 // for given real local coordinates (x,z)
 
@@ -106,7 +143,7 @@ void AliITSsegmentationSDD::GetPadIxz(Float_t x,Float_t z,
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSDD::GetPadCxz(Int_t timebin,Int_t anode,
-                                     Float_t &x ,Float_t &z){
+                                     Float_t &x ,Float_t &z) const{
     // Transform from cell to real local coordinates
     // returns x, z in cm
 
@@ -123,7 +160,7 @@ void AliITSsegmentationSDD::GetPadCxz(Int_t timebin,Int_t anode,
 
 }
 //----------------------------------------------------------------------
-void AliITSsegmentationSDD::GetPadTxz(Float_t &x,Float_t &z){
+void AliITSsegmentationSDD::GetPadTxz(Float_t &x,Float_t &z) const{
     // Get anode and time bucket as floats - numbering from 0
 
     // expects x, z in cm
@@ -139,20 +176,19 @@ void AliITSsegmentationSDD::GetPadTxz(Float_t &x,Float_t &z){
 
 }
 //----------------------------------------------------------------------
-void AliITSsegmentationSDD::GetLocal(Int_t module,Float_t *g ,Float_t *l){
+void AliITSsegmentationSDD::GetLocal(Int_t module,Float_t *g ,Float_t *l) const {
   // returns local coordinates from global
     if(!fGeom) {
+      Fatal("GetLocal","the pointer to the ITS geometry class (AliITSgeom) is null\n");
         return;
-        //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
     }
     fGeom->GtoL(module,g,l);
 }
 //----------------------------------------------------------------------
-void AliITSsegmentationSDD::GetGlobal(Int_t module,Float_t *l ,Float_t *g){
+void AliITSsegmentationSDD::GetGlobal(Int_t module,Float_t *l ,Float_t *g) const {
   // return global coordinates from local
     if(!fGeom) {
-        return;
-        //fGeom = ((AliITS*)gAlice->GetModule("ITS"))->GetITSgeom();
+      Fatal("GetGlobal","the pointer to the ITS geometry class (AliITSgeom) is null\n");
     }
 
     fGeom->LtoG(module,l,g);
@@ -169,16 +205,38 @@ void AliITSsegmentationSDD::Print(Option_t *opt) const {
    cout << "Number of Anodes: " << fNanodes << endl;
    cout << "Time Step (ns): " << fTimeStep << endl;
    cout << "Anode Pitch (um): " << fPitch << endl;
-   cout << "Full Detector Width     (x): " << fDx << endl;
-   cout << "Half Detector Length    (z): " << fDz << endl;
-   cout << "Full Detector Thickness (y): " << fDy << endl;
+   cout << "Full Detector Width     (x): " << fDx;
+   cout<<" (Default is "<<fgkDxDefault<<") "<<endl;
+   cout << "Half Detector Length    (z): " << fDz;
+   cout<<" (Default is "<<fgkDzDefault<<") "<<endl;
+   cout << "Full Detector Thickness (y): " << fDy;
+   cout<<" (Default is "<<fgkDyDefault<<") "<<endl;
    cout << "**************************************************" << endl;
 
 }
-//______________________________________________________________________
+
+//----------------------------------------------------------------------
+void AliITSsegmentationSDD::PrintDefaultParameters() const {
+  // print SDD parameters defined as static const data members
+
+  cout << "**************************************************" << endl;
+  cout << "  Silicon Drift Detector Segmentation Parameters  " << endl;
+  cout << " Default values defined as static const data members"<< endl;
+  cout << " Actual values can be set with the relevant setters"<< endl; 
+  cout << "**************************************************" << endl;
+  cout<<"fgkDxDefault = "<<fgkDxDefault<<endl;
+  cout<<"fgkDzDefault = "<<fgkDzDefault<<endl;
+  cout<<"fgkDyDefault = "<<fgkDyDefault<<endl;
+  cout<<"fgkPitchDefault = "<<fgkPitchDefault<<endl;
+  cout<<"fgkClockDefault = "<<fgkClockDefault<<endl;
+  cout<<"fgkHalfNanodesDefault = "<<fgkHalfNanodesDefault<<endl;
+  cout<<"fgkNsamplesDefault = "<<fgkNsamplesDefault<<endl;
+  cout << "**************************************************" << endl;
+
+}
 
 //______________________________________________________________________
-void AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
+void AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const {
 // Transformation from Geant detector centered local coordinates (cm) to
 // time bucket numbers ix and anode number iz.
 // Input:
@@ -233,7 +291,7 @@ void AliITSsegmentationSDD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
     return; // Found ix and iz, return.
 }
 //______________________________________________________________________
-void AliITSsegmentationSDD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
+void AliITSsegmentationSDD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
 {
 // Transformation from Detector time bucket and anode coordiantes to Geant 
 // detector centerd local coordinates (cm).
index ceff3de212e7134754d70ff52104aa01718e6c27..eff72a4a1a21bf2cbb5dde22ac3547e11c031121 100644 (file)
@@ -13,127 +13,86 @@ public AliITSsegmentation {
 
 
     AliITSsegmentationSDD();
+    AliITSsegmentationSDD(const AliITSsegmentationSDD &source);
+    AliITSsegmentationSDD& operator=(const AliITSsegmentationSDD &source);
     AliITSsegmentationSDD(AliITSgeom *gm, AliITSresponse *resp);
     virtual ~AliITSsegmentationSDD(){}
 
     // Set Detector Segmentation Parameters
     //
-    // Detector size : x,z,y
-    virtual void   SetDetSize(Float_t p1=35085.,Float_t p2=75264.,
-                             Float_t p3=300.) 
-          {fDx=p1; fDz=p2; fDy=p3;}
 
     // Cell size dz*dx  
-    virtual void    SetPadSize(Float_t pitch=294., Float_t clock=40.
+    virtual void    SetPadSize(Float_t pitch, Float_t clock
                          {fPitch=pitch;fTimeStep=1000./clock;}
 
     // Maximum number of cells along the two coordinates z,x (anodes,samples) 
-    virtual void    SetNPads(Int_t p1=256, Int_t p2=256
+    virtual void    SetNPads(Int_t p1, Int_t p2
                          {fNanodes=2*p1;fNsamples=p2;}
     // Returns the maximum number of cells (digits) posible
-    virtual Int_t   GetNPads(){return fNanodes*fNsamples;}
+    virtual Int_t   GetNPads() const {return fNanodes*fNsamples;}
 
     // Transform from real local to cell coordinates
-    virtual void    GetPadIxz(Float_t x ,Float_t z ,Int_t   &ix,Int_t   &iz);
+    virtual void    GetPadIxz(Float_t x ,Float_t z ,Int_t   &ix,Int_t   &iz) const;
     // Transform from cell to real local coordinates
-    virtual void    GetPadCxz(Int_t   ix,Int_t   iz,Float_t &x ,Float_t &z );
+    virtual void    GetPadCxz(Int_t   ix,Int_t   iz,Float_t &x ,Float_t &z ) const;
     // Transform from real global to local coordinates
-    virtual void    GetLocal(Int_t module,Float_t *g ,Float_t *l);
+    virtual void    GetLocal(Int_t module,Float_t *g ,Float_t *l) const;
     // Transform from real local to global coordinates
-    virtual void    GetGlobal(Int_t module,Float_t *l ,Float_t *g);
+    virtual void    GetGlobal(Int_t module,Float_t *l ,Float_t *g) const;
     // Get anode and time bucket as floats - numbering from 0
-    virtual void    GetPadTxz(Float_t &x ,Float_t &z);
+    virtual void    GetPadTxz(Float_t &x ,Float_t &z) const;
     // Transformation from Geant cm detector center local coordinates
     // to detector segmentation/cell coordiantes starting from (0,0).
-    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz);
+    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const;
     // Transformation from detector segmentation/cell coordiantes starting
     // from (0,0) to Geant cm detector center local coordinates.
-    virtual void    DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z);
+    virtual void    DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const;
     //
     // Initialisation
     virtual void Init();
     //
     // Get member data
     //
-    // Detector type geometry
-    AliITSgeom* Geometry() {return fGeom;}
-    // Detector length
-    virtual Float_t Dx() {return fDx;}
-    // Detector drift distance or detector active area half width
-    virtual Float_t Dz()  {return fDz;}  
-    // Detector thickness
-    virtual Float_t Dy() {return fDy;}
     // Cell size in x
-    virtual Float_t Dpx(Int_t) {return fTimeStep;}
+    virtual Float_t Dpx(Int_t) const {return fTimeStep;}
     // Cell size in z 
-    virtual Float_t Dpz(Int_t) {return fPitch;} 
+    virtual Float_t Dpz(Int_t) const {return fPitch;} 
 
     // Maximum number of samples in x
-    virtual Int_t    Npx() {return fNsamples;}
+    virtual Int_t    Npx() const {return fNsamples;}
     // Maximum number of anodes in z
-    virtual Int_t    Npz() {return fNanodes;}
+    virtual Int_t    Npz() const {return fNanodes;}
 
     //
     // Get next neighbours 
     virtual void Neighbours(Int_t iX,Int_t iZ,Int_t* Nlist,Int_t Xlist[10],
-                           Int_t Zlist[10]);
+                           Int_t Zlist[10]) const;
 
-    // Set cell position
-    virtual void     SetPad(Int_t,Int_t) {}
-    // Set hit position
-    virtual void     SetHit(Float_t,Float_t) {}
-    
-    //
-    // Iterate over cells 
-    // Initialiser
-    virtual void  FirstPad(Float_t,Float_t,Float_t,Float_t){}
-    // Stepper
-    virtual void  NextPad() {}
-    // Condition
-    virtual Int_t MorePads() {return 0;}
-    //
-    // Current cell cursor during disintegration
-    // x-coordinate
-    virtual Int_t  Ix() {return 0;}
-    // z-coordinate
-    virtual Int_t  Iz() {return 0;}
-    //
-    // Signal Generation Condition during Stepping
-    virtual Int_t SigGenCond(Float_t,Float_t,Float_t){return 0;}
-    // Initialise signal generation at coord (x,y,z)
-    virtual void  SigGenInit(Float_t,Float_t,Float_t){}
     // Current integration limits 
     virtual void  IntegrationLimits(Float_t&,Float_t&,Float_t&,Float_t&) {}
-    // Test points for auto calibration
-    virtual void GiveTestPoints(Int_t &, Float_t *, Float_t *) {}
-    // Function for systematic corrections
-    // Set the correction function
-    virtual void SetCorrFunc(Int_t, TF1*) {}
-    // Get the correction Function
-    virtual TF1* CorrFunc(Int_t) {return 0;}
     // Print Parameters
     virtual void    Print(Option_t *opt="") const;
-           
-  private:
-
-    AliITSsegmentationSDD(AliITSsegmentationSDD &source);
-    AliITSsegmentationSDD& operator=(AliITSsegmentationSDD &source);
+// Print default parameters (static const data members, if any)
+    virtual void PrintDefaultParameters() const;           
 
   protected:
 
+    virtual void Copy(TObject &obj) const;
+
     Int_t      fNsamples; // Number of time samples in x
     Int_t      fNanodes;  // Summed # of anodes in the two det halves (z)
     Float_t    fPitch;    // Anode pitch - microns
     Float_t    fTimeStep; // Sampling time - ns
-    Float_t    fDx;       // Drift distance of the 1/2detector (x axis)-microns
-    Float_t    fDz;       // Length of half-detector (z axis) - microns
-    Float_t    fDy;       // Full thickness of the detector (y axis) - microns
     Float_t    fDriftSpeed;  // Drift speed 
-
-    AliITSgeom *fGeom;         //! pointer to the geometry class
-    TF1*       fCorr;          // correction function
-
-    ClassDef(AliITSsegmentationSDD,2) // SDD segmentation
+    static const Float_t fgkDxDefault;  // Default value for fDx
+    static const Float_t fgkDzDefault;  // Default value for fDz
+    static const Float_t fgkDyDefault;  // Default value for fDy
+    static const Float_t fgkPitchDefault; //Default value for fPitch
+    static const Float_t fgkClockDefault; //Default value for the clock freq.
+    static const Int_t fgkHalfNanodesDefault; //Default value for fNanodes/2
+    static const Int_t fgkNsamplesDefault; //Default value for fNsamples
+
+    ClassDef(AliITSsegmentationSDD,3) // SDD segmentation
 };
 
 #endif
index 2b0baadb4a36826c2efa160f32aa61a1273bd800..f032beff00fac541b3eeee8a27d4ba6564480c14 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-#include <TMath.h>
-#include <TF1.h>
-
 #include "AliITSsegmentationSPD.h"
-#include "AliITSgeom.h"
-
+//#include "AliITSgeom.h"
+//////////////////////////////////////////////////////
+// Segmentation class for                           //
+// pixels                                           //
+//                                                  //
+//////////////////////////////////////////////////////
 ClassImp(AliITSsegmentationSPD)
 
+//_____________________________________________________________________________
+  AliITSsegmentationSPD::AliITSsegmentationSPD(): AliITSsegmentation(){
+  // Default constructor
+  fNpx = 0;
+  fNpz = 0;
+  for(Int_t k=0; k<256; k++){
+    fCellSizeX[k] = 0.;
+    fCellSizeZ[k] = 0.;
+  }
+}
 
-Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) {
+//_____________________________________________________________________________
+Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) const {
 // Get column number for each z-coordinate taking into account the 
 // extra pixels in z direction assuming 300 micron sized pixels.
      Float_t col = 0.0;
@@ -31,7 +43,7 @@ Float_t AliITSsegmentationSPD::ColFromZ300(Float_t z) {
      return col;
 }
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) {
+Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) const {
 // same comments as above
 // Get z-coordinate for each colunm number
   Float_t pitchz = 300.0;
@@ -40,14 +52,14 @@ Float_t AliITSsegmentationSPD::ZFromCol300(Int_t col) {
   return z;
 }
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ZpitchFromCol300(Int_t col) {
+Float_t AliITSsegmentationSPD::ZpitchFromCol300(Int_t col) const {
   // returns Z pixel pitch for 300 micron pixels.
 
     col = 0; // done to remove unused variable warning.
     return 300.0;
 }
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) {
+Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) const {
     // hard-wired - keep it like this till we can parametrise 
     // and get rid of AliITSgeomSPD425
     // Get column number for each z-coordinate taking into account the 
@@ -104,7 +116,7 @@ Float_t AliITSsegmentationSPD::ColFromZ(Float_t z) {
 }
 
 //_____________________________________________________________________________
-Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
+Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) const {
     // same comments as above
     // Get z-coordinate for each colunm number
     Int_t i;
@@ -154,7 +166,7 @@ Float_t AliITSsegmentationSPD::ZFromCol(Int_t col) {
   return z;*/
 }
 //______________________________________________________________________
-Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) {
+Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) const {
     // Get pitch size in z direction for each colunm
 
    Float_t pitchz = 425.;
@@ -176,15 +188,6 @@ Float_t AliITSsegmentationSPD::ZpitchFromCol(Int_t col) {
     return pitchz;
 }
 //______________________________________________________________________
-AliITSsegmentationSPD::AliITSsegmentationSPD(){
-  // Default constructor
-   fNpx = 0;
-   fNpz = 0;
-   fCorr=0;
-   fGeom = 0;
-
-}
-//______________________________________________________________________
 AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
   // Constructor
    fCorr=0;
@@ -195,25 +198,30 @@ AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSgeom *gm){
 
 }
 //______________________________________________________________________
-AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(AliITSsegmentationSPD &source){
+void AliITSsegmentationSPD::Copy(TObject &obj) const {
+  // protected method. copy this to obj
+  AliITSsegmentation::Copy(obj);
+  ((AliITSsegmentationSPD& ) obj).fNpx  = fNpx;
+  ((AliITSsegmentationSPD& ) obj).fNpz  = fNpz;
+  Int_t i;
+  for(i=0;i<256;i++) 
+         ((AliITSsegmentationSPD& ) obj).fCellSizeX[i] = fCellSizeX[i];
+  for(i=0;i<280;i++) 
+         ((AliITSsegmentationSPD& ) obj).fCellSizeZ[i] = fCellSizeZ[i];
+}
+
+//______________________________________________________________________
+AliITSsegmentationSPD& AliITSsegmentationSPD::operator=(const AliITSsegmentationSPD &source){
    // = operator
    if(this==&source) return *this;
-   this->fNpx  = source.fNpx;
-   this->fNpz  = source.fNpz;
-   this->fDx   = source.fDx;
-   this->fDy   = source.fDy;
-   Int_t i;
-   for(i=0;i<256;i++) this->fCellSizeX[i] = source.fCellSizeX[i];
-   for(i=0;i<280;i++) this->fCellSizeZ[i] = source.fCellSizeZ[i];
-   this->fCorr = new TF1(*(source.fCorr));// make a proper copy of the function
-   this->fGeom = source.fGeom; // copy only the pointers.
+   source.Copy(*this);
    return *this;
 }
 //____________________________________________________________________________
-AliITSsegmentationSPD::AliITSsegmentationSPD(AliITSsegmentationSPD &source) :
+AliITSsegmentationSPD::AliITSsegmentationSPD(const AliITSsegmentationSPD &source) :
     AliITSsegmentation(source){
   // copy constructor
-   *this = source;
+  source.Copy(*this);
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSPD::SetBinSize(Float_t *x,Float_t *z){
@@ -277,30 +285,21 @@ void AliITSsegmentationSPD::SetNPads(Int_t p1, Int_t p2){
     fNpz=p2;
 
 }
-//------------------------------
-void AliITSsegmentationSPD::SetDetSize(Float_t p1, Float_t p2, Float_t p3){
-  // for SPD this function should be used ONLY when a beam test setup 
-  // configuration is studied
 
-    fDx=p1;
-    fDz=p2;
-    fDy=p3;
-
-}
 //------------------------------
-Float_t AliITSsegmentationSPD::Dpx(Int_t i){
+Float_t AliITSsegmentationSPD::Dpx(Int_t i) const {
     //returs x pixel pitch for a give pixel
     if(i<0||i>=256) return 0.0;
     return fCellSizeX[i];
 }
 //------------------------------
-Float_t AliITSsegmentationSPD::Dpz(Int_t i){
+Float_t AliITSsegmentationSPD::Dpz(Int_t i) const {
     // returns z pixel pitch for a give pixel
     if(i<0||i>=280) return 0.0;
     return fCellSizeZ[i];
 }
 //------------------------------
-void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
+void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const {
 //  Returns pixel coordinates (ix,iz) for given real local coordinates (x,z)
 //
 
@@ -322,7 +321,7 @@ void AliITSsegmentationSPD::GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
 }
 
 //------------------------------
-void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
+void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z) const{
 //  local transformation of real local coordinates (x,z)
 //
 
@@ -336,7 +335,7 @@ void AliITSsegmentationSPD::GetPadTxz(Float_t &x,Float_t &z){
 
 }
 //------------------------------
-void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
+void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z) const {
     // Transform from pixel to real local coordinates
 
     // returns x, z in microns
@@ -350,7 +349,7 @@ void AliITSsegmentationSPD::GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t&z){
 }
 //------------------------------
 void AliITSsegmentationSPD::
-Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
+Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]) const {
   // returns the neighbouring pixels for use in Cluster Finders and the like.
   /*
     *Nlist=4;Xlist[0]=Xlist[1]=iX;Xlist[2]=iX-1;Xlist[3]=iX+1;
@@ -380,7 +379,7 @@ Neighbours(Int_t iX, Int_t iZ, Int_t* Nlist, Int_t Xlist[8], Int_t Zlist[8]){
     Zlist[7]=iZ-1;
 }
 //______________________________________________________________________
-void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
+void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const {
 // Transformation from Geant detector centered local coordinates (cm) to
 // Pixel cell numbers ix and iz.
 // Input:
@@ -418,7 +417,7 @@ void AliITSsegmentationSPD::LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz){
     return; // Found ix and iz, return.
 }
 //______________________________________________________________________
-void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
+void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const
 {
 // Transformation from Detector cell coordiantes to Geant detector centerd 
 // local coordinates (cm).
@@ -448,7 +447,7 @@ void AliITSsegmentationSPD::DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z)
 //______________________________________________________________________
 void AliITSsegmentationSPD::CellBoundries(Int_t ix,Int_t iz,
                                          Double_t &xl,Double_t &xu,
-                                         Double_t &zl,Double_t &zu)
+                                         Double_t &zl,Double_t &zu) const
 {
 // Transformation from Detector cell coordiantes to Geant detector centerd 
 // local coordinates (cm).
index 020f6b64423c6b020db6e98a2be162062ae7930f..f1c69a18055baa2c99117a4605c0eab9d5d35eee 100644 (file)
@@ -3,7 +3,6 @@
 
 #include "AliITSsegmentation.h"
 
-#include <TF1.h>
 
 class AliITSgeom;
 
@@ -15,43 +14,38 @@ public AliITSsegmentation {
 
     AliITSsegmentationSPD();
     AliITSsegmentationSPD(AliITSgeom *gm);
-    AliITSsegmentationSPD(AliITSsegmentationSPD &source);
+    AliITSsegmentationSPD(const AliITSsegmentationSPD &source);
     virtual ~AliITSsegmentationSPD(){}
-    AliITSsegmentationSPD& operator=(AliITSsegmentationSPD &source);
+    AliITSsegmentationSPD& operator=(const AliITSsegmentationSPD &source);
 
     // Set Detector Segmentation Parameters
-    //
-    // Detector size along x,z,y coordinates  
-    virtual void    SetDetSize(Float_t Dx, Float_t Dz, Float_t Dy);
 
     // Maximum number of pixels along the two coordinates  
     virtual void    SetNPads(Int_t p1, Int_t p2);
     // Returns the maximum number of cells (digits) posible
-    virtual Int_t   GetNPads(){return fNpx*fNpz;}
+    virtual Int_t   GetNPads() const {return fNpx*fNpz;}
     // Set Pixel Size Array in x and z, microns.
     virtual void    SetBinSize(Float_t *x,Float_t *z);
 
     // Transform from real to pixel coordinates
-    virtual void    GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz);
+    virtual void    GetPadIxz(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const;
     // Transform from pixel to real coordinates
-    virtual void    GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t &z);
-    // Transform from real global to local coordinates
-    //virtual void    GetLocal(Int_t module,Float_t *g ,Float_t *l) {}
+    virtual void    GetPadCxz(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const;
     // Transform from real local to global coordinates
     //virtual void    GetGlobal(Int_t module,Float_t *l ,Float_t *g) {}
     // Local transformation of real local coordinates -
-    virtual void    GetPadTxz(Float_t &x ,Float_t &z);
+    virtual void    GetPadTxz(Float_t &x ,Float_t &z) const;
     // Transformation from Geant cm detector center local coordinates
     // to detector segmentation/cell coordiantes starting from (0,0).
-    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz);
+    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &ix,Int_t &iz) const;
     // Transformation from detector segmentation/cell coordiantes starting
     // from (0,0) to Geant cm detector center local coordinates.
-    virtual void    DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z);
+    virtual void    DetToLocal(Int_t ix,Int_t iz,Float_t &x,Float_t &z) const;
     // Returns the Cell upper and lower boundries in x and y. cell indexes
     // starting from (0,0) and return Geant cm detector centered local
     // coordinates, consistant with DetToLocal and LocalToDet functions above.
     virtual void CellBoundries(Int_t ix,Int_t iz,Double_t &xl,Double_t &xu,
-                              Double_t &zl,Double_t &zu);
+                              Double_t &zl,Double_t &zu) const;
     //
     // Initialisation
     virtual void Init();
@@ -59,49 +53,41 @@ public AliITSsegmentation {
     //
     // Get member data
     //
-    // Detector Type geometry
-    virtual AliITSgeom* Geometry() {return fGeom;}
-    // Detector length
-    virtual Float_t Dx() {return fDx;}
-    // Detector width
-    virtual Float_t Dz() {return fDz;}
-    // Detector thickness
-    virtual Float_t Dy() {return fDy;}
     // Pixel size in x
-    virtual Float_t Dpx(Int_t ix);
+    virtual Float_t Dpx(Int_t ix) const;
     // Pixel size in z 
-    virtual Float_t Dpz(Int_t iz);
+    virtual Float_t Dpz(Int_t iz) const;
 
     // Maximum number of Pixels in x
-    virtual Int_t    Npx() {return fNpx;}
+    virtual Int_t    Npx() const {return fNpx;}
     // Maximum number of Pixels in z
-    virtual Int_t    Npz(){return fNpz;}
+    virtual Int_t    Npz() const {return fNpz;}
     //
     // Get next neighbours
     virtual void Neighbours
-       (Int_t iX,Int_t iZ,Int_t* Nlist,Int_t Xlist[10],Int_t Zlist[10]);
-
- private:
-    Float_t ColFromZ300(Float_t z);
-    Float_t ZFromCol300(Int_t col);
-    Float_t ZpitchFromCol300(Int_t col);
-    Float_t ColFromZ(Float_t z);
-    Float_t ZFromCol(Int_t col);
-    Float_t ZpitchFromCol(Int_t col);
+       (Int_t iX,Int_t iZ,Int_t* Nlist,Int_t Xlist[10],Int_t Zlist[10]) const;
+    // Print default parameters (static const data members, if any)
+    virtual void PrintDefaultParameters() const 
+            {Warning("PrintDefaultParameters","No def. parameters defined as const static data members\n");}
     
 protected:
+ protected:
 
+    virtual void Copy(TObject &obj) const;
     Int_t   fNpx;           // Number of pixels in x
     Int_t   fNpz;           // Number of pixels in z
-    Float_t fDx;            // Full width of the detector (x axis)- microns
-    Float_t fDz;            // Full length of the detector (z axis)- microns
-    Float_t fDy;            // Full thickness of the detector (y axis) -um 
     Float_t fCellSizeX[256];// Size for each pixel in x -microns
     Float_t fCellSizeZ[280];// Size for each pixel in z -microns
-    TF1*    fCorr;          // correction function
-    AliITSgeom *fGeom;      //! local pointer to AliITSgeom.
 
-  ClassDef(AliITSsegmentationSPD,1) //Segmentation class for SPD 
+ private:
+
+    Float_t ColFromZ300(Float_t z) const;
+    Float_t ZFromCol300(Int_t col) const;
+    Float_t ZpitchFromCol300(Int_t col) const;
+    Float_t ColFromZ(Float_t z) const;
+    Float_t ZFromCol(Int_t col) const;
+    Float_t ZpitchFromCol(Int_t col) const;
+
+  ClassDef(AliITSsegmentationSPD,2) //Segmentation class for SPD 
 
 };
 
index af660255597a76a5714862bc5abba8afa81fd94b..679d3ee087bfa9671cfc386760323f9a3a691996 100644 (file)
 
 /* $Id$ */
 
-#include <TMath.h>
-#include <TF1.h>
 #include <Riostream.h>
+#include <TMath.h>
 #include "AliITSsegmentationSSD.h"
-#include "AliITSgeom.h"
-#include "AliRun.h"
-#include "AliModule.h"
+
+//////////////////////////////////////////////////////
+// Segmentation class for                           //
+// silicon strips                                   //
+//                                                  //
+//////////////////////////////////////////////////////
+const Float_t AliITSsegmentationSSD::fgkDxDefault = 72960.;
+const Float_t AliITSsegmentationSSD::fgkDzDefault = 40000.;
+const Float_t AliITSsegmentationSSD::fgkDyDefault = 300.;
+const Float_t AliITSsegmentationSSD::fgkPitchDefault = 95.;
+const Int_t AliITSsegmentationSSD::fgkNstripsDefault = 768;
 
 ClassImp(AliITSsegmentationSSD)
-AliITSsegmentationSSD::AliITSsegmentationSSD(){
+AliITSsegmentationSSD::AliITSsegmentationSSD(): AliITSsegmentation(){
     // default constructor
-    fGeom  = 0;
-    fCorr  = 0;
-    fLayer = 0;
 }
 //----------------------------------------------------------------------
 AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSgeom *geom){
     // constuctor
     fGeom = geom;
     fCorr = 0;
-    SetDetSize();
-    SetPadSize();
-    SetNPads();
+    SetDetSize(fgkDxDefault,fgkDzDefault,fgkDyDefault);
+    SetPadSize(fgkPitchDefault,0.);
+    SetNPads(fgkNstripsDefault,0);
     SetAngles();
     fLayer = 0;
 }
+
+//______________________________________________________________________
+void AliITSsegmentationSSD::Copy(TObject &obj) const {
+  // protected method. copy this to obj
+  AliITSsegmentation::Copy(obj);
+  ((AliITSsegmentationSSD& ) obj).Clear();
+  ((AliITSsegmentationSSD& ) obj).fNstrips = fNstrips;
+  ((AliITSsegmentationSSD& ) obj).fStereoP = fStereoP;
+  ((AliITSsegmentationSSD& ) obj).fStereoN = fStereoN;
+  ((AliITSsegmentationSSD& ) obj).fStereoPl5 = fStereoPl5;
+  ((AliITSsegmentationSSD& ) obj).fStereoNl5 = fStereoNl5;
+  ((AliITSsegmentationSSD& ) obj).fStereoPl6 = fStereoPl6;
+  ((AliITSsegmentationSSD& ) obj).fStereoNl6 = fStereoNl6;
+  ((AliITSsegmentationSSD& ) obj).fLayer   = fLayer;
+  ((AliITSsegmentationSSD& ) obj).fPitch   = fPitch;
+  ((AliITSsegmentationSSD& ) obj).fLayer   = fLayer;
+}
+
 //______________________________________________________________________
 AliITSsegmentationSSD& AliITSsegmentationSSD::operator=(
-                                             AliITSsegmentationSSD &source){
+                        const AliITSsegmentationSSD &source){
 // Operator =
-    if(this==&source) return *this;
-    this->fNstrips = source.fNstrips;
-    this->fStereoP = source.fStereoP;
-    this->fStereoN = source.fStereoN;
-    this->fStereoPl5 = source.fStereoPl5;
-    this->fStereoNl5 = source.fStereoNl5;
-    this->fStereoPl6 = source.fStereoPl6;
-    this->fStereoNl6 = source.fStereoNl6;
-    this->fLayer   = source.fLayer;
-    this->fPitch   = source.fPitch;
-    this->fDz      = source.fDz;
-    this->fDx      = source.fDx;
-    this->fDy      = source.fDy;
-    this->fLayer   = source.fLayer;
-    this->fGeom    = source.fGeom; // copy only the pointer
-    this->fCorr    = new TF1(*(source.fCorr)); // make a proper copy
-    return *this;     
+  if(this != &source){
+    source.Copy(*this);
+  }
+  return *this;
 }
 //______________________________________________________________________
-AliITSsegmentationSSD::AliITSsegmentationSSD(AliITSsegmentationSSD &source):
+AliITSsegmentationSSD::AliITSsegmentationSSD(const AliITSsegmentationSSD &source):
     AliITSsegmentation(source){
     // copy constructor
-    *this = source;
+  source.Copy(*this);
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::Init(){
     // standard initalizer
 
-    SetPadSize();
-    SetNPads();
+    SetPadSize(fgkPitchDefault,0.);
+    SetNPads(fgkNstripsDefault,0);
     SetAngles();
 }
 //----------------------------------------------------------------------
-void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN){
-
+void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN) const{
+  // P and N side stereo angles
     if (fLayer == 5){
        aP = fStereoPl5;
        aN = fStereoNl5;
@@ -91,12 +101,13 @@ void AliITSsegmentationSSD::Angles(Float_t &aP,Float_t &aN){
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::SetLayer(Int_t l){
-
+  //set fLayer data member (only 5 or 6 are allowed)
     if (l==5) fLayer =5;
     if (l==6) fLayer =6;
+    if((l!=5) && (l!=6))Error("SetLayer","Layer can be 5 or 6, not %d",l);
 }
 //----------------------------------------------------------------------
-void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z){
+void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z) const{
     // returns P and N sided strip numbers for a given location.
     // Transformation from microns detector center local coordinates
     // to detector P and N side strip numbers..
@@ -120,10 +131,10 @@ void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z){
                      |0/
     // expects x, z in microns
     */
-    Float_t StereoP, StereoN;
-    Angles(StereoP,StereoN);
-    Float_t tanP = TMath::Tan(StereoP);
-    Float_t tanN = TMath::Tan(-StereoN);
+    Float_t stereoP, stereoN;
+    Angles(stereoP,stereoN);
+    Float_t tanP = TMath::Tan(stereoP);
+    Float_t tanN = TMath::Tan(-stereoN);
     Float_t x1 = x;
     Float_t z1 = z;
     x1 += fDx/2;
@@ -132,7 +143,7 @@ void AliITSsegmentationSSD::GetPadTxz(Float_t &x,Float_t &z){
     z   = (x1 - tanN*(z1 - fDz))/fPitch;
 }
 //----------------------------------------------------------------------
-void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN){
+void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN) const {
   // returns P and N sided strip numbers for a given location.
     /*                       _-  Z
                     + angle /    ^
@@ -156,10 +167,10 @@ void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN){
     // expects x, z in microns
   */ 
 
-    Float_t StereoP, StereoN;
-    Angles(StereoP,StereoN);
-    Float_t tanP=TMath::Tan(StereoP);
-    Float_t tanN=TMath::Tan(StereoN);
+    Float_t stereoP, stereoN;
+    Angles(stereoP,stereoN);
+    Float_t tanP=TMath::Tan(stereoP);
+    Float_t tanN=TMath::Tan(stereoN);
     Float_t x1=x,z1=z;
     x1 += fDx/2;
     z1 += fDz/2;
@@ -175,25 +186,25 @@ void AliITSsegmentationSSD::GetPadIxz(Float_t x,Float_t z,Int_t &iP,Int_t &iN){
 
 }
 //-------------------------------------------------------
-void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z){
+void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z) const {
     // actually this is the GetCrossing(Float_t &,Float_t &)
     // returns local x, z  in microns !
 
-    Float_t Dx = fDx; // detector size in x direction, microns
-    Float_t Dz = fDz; // detector size in z direction, microns
+    Float_t lDx = fDx; // detector size in x direction, microns
+    Float_t lDz = fDz; // detector size in z direction, microns
     Float_t xP; // x coordinate in the P side from the first P strip
     Float_t xN; // x coordinate in the N side from the first N strip
-    Float_t StereoP, StereoN;
-    Angles(StereoP,StereoN);
-    Float_t kP=TMath::Tan(StereoP);
-    Float_t kN=TMath::Tan(StereoN);
+    Float_t stereoP, stereoN;
+    Angles(stereoP,stereoN);
+    Float_t kP=TMath::Tan(stereoP);
+    Float_t kN=TMath::Tan(stereoN);
 
     xP=iP*fPitch;
     xN=iN*fPitch; 
-    x = xP + kP*(Dz*kN-xP+xN)/(kP+kN);
-    z = (Dz*kN-xP+xN)/(kP+kN); 
-    x -= Dx/2;
-    z -= Dz/2;
+    x = xP + kP*(lDz*kN-xP+xN)/(kP+kN);
+    z = (lDz*kN-xP+xN)/(kP+kN); 
+    x -= lDx/2;
+    z -= lDz/2;
     //if(TMath::Abs(z) > Dz/2) cout<<"Warning, wrong z local ="<<z<<endl; 
     // Check that zL is inside the detector for the 
     // correspondent xP and xN coordinates
@@ -202,7 +213,7 @@ void AliITSsegmentationSSD::GetPadCxz(Int_t iP,Int_t iN,Float_t &x,Float_t &z){
 }
 //______________________________________________________________________
 void AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
-                                      Int_t &iP,Int_t &iN){
+                                      Int_t &iP,Int_t &iN) const {
     // Transformation from Geant cm detector center local coordinates
     // to detector P and N side strip numbers..
     /*                       _-  Z
@@ -240,7 +251,7 @@ void AliITSsegmentationSSD::LocalToDet(Float_t x,Float_t z,
 }
 //----------------------------------------------------------------------
 void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN,
-                                      Float_t &x,Float_t &z){
+                                      Float_t &x,Float_t &z) const{
     // Transformation from detector segmentation/cell coordiantes starting
     // from 0. iPN=0 for P side and 1 for N side strip. Returned is z=0.0
     // and the corresponding x value..
@@ -270,8 +281,8 @@ void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN,
     const Double_t kconst = 1.0E-04; // convert microns to cm.
     Float_t flag=kconst*Dx(); // error value
     Double_t th=0.0,dx,dz,i,a,b=0.0,xb[4],zb[4];
-    Float_t StereoP, StereoN;
-    Angles(StereoP,StereoN);
+    Float_t stereoP, stereoN;
+    Angles(stereoP,stereoN);
 
     z = 0.0;  // Strip center in z.
     if(iPN<0 || iPN>1){// if error return full detector size in x.
@@ -287,10 +298,10 @@ void AliITSsegmentationSSD::DetToLocal(Int_t ix,Int_t iPN,
     dz = 0.5*kconst*Dz();    // half distance in z in cm
     a  = kconst*Dpx(ix)*(i+0.5)-dx; // Min x value.
     if(iPN==0){ //P-side angle defined backwards.
-       th = TMath::Tan(StereoP); 
+       th = TMath::Tan(stereoP); 
        b  = dz*th;
     }else if(iPN==1){ // N-side
-        th = TMath::Tan(-StereoN);
+        th = TMath::Tan(-stereoN);
         b  = -dz*th;
     } // end if
     // compute average/center position of the strip.
@@ -340,11 +351,11 @@ Bool_t AliITSsegmentationSSD::GetCrossing(Int_t iP,Int_t iN,
     */
     const Double_t kconst = 1.0E-04; // convert microns to cm.
     Double_t thp,thn,th,dx,dz,p,ip,in;
-    Float_t StereoP, StereoN;
-    Angles(StereoP,StereoN);
+    Float_t stereoP, stereoN;
+    Angles(stereoP,stereoN);
     
-    thp = TMath::Tan(StereoP);
-    thn = TMath::Tan(-StereoN);
+    thp = TMath::Tan(stereoP);
+    thn = TMath::Tan(-stereoN);
     th  = thp-thn;
     if(th==0.0) { // parall strips then never cross.
        x = 0.0;
@@ -371,3 +382,15 @@ Bool_t AliITSsegmentationSSD::GetCrossing(Int_t iP,Int_t iN,
                                                       // cross.
     return kTRUE;
 }
+
+//----------------------------------------------------------------------
+void AliITSsegmentationSSD::PrintDefaultParameters() const {
+// Print default values for parameters. 
+// Values specified as static const data members are shown
+
+  cout<<"fgkDxDefault = "<<fgkDxDefault<<endl;
+  cout<<"fgkDzDefault = "<<fgkDzDefault<<endl;
+  cout<<"fgkDyDefault = "<<fgkDyDefault<<endl;
+  cout<<"fgkPitchDefault = "<<fgkPitchDefault<<endl;
+  cout<<"fgkNstripsDefault = "<<fgkNstripsDefault<<endl;
+}
index 2cab9e84bd770fe09ef1b5649680fa0054602320..3fb1793f2eb376a9e2cda09ee26b2bb38f46c757 100644 (file)
@@ -11,24 +11,19 @@ public AliITSsegmentation {
 
     AliITSsegmentationSSD();
     AliITSsegmentationSSD(AliITSgeom *gm);
-    AliITSsegmentationSSD(AliITSsegmentationSSD &source);
+    AliITSsegmentationSSD(const AliITSsegmentationSSD &source);
     virtual ~AliITSsegmentationSSD(){}
-    AliITSsegmentationSSD& operator=(AliITSsegmentationSSD &source);
+    AliITSsegmentationSSD& operator=(const AliITSsegmentationSSD &source);
 
 
-    // Detector size: x,z,y 
-    virtual void    SetDetSize(Float_t p1=72960.,Float_t p2=40000.,
-                              Float_t p3= 300.) 
-                        {fDx=p1; fDz=p2; fDy=p3;}
-
     // Strip size  
-    virtual void    SetPadSize(Float_t pitch=95.,Float_t d=1.0)
-       {fPitch=pitch;d=1.;}
+    virtual void    SetPadSize(Float_t pitch,Float_t /* d */)
+       {fPitch=pitch;}
 
     // Maximum number of strips along the two coordinates  
-    virtual void    SetNPads(Int_t p1=768,Int_t d=1){fNstrips=p1;d=1;}
+    virtual void    SetNPads(Int_t p1,Int_t /* d */){fNstrips=p1;}
     // Returns the maximum number of cells (digits) posible
-    virtual Int_t   GetNPads(){return 2*fNstrips;}
+    virtual Int_t   GetNPads() const {return 2*fNstrips;}
 
 
     // Set stereo angles Pside-Nside 
@@ -44,22 +39,17 @@ public AliITSsegmentation {
 
     // Set stereo angles Pside-Nside 
     // Transform from real coordinates to strips
-    virtual void    GetPadIxz(Float_t x ,Float_t z ,Int_t   &iP,Int_t  &iN);
+    virtual void    GetPadIxz(Float_t x ,Float_t z ,Int_t   &iP,Int_t  &iN) const;
     // Transform from strips to real coordinates
-    virtual void    GetPadCxz(Int_t iP, Int_t iN, Float_t &x , Float_t &z);
-    virtual void    GetPadTxz(Float_t &x , Float_t &z);
-
-    // Transform from real global to local coordinates
-    virtual void    GetLocal(Int_t,Float_t *,Float_t *) {}
-    // Transform from real local to global coordinates
-    virtual void    GetGlobal(Int_t,Float_t *,Float_t *) {}
+    virtual void    GetPadCxz(Int_t iP, Int_t iN, Float_t &x , Float_t &z) const;
+    virtual void    GetPadTxz(Float_t &x , Float_t &z) const;
     // Transformation from Geant cm detector center local coordinates
     // to detector P and N side strip numbers..
-    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &iP,Int_t &iN);
+    virtual void    LocalToDet(Float_t x,Float_t z,Int_t &iP,Int_t &iN) const;
     // Transformation from detector segmentation/cell coordiantes starting
     // from 0. iPN=0 for P side and 1 for N side strip. Returned is z=0.0
     // and the corresponding x value..
-    virtual void    DetToLocal(Int_t ix,Int_t iPN,Float_t &x,Float_t &z);
+    virtual void    DetToLocal(Int_t ix,Int_t iPN,Float_t &x,Float_t &z) const;
     // Given one P side strip and one N side strip, Returns kTRUE if they
     // cross each other and the location of the two crossing strips and
     // their correxlation matrix c[2][2].
@@ -68,48 +58,43 @@ public AliITSsegmentation {
 
     virtual void Init();
 
-    // Detector type geometry
-    virtual AliITSgeom* Geometry() {return 0;}
-    // Detector length
-    virtual Float_t Dx() {return fDx;}
-    // Detector width
-    virtual Float_t Dz() {return fDz;}
-    // Detector thickness
-    virtual Float_t Dy() {return fDy;}
     // Strip size in x
-    virtual Float_t Dpx(Int_t) {return fPitch;}
+    virtual Float_t Dpx(Int_t) const {return fPitch;}
     // Strip size in z 
-    virtual Float_t Dpz(Int_t) {return fDz;}
+    virtual Float_t Dpz(Int_t) const {return fDz;}
     // Maximum number of Strips in x
-    virtual Int_t    Npx() {return fNstrips;}
+    virtual Int_t    Npx() const {return fNstrips;}
     // Maximum number of Strips in z
-    virtual Int_t    Npz(){return 1;}
+    virtual Int_t    Npz()const {return 1;}
 
     // Angles : Pside stereo angle-Nside stereo angle
-     virtual void Angles(Float_t &aP,Float_t &aN);
+     virtual void Angles(Float_t &aP,Float_t &aN) const;
      virtual void SetLayer(Int_t l);
      virtual Int_t GetLayer() const {return fLayer;}
+    // Print Default parameters
+     virtual void PrintDefaultParameters() const;
 
   protected:
 
+  virtual void Copy(TObject &obj) const; 
+
   Int_t      fNstrips;       // Number of strips in x 
   Float_t    fStereoP;       // Stereo angle for Pside (rad)
   Float_t    fStereoN;       // Stereo angle for Nside (rad)
   Float_t    fPitch;         // Pitch of the strips
-  Float_t    fDz;            // Full width of the detector (z axis)- microns
-  Float_t    fDx;            // Full length of the detector (x axis)- microns
-  Float_t    fDy;            // Full thickness of the detector (y axis) -um 
   
   Float_t    fStereoPl5;       // Stereo angle for Pside
   Float_t    fStereoNl5;       // Stereo angle for Nside
   Float_t    fStereoPl6;       // Stereo angle for Pside
   Float_t    fStereoNl6;       // Stereo angle for Nside
-  Int_t      fLayer;
-
-  AliITSgeom *fGeom;         //! pointer to the geometry class
-  TF1*       fCorr;          // correction function
-  
-  ClassDef(AliITSsegmentationSSD,1) //Segmentation class for SSD 
+  Int_t      fLayer;           //! layer number (5 or 6)
+  static const Float_t fgkDxDefault;  // Default value for fDx
+  static const Float_t fgkDzDefault;  // Default value for fDz
+  static const Float_t fgkDyDefault;  // Default value for fDy
+  static const Float_t fgkPitchDefault; //Default value for fPitch
+  static const Int_t fgkNstripsDefault; //Default value for fNstrips
+
+  ClassDef(AliITSsegmentationSSD,2) //Segmentation class for SSD 
 };
 
 #endif