]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added new data members to remove magic numbers
authorschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Jan 2002 02:51:25 +0000 (02:51 +0000)
committerschutz <schutz@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Jan 2002 02:51:25 +0000 (02:51 +0000)
EMCAL/AliEMCALGeometry.cxx
EMCAL/AliEMCALGeometry.h

index d9fb7053c3b619ac54e2d4f489b35098f4ddfac5..124196053e9996ce8404c3f9662532c0acfca811 100644 (file)
@@ -55,28 +55,14 @@ AliEMCALGeometry::~AliEMCALGeometry(void){
 void AliEMCALGeometry::Init(void){
     // Initializes the EMCAL parameters
 
+    fgInit = kFALSE; // Assume failer untill proven otherwise.
     if(!(  (strcmp( fName, "EMCALArch1a" ) == 0) |
           (strcmp( fName, "EMCALArch1b" ) == 0) | 
           (strcmp( fName, "EMCALArch2a" ) == 0) | 
           (strcmp( fName, "EMCALArch2b" ) == 0) )){
-       fgInit = kFALSE;
        cout <<"Instance " << fName << " undefined" << endl;
     } // end if
-    fgInit = kTRUE; 
-
-    // geometry 
-    fAirGap     = 5.0; 
-    fArm1PhiMin = 0.0; 
-    fArm1PhiMax = 120.0; 
-
-    fIPDistance = 454.0; 
-    fZLength = 817.0; 
-    fEnvelop[0] = fIPDistance; 
-    fEnvelop[2] = fZLength; 
-    fGap2Active = 1.0; 
-    fShellThickness = 3.18 + 1.2 + (double)((2*fNLayers -3)/2);   
-    fEnvelop[1] = fIPDistance + fShellThickness;
-
+    //
     if (((strcmp( fName, "EMCALArch1a" ))    == 0) |
        ((strcmp( fName, "EMCALArch1b" ))    == 0)){
        fNZ         = 96;
@@ -95,6 +81,30 @@ void AliEMCALGeometry::Init(void){
        ((strcmp( fName, "EMCALArch2b" ))    == 0)){
        fNLayers    = 25;
     } // end if
+
+    // geometry
+    fAirGap         = 5.0; // cm, air gap between EMCAL mother volume and 
+                           // active material.
+    fAlFrontThick   = 3.18; // cm, Thickness of front Al layer
+    fPbRadThickness = 0.5; // cm, Thickness of theh Pb radiators.
+    fPreShowerSintThick = 0.6; // cm, Thickness of the sintilator for the
+                               // preshower part of the calorimeter
+    fFullShowerSintThick = 0.5; // cm, Thickness of the sintilator for the
+                                // full shower part of the calorimeter
+    fArm1PhiMin     =   0.0; // degrees, Starting EMCAL Phi position
+    fArm1PhiMax     = 120.0; // degrees, Ending EMCAL Phi position
+    fArm1EtaMin     = -0.7; // pseudorapidity, Starting EMCAL Eta position
+    fArm1EtaMax     = +0.7; // pseudorapidity, Ending EMCAL Eta position
+    fIPDistance     = 454.0; // cm, Radial distance to inner surface of EMCAL
+    fShellThickness = GetAlFrontThickness() + 2.*GetPreSintThick() +
+       (fNLayers-2)*GetFullSintThick()+(fNLayers-1)*GetPbRadThick();
+    //below; cm, Z lenght of the EMCAL.
+    fZLength        = 2.*ZFromEtaR(fIPDistance+fShellThickness,fArm1EtaMax);
+    fEnvelop[0]     = fIPDistance; // mother volume inner radius
+    fEnvelop[1]     = fIPDistance + fShellThickness; // mother volume outer r.
+    fEnvelop[2]     = 1.00001*fZLength; // add some padding for mother volume. 
+    fGap2Active     = 1.0;  // cm, Gap between 
+    fgInit = kTRUE; 
 }
 //______________________________________________________________________
 AliEMCALGeometry *  AliEMCALGeometry::GetInstance(){ 
@@ -132,12 +142,12 @@ AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name,
     return rv; 
 }
 //______________________________________________________________________
-Int_t AliEMCALGeometry::TowerIndex(Int_t iz,Int_t iphi,Int_t ipre){
+Int_t AliEMCALGeometry::TowerIndex(Int_t ieta,Int_t iphi,Int_t ipre){
     // Returns the tower index number from the based on the Z and Phi
     // index numbers. There are 2 times the number of towers to separate
     // out the full towsers from the pre-towsers.
     // Inputs:
-    //   Int_t iz    // index allong z axis [1-fNZ]
+    //   Int_t ieta    // index allong z axis [1-fNZ]
     //   Int_t iphi  // index allong phi axis [1-fNPhi]
     //   Int_t ipre  // 0 = Full tower, 1 = Pre-shower tower only. [0,1]
     // Outputs:
@@ -146,18 +156,18 @@ Int_t AliEMCALGeometry::TowerIndex(Int_t iz,Int_t iphi,Int_t ipre){
     // Int_t the absoulute tower index. [1-2*fNZ*fNPhi]
     Int_t index;
 
-    if((iz<=0 || iz>GetNZ()) || (iphi<=0 || iphi>GetNPhi()) ||
+    if((ieta<=0 || ieta>GetNEta()) || (iphi<=0 || iphi>GetNPhi()) ||
        (ipre<0 || ipre>1) ){
-       cout << "inputs out of range iz=" << iz << "[1-" << GetNZ();
-       cout << "] iPhi=" << iphi << "[1-" << GetNPhi() << "] ipre=";
+       cout << "inputs out of range ieta=" << ieta << " [1-" << GetNEta();
+       cout << "] iphi=" << iphi << " [1-" << GetNPhi() << "] ipre=";
        cout << ipre << "[0,1]. returning -1" << endl;
        return -1;
     } // end if
-    index = iphi + GetNPhi()*(iz-1) + ipre*(GetNPhi()*GetNZ());
+    index = iphi + GetNPhi()*(ieta-1) + ipre*(GetNPhi()*GetNEta());
     return index;
 }
 //______________________________________________________________________
-void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &iz,Int_t &iphi,
+void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &ieta,Int_t &iphi,
                                    Int_t &ipre){
     // given the tower index number it returns the based on the Z and Phi
     // index numbers and if it is for the full tower or the pre-tower number.
@@ -166,18 +176,18 @@ void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &iz,Int_t &iphi,
     // Inputs:
     //   Int_t index // Tower index number [1-2*fNZ*fNPhi]
     // Outputs:
-    //   Int_t iz    // index allong z axis [1-fNZ]
+    //   Int_t ieta    // index allong z axis [1-fNZ]
     //   Int_t iphi  // index allong phi axis [1-fNPhi]
     //   Int_t ipre  // 0 = Full tower, 1 = Pre-shower tower only. [0,1]
     // Returned
     //   none.
     Int_t itowers;
 
-    itowers = GetNZ()*GetNPhi();
+    itowers = GetNEta()*GetNPhi();
     if(index<1 || index>2*itowers){
        cout << "index=" << index <<" is out of range [1-";
        cout << 2*itowers << "], returning -1 for all." << endl;
-       iz = -1; iphi = -1; ipre = -1;
+       ieta = -1; iphi = -1; ipre = -1;
        return ;
     } // end if
     ipre = 0;
@@ -185,8 +195,8 @@ void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &iz,Int_t &iphi,
        ipre = 1;
        index = index - itowers;
     } // end if
-    iz = 1+ (Int_t)(index/GetNPhi());
-    iphi = index - GetNPhi()*(iz-1);
+    ieta = 1+ (Int_t)(index/GetNPhi());
+    iphi = index - GetNPhi()*(ieta-1) +1;
     return;
 }
 //______________________________________________________________________
@@ -200,17 +210,14 @@ void AliEMCALGeometry::EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi){
     //   Float_t phi  // phi of center of tower in degrees
     // Returned
     //   none.
-    Int_t iz,iphi,ipre;
-    Double_t dz,dphi,zmax,z,phid,r;
+    Int_t ieta,iphi,ipre;
+    Double_t deta,dphi,phid;
 
-    TowerIndexes(index,iz,iphi,ipre);
-    zmax = (Double_t) GetZLength();
-    dz   = zmax/((Double_t)GetNZ());
-    r    = GetIPDistance();
-    z    = dz*((Double_t)iz - 0.5);  // iz range [1-fNZ].
-    eta  = -TMath::Log(TMath::Tan(0.5*TMath::ATan2(r,z)));
-    dphi = GetArm1PhiMax() - GetArm1PhiMin();  // in degrees.
-    phid = GetArm1PhiMin() + dphi*((Double_t)iphi -0.5);//iphi range [1-fNphi].
+    TowerIndexes(index,ieta,iphi,ipre);
+    deta = (GetArm1EtaMax()-GetArm1EtaMin())/((Float_t)GetNEta());
+    eta  = GetArm1EtaMin() + (((Float_t)ieta)-0.5)*deta;
+    dphi = (GetArm1PhiMax() - GetArm1PhiMin())/((Float_t)GetNPhi());  // in degrees.
+    phid = GetArm1PhiMin() + dphi*((Float_t)iphi -0.5);//iphi range [1-fNphi].
     phi  = phid;
 }
 //______________________________________________________________________
@@ -223,33 +230,27 @@ Int_t AliEMCALGeometry::TowerIndexFromEtaPhi(Float_t eta,Float_t phi){
     //   none.
     // Returned
     //   Int_t index // Tower index number [1-fNZ*fNPhi]
-    Int_t iz,iphi;
-    Double_t z,zp,r,zl;
+    Int_t ieta,iphi;
 
-    r = GetIPDistance();
-    z = 2.0*TMath::ATan(TMath::Exp(-eta));
-    z = TMath::Tan(z);
-    if(z!=0.0) z = r/z;
-    else z = 0.0;
-    zp = z;
-    zl = GetZLength();
-    z = 0.5*zl+z;
-    iz = (Int_t)(((Double_t)GetNZ())*z/zl);
-    if(iz<=0 || iz>GetNZ()){
-       cout << "z=" << zp << " is outside of EMCAL. r=" << r << " eta =";
-       cout << eta << " z length =" << zl ;
+    ieta = 1 + (Int_t)(((Float_t)GetNEta())*(eta-GetArm1EtaMin())/
+                 (GetArm1EtaMax() - GetArm1EtaMin()));
+    if(ieta<=0 || ieta>GetNEta()){
+       cout << "TowerIndexFromEtaPhi:";
+       cout << "ieta = "<< ieta << " eta=" << eta << " is outside of EMCAL. etamin=";
+       cout << GetArm1EtaMin() << " to etamax=" << GetArm1EtaMax();
        cout << " returning -1" << endl;
        return -1;
     } // end if
-    iphi =(Int_t)(((Double_t)GetNPhi())*((Double_t)phi)/
-                 ((Double_t)(GetArm1PhiMax() - GetArm1PhiMin())));
+    iphi = 1 + (Int_t)(((Float_t)GetNPhi())*(phi-GetArm1PhiMin())/
+                 ((Float_t)(GetArm1PhiMax() - GetArm1PhiMin())));
     if(iphi<=0 || iphi>GetNPhi()){
-       cout << "phi=" << phi << " is outside of EMCAL. r=" << r;
+       cout << "TowerIndexFromEtaPhi:";
+       cout << "iphi=" << iphi << " phi=" << phi << " is outside of EMCAL.";
        cout << " Phimin=" << GetArm1PhiMin() << " PhiMax=" << GetArm1PhiMax();
        cout << " returning -1" << endl;
        return -1;
     } // end if
-    return TowerIndex(iz,iphi,0);
+    return TowerIndex(ieta,iphi,0);
 }
 //______________________________________________________________________
 Int_t AliEMCALGeometry::PreTowerIndexFromEtaPhi(Float_t eta,Float_t phi){
@@ -262,7 +263,7 @@ Int_t AliEMCALGeometry::PreTowerIndexFromEtaPhi(Float_t eta,Float_t phi){
     // Returned
     //   Int_t index // PreTower index number [fNZ*fNPhi-2*fNZ*fNPhi]
 
-    return GetNZ()*GetNPhi()+TowerIndexFromEtaPhi(eta,phi);
+    return GetNEta()*GetNPhi()+TowerIndexFromEtaPhi(eta,phi);
 }
 //______________________________________________________________________
 Bool_t AliEMCALGeometry::AbsToRelNumbering(Int_t AbsId, Int_t *relid){
@@ -277,13 +278,13 @@ Bool_t AliEMCALGeometry::AbsToRelNumbering(Int_t AbsId, Int_t *relid){
     // Outputs:
     //   Int_t *relid // array of 5. Discribed above.
     Bool_t rv  = kTRUE ;
-    Int_t iz=0,iphi=0,ipre=0,index=AbsId;
+    Int_t ieta=0,iphi=0,ipre=0,index=AbsId;
 
-    TowerIndexes(index,iz,iphi,ipre);
+    TowerIndexes(index,ieta,iphi,ipre);
     relid[0] = 1;
     relid[1] = 0;
     if(ipre==1) relid[1] = -1;
-    relid[2] = iz;
+    relid[2] = ieta;
     relid[3] = iphi;
 
     return rv;
@@ -293,14 +294,14 @@ void AliEMCALGeometry::RelPosInModule(const Int_t *relid,Float_t &theta,
                                     Float_t &phi){
     // Converts the relative numbering into the local PHOS-module (x, z)
     // coordinates
-    Int_t iz   = relid[2]; // offset along x axis
+    Int_t ieta   = relid[2]; // offset along x axis
     Int_t iphi = relid[3]; // offset along z axis
     Int_t ipre = relid[1]; // indecates -1 preshower, or 0 full tower.
     Int_t index;
     Float_t eta;
 
     if(ipre==-1) ipre = 1;
-    index = TowerIndex(iz,iphi,ipre);
+    index = TowerIndex(ieta,iphi,ipre);
     EtaPhiFromIndex(index,eta,phi);
     theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi();
 
@@ -319,12 +320,12 @@ Boot_t AliEMCALGeometry::AreNeighbours(Int_t index1,Int_t index2){
     // Returned
     //   Boot_t kTRUE if the towers are neighbours otherwise false.
     Boot_t anb = kFALSE;
-    Int_t iz1 = 0, iz2 = 0, iphi1 = 0, iphi2 = 0, ipre1 = 0, ipre2 = 0;
+    Int_t ieta1 = 0, ieta2 = 0, iphi1 = 0, iphi2 = 0, ipre1 = 0, ipre2 = 0;
 
-    TowerIndexes(index1,iz1,iphi1,ipre1);
-    TowerIndexes(index2,iz2,iphi2,ipre2);
+    TowerIndexes(index1,ieta1,iphi1,ipre1);
+    TowerIndexes(index2,ieta2,iphi2,ipre2);
     if(ipre1!=ipre2) return anb;
-    if((iz1>=iz2-1 && iz1<=iz2+1) && (iphi1>=iphi2-1 && iphi1<=iphi2+1))
+    if((ieta1>=ieta2-1 && ieta1<=ieta2+1) && (iphi1>=iphi2-1 &&iphi1<=iphi2+1))
                                                                  anb = kTRUE;
     return anb;
 }
index b9bf971c538142d28c4b05debde42edd7979a37e..23eee81d6d4804abc03d8cd6740df792992d6a8b 100644 (file)
@@ -23,7 +23,6 @@
 
 #include "AliGeometry.h"
 
-
 class AliEMCALGeometry : public AliGeometry {
  public:
     AliEMCALGeometry() {
@@ -50,16 +49,43 @@ class AliEMCALGeometry : public AliGeometry {
     // Return EMCA geometrical parameters
     // geometry
     const Float_t GetAirGap() const { return fAirGap ; }
+    const Float_t GetAlFrontThickness() const { return fAlFrontThick;}
     const Float_t GetArm1PhiMin() const { return fArm1PhiMin ; }
     const Float_t GetArm1PhiMax() const { return fArm1PhiMax ; }
+    const Float_t GetArm1EtaMin() const { return fArm1EtaMin;}
+    const Float_t GetArm1EtaMax() const { return fArm1EtaMax;}
     const Float_t GetIPDistance()   const { return  fIPDistance  ; } 
     const Float_t GetEnvelop(Int_t index) const { return fEnvelop[index] ; }  
     const Float_t GetShellThickness() const { return fShellThickness ; }
     const Float_t GetZLength() const { return fZLength ; } 
     const Float_t GetGap2Active() const {return  fGap2Active ; }
+    const Float_t GetDeltaEta() const {return (fArm1EtaMax-fArm1EtaMin)/
+                                          ((Float_t)fNZ);}
+    const Float_t GetDeltaPhi() const {return (fArm1PhiMax-fArm1PhiMin)/
+                                          ((Float_t)fNPhi);}
     const Int_t   GetNLayers() const {return fNLayers ;}
     const Int_t   GetNZ() const {return fNZ ;}
+    const Int_t   GetNEta() const {return fNZ ;}
     const Int_t   GetNPhi() const {return fNPhi ;}
+    const Float_t GetPbRadThick(){ // returns Pb radiator thickness in cm.
+       return fPbRadThickness;
+    }
+    const Float_t GetFullSintThick(){ // returns Full tower sintilator
+                                     // thickness in cm.
+       return fFullShowerSintThick;
+    }
+    const Float_t GetPreSintThick(){ // returns PreShower tower sintilator
+                                     // thickness in cm.
+       return fPreShowerSintThick;
+    }
+    Float_t AngleFromEta(Float_t eta){ // returns angle in radians for a given
+       // pseudorapidity.
+       return 2.0*TMath::ATan(TMath::Exp(-eta));
+       }
+    Float_t ZFromEtaR(Float_t r,Float_t eta){ // returns z in for a given
+       // pseudorapidity and r=sqrt(x*x+y*y).
+       return r/TMath::Tan(AngleFromEta(eta));
+       }
     Int_t TowerIndex(Int_t iz,Int_t iphi,Int_t ipre); // returns tower index
     // returns tower indexs iz, iphi.
     void TowerIndexes(Int_t index,Int_t &iz,Int_t &iphi,Int_t &ipre);
@@ -81,35 +107,39 @@ class AliEMCALGeometry : public AliGeometry {
 
  protected:
     AliEMCALGeometry(const Text_t* name, const Text_t* title="") :
-       AliGeometry(name, title) { 
-       // ctor only for internal usage (singleton)
-       Init() ; 
+       AliGeometry(name, title) {// ctor only for internal usage (singleton)
+       Init();
     };
     void Init(void) ;            // initializes the parameters of EMCAL
+
  private:
     static AliEMCALGeometry * fgGeom ; // pointer to the unique instance
                                        // of the singleton 
-    static Bool_t fgInit ;// Tells if geometry has been succesfully set up
-                          // geometry
-    Float_t fAirGap ; // Distance between envelop and active material 
-    Float_t fArm1PhiMin ; // Minimum angular position of EMCAL in Phi (degrees)
-    Float_t fArm1PhiMax ; // Maximum angular position of EMCAL in Phi (degrees)
+    static Bool_t fgInit;// Tells if geometry has been succesfully set up.
+    Float_t fAirGap;     // Distance between envelop and active material
+    Float_t fAlFrontThick; // Thickness of the front Al face of the support box
+    Float_t fPreShowerSintThick; // Thickness of the sintilator for the
+                                 // preshower part of the calorimeter
+    Float_t fFullShowerSintThick;// Thickness of the sintilaor for the full
+                                 // shower part of the calorimeter
+    Float_t fPbRadThickness; // Thickness of Pb radiators cm.
+    Float_t fArm1PhiMin; // Minimum angular position of EMCAL in Phi (degrees)
+    Float_t fArm1PhiMax; // Maximum angular position of EMCAL in Phi (degrees)
+    Float_t fArm1EtaMin; // Minimum pseudorapidity position of EMCAL in Eta
+    Float_t fArm1EtaMax; // Maximum pseudorapidity position of EMCAL in Eta
 
     // It is assumed that Arm1 and Arm2 have the same following parameters
-    Float_t fEnvelop[3] ;              // the GEANT TUB for the detector 
-    Float_t fIPDistance ; // Distance of the inner surface to the
-                          // interaction point
-    Float_t fShellThickness ;          // Total thickness in (x,y) direction
-    Float_t fZLength ;                 // Total length in z direction
-    Float_t fGap2Active ; // Gap between the envelop and the active material
-    Int_t fNLayers ; // Number of layers of material in the R direction
-    Int_t fNZ ;                      // Number of Towers in the Z direction
-    Int_t fNPhi ;                    //Number of Towers in the Phi Direction
+    Float_t fEnvelop[3];      // the GEANT TUB for the detector 
+    Float_t fIPDistance; // Radial Distance of the inner surface of the EMCAL
+    Float_t fShellThickness; // Total thickness in (x,y) direction
+    Float_t fZLength;        // Total length in z direction
+    Float_t fGap2Active;     // Gap between the envelop and the active material
+    Int_t   fNLayers;        // Number of layers of material in the R direction
+    Int_t   fNZ;             // Number of Towers in the Z direction
+    Int_t   fNPhi;           //Number of Towers in the Phi Direction
  
-    ClassDef(AliEMCALGeometry,2)       // EMCAL geometry class 
+    ClassDef(AliEMCALGeometry,3) // EMCAL geometry class 
 
-} ;
+};
 
 #endif // AliEMCALGEOMETRY_H
-
-