]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSGeometry.cxx
Added track cut method, warning for q<0, profiles for qmax vs pad row and qtot vs...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSGeometry.cxx
index 71591c4399e05a07b6386abedaaaa65ca43d95b1..33a8d95f01bb690b4c8ec3873e29ffe110e92c78 100644 (file)
@@ -24,7 +24,7 @@
 // can be easily implemented 
 // The title is used to identify the version of CPV used.
 //                  
-//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC "KI" & SUBATECH)
+// -- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC "KI" & SUBATECH)
 
 // --- ROOT system ---
 
 ClassImp(AliPHOSGeometry)
 
 // these initialisations are needed for a singleton
-AliPHOSGeometry * AliPHOSGeometry::fgGeom = 0 ;
-Bool_t            AliPHOSGeometry::fgInit = kFALSE ;
+AliPHOSGeometry  * AliPHOSGeometry::fgGeom = 0 ;
+Bool_t             AliPHOSGeometry::fgInit = kFALSE ;
 
 //____________________________________________________________________________
-AliPHOSGeometry::AliPHOSGeometry() {
+AliPHOSGeometry::AliPHOSGeometry() : 
+                   fNModules(0),
+                   fAngle(0.f),
+                   fPHOSAngle(0),
+                   fIPtoUpperCPVsurface(0),
+                   fRotMatrixArray(0),
+                   fGeometryEMCA(0),
+                   fGeometryCPV(0),
+                   fGeometrySUPP(0)
+{
     // default ctor 
     // must be kept public for root persistency purposes, but should never be called by the outside world
-    fPHOSAngle      = 0 ;
-    fGeometryEMCA   = 0 ;
-    fGeometrySUPP   = 0 ;
-    fGeometryCPV    = 0 ;
     fgGeom          = 0 ;
-    fRotMatrixArray = 0 ;  
 }  
 
+//____________________________________________________________________________
+AliPHOSGeometry::AliPHOSGeometry(const AliPHOSGeometry & rhs)
+                   : AliGeometry(rhs),
+                     fNModules(rhs.fNModules),
+                     fAngle(rhs.fAngle),
+                     fPHOSAngle(0),
+                     fIPtoUpperCPVsurface(rhs.fIPtoUpperCPVsurface),
+                     fRotMatrixArray(0),
+                     fGeometryEMCA(0),
+                     fGeometryCPV(0),
+                     fGeometrySUPP(0)
+{
+  Fatal("cpy ctor", "not implemented") ; 
+}
+
+AliPHOSGeometry::AliPHOSGeometry(const Text_t* name, const Text_t* title) 
+                 : AliGeometry(name, title),
+                   fNModules(0),
+                   fAngle(0.f),
+                   fPHOSAngle(0),
+                   fIPtoUpperCPVsurface(0),
+                   fRotMatrixArray(0),
+                   fGeometryEMCA(0),
+                   fGeometryCPV(0),
+                   fGeometrySUPP(0)
+{ 
+  // ctor only for internal usage (singleton)
+  Init() ; 
+}
+
+
 //____________________________________________________________________________
 AliPHOSGeometry::~AliPHOSGeometry(void)
 {
@@ -81,10 +116,10 @@ void AliPHOSGeometry::Init(void)
   }
 
   fgInit     = kTRUE ; 
-  
+
   fNModules     = 5;
   fAngle        = 20;
-  
+
   fGeometryEMCA = new AliPHOSEMCAGeometry();
   
   fGeometryCPV  = new AliPHOSCPVGeometry ();
@@ -108,9 +143,26 @@ void AliPHOSGeometry::Init(void)
   for ( index = 0; index < fNModules; index++ )
     fPHOSAngle[index] = 0.0 ; // Module position angles are set in CreateGeometry()
   
-  this->SetPHOSAngles() ; 
   fRotMatrixArray = new TObjArray(fNModules) ; 
-  
+
+  // Geometry parameters are calculated
+
+  SetPHOSAngles();
+  Double_t const kRADDEG = 180.0 / TMath::Pi() ;
+  Float_t r = GetIPtoOuterCoverDistance() + fPHOSParams[3] - GetCPVBoxSize(1) ;
+  for (Int_t iModule=0; iModule<fNModules; iModule++) {
+    fModuleCenter[iModule][0] = r * TMath::Sin(fPHOSAngle[iModule] / kRADDEG );
+    fModuleCenter[iModule][1] =-r * TMath::Cos(fPHOSAngle[iModule] / kRADDEG );
+    fModuleCenter[iModule][2] = 0.;
+    
+    fModuleAngle[iModule][0][0] =  90;
+    fModuleAngle[iModule][0][1] =   fPHOSAngle[iModule];
+    fModuleAngle[iModule][1][0] =   0;
+    fModuleAngle[iModule][1][1] =   0;
+    fModuleAngle[iModule][2][0] =  90;
+    fModuleAngle[iModule][2][1] = 270 + fPHOSAngle[iModule];
+  }
+
 }
 
 //____________________________________________________________________________
@@ -266,7 +318,7 @@ void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t
  
 
 //____________________________________________________________________________
-void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & /*gmat*/) const
+void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrixF & /*gmat*/) const
 {
   // Calculates the coordinates of a RecPoint and the error matrix in the ALICE global coordinate system
  
@@ -354,20 +406,20 @@ void AliPHOSGeometry::ImpactOnEmc(Double_t theta, Double_t phi, Int_t & moduleNu
 }
 
 //____________________________________________________________________________
-void AliPHOSGeometry::ImpactOnEmc(TVector3 vec, Int_t & moduleNumber, Double_t & z, Double_t & x) const
+void AliPHOSGeometry::ImpactOnEmc(const TVector3& vec, Int_t & moduleNumber, Double_t & z, Double_t & x) const
 {
   // calculates the impact coordinates on PHOS of a neutral particle  
   // emitted in the direction theta and phi in the ALICE global coordinate system
   // searches for the PHOS EMC module
 
-  TParticle p ; 
-  p.SetMomentum(vec.X(), vec.Y(), vec.Z(), 0.) ; 
-  
-  ImpactOnEmc(p, moduleNumber, z, x) ;
+  Double_t theta = vec.Theta() ; 
+  Double_t phi   = vec.Phi() ; 
+
+  ImpactOnEmc(theta, phi, moduleNumber, z, x) ;
 }
 
 //____________________________________________________________________________
-void AliPHOSGeometry::ImpactOnEmc(TParticle p, Int_t & moduleNumber, Double_t & z, Double_t & x) const
+void AliPHOSGeometry::ImpactOnEmc(const TParticle& p, Int_t & moduleNumber, Double_t & z, Double_t & x) const
 {
   // calculates the impact coordinates on PHOS of a neutral particle  
   // emitted in the direction theta and phi in the ALICE global coordinate system
@@ -496,7 +548,9 @@ void AliPHOSGeometry::RelPosInModule(const Int_t * relid, Float_t & x, Float_t &
 
 //____________________________________________________________________________
 
-TVector3 AliPHOSGeometry::GetModuleCenter(const char *det, Int_t module) const
+void AliPHOSGeometry::GetModuleCenter(TVector3& center, 
+                                     const char *det,
+                                     Int_t module) const
 {
   // Returns a position of the center of the CPV or EMC module
   Float_t rDet = 0.;
@@ -508,17 +562,19 @@ TVector3 AliPHOSGeometry::GetModuleCenter(const char *det, Int_t module) const
   Float_t angle = GetPHOSAngle(module); // (40,20,0,-20,-40) degrees
   angle *= TMath::Pi()/180;
   angle += 3*TMath::Pi()/2.;
-  return TVector3(rDet*TMath::Cos(angle), rDet*TMath::Sin(angle), 0.);
+  center.SetXYZ(rDet*TMath::Cos(angle), rDet*TMath::Sin(angle), 0.);
 }
 
 //____________________________________________________________________________
 
-TVector3 AliPHOSGeometry::Global2Local(TVector3 globalPosition, Int_t module) const
+void AliPHOSGeometry::Global2Local(TVector3& localPosition,
+                                  const TVector3& globalPosition,
+                                  Int_t module) const
 {
   // Transforms a global position of the rec.point to the local coordinate system
   Float_t angle = GetPHOSAngle(module); // (40,20,0,-20,-40) degrees
   angle *= TMath::Pi()/180;
   angle += 3*TMath::Pi()/2.;
-  globalPosition.RotateZ(-angle);
-  return TVector3(globalPosition.Y(),globalPosition.X(),globalPosition.Z());
+  localPosition = globalPosition;
+  localPosition.RotateZ(-angle);
 }