]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Refactoring: rempved the usage of AliHLTEMCALConstant
authorphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 May 2010 02:51:16 +0000 (02:51 +0000)
committerphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 5 May 2010 02:51:16 +0000 (02:51 +0000)
from  AliHLTEMCALGeometry

HLT/EMCAL/AliHLTEMCALGeometry.cxx

index a7eb54260d8888fbe2b1e7139cc193623bd1e2ec..f4a06c6c139f378ffd54130211df6fae542ac73f 100644 (file)
 
 #include "AliHLTEMCALGeometry.h"
 #include "AliHLTEMCALConstants.h"
-#include "AliHLTEMCALConstant.h"
+// #include "AliHLTEMCALConstant.h"
 #include "assert.h"
 #include "AliHLTCaloConstantsHandler.h"
 #include "AliHLTEMCALSharedMemoryInterface.h" 
 #include "TVector3.h"
 
-using namespace EmcalHLTConst;
+// using namespace EmcalHLTConst;
 
 ClassImp(AliHLTEMCALGeometry);
 TGeoManager *gGeoManager = 0;
@@ -57,146 +57,139 @@ AliHLTEMCALGeometry::~AliHLTEMCALGeometry()
 void 
 AliHLTEMCALGeometry::GetGlobalCoordinates(AliHLTCaloRecPointDataStruct &recPoint, AliHLTCaloGlobalCoordinate &globalCoord)
 {
+  Int_t istrip = 0;
+  Float_t z0 = 0;
+  Float_t zb = 0;
+  Float_t z_is = 0;
+  Float_t d = 0;
+  Float_t x,y,z; // return variables in terry's RF
+  Float_t dz = fCaloConstants->GetMINCELLSTEPETA(); // base cell width in eta
+  Float_t dx = fCaloConstants->GetCELLSTEPPHI(); // base cell width in phi
+  
+  // parameters for shower depth calculation
+  Float_t X0 = fCaloConstants->GetRADLENGTH();
+  Float_t Ecr = fCaloConstants->GetCRITICENERGY();
+  Float_t Cj;
+  Float_t teta0 = fCaloConstants->GetCELLANGLE(); //tapering angle (deg)
+  Float_t teta1; //working angle
+  Float_t L = fCaloConstants->GetCELLHEIGHT();
+  // converting to MEV
+  Float_t E = recPoint.fAmp * 1000;
+  //TVector3 v1;
+  Double_t glob[3] ={0,0,0};
+  Double_t loc[3] = {0,0,0};
+  
+  if (recPoint.fZ >= 47.51 || recPoint.fZ< -0.51) {
+    Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetGlobalCoordinates: invalid Z: %f from recpoint ", recPoint.fZ);
+    return;
+  }
+  
+  if (recPoint.fX >= 23.51 || recPoint.fX< -0.51) {
+    Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetGlobalCoordinates: invalid X: % from recpoint ", recPoint.fX);
+    return;
+  }
+  
+  
+  switch ( recPoint.fParticle )
+    {
+    case 0:
+      Cj = - fCaloConstants->GetCJ(); // photon
+      d = X0 * TMath::Log( E / Ecr + Cj);
+      break;
+      
+    case 1:
+      Cj = + fCaloConstants->GetCJ(); // electron
+      d = X0 * TMath::Log( E / Ecr + Cj);
+      break;
+      
+    case 2:
+      // hadron
+      d = 0.5 * L;
+      break;
+                 
+    default:
+      Cj = - fCaloConstants->GetCJ(); // defaulting to photon
+      d = X0 * TMath::Log( E / Ecr + Cj);
+    }
+  
+  istrip = int ((recPoint.fZ + 0.5 ) / 2);
+  
+  // module angle
+  teta1 = TMath::DegToRad() * istrip * teta0;
 
-        Int_t istrip = 0;
-        Float_t z0 = 0;
-        Float_t zb = 0;
-        Float_t z_is = 0;
-        Float_t d = 0;
-
-        Float_t x,y,z; // return variables in terry's RF
-
-        Float_t dz = fCaloConstants->GetMINCELLSTEPETA(); // base cell width in eta
-        Float_t dx = fCaloConstants->GetCELLSTEPPHI(); // base cell width in phi
-
-         // parameters for shower depth calculation
-        Float_t X0 = fCaloConstants->GetRADLENGTH();
-        Float_t Ecr = fCaloConstants->GetCRITICENERGY();
-        Float_t Cj;
-
-        Float_t teta0 = fCaloConstants->GetCELLANGLE(); //tapering angle (deg)
-        Float_t teta1; //working angle
-
-        Float_t L = fCaloConstants->GetCELLHEIGHT();
-
-        // converting to MEV
-        Float_t E = recPoint.fAmp * 1000;
-
-        //TVector3 v1;
-               Double_t glob[3] ={0,0,0};
-               Double_t loc[3] = {0,0,0};
-
-        if (recPoint.fZ >= 47.51 || recPoint.fZ< -0.51) {
-                Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetGlobalCoordinates: invalid Z: %f from recpoint ", recPoint.fZ);
-                return;
-         }
-
-         if (recPoint.fX >= 23.51 || recPoint.fX< -0.51) {
-                 Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetGlobalCoordinates: invalid X: % from recpoint ", recPoint.fX);
-                 return;
-         }
-
-
-         switch ( recPoint.fParticle )
-         {
-         case 0:
-                 Cj = - fCaloConstants->GetCJ(); // photon
-                 d = X0 * TMath::Log( E / Ecr + Cj);
-                 break;
-
-         case 1:
-                 Cj = + fCaloConstants->GetCJ(); // electron
-                 d = X0 * TMath::Log( E / Ecr + Cj);
-                 break;
-
-         case 2:
-                 // hadron
-                 d = 0.5 * L;
-                 break;
-
-         default:
-                 Cj = - fCaloConstants->GetCJ(); // defaulting to photon
-                 d = X0 * TMath::Log( E / Ecr + Cj);
-         }
-
-          istrip = int ((recPoint.fZ + 0.5 ) / 2);
-
-          // module angle
-          teta1 = TMath::DegToRad() * istrip * teta0;
-
-          // calculation of module corner along z
-          // as a function of strip
+  // calculation of module corner along z
+  // as a function of strip
 
-          for (Int_t is=0; is<= istrip; is++) {
+  for (Int_t is=0; is<= istrip; is++) {
 
-            teta1 = TMath::DegToRad() * is * teta0;
+    teta1 = TMath::DegToRad() * is * teta0;
 
-            z_is = z_is + 2*dz*(TMath::Sin(teta1)*TMath::Tan(teta1) + TMath::Cos(teta1));
+    z_is = z_is + 2*dz*(TMath::Sin(teta1)*TMath::Tan(teta1) + TMath::Cos(teta1));
 
-          }
+  }
 
-          z0 = dz * (recPoint.fZ - 2*istrip + 0.5);
-          zb = (2*dz-z0-d*TMath::Tan(teta1))*TMath::Cos(teta1);
+  z0 = dz * (recPoint.fZ - 2*istrip + 0.5);
+  zb = (2*dz-z0-d*TMath::Tan(teta1))*TMath::Cos(teta1);
 
-          z = z_is - zb*TMath::Cos(teta1);
+  z = z_is - zb*TMath::Cos(teta1);
 
-//        cout << "----> istrip: " << istrip << endl;
-//        cout << "----> z0: "<< z0 << endl;
-//        cout << "----> zb: "<< zb << endl;
-//        cout << "----> corner z: "<< z_is << endl;
+  //      cout << "----> istrip: " << istrip << endl;
+  //      cout << "----> z0: "<< z0 << endl;
+  //      cout << "----> zb: "<< zb << endl;
+  //      cout << "----> corner z: "<< z_is << endl;
 
-//        cout << "----> teta1: "<< TMath::RadToDeg()*teta1 << endl;
+  //      cout << "----> teta1: "<< TMath::RadToDeg()*teta1 << endl;
 
-          y = d/TMath::Cos(teta1) + zb*TMath::Sin(teta1);
+  y = d/TMath::Cos(teta1) + zb*TMath::Sin(teta1);
 
-          x = (recPoint.fX + 0.5)*dx;
+  x = (recPoint.fX + 0.5)*dx;
 
-          // cout << "x: " << x << " y: "<< y << " z " << z << endl;
+  // cout << "x: " << x << " y: "<< y << " z " << z << endl;
 
-       // check coordinate origin
-       loc[0] = x;
-       loc[1] = y;
-       loc[2] = z;
+  // check coordinate origin
+  loc[0] = x;
+  loc[1] = y;
+  loc[2] = z;
 
-        if(!fGeo)
-   {
+  if(!fGeo)
+    {
       Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetGlobalCoordinates: no geometry initialised");
       return;
-   }
+    }
 
-        ConvertRecPointCoordinates(loc[1], loc[2], loc[3]);
+  ConvertRecPointCoordinates(loc[1], loc[2], loc[3]);
 
-        fGeo->GetGlobal(loc, glob, recPoint.fModule);
+  fGeo->GetGlobal(loc, glob, recPoint.fModule);
 
-        globalCoord.fX = glob[0];
-        globalCoord.fY = glob[1];
-        globalCoord.fZ = glob[2];
+  globalCoord.fX = glob[0];
+  globalCoord.fY = glob[1];
+  globalCoord.fZ = glob[2];
 }
  
 void 
 AliHLTEMCALGeometry::GetCellAbsId(UInt_t module, UInt_t y, UInt_t z, Int_t& AbsId)
 {
 
-       if(!fGeo)
-       {
-                Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetCellAbsId: no geometry initialised");
-                return;
+  if(!fGeo)
+    {
+      Logging(kHLTLogError, "HLT", "EMCAL", "AliHLTEMCALGeometry::GetCellAbsId: no geometry initialised");
+      return;
 
-       }
+    }
        
-       AbsId = fGeo->GetAbsCellIdFromCellIndexes(module, y, z);
+  AbsId = fGeo->GetAbsCellIdFromCellIndexes(module, y, z);
        
 }
 
 void AliHLTEMCALGeometry::ConvertRecPointCoordinates(Double_t &x, Double_t &y, Double_t &z) const
 {
-       Double_t DX = 13.869008;
-       Double_t DY = 72.559998;
-       Double_t DZ = 175.00000;
+  Double_t DX = 13.869008;
+  Double_t DY = 72.559998;
+  Double_t DZ = 175.00000;
 
-        x = y - DX;  //fixme
-        y = -x + DY; //fixme
-        z = z - DZ;  //fixme
+  x = y - DX;  //fixme
+  y = -x + DY; //fixme
+  z = z - DZ;  //fixme
 
 }
 
@@ -205,7 +198,7 @@ int
 AliHLTEMCALGeometry::GetGeometryFromCDB()
 {
 
- // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
 // AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
 
   AliCDBPath path("GRP","Geometry","Data");
   if(path.GetPath())
@@ -231,7 +224,7 @@ AliHLTEMCALGeometry::GetGeometryFromCDB()
        }
       else
        {
-                 //HLTError("can not fetch object \"%s\" from OCDB", path);
+         //HLTError("can not fetch object \"%s\" from OCDB", path);
        }
     }
   return 0;