]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDRing.cxx
Export hit structure header
[u/mrichter/AliRoot.git] / FMD / AliFMDRing.cxx
index b53588f997092b582d2fbc225a1a93f04895ccfc..601e95fe26c00f1af26ef4fcb7dacd82cc6af441 100644 (file)
@@ -65,9 +65,16 @@ AliFMDRing::AliFMDRing(Char_t id)
     fSpacing(0),
     fHoneycombThickness(0.),
     fAlThickness(0.),
-    fVerticies(0)
+    fVerticies(0), 
+    fSensorVerticies(0),
+    fHybridVerticies(0),
+    fFeetPositions(0)
 {
-  // CTOR
+  // Constructor 
+  // 
+  // Parameters: 
+  //    id      Type of ring (either 'I' or 'O') 
+  // 
   SetBondingWidth();
   SetWaferRadius();
   SetSiThickness();
@@ -87,12 +94,56 @@ AliFMDRing::AliFMDRing(Char_t id)
     SetHighR(17.2);
     SetTheta(36/2);
     SetNStrips(512);
+    Double_t base = 0; // 4.1915;
+    fFeetPositions.Add(new TVector2( 0.0551687, 8.0534-base));
+    fFeetPositions.Add(new TVector2( 2.9993,   12.9457-base));
+    fFeetPositions.Add(new TVector2(-2.9062,   12.9508-base));
+    
+    fHybridVerticies.Add(new TVector2(0.0000,  4.1700));
+    fHybridVerticies.Add(new TVector2(1.0574,  4.1700));
+    fHybridVerticies.Add(new TVector2(4.6614, 15.2622));
+    fHybridVerticies.Add(new TVector2(0.9643, 17.4000));
+    fHybridVerticies.Add(new TVector2(0.0000, 17.4000));
+
+    fSensorVerticies.Add(new TVector2(0.0000,  4.1915));
+    fSensorVerticies.Add(new TVector2(1.5793,  4.1915));
+    fSensorVerticies.Add(new TVector2(5.2293, 15.4251));
+    fSensorVerticies.Add(new TVector2(1.9807, 17.3035));
+    fSensorVerticies.Add(new TVector2(0.0000, 17.3035));
+
+    fVerticies.Add(new TVector2(0.0000,  4.3000));
+    fVerticies.Add(new TVector2(1.3972,  4.3000));
+    fVerticies.Add(new TVector2(4.9895, 15.3560));
+    fVerticies.Add(new TVector2(1.8007, 17.2000));
+    fVerticies.Add(new TVector2(0.0000, 17.2000));
   }
   else if (fId == 'O' || fId == 'o') {
     SetLowR(15.6);
     SetHighR(28.0);
     SetTheta(18/2);
     SetNStrips(256);
+    Double_t base = 0; // 14.9104;
+    fFeetPositions.Add(new TVector2(-1.72540000, 20.6267-base));
+    fFeetPositions.Add(new TVector2( 1.72900000, 20.6267-base));
+    fFeetPositions.Add(new TVector2( 0.00177616, 26.6007-base));
+
+    fHybridVerticies.Add(new TVector2(0.0000, 14.9104));
+    fHybridVerticies.Add(new TVector2(2.0783, 14.9104));
+    fHybridVerticies.Add(new TVector2(3.9202, 26.5395));
+    fHybridVerticies.Add(new TVector2(0.6784, 28.2500));
+    fHybridVerticies.Add(new TVector2(0.0000, 28.2500));
+
+    fSensorVerticies.Add(new TVector2(0.0000, 15.0104));
+    fSensorVerticies.Add(new TVector2(2.5799, 15.0104));
+    fSensorVerticies.Add(new TVector2(4.4439, 26.7766));
+    fSensorVerticies.Add(new TVector2(1.8350, 28.1500));
+    fSensorVerticies.Add(new TVector2(0.0000, 28.1500));
+
+    fVerticies.Add(new TVector2(0.0000, 15.2104));
+    fVerticies.Add(new TVector2(2.4091, 15.2104));
+    fVerticies.Add(new TVector2(4.2231, 26.6638));
+    fVerticies.Add(new TVector2(1.8357, 27.9500));
+    fVerticies.Add(new TVector2(0.0000, 27.9500));
   }
 }
 
@@ -101,6 +152,10 @@ void
 AliFMDRing::Init()
 {
   // Initialize 
+  // 
+  // All derived quantities are calculated here. 
+  // 
+#if 0
   Double_t tanTheta  = TMath::Tan(fTheta * TMath::Pi() / 180.);
   Double_t tanTheta2 = TMath::Power(tanTheta,2);
   Double_t r2        = TMath::Power(fWaferRadius,2);
@@ -122,10 +177,11 @@ AliFMDRing::Init()
   fVerticies.AddAt(new TVector2(fHighR,  yB), 3);
   fVerticies.AddAt(new TVector2(xC,      yC), 4);
   fVerticies.AddAt(new TVector2(fLowR,   yA), 5);  
+#endif
 
   // A's length. Corresponds to distance from nominal beam line to the
   // cornor of the active silicon element. 
-  fMinR = GetVertex(5)->Mod();
+  fMinR = GetVertex(1)->Mod(); // GetVertex(5)->Mod();
   // A's length. Corresponds to distance from nominal beam line to the
   // cornor of the active silicon element. 
   fMaxR = fHighR;
@@ -140,35 +196,102 @@ TVector2*
 AliFMDRing::GetVertex(Int_t i) const
 {
   // Get the i'th vertex of polygon shape
+  // 
+  // the polygon shape describes the shape of the rings' sensors
+  // 
+  // Parameters: 
+  //     i    The vertex number to get (from 0 to 5)
   return static_cast<TVector2*>(fVerticies.At(i));
 }
 
+//____________________________________________________________________
+TVector2*
+AliFMDRing::GetSensorVertex(Int_t i) const
+{
+  // Get the i'th vertex of polygon shape
+  // 
+  // the polygon shape describes the shape of the rings' sensors
+  // 
+  // Parameters: 
+  //     i    The vertex number to get (from 0 to 5)
+  return static_cast<TVector2*>(fSensorVerticies.At(i));
+}
+
+//____________________________________________________________________
+TVector2*
+AliFMDRing::GetHybridVertex(Int_t i) const
+{
+  // Get the i'th vertex of polygon shape
+  // 
+  // the polygon shape describes the shape of the rings' hybrid cards
+  // 
+  // Parameters: 
+  //     i    The vertex number to get (from 0 to 5)
+  return static_cast<TVector2*>(fHybridVerticies.At(i));
+}
+
+//____________________________________________________________________
+TVector2*
+AliFMDRing::GetFootPosition(Int_t i) const
+{
+  // Get the i'th vertex of polygon shape
+  // 
+  // The feet are attached to the hybrid cards
+  // 
+  // Parameters: 
+  //     i    The foot number to get (from 0 to 2)
+  return static_cast<TVector2*>(fFeetPositions.At(i));
+}
+
 //____________________________________________________________________
 Double_t
 AliFMDRing::GetStripRadius(UShort_t strip) const
 {
   // Return the nominal strip radius 
+  // 
+  // Parameter 
+  //   strip    Strip number (0-511 for inners, 0-255 for outers)
   Double_t rmax     = GetMaxR();
   Double_t stripoff = GetMinR();
   Double_t dstrip   = (rmax - stripoff) / GetNStrips();
   return (strip + .5) * dstrip + stripoff; // fLowR
 }
  
+//____________________________________________________________________
+Double_t
+AliFMDRing::GetModuleDepth() const
+{
+  // Get the total depth of a module (sensor + hybrid card) 
+  // 
+  // The depth is the sum of 
+  // 
+  //   The silicon thickness 
+  //   The thickness of spacers between the silicon and hybrid
+  //   The thickness of the hybrid PCB
+  //   The thickness of the copper layer in the PCB
+  //   The thickness of the chip layer in the PCB
+  //   The height of the legs
+  return (GetSiThickness() 
+         + GetSpacing() 
+         + GetPrintboardThickness()
+         + GetCopperThickness()
+         + GetChipThickness()
+         + GetLegLength());
+  
+}
+
 //____________________________________________________________________
 Double_t
 AliFMDRing::GetFullDepth() const
 {
-  return (GetSiThickness() + 
-         GetSpacing() + 
-         GetPrintboardThickness() + 
-         GetCopperThickness() + 
-         GetChipThickness() + 
-         GetModuleSpacing() +
-         GetLegLength() + 
-         GetHoneycombThickness() + 
-         GetFMDDPrintboardThickness() + 
-         GetFMDDCopperThickness() + 
-         GetFMDDChipThickness() 
+  // Get the full depth of this ring, including the honeycomb, 
+  // digitizer and card. 
+  return (GetModuleDepth() 
+         + GetModuleSpacing()
+         + GetHoneycombThickness()
+         + GetFMDDPrintboardThickness()
+         + GetFMDDCopperThickness()
+         + GetFMDDChipThickness() 
          + 0.5);
 }
 
@@ -182,13 +305,23 @@ AliFMDRing::Detector2XYZ(UShort_t sector,
 {
   // Translate detector coordinates (this,sector,strip) to global
   // coordinates (x,y,z)
+  // 
+  // Parameters 
+  //    sector        Sector number in this ring 
+  //    strip         Strip number in this ring 
+  //    x             On return, the global X coordinate
+  //    y             On return, the global Y coordinate 
+  //    z             On return, the z coordinate in the ring plane 
+  //
+  // The ring plane is the plane half way between the two sensor
+  // layers. 
   if (sector >= GetNSectors()) {
     Error("Detector2XYZ", "Invalid sector number %d (>=%d) in ring %c", 
          sector, GetNSectors(), fId);
     return;
   }
   if (strip >= GetNStrips()) {
-    Error("Detector2XYZ", "Invalid strip number %d (>=%d)", 
+    Error("Detector2XYZ", "Invalid strip number %d (>=%d) for ring type '%c'", 
          strip, GetNStrips(), fId);
     return;
   }
@@ -210,6 +343,14 @@ AliFMDRing::XYZ2Detector(Double_t  x,
 {
   // Translate global coordinates (x,y,z) to detector coordinates
   // (this,sector,strip)
+  // 
+  //  Parameters: 
+  //     x       Global x coordinate 
+  //     y       Global y coordinate
+  //     z       Global y coordinate
+  //     sector  On return, the sector number in this ring
+  //     strip   On return, the strip number in this ring
+  // 
   sector = strip = 0;
   Double_t r = TMath::Sqrt(x * x + y * y);
   Int_t str = Int_t((r - fMinR) / GetPitch());
@@ -229,8 +370,69 @@ AliFMDRing::XYZ2Detector(Double_t  x,
   sector = sec;
   return kTRUE;
 }
-
-
+//____________________________________________________________________
+Float_t 
+AliFMDRing::GetStripLength(UShort_t strip) const 
+{
+  // Get the length of a strip 
+  // 
+  // Parameters:
+  //   strip     Strip number (0-511 for inners, 0-255 for outers)
+  // 
+  if(strip >= GetNStrips())
+    Error("GetStripLength", "Invalid strip number %d (>=%d) for ring type %c", 
+         strip, GetNStrips(), fId);
+  
+  Float_t rad        = GetMaxR()-GetMinR();
+  
+  Float_t segment    = rad / GetNStrips();
+  
+  TVector2* corner1  = GetVertex(2);  
+  TVector2* corner2  = GetVertex(3);
+  
+  Float_t slope      = ((corner1->Y() - corner2->Y()) / 
+                       (corner1->X() - corner2->X()));
+  Float_t constant   = ((corner2->Y() * corner1->X() - 
+                        (corner2->X()*corner1->Y())) / 
+                       (corner1->X() - corner2->X()));
+  Float_t radius     = GetMinR() + strip*segment;
+  
+  Float_t d          = (TMath::Power(TMath::Abs(radius*slope),2) + 
+                       TMath::Power(radius,2) - TMath::Power(constant,2));
+  
+  Float_t arclength  = GetBaseStripLength(strip);
+  if(d>0) {
+    Float_t x        = ((-1 * TMath::Sqrt(d) -slope*constant) / 
+                       (1 + TMath::Power(slope,2)));
+    Float_t y        = slope*x + constant;
+    Float_t theta    = TMath::ATan2(x,y);
+    
+    if(x < corner1->X() && y > corner1->Y()) {
+      //One sector since theta is by definition half-hybrid
+      arclength = radius*theta;
+    }
+  }
+  
+  return arclength;
+  
+  
+}
+//____________________________________________________________________
+Float_t 
+AliFMDRing::GetBaseStripLength(UShort_t strip) const 
+{  
+  // Get the basic strip length 
+  // 
+  // Parameters:
+  //   strip    Strip number
+  Float_t rad             = GetMaxR()-GetMinR();
+  Float_t segment         = rad / GetNStrips();
+  Float_t basearc         = 2*TMath::Pi() / (0.5*GetNSectors()); 
+  Float_t radius          = GetMinR() + strip*segment;
+  Float_t basearclength   = 0.5*basearc * radius;                
+  
+  return basearclength;
+}
 //
 // EOF
 //