]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMD3.cxx
Getting rid of obsolete objects.
[u/mrichter/AliRoot.git] / FMD / AliFMD3.cxx
index 3fc331a74fb0deffd63a669086263f8d5d8e73de..8d2a3901ffe74fb99087fa32c9a73cc71214f018 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-
 /* $Id$ */
-
+/** @file    AliFMD3.cxx
+    @author  Christian Holm Christensen <cholm@nbi.dk>
+    @date    Sun Mar 26 18:26:12 2006
+    @brief   Concrete implementation of AliFMDDetector for FMD3
+*/
 //____________________________________________________________________
 //                                                                          
-// Concrete implementation of AliFMDSubDetector 
+// Concrete implementation of AliFMDDetector 
 //
-// This implements the geometry for FMD3
+// This implements the geometry for FMD3.
+// This has 2 rings.
+// The support of the FMD3 is a carbon-fibre cone, attached to the ITS
+// support via flanges.  The cone also supports the beam-pipe.
+// The support is a special cone of carbon-fibre made by a Danish
+// Yacht company.
 //
-#ifndef ROOT_TVirtualMC
-# include <TVirtualMC.h>
-#endif
-#ifndef ROOT_TCONS
-# include <TCONS.h>
-#endif
-#ifndef ROOT_TNode
-# include <TNode.h>
-#endif
-#ifndef ROOT_TList
-# include <TList.h>
-#endif
-#ifndef ALIFMD3_H
-# include "AliFMD3.h"
-#endif 
-#ifndef ALILOG_H
-# include "AliLog.h"
-#endif
-#ifndef ALIFMDRING_H
-# include "AliFMDRing.h"
-#endif 
-#include <iostream>
 
-//____________________________________________________________________
-ClassImp(AliFMD3);
+#include <TMath.h>             // ROOT_TMath
 
-//____________________________________________________________________
-AliFMD3::AliFMD3() 
-  : AliFMDSubDetector(3), 
-    fVolumeId(0),
-    fDz(0)
-{
-  // Default constructor for the FMD3 sub-detector 
-}
-
-
-//____________________________________________________________________
-AliFMD3::~AliFMD3() 
-{
-  // Destructor - does nothing 
-}
+#include "AliFMD3.h"           // ALIFMD3_H 
+#include "AliFMDDebug.h"               // ALIFMDDEBUG_H ALILOG_H
+#include "AliFMDRing.h"                // ALIFMDRING_H 
+#include <TVector3.h>
 
+//====================================================================
+ClassImp(AliFMD3)
+#if 0
+  ; // This is here to keep Emacs for indenting the next line
+#endif
 
 //____________________________________________________________________
-void 
-AliFMD3::SetupGeometry(Int_t airId, Int_t kaptionId) 
+AliFMD3::AliFMD3(AliFMDRing* inner, AliFMDRing* outer) 
+  : AliFMDDetector(3, inner, outer),
+    // fNoseZ(16.54667)
+    fNoseZ(18.13 - inner->GetModuleDepth()-inner->GetModuleSpacing()/2),    // From drawing
+    fFlangeDepth(0),
+    fFlangeHighR(49.25), // From drawing 
+    fFlangeLength(0),
+    fFlangeWidth(6),     // From drawing 
+    fFiducialRadius(.25),
+    fConeInnerAngle(0),
+    fConeOuterAngle(0),
+    fHoleOffset(6.9),    // From drawing
+    fHoleDepth(2),       // What's needed
+    fHoleLength(31.2),   // From drawing
+    fHoleLowWidth(3), // 4),    // What's needed
+    fHoleHighWidth(18.5), // 17.5), // 18),  // What's needed
+    fBoltLength(1),      // Guessed
+    fBoltRadius(0.15),   // Estimate
+    fConeRadii(6),    
+    fFiducialHoles(4)
 {
-  // Setup the FMD3 sub-detector geometry 
-  // 
-  // Parameters:
-  // 
-  //     airId         Id # of the Air medium 
-  //     kaptionId     Id # of the Aluminium medium 
-  // 
-  fInnerHoneyLowR  = fInner->GetLowR() + 1;
-  fInnerHoneyHighR = fInner->GetHighR() + 1;
-  fOuterHoneyLowR  = fOuter->GetLowR() + 1;
-  fOuterHoneyHighR = fOuter->GetHighR() + 1;
+  // Constructor. 
+  Double_t off = 0; // -0.39615-0.10185; // -0.25;
+  if (off != 0) 
+    AliWarning(Form("Z position of FMD3 rings may be off by %fcm!", off));
 
-  CalculateDz();
-  Double_t par[3];
-  par[0] = fInner->GetLowR();
-  par[1] = fOuterHoneyHighR;
-  par[2] = fDz;
-  fVolumeId = gMC->Gsvolu("FMD3", "TUBE", airId, par, 3);
+  SetInnerZ(-62.8+off);             // By design
+  SetOuterZ(-75.2+off);             // By design
 
-  gMC->Matrix(fRotationId, 90, 0, 90, 90, 0, 0); 
-  //0, 180, 90, 90, 180, 0);
+  SetInnerHoneyLowR(4.18207);   // From drawing
+  SetInnerHoneyHighR(19.74922); // From drawing
+  SetOuterHoneyLowR(13.4776);   // From drawing
+  SetOuterHoneyHighR(31.01964); // From drawing
+  
+  // These are from the drawings
+  fConeRadii.Add(new TVector3( 0,       5.55,  6.25));
+  fConeRadii.Add(new TVector3( 2.35,    5.55,  6.25));
+  fConeRadii.Add(new TVector3( 2.9935,  5.55,  6.88479));
+  fConeRadii.Add(new TVector3(28.9435, 31.50, 32.75850));
+  fConeRadii.Add(new TVector3(29.5,    31.50, 33.4));
+  fConeRadii.Add(new TVector3(30.9,    31.50, 33.4));
 
-  AliFMDSubDetector::SetupGeometry(airId, kaptionId);
+  // These are from the drawings
+  fFiducialHoles.Add(new TVector2(29.666, 32.495));
+  fFiducialHoles.Add(new TVector2(31.082, 33.910));
+  fFiducialHoles.Add(new TVector2(32.674, 35.503));
+  fFiducialHoles.Add(new TVector2(33.403, 34.818));
 }
 
 //____________________________________________________________________
-void 
-AliFMD3::Geometry(const char* mother, Int_t pbRotId, 
-                 Int_t idRotId, Double_t z) 
+void
+AliFMD3::Init() 
 {
-  // Position the FMD3 sub-detector volume 
-  // 
-  // Parameters 
-  //
-  //     mother     name of the mother volume 
-  //     pbRotId    Printboard roation matrix ID 
-  //     idRotId    Identity rotation matrix ID 
-  //     z          Z position (not really used here, but passed down)
-  //
-  z = fInnerZ - fDz;
-  gMC->Gspos("FMD3", 1, mother, 0, 0, z, fRotationId);
+  // Initialize 
+  AliFMDDetector::Init();
+  // TVector3& v0 = *(static_cast<TVector3*>(fConeRadii.At(0)));
+  TVector3& v1 = *(static_cast<TVector3*>(fConeRadii.At(1)));
+  TVector3& v2 = *(static_cast<TVector3*>(fConeRadii.At(2)));
+  TVector3& v3 = *(static_cast<TVector3*>(fConeRadii.At(3)));
+  TVector3& v4 = *(static_cast<TVector3*>(fConeRadii.At(4)));
+  TVector3& v5 = *(static_cast<TVector3*>(fConeRadii.At(5)));
   
-  AliFMDSubDetector::Geometry("FMD3", pbRotId, idRotId, z);
+  fFlangeDepth     = v5.X() - v4.X();
+  fFlangeLength    = fFlangeHighR - v5.Y();
+  
+  fConeInnerAngle  = TMath::ATan2(v4.Z()-v1.Z(), v4.X()-v1.X());
+  fConeOuterAngle  = TMath::ATan2(v3.Y()-v2.Y(), v3.X()-v2.X());
+  
+#if 0
+  Double_t    hz1  = -fHoleOffset+fInnerZ+fNoseZ;
+  fHoleLength      = TMath::Sqrt(TMath::Power(v4.Z()-ConeR(hz1),2) + 
+                                TMath::Power(v4.X()-fHoleOffset,2));  
+#endif
 }
 
-  
 //____________________________________________________________________
-void 
-AliFMD3::SimpleGeometry(TList* nodes, 
-                       TNode* mother, 
-                       Int_t colour, 
-                       Double_t zMother) 
+Double_t
+AliFMD3::ConeR(Double_t z, Option_t* opt) const
 {
-  // We need to get the equation for the line that connects the 
-  // outer circumfrences of the two rings, as  well as for the line
-  // that connects the inner curcumfrences, so that we can project to
-  // where the honey-comb actually ends. 
-  // 
-  // we have 
-  //   
-  //   y = a * x + b 
-  //   b = y - a * x;
-  // 
-  // For the outer line, we have the two equations 
-  // 
-  //    fOuterHoneyHighR = a * x1 + b;
-  //    fInnerHoneyHighR = a * x2 + b; 
-  // 
-  // where 
-  // 
-  //    x1 = (fOuterZ + fOuter->fSiThickness + fOuter->fPrintboardThickness 
-  //          + fOuter->fLegLength + fModuleSpacing) 
-  //       = fInner - fDz + fHoneycombThickness
-  //    x2 = (fInnerZ + fInner->fSiThickness + fInner->fPrintboardThickness 
-  //          + fInner->fLegLength + fModuleSpacing)
-  // 
-  // and 
-  //
-  //    a  = (fOuterHoneyHighR - fInnerHoneyHighR) / (x1 - x2)
-  //    
-  // 
-  CalculateDz();
-#if 1
-  Double_t x1  = (fOuterZ - (fOuter->GetSiThickness() 
-                            + fOuter->GetPrintboardThickness() 
-                            + fOuter->GetLegLength() 
-                            + fOuter->GetModuleSpacing()));
-  Double_t x2  = (fInnerZ - (fInner->GetSiThickness() 
-                            + fInner->GetPrintboardThickness() 
-                            + fInner->GetLegLength() 
-                            + fInner->GetModuleSpacing()));
-  Double_t ao   = 0;
-  Double_t ao1  = (fOuterHoneyHighR - fInnerHoneyHighR) / (x1 - x2);
-  Double_t ao2  = ((fOuter->GetHighR() - fInner->GetHighR()) 
-                  / (fOuterZ - fInnerZ));
-  Double_t bo   = 0;
-  if (ao2 > ao1) {
-    std::cout << "Wafer determinds the size" << std::endl;
-    ao  = ao2;
-    bo  = fInner->GetHighR() - ao * fInnerZ;
+  // Calculate the cone radius at Z
+  // TVector3& v0 = *(static_cast<TVector3*>(fConeRadii.At(0)));
+  TVector3& v1 = *(static_cast<TVector3*>(fConeRadii.At(1)));
+  TVector3& v2 = *(static_cast<TVector3*>(fConeRadii.At(2)));
+  TVector3& v3 = *(static_cast<TVector3*>(fConeRadii.At(3)));
+  TVector3& v4 = *(static_cast<TVector3*>(fConeRadii.At(4)));
+  TVector3& v5 = *(static_cast<TVector3*>(fConeRadii.At(5)));
+
+  if (z > fInnerZ + fNoseZ) {
+    AliWarning(Form("z=%lf is before start of cone %lf", z, fInnerZ + fNoseZ));
+    return -1;
   }
-  else {
-    ao = ao1;
-    bo = fOuterHoneyHighR - ao * x1;
+  if (z < fInnerZ + fNoseZ - v5.Z()) {
+    AliWarning(Form("z=%lf is after end of cone %lf", z, 
+                   fInnerZ + fNoseZ - v5.Z()));
+    return -1;
   }
+  Double_t rz    = -(z-fInnerZ-fNoseZ);
+  Bool_t   inner = opt[0] == 'I' || opt[1] == 'i';
+  if (inner  && rz <= v2.X()) return v2.Y();
+  if (!inner && rz <= v1.X()) return v1.Z();
+  if (inner  && rz >  v3.X()) return v3.Y();
+  if (!inner && rz >  v4.X()) return v4.Z();
   
-  Double_t y1o = ao * (fInnerZ - 2 * fDz) + bo;
-  Double_t y2o = ao * fInnerZ + bo;
-#endif
-  // We probably need to make a PCON here. 
-  TShape* shape = new TCONS("FMD3", "FMD3", "", fDz, 
-                           fOuter->GetLowR(),  y1o, /* fOuterHoneyHighR, */
-                           fInner->GetLowR(),  y2o, /* fInnerHoneyHighR, */
-                           0, 360);
-  mother->cd();
-  zMother = fInnerZ - fDz;  
-  TNode* node = new TNode("FMD3", "FMD3", shape, 0, 0, zMother, 0);
-  node->SetVisibility(0);
-  nodes->Add(node);
-  AliFMDSubDetector::SimpleGeometry(nodes, node, colour, zMother);
+  rz             -= (inner ? v2.X() : v1.X());
+  Double_t sr    =  (inner ? v2.Y() : v1.Z());
+  Double_t ang   =  (inner ? fConeInnerAngle : fConeOuterAngle);
+  return sr + rz * TMath::Tan(ang);
 }
 
-//____________________________________________________________________
-void 
-AliFMD3::CalculateDz() 
-{
-  if (fDz > 0) return;
-  fDz = (TMath::Abs(fInnerZ - fOuterZ) 
-        + fOuter->GetSiThickness() 
-        + fOuter->GetPrintboardThickness() 
-        + fOuter->GetLegLength() 
-        + fOuter->GetModuleSpacing() 
-        + fHoneycombThickness) / 2;
-}
 
 //____________________________________________________________________
 //