]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDGeometry.cxx
Compilation warnings
[u/mrichter/AliRoot.git] / FMD / AliFMDGeometry.cxx
index 83031a45638735b844b0349a98b3197cd7e61750..2be2bcf867430cdc334d9436a573bef6b49cdc90 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
-
+/** @file    AliFMDGeometry.cxx
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Mon Mar 27 12:40:37 2006
+    @brief   Geometry mananger for the FMD
+*/
 //____________________________________________________________________
 //                                                                          
 // Forward Multiplicity Detector based on Silicon wafers. 
 #include "AliFMD2.h"           // ALIFMD2_H
 #include "AliFMD3.h"           // ALIFMD2_H
 #include "AliRecPoint.h"       // ALIRECPOINT_H
-#include "AliLog.h"            // ALIRECPOINT_H
+#include "AliFMDDebug.h"                  // ALILOG_H
 #include <TVector3.h>           // ROOT_TVector3
-#include <TMatrix.h>            // ROOT_TMatrix
-#include <TParticle.h>          // ROOT_TParticle
+// #include <TMatrix.h>            // ROOT_TMatrix
+// #include <TParticle.h>          // ROOT_TParticle
 #include <Riostream.h>
-#ifndef USE_PRE_MOVE
 #include "AliFMDGeometryBuilder.h"
-#include <TArrayI.h>
+// #include <TArrayI.h>
 #include <TGeoManager.h>
 #include <TGeoVolume.h>
 #include <TGeoNode.h>
 static Int_t FindNodeDepth(const char* name, const char* volname);
-#endif
 
 
 //====================================================================
@@ -99,27 +100,38 @@ AliFMDGeometry::Instance()
 //____________________________________________________________________
 AliFMDGeometry::AliFMDGeometry() 
   : AliGeometry("FMD", "Forward multiplicity"), 
-    fBuilder(0)
+    fIsInitialized(kFALSE), 
+    fInner(0),
+    fOuter(0),
+    fFMD1(0),
+    fFMD2(0),
+    fFMD3(0),
+    fUseFMD1(kFALSE),
+    fUseFMD2(kFALSE),
+    fUseFMD3(kFALSE),
+    fBuilder(0),
+    fDetectorOff(0),
+    fModuleOff(0),  
+    fRingOff(0),
+    fSectorOff(0),
+    fActive(2),
+    fDetailed(kFALSE),       
+    fUseAssembly(kFALSE)
 {
   // PROTECTED
   // Default constructor 
   fUseFMD1     = kTRUE;
   fUseFMD2     = kTRUE;
   fUseFMD3     = kTRUE;  
-#ifndef USE_PRE_MOVE
   fDetailed    = kTRUE;
   fUseAssembly = kTRUE;
-#endif
   fInner = new AliFMDRing('I');
   fOuter = new AliFMDRing('O');
   fFMD1  = new AliFMD1(fInner);
   fFMD2  = new AliFMD2(fInner, fOuter);
   fFMD3  = new AliFMD3(fInner, fOuter);
   fIsInitialized = kFALSE;
-  // fActive.Set(4);
-#ifndef USE_PRE_MOVE
   fActive.Reset(-1);
-#endif
 }
 
 //____________________________________________________________________
@@ -133,12 +145,15 @@ AliFMDGeometry::AliFMDGeometry(const AliFMDGeometry& other)
     fFMD3(other.fFMD3), 
     fUseFMD1(other.fUseFMD1), 
     fUseFMD2(other.fUseFMD2), 
-    fUseFMD3(other.fUseFMD3)
-#ifndef USE_PRE_MOVE
-    , fActive(other.fActive),
+    fUseFMD3(other.fUseFMD3), 
+    fBuilder(other.fBuilder),
+    fDetectorOff(other.fDetectorOff),
+    fModuleOff(other.fModuleOff),  
+    fRingOff(other.fRingOff),
+    fSectorOff(other.fSectorOff),
+    fActive(other.fActive),
     fDetailed(other.fDetailed),
     fUseAssembly(other.fUseAssembly)
-#endif
 {
   // PROTECTED
   // Copy constructor
@@ -177,11 +192,26 @@ AliFMDGeometry::Init()
   fFMD3->Init();
 }
 
-#ifndef USE_PRE_MOVE
+//____________________________________________________________________
+void
+AliFMDGeometry::InitTransformations()
+{
+  // Find all local <-> global transforms 
+  if (!gGeoManager) {
+    AliError("No TGeoManager defined");
+    return;
+  }
+  AliFMDDebug(0, ("Initialising transforms for FMD geometry"));
+  if (fFMD1) fFMD1->InitTransformations();
+  if (fFMD2) fFMD2->InitTransformations();
+  if (fFMD3) fFMD3->InitTransformations();
+}
+
 //____________________________________________________________________
 void
 AliFMDGeometry::Build()
 {
+  // Build the geometry 
   if (!fBuilder) fBuilder = new AliFMDGeometryBuilder(fDetailed);
   fBuilder->SetDetailed(fDetailed);
   fBuilder->UseAssembly(fUseAssembly);
@@ -192,9 +222,10 @@ AliFMDGeometry::Build()
 void
 AliFMDGeometry::SetActive(Int_t* active, Int_t n) 
 {
+  // Set active volumes 
   fActive.Set(n);
   for (Int_t i = 0; i < n; i++) { 
-    AliDebug(1, Form("Active vol id # %d: %d", i, active[i]));
+    AliFMDDebug(1, ("Active vol id # %d: %d", i, active[i]));
     fActive[i] = active[i];
   }
 }
@@ -203,6 +234,7 @@ AliFMDGeometry::SetActive(Int_t* active, Int_t n)
 void
 AliFMDGeometry::AddActive(Int_t active)
 {
+  // Add an active volume 
   Int_t n = fActive.fN;
   fActive.Set(n+1);
   fActive[n] = active;
@@ -212,12 +244,11 @@ AliFMDGeometry::AddActive(Int_t active)
 Bool_t
 AliFMDGeometry::IsActive(Int_t vol) const
 {
+  // Check if a volume is active 
   for (Int_t i = 0; i < fActive.fN; i++) 
     if (fActive[i] == vol) return kTRUE;
   return kFALSE;
 }
-
-#endif
   
 //____________________________________________________________________
 AliFMDDetector*
@@ -287,7 +318,10 @@ AliFMDGeometry::Detector2XYZ(UShort_t  detector,
   // spatial coordinates (x, y, z) in the master reference frame of
   // ALICE. 
   AliFMDDetector* det = GetDetector(detector);
-  if (!det) return;
+  if (!det) { 
+    AliWarning(Form("Unknown detector %d", detector));
+    return;
+  }
   det->Detector2XYZ(ring, sector, strip, x, y, z);
 }
 
@@ -325,7 +359,7 @@ AliFMDGeometry::XYZ2Detector(Double_t  x,
 void
 AliFMDGeometry::GetGlobal(const AliRecPoint* p, 
                          TVector3& pos, 
-                         TMatrix& /* mat */) const 
+                         TMatrixF& /* mat */) const 
 {
   // Get the global coordinates cooresponding to the reconstructed
   // point p.  The coordiates is returned in the 3-vector pos passed
@@ -366,7 +400,16 @@ AliFMDGeometry::Impact(const TParticle* /* particle */) const
   return kFALSE; 
 }
 
-#ifndef USE_PRE_MOVE
+//____________________________________________________________________ 
+void  
+AliFMDGeometry::SetAlignableVolumes() const
+{
+  // Declare alignable volumes
+  for (Int_t d = 1; d <= 3; d++) 
+    if (GetDetector(d)) GetDetector(d)->SetAlignableVolumes();
+}
+
+
 //____________________________________________________________________ 
 void  
 AliFMDGeometry::ExtractGeomInfo()
@@ -385,7 +428,7 @@ AliFMDGeometry::ExtractGeomInfo()
   Int_t moduleDepth   = FindNodeDepth("FIFV_0", "ALIC");
   Int_t sectorDepth   = FindNodeDepth("FISE_1", "ALIC");
   fActive.Reset(-1);
-  AliDebug(1, Form("Geometry depths:\n"
+  AliFMDDebug(1, ("Geometry depths:\n"
                   "   Sector:     %d\n"
                   "   Module:     %d\n"
                   "   Ring:       %d\n"
@@ -425,7 +468,7 @@ AliFMDGeometry::ExtractGeomInfo()
     if (striVol) AddActive(striVol->GetNumber());
     if (stroVol) AddActive(stroVol->GetNumber());
   }    
-  AliDebug(1, Form("Geometry offsets:\n"
+  AliFMDDebug(1, ("Geometry offsets:\n"
                   "   Sector:     %d\n"
                   "   Module:     %d\n"
                   "   Ring:       %d\n"
@@ -467,6 +510,7 @@ CheckNodes(TGeoNode* node, const char* name, Int_t& lvl)
 Int_t 
 FindNodeDepth(const char* name, const char* volname) 
 {
+  // Find the depth of a node 
   TGeoVolume* vol  = gGeoManager->GetVolume(volname);
   if (!vol) {
     std::cerr << "No top volume defined" << std::endl;
@@ -484,7 +528,6 @@ FindNodeDepth(const char* name, const char* volname)
     if (CheckNodes(node, name, lvl) >= 0) return lvl;
   return -1;
 }
-#endif
 
 //____________________________________________________________________
 //