]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Set geom parameters from CDB
authorkharlov <kharlov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 4 Mar 2006 20:25:56 +0000 (20:25 +0000)
committerkharlov <kharlov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 4 Mar 2006 20:25:56 +0000 (20:25 +0000)
PHOS/AliPHOSGeometry.cxx
PHOS/AliPHOSGeometry.h
PHOS/AliPHOSv0.cxx

index 5bb0aeb62c0b14d33774c5e15018702329170628..273a68620097fcb2bfe2574a8836d4b3dbd89ae1 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 ---
 
@@ -43,8 +43,9 @@
 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 ;
+AliPHOSAlignData * AliPHOSGeometry::fgAlignData = 0 ;
 
 //____________________________________________________________________________
 AliPHOSGeometry::AliPHOSGeometry() {
@@ -81,10 +82,18 @@ void AliPHOSGeometry::Init(void)
   }
 
   fgInit     = kTRUE ; 
-  
-  fNModules     = 5;
-  fAngle        = 20;
-  
+
+  // YK 23.02.2006
+  if(fgAlignData != NULL) {
+    // Number of modules is read from Alignment DB if exists
+    fNModules = fgAlignData->GetNModules();
+  }
+  else {
+    // Number of modules is fixed if Alignment DB does not exist
+    fNModules     = 5;
+    fAngle        = 20;
+  }
+
   fGeometryEMCA = new AliPHOSEMCAGeometry();
   
   fGeometryCPV  = new AliPHOSCPVGeometry ();
@@ -108,9 +117,43 @@ 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) ; 
-  
+
+  // YK 23.02.2006
+  if(fgAlignData) {
+    // Geometry parameters are read from Alignment DB if exists
+
+    for (Int_t iModule=0; iModule<fNModules; iModule++) {
+      for (Int_t iXYZ=0; iXYZ<3; iXYZ++) {
+       fModuleCenter[iModule][iXYZ]   =
+         fgAlignData->GetModuleCenter(iModule,iXYZ);
+       fModuleAngle[iModule][iXYZ][0] = 
+         fgAlignData->GetModuleAngle(iModule,iXYZ,0);
+       fModuleAngle[iModule][iXYZ][1] = 
+         fgAlignData->GetModuleAngle(iModule,iXYZ,1);
+      }
+    }
+  }
+  else {
+    // Geometry parameters are calculated if Alignment DB does not exist
+
+    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];
+    }
+  }
+
 }
 
 //____________________________________________________________________________
@@ -152,6 +195,17 @@ AliPHOSGeometry *  AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t
   return rv ; 
 }
 
+//____________________________________________________________________________
+AliPHOSGeometry *  AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title,
+                                               AliPHOSAlignData *alignda) 
+{
+  // Returns the pointer of the unique instance
+  // Creates it with the specified options (name, title) if it does not exist yet
+
+  fgAlignData = alignda;
+  return GetInstance(name,title);
+}
+
 //____________________________________________________________________________
 void AliPHOSGeometry::SetPHOSAngles() 
 { 
index a2caa3c2246f780cb3a1284f15250fb2c9864217..249611b64e13d8050957949bb1caf4e8ad74a394 100644 (file)
@@ -24,6 +24,7 @@
 #include "AliPHOSEMCAGeometry.h"
 #include "AliPHOSCPVGeometry.h"
 #include "AliPHOSSupportGeometry.h"
+#include "AliPHOSAlignData.h"
 
 
 class AliPHOSGeometry : public AliGeometry {
@@ -38,6 +39,8 @@ public:
   
   virtual ~AliPHOSGeometry(void) ; 
   static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title="") ; 
+  static AliPHOSGeometry * GetInstance(const Text_t* name, const Text_t* title,
+                                      AliPHOSAlignData *alignda) ; 
   static AliPHOSGeometry * GetInstance() ; 
   virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrixF & gmat) const ;
   virtual void   GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const ;
@@ -92,6 +95,12 @@ public:
   Float_t  GetCellStep(void)                    const { return 2*(fGeometryEMCA->GetAirCellHalfSize()[0] + 
                                                                  fGeometryEMCA->GetStripWallWidthOut()) ;}
 
+  Float_t GetModuleCenter(Int_t module, Int_t axis) const {
+    return fModuleCenter[module][axis];}
+  Float_t GetModuleAngle(Int_t module, Int_t axis, Int_t angle) const {
+    return fModuleAngle[module][axis][angle];}
+  
+
   // Return EMCA geometry parameters
 
   AliPHOSEMCAGeometry * GetEMCAGeometry()      const {return fGeometryEMCA ;}
@@ -138,6 +147,11 @@ public:
   Float_t GetCradleWallThickness(void)   const { return fGeometrySUPP->GetCradleWallThickness();}
   Float_t GetCradleWall   (Int_t index)  const { return fGeometrySUPP->GetCradleWall   (index); }
   Float_t GetCradleWheel  (Int_t index)  const { return fGeometrySUPP->GetCradleWheel  (index); }
+  void Init(void) ;            // steering method for PHOS and PPSD/CPV
+
+
+  void SetAlignData(AliPHOSAlignData* alignda) { fgAlignData = alignda; }
+  AliPHOSAlignData * AlignData() {return fgAlignData;}
 
 protected:
 
@@ -145,8 +159,6 @@ protected:
     // ctor only for internal usage (singleton)
     Init() ; 
   }
-  void Init(void) ;            // steering method for PHOS and PPSD/CPV
-
 private:
 
   Int_t                    fNModules ;       // Number of modules constituing PHOS
@@ -158,13 +170,16 @@ private:
   AliPHOSEMCAGeometry     *fGeometryEMCA ;   // Geometry object for Electromagnetic calorimeter
   AliPHOSCPVGeometry      *fGeometryCPV ;    // Geometry object for CPV  (IHEP)
   AliPHOSSupportGeometry  *fGeometrySUPP ;   // Geometry object for PHOS support
+  Float_t fModuleCenter[5][3];   // xyz-position of the module center
+  Float_t fModuleAngle[5][3][2]; // polar and azymuth angles for 3 axes of modules
 
   void                     SetPHOSAngles();  // calculates the PHOS modules PHI angle
 
   static AliPHOSGeometry * fgGeom ; // pointer to the unique instance of the singleton 
   static Bool_t fgInit ;            // Tells if geometry has been succesfully set up 
+  static AliPHOSAlignData * fgAlignData; // PHOS alignment data
 
-  ClassDef(AliPHOSGeometry,1)       // PHOS geometry class 
+  ClassDef(AliPHOSGeometry,2)       // PHOS geometry class 
 
 } ;
 
index 72c87dfe1e74f04b34b6c5f987ba2a1a613bb29f..39f488925c081e0d13ae5d378993185b247a3850 100644 (file)
@@ -17,6 +17,9 @@
 /* History of cvs commits:
  *
  * $Log$
+ * Revision 1.80  2005/06/17 07:39:07  hristov
+ * Removing GetDebug and SetDebug from AliRun and AliModule. Using AliLog for the messages
+ *
  * Revision 1.79  2005/05/28 14:19:05  schutz
  * Compilation warnings fixed by T.P.
  *
@@ -336,22 +339,24 @@ void AliPHOSv0::CreateGeometry()
   // --- Position  PHOS mdules in ALICE setup ---
   
   Int_t idrotm[99] ;
-  Double_t const kRADDEG = 180.0 / TMath::Pi() ;
-  Float_t * phosParams = geom->GetPHOSParams() ;
-
-  Float_t r = geom->GetIPtoOuterCoverDistance() + phosParams[3] - geom->GetCPVBoxSize(1) ;
-  Int_t i;
-  for( i = 1; i <= geom->GetNModules()  ; i++ ) {
+  Int_t iXYZ,iAngle;
+  for (Int_t iModule = 0; iModule < geom->GetNModules(); iModule++ ) {
     
-    Float_t angle = geom->GetPHOSAngle(i) ;
-    AliMatrix(idrotm[i-1], 90.,angle, 0., 0., 90., 270. +angle) ;
-    
-    Float_t xP1 =  r * TMath::Sin( angle / kRADDEG ) ;
-    Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
+    Float_t angle[3][2];
+    for (iXYZ=0; iXYZ<3; iXYZ++)
+      for (iAngle=0; iAngle<2; iAngle++)
+       angle[iXYZ][iAngle] = geom->GetModuleAngle(iModule,iXYZ, iAngle);
+    AliMatrix(idrotm[iModule],
+             angle[0][0],angle[0][1],
+             angle[1][0],angle[1][1],
+             angle[2][0],angle[2][1]) ;
     
-    gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
-    
-  } 
+    Float_t pos[3];
+    for (iXYZ=0; iXYZ<3; iXYZ++)
+      pos[iXYZ] = geom->GetModuleCenter(iModule,iXYZ);
+    gMC->Gspos("PHOS", iModule+1, "ALIC", pos[0], pos[1], pos[2],
+              idrotm[iModule], "ONLY") ;
+  }
 
 }