]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDRing.cxx
Conding conventions violation and Doxygen comments (Philippe Pillot)
[u/mrichter/AliRoot.git] / FMD / AliFMDRing.cxx
index 6dbd1f33bb4669669db18ec89129f15d489531ab..1ff2890d7c080c8115ddc1eb92998a0951692d3c 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
-
+/** @file    AliFMDRing.cxx
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Mon Mar 27 12:47:43 2006
+    @brief   FMD ring geometry parameters 
+*/
 //__________________________________________________________________
 //
 // Utility class to help implement collection of FMD modules into
-// rings.  This is used by AliFMDDetector and AliFMDGeometry.  
-//
+// rings.  This is used by AliFMDDetector and AliFMDGeometry.
 // The AliFMDGeometry object owns the AliFMDRing objects, and the
 // AliFMDDetector objects reference these.  That is, the AliFMDRing
 // objects are share amoung the AliFMDDetector objects.
@@ -27,9 +29,9 @@
 // Latest changes by Christian Holm Christensen
 //
 
-#include <AliLog.h>            // ALILOG_H
+// #include <AliLog.h>         // ALILOG_H
 #include "AliFMDRing.h"                // ALIFMDRING_H
-#include <TMath.h>             // ROOT_TMath
+// #include <TMath.h>          // ROOT_TMath
 #include <TVector2.h>          // ROOT_TVector2
 
 //====================================================================
@@ -42,8 +44,27 @@ ClassImp(AliFMDRing)
 AliFMDRing::AliFMDRing(Char_t id) 
   : TNamed(Form("FMD%c", id), "Forward multiplicity ring"), 
     fId(id), 
+    fBondingWidth(0),
+    fWaferRadius(0),
+    fSiThickness(0),
+    fLowR(0),
+    fHighR(0),
+    fMinR(0),
+    fMaxR(0),
+    fTheta(0),
+    fNStrips(0),
+    fRingDepth(0),
+    fLegRadius(0),
+    fLegLength(0),
+    fLegOffset(0),
+    fModuleSpacing(0),
+    fPrintboardThickness(0),
+    fCopperThickness(0),
+    fChipThickness(0),
+    fSpacing(0),
     fVerticies(0)
 {
+  // CTOR
   SetBondingWidth();
   SetWaferRadius();
   SetSiThickness();
@@ -52,6 +73,9 @@ AliFMDRing::AliFMDRing(Char_t id)
   SetLegOffset();
   SetModuleSpacing();
   SetPrintboardThickness();
+  SetCopperThickness();
+  SetChipThickness();
+  SetSpacing();
   
   if (fId == 'I' || fId == 'i') {
     SetLowR(4.3);
@@ -71,6 +95,7 @@ AliFMDRing::AliFMDRing(Char_t id)
 void
 AliFMDRing::Init()
 {
+  // Initialize 
   Double_t tanTheta  = TMath::Tan(fTheta * TMath::Pi() / 180.);
   Double_t tanTheta2 = TMath::Power(tanTheta,2);
   Double_t r2        = TMath::Power(fWaferRadius,2);
@@ -93,17 +118,37 @@ AliFMDRing::Init()
   fVerticies.AddAt(new TVector2(xC,      yC), 4);
   fVerticies.AddAt(new TVector2(fLowR,   yA), 5);  
 
+  // A's length. Corresponds to distance from nominal beam line to the
+  // cornor of the active silicon element. 
+  fMinR = GetVertex(5)->Mod();
+  // A's length. Corresponds to distance from nominal beam line to the
+  // cornor of the active silicon element. 
+  fMaxR = fHighR;
+
   fRingDepth = (fSiThickness + fPrintboardThickness 
-               + fLegLength + fModuleSpacing);
+               + fCopperThickness + fChipThickness 
+               + fLegLength + fModuleSpacing + fSpacing);
 }
 
 //____________________________________________________________________
 TVector2*
 AliFMDRing::GetVertex(Int_t i) const
 {
+  // Get the i'th vertex of polygon shape
   return static_cast<TVector2*>(fVerticies.At(i));
 }
 
+//____________________________________________________________________
+Double_t
+AliFMDRing::GetStripRadius(UShort_t strip) const
+{
+  // Return the nominal strip radius 
+  Double_t rmax     = GetMaxR();
+  Double_t stripoff = GetMinR();
+  Double_t dstrip   = (rmax - stripoff) / GetNStrips();
+  return (strip + .5) * dstrip + stripoff; // fLowR
+}
 //____________________________________________________________________
 void
 AliFMDRing::Detector2XYZ(UShort_t sector,
@@ -112,6 +157,8 @@ AliFMDRing::Detector2XYZ(UShort_t sector,
                         Double_t& y, 
                         Double_t& z) const
 {
+  // Translate detector coordinates (this,sector,strip) to global
+  // coordinates (x,y,z)
   if (sector >= GetNSectors()) {
     Error("Detector2XYZ", "Invalid sector number %d (>=%d) in ring %c", 
          sector, GetNSectors(), fId);
@@ -130,6 +177,37 @@ AliFMDRing::Detector2XYZ(UShort_t sector,
     z += TMath::Sign(fModuleSpacing, z);
 }
 
+//____________________________________________________________________
+Bool_t
+AliFMDRing::XYZ2Detector(Double_t  x, 
+                        Double_t  y, 
+                        Double_t  z,
+                        UShort_t& sector,
+                        UShort_t& strip) const
+{
+  // Translate global coordinates (x,y,z) to detector coordinates
+  // (this,sector,strip)
+  sector = strip = 0;
+  Double_t r = TMath::Sqrt(x * x + y * y);
+  Int_t str = Int_t((r - fMinR) / GetPitch());
+  if (str < 0 || str >= GetNStrips()) return kFALSE;
+
+  Double_t phi = TMath::ATan2(y, x) * 180. / TMath::Pi();
+  if (phi < 0) phi = 360. + phi;
+  Int_t sec = Int_t(phi / fTheta);
+  if (sec < 0 || sec >= GetNSectors()) return kFALSE;
+  if ((sec / 2) % 2 == 1) {
+    if (TMath::Abs(z - TMath::Sign(fModuleSpacing, z)) >= 0.01)
+      return kFALSE;
+  }
+  else if (TMath::Abs(z) >= 0.01) return kFALSE;
+
+  strip  = str;
+  sector = sec;
+  return kTRUE;
+}
+
+
 //
 // EOF
 //