]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALShishKebabTrd1Module.cxx
several coverity reports corrected in geometry
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALShishKebabTrd1Module.cxx
index 678a0ca116c6c83776d88bbdee8d46935d1c8d32..1358387acb7dfb06240dc39229f8c440e6bd3edc 100644 (file)
 
 #include "AliLog.h"
 #include "AliEMCALShishKebabTrd1Module.h"
-//#include <assert.h>
-#include "AliEMCALGeometry.h"
+#include "AliEMCALEMCGeometry.h"
 
-#include <Riostream.h>
+#include <cassert>
 
 ClassImp(AliEMCALShishKebabTrd1Module)
 
-  AliEMCALGeometry *AliEMCALShishKebabTrd1Module::fgGeometry=0; 
+  //AliEMCALEMCGeometry *AliEMCALShishKebabTrd1Module::fgGeometry=0; 
   Double_t AliEMCALShishKebabTrd1Module::fga=0.; 
   Double_t AliEMCALShishKebabTrd1Module::fga2=0.; 
   Double_t AliEMCALShishKebabTrd1Module::fgb=0.; 
@@ -42,8 +41,9 @@ ClassImp(AliEMCALShishKebabTrd1Module)
   Double_t AliEMCALShishKebabTrd1Module::fgtanBetta=0; //
 
 //_____________________________________________________________________________
-AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(Double_t theta, AliEMCALGeometry *g) 
+AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(Double_t theta, AliEMCALEMCGeometry *g) 
   : TNamed(),
+    fGeometry(g),
     fOK(),
     fA(0.),
     fB(0.),
@@ -56,23 +56,23 @@ AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(Double_t theta, AliEM
     fOB2(),
     fThetaOB1(0.),
     fThetaOB2(0.),
-    fOK3X3()
+    fOK3X3(),
+    fORB(), 
+    fORT()
 { 
   // theta in radians ; first object shold be with theta=pi/2.
-  if(fgGeometry==0) {
-    fTheta = TMath::PiOver2();
-    fgGeometry = g;
-    if(GetParameters()) {
-      DefineFirstModule();
-    }
-  } else Warning("AliEMCALShishKebabTrd1Module(theta)","You should call this constractor just once !!");
+  fTheta = TMath::PiOver2();
+  if(GetParameters()) {
+    DefineFirstModule();
+  }
   DefineName(fTheta);
-  AliInfo(Form("AliEMCALShishKebabTrd1Module - first module:  theta %1.4f geometry %s",fTheta,g->GetName()));  
+  AliDebug(1,Form("AliEMCALShishKebabTrd1Module - first module:  theta %1.4f geometry %s",fTheta,g->GetName()));  
 }
 
 //_____________________________________________________________________________
 AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(AliEMCALShishKebabTrd1Module &leftNeighbor) 
   : TNamed(),
+    fGeometry(leftNeighbor.fGeometry),
     fOK(),
     fA(0.),
     fB(0.),
@@ -85,7 +85,9 @@ AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(AliEMCALShishKebabTrd
     fOB2(),
     fThetaOB1(0.),
     fThetaOB2(0.),
-    fOK3X3()
+    fOK3X3(),
+    fORB(), 
+    fORT()
 { 
   //  printf("** Left Neighbor : %s **\n", leftNeighbor.GetName());
   fTheta  = leftNeighbor.GetTheta() - fgangle; 
@@ -98,6 +100,7 @@ AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(AliEMCALShishKebabTrd
 //________________________________________________________________
 AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(const AliEMCALShishKebabTrd1Module& mod) 
   : TNamed(mod.GetName(),mod.GetTitle()),
+    fGeometry(mod.fGeometry),
     fOK(mod.fOK),
     fA(mod.fA),
     fB(mod.fB),
@@ -107,7 +110,11 @@ AliEMCALShishKebabTrd1Module::AliEMCALShishKebabTrd1Module(const AliEMCALShishKe
     fOK2(mod.fOK2),
     fOB(mod.fOB),
     fOB1(mod.fOB1),
-    fOB2(mod.fOB2)
+    fOB2(mod.fOB2),
+    fThetaOB1(mod.fThetaOB1),
+    fThetaOB2(mod.fThetaOB2),
+    fORB(mod.fORB),
+    fORT(mod.fORT)
 {
   //copy ctor
   for (Int_t i=0; i<3; i++) fOK3X3[i] = mod.fOK3X3[i];
@@ -144,6 +151,7 @@ void AliEMCALShishKebabTrd1Module::Init(Double_t A, Double_t B)
 
 void AliEMCALShishKebabTrd1Module::DefineAllStaff()
 {
+  //Define some parameters     
   DefineName(fTheta);
   // Centers of cells - 2X2 case
   Double_t kk1 = (fga+fga2)/(2.*4.); // kk1=kk2 
@@ -176,6 +184,17 @@ void AliEMCALShishKebabTrd1Module::DefineAllStaff()
   // Jul 30, 2007 - for taking into account a position of shower maximum
   fThetaOB1 = fTheta - fgangle/4.; // ??
   fThetaOB2 = fTheta + fgangle/4.;
+
+  // Position of right/top point of module
+  // Gives the posibility to estimate SM size in z direction
+  Double_t xBottom     = (fgr - fB) / fA;
+  Double_t yBottom     = fgr;
+  fORB.Set(xBottom, yBottom);
+
+  Double_t l = fgb / TMath::Cos(fgangle/2.); // length of lateral module side
+  Double_t xTop = xBottom + l*TMath::Cos(TMath::ATan(fA));
+  Double_t yTop = fA*xTop + fB;
+  fORT.Set(xTop, yTop);
 }
 
 //_____________________________________________________________________________
@@ -205,24 +224,26 @@ void AliEMCALShishKebabTrd1Module::DefineName(Double_t theta)
 //_____________________________________________________________________________
 Bool_t AliEMCALShishKebabTrd1Module::GetParameters()
 {
- // Get needing module parameters from EMCAL geometry
-  if(!fgGeometry) fgGeometry = AliEMCALGeometry::GetInstance();
-  TString sn(fgGeometry->GetName()); // 2-Feb-05
-  sn.ToUpper();
-  if(!fgGeometry) {
+  
+  // Get needing module parameters from EMCAL geometry
+  
+  if(!fGeometry) {
     Warning("GetParameters()"," No geometry ");
     return kFALSE; 
-  }
-
-  fga        = (Double_t)fgGeometry->GetEtaModuleSize();
-  fgb        = (Double_t)fgGeometry->GetLongModuleSize();
-  fgangle    = Double_t(fgGeometry->GetTrd1Angle())*TMath::DegToRad();
+  }  
+  
+  TString sn(fGeometry->GetName()); // 2-Feb-05
+  sn.ToUpper();
+  
+  fga        = (Double_t)fGeometry->GetEtaModuleSize();
+  fgb        = (Double_t)fGeometry->GetLongModuleSize();
+  fgangle    = Double_t(fGeometry->GetTrd1Angle())*TMath::DegToRad();
   fgtanBetta = TMath::Tan(fgangle/2.);
-  fgr        = (Double_t)fgGeometry->GetIPDistance();
+  fgr        = (Double_t)fGeometry->GetIPDistance();
 
-  if(!sn.Contains("TRD2")) fgr += fgGeometry->GetSteelFrontThickness();
+  fgr += fGeometry->GetSteelFrontThickness();
 
-  fga2       = Double_t(fgGeometry->Get2Trd1Dx2());
+  fga2       = Double_t(fGeometry->Get2Trd1Dx2());
   //PH  PrintShish(0);
   return kTRUE;
 }
@@ -270,6 +291,7 @@ Double_t  AliEMCALShishKebabTrd1Module::GetEtaOfCenterOfModule() const
   return -TMath::Log(TMath::Tan(fOK.Phi()/2.));
 }
 
+//_____________________________________________________________________________
 void AliEMCALShishKebabTrd1Module::GetPositionAtCenterCellLine(Int_t ieta, Double_t dist, TVector2 &v)
 {
   // Jul 30, 2007
@@ -294,21 +316,17 @@ void AliEMCALShishKebabTrd1Module::GetPositionAtCenterCellLine(Int_t ieta, Doubl
 Double_t  AliEMCALShishKebabTrd1Module::GetMaxEtaOfModule(int pri) const 
 { 
   // Right bottom point of module
-  Double_t xBottom     = (fgr - fB) / fA;
-  Double_t thetaBottom = TMath::ATan2(fgr, xBottom);
+  Double_t thetaBottom = TMath::ATan2(fORB.Y(),fORB.X());
   Double_t etaBottom   = ThetaToEta(thetaBottom);
   // Right top point of module
-  Double_t l = fgb / TMath::Cos(fgangle/2.); // length of lateral module side
-  Double_t xTop = xBottom + l*TMath::Cos(TMath::ATan(fA));
-  Double_t yTop = fA*xTop + fB;
-  Double_t thetaTop = TMath::ATan2(yTop, xTop);
+  Double_t thetaTop = TMath::ATan2(fORT.Y(),fORT.X());
   Double_t etaTop   = ThetaToEta(thetaTop);
 
   if(pri) { 
-    printf(" Right bottom point of module : eta %5.4f : theta %6.4f (%6.2f) \n", 
-    etaBottom, thetaBottom, thetaBottom * TMath::RadToDeg());
-    printf(" Right    top point of module : eta %5.4f : theta %6.4f (%6.2f) \n", 
-    etaTop, thetaTop, thetaTop * TMath::RadToDeg());
+    printf(" Right bottom point of module : eta %5.4f : theta %6.4f (%6.2f) : x(zglob) %7.2f y(phi) %5.2f \n", 
+          etaBottom, thetaBottom, thetaBottom * TMath::RadToDeg(), fORB.X(), fORB.Y());
+    printf(" Right    top point of module : eta %5.4f : theta %6.4f (%6.2f) : x(zglob) %7.2f y(phi) %5.2f \n", 
+          etaTop, thetaTop, thetaTop * TMath::RadToDeg(), fORT.X(), fORT.Y());
   }
   return etaBottom>etaTop ? etaBottom : etaTop;
 }