]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSv0.cxx
AliITSgeom taken from AliITSLoader
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0.cxx
index 2310b60c1d5429aa213cec06b49ab54efb89ae69..39f488925c081e0d13ae5d378993185b247a3850 100644 (file)
  **************************************************************************/
 /* $Id$ */
 
+/* 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.
+ *
+ */
 
 //_________________________________________________________________________
 // Implementation version v0 of PHOS Manager class 
 
 // --- ROOT system ---
 
-#include "TBRIK.h"
-#include "TTRD1.h"
-#include "TNode.h"
-#include "TRandom.h"
-#include "TGeometry.h"
-#include "TFolder.h"
-#include "TROOT.h"
-#include "TTree.h"
-
+#include <TBRIK.h>
+#include <TFolder.h>
+#include <TGeometry.h>
+#include <TNode.h>
+#include <TROOT.h>
+#include <TRandom.h>
+#include <TTRD1.h>
+#include <TTree.h>
+#include <TVirtualMC.h>
 
 // --- Standard library ---
 
-#include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <strstream.h>
 
 // --- AliRoot header files ---
 
-#include "AliPHOSv0.h"
-#include "AliRun.h"
 #include "AliConst.h"
-#include "AliMC.h"
 #include "AliPHOSGeometry.h"
-#include "AliPHOSGetter.h"
+#include "AliPHOSLoader.h"
+#include "AliPHOSv0.h"
+#include "AliRun.h"
+#include "AliLog.h"
 
 ClassImp(AliPHOSv0)
 
@@ -58,11 +66,14 @@ AliPHOSv0::AliPHOSv0(const char *name, const char *title):
   AliPHOS(name,title)
 {
   // ctor : title is used to identify the layout
-  // create the geometry parameters object  
-  // and post it to a folder (Post retrieves the correct geometry)
-  AliPHOSGetter::GetInstance(gDirectory->GetName(), 0)->PostGeometry() ; 
-  
+  GetGeometry() ; 
+}
+
+//____________________________________________________________________________
+void AliPHOSv0::Copy(TObject & phos) const
+{
+  TObject::Copy(phos) ; 
+  AliPHOS::Copy(phos) ; 
 }
 
 //____________________________________________________________________________
@@ -112,7 +123,7 @@ void AliPHOSv0:: BuildGeometryforEMC(void)
   const Int_t kColorPHOS = kRed ;
   const Int_t kColorXTAL = kBlue ;
   
-  Double_t const kRADDEG = 180.0 / kPI ;
+  Double_t const kRADDEG = 180.0 / TMath::Pi() ;
   
   AliPHOSGeometry * geom = GetGeometry() ; 
   AliPHOSEMCAGeometry * emcg = geom->GetEMCAGeometry() ;
@@ -192,7 +203,7 @@ void AliPHOSv0:: BuildGeometryforCPV(void)
   */
   //END_HTML  
 
-  const Double_t kRADDEG         = 180.0 / kPI ;
+  const Double_t kRADDEG         = 180.0 / TMath::Pi() ;
   const Int_t    kColorCPV       = kGreen ;
   const Int_t    kColorFrame     = kYellow ;
   const Int_t    kColorGassiplex = kRed;
@@ -301,7 +312,7 @@ void AliPHOSv0::CreateGeometry()
 {
   // Create the PHOS geometry for Geant
 
-  AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
+  AliPHOSv0 *phostmp = dynamic_cast<AliPHOSv0*>(gAlice->GetModule("PHOS")) ;
 
   if ( phostmp == NULL ) {
     
@@ -328,23 +339,24 @@ void AliPHOSv0::CreateGeometry()
   // --- Position  PHOS mdules in ALICE setup ---
   
   Int_t idrotm[99] ;
-  Double_t const kRADDEG = 180.0 / kPI ;
-  Float_t * phosParams = geom->GetPHOSParams() ;
-  
-  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 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]) ;
     
-    Float_t r = geom->GetIPtoOuterCoverDistance() + phosParams[3] ;
-    
-    Float_t xP1 =  r * TMath::Sin( angle / kRADDEG ) ;
-    Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
-    
-    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") ;
+  }
 
 }
 
@@ -822,7 +834,7 @@ void AliPHOSv0::CreateGeometryforSupport()
   par[4] =  geom->GetCradleWall(4) ;
   gMC->Gsvolu("PCRA", "TUBS", idtmed[716], par, 5) ;
 
-  par[0] -=  geom->GetCradleWallThickness() ;
+  par[0] +=  geom->GetCradleWallThickness() ;
   par[1] -=  geom->GetCradleWallThickness() ;
   par[2] -=  geom->GetCradleWallThickness() ;
   gMC->Gsvolu("PCRE", "TUBS", idtmed[798], par, 5) ;
@@ -881,26 +893,20 @@ void AliPHOSv0::Init(void)
   
   Int_t i;
 
-  if(fDebug) {
-    printf("\n%s: ",ClassName());
-    for(i=0;i<35;i++) printf("*");
-    printf(" PHOS_INIT ");
-    for(i=0;i<35;i++) printf("*");
-    printf("\n%s: ",ClassName());
-    
-    
+  if(AliLog::GetGlobalDebugLevel()>0) {
+    TString st ; 
+    for(i=0;i<35;i++) 
+      st += "*";
+    Info("Init", "%s", st.Data()) ;  
     // Here the PHOS initialisation code (if any!)
-
+    
     AliPHOSGeometry * geom = GetGeometry() ; 
 
     if (geom!=0)  
-      cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << geom->GetName() << endl ;
+      Info("Init", "AliPHOS%s: PHOS geometry intialized for %s", Version().Data(), geom->GetName()) ;
     else
-      cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ;   
-    
-    for(i=0;i<80;i++) printf("*");
-    printf("\n");
-  }  
-}
-
+      Info("Init", "AliPHOS%s: PHOS geometry initialization failed !", Version().Data()) ;       
 
+    Info("Init", "%s", st.Data()) ;  
+  }
+}