New class to implement support for the FMD3
[u/mrichter/AliRoot.git] / FMD / AliFMD3.cxx
CommitLineData
4347b38f 1/**************************************************************************
2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
ba224443 18//____________________________________________________________________
4347b38f 19//
20// Concrete implementation of AliFMDSubDetector
21//
22// This implements the geometry for FMD3
23//
e802be3e 24#include "TVirtualMC.h" // ROOT_TVirtualMC
25#include "TCONS.h" // ROOT_TCONS
26#include "TNode.h" // ROOT_TNode
27#include "TList.h" // ROOT_TList
28#include "AliFMD3.h" // ALIFMD3_H
29#include "AliLog.h" // ALILOG_H
30#include "AliFMDRing.h" // ALIFMDRING_H
31#include <Riostream.h> // ROOT_Riostream
4347b38f 32
33//____________________________________________________________________
34ClassImp(AliFMD3);
35
36//____________________________________________________________________
37AliFMD3::AliFMD3()
ba224443 38 : AliFMDSubDetector(3),
a16179cb 39 fVolumeId(0)
ba224443 40{
41 // Default constructor for the FMD3 sub-detector
42}
43
4347b38f 44
45//____________________________________________________________________
46AliFMD3::~AliFMD3()
ba224443 47{
48 // Destructor - does nothing
49}
50
4347b38f 51
52//____________________________________________________________________
53void
a16179cb 54AliFMD3::SetupGeometry(Int_t airId, Int_t alId, Int_t carbonId)
4347b38f 55{
ba224443 56 // Setup the FMD3 sub-detector geometry
57 //
58 // Parameters:
59 //
60 // airId Id # of the Air medium
61 // kaptionId Id # of the Aluminium medium
62 //
a16179cb 63 Double_t innerZl = fInnerZ;
64 Double_t innerZh = (fInnerZ
65 - fInner->GetModuleSpacing()
66 - fInner->GetLegLength()
67 - fInner->GetSiThickness()
68 - fInner->GetPrintboardThickness()
69 - fHoneycombThickness);
70 Double_t innerRl = fInner->GetLowR();
71 Double_t outerZl = fOuterZ;
72 Double_t outerZh = (fOuterZ
73 - fOuter->GetModuleSpacing()
74 - fOuter->GetLegLength()
75 - fOuter->GetSiThickness()
76 - fOuter->GetPrintboardThickness()
77 - fHoneycombThickness);
78 Double_t outerRl = fOuter->GetLowR();
79
80 fSupport.SetupGeometry(airId, carbonId,
81 innerZl, innerZh, innerRl,
82 outerZl, outerZh, outerRl);
83
4347b38f 84 fInnerHoneyLowR = fInner->GetLowR() + 1;
a16179cb 85 fInnerHoneyHighR = fSupport.ConeR(innerZh + fHoneycombThickness, "I");
4347b38f 86 fOuterHoneyLowR = fOuter->GetLowR() + 1;
a16179cb 87 fOuterHoneyHighR = fSupport.GetBackLowR();
4347b38f 88
a16179cb 89 // Identity matrix
4347b38f 90 gMC->Matrix(fRotationId, 90, 0, 90, 90, 0, 0);
91 //0, 180, 90, 90, 180, 0);
92
a16179cb 93 AliFMDSubDetector::SetupGeometry(airId, alId, carbonId);
4347b38f 94}
95
96//____________________________________________________________________
97void
98AliFMD3::Geometry(const char* mother, Int_t pbRotId,
99 Int_t idRotId, Double_t z)
100{
ba224443 101 // Position the FMD3 sub-detector volume
102 //
103 // Parameters
104 //
105 // mother name of the mother volume
106 // pbRotId Printboard roation matrix ID
107 // idRotId Identity rotation matrix ID
108 // z Z position (not really used here, but passed down)
109 //
a16179cb 110 z = fSupport.GetZ();
111 AliDebug(10, Form("Passing z=%lf to ring volumes", z));
4347b38f 112 AliFMDSubDetector::Geometry("FMD3", pbRotId, idRotId, z);
a16179cb 113 fSupport.Geometry(mother, fRotationId, z);
4347b38f 114}
115
116
ba224443 117//____________________________________________________________________
118void
119AliFMD3::SimpleGeometry(TList* nodes,
120 TNode* mother,
121 Int_t colour,
122 Double_t zMother)
123{
124 // We need to get the equation for the line that connects the
125 // outer circumfrences of the two rings, as well as for the line
126 // that connects the inner curcumfrences, so that we can project to
127 // where the honey-comb actually ends.
128 //
129 // we have
130 //
131 // y = a * x + b
132 // b = y - a * x;
133 //
134 // For the outer line, we have the two equations
135 //
136 // fOuterHoneyHighR = a * x1 + b;
137 // fInnerHoneyHighR = a * x2 + b;
138 //
139 // where
140 //
141 // x1 = (fOuterZ + fOuter->fSiThickness + fOuter->fPrintboardThickness
142 // + fOuter->fLegLength + fModuleSpacing)
143 // = fInner - fDz + fHoneycombThickness
144 // x2 = (fInnerZ + fInner->fSiThickness + fInner->fPrintboardThickness
145 // + fInner->fLegLength + fModuleSpacing)
146 //
147 // and
148 //
149 // a = (fOuterHoneyHighR - fInnerHoneyHighR) / (x1 - x2)
150 //
151 //
a16179cb 152 Double_t dz = (TMath::Abs(fInnerZ - fOuterZ)
153 + fOuter->GetSiThickness()
154 + fOuter->GetPrintboardThickness()
155 + fOuter->GetLegLength()
156 + fOuter->GetModuleSpacing()
157 + fHoneycombThickness) / 2;
ba224443 158#if 1
159 Double_t x1 = (fOuterZ - (fOuter->GetSiThickness()
160 + fOuter->GetPrintboardThickness()
161 + fOuter->GetLegLength()
162 + fOuter->GetModuleSpacing()));
163 Double_t x2 = (fInnerZ - (fInner->GetSiThickness()
164 + fInner->GetPrintboardThickness()
165 + fInner->GetLegLength()
166 + fInner->GetModuleSpacing()));
167 Double_t ao = 0;
168 Double_t ao1 = (fOuterHoneyHighR - fInnerHoneyHighR) / (x1 - x2);
169 Double_t ao2 = ((fOuter->GetHighR() - fInner->GetHighR())
170 / (fOuterZ - fInnerZ));
171 Double_t bo = 0;
172 if (ao2 > ao1) {
e802be3e 173 // std::cout << "Wafer determinds the size" << std::endl;
ba224443 174 ao = ao2;
175 bo = fInner->GetHighR() - ao * fInnerZ;
176 }
177 else {
178 ao = ao1;
179 bo = fOuterHoneyHighR - ao * x1;
180 }
181
a16179cb 182 Double_t y1o = ao * (fInnerZ - 2 * dz) + bo;
ba224443 183 Double_t y2o = ao * fInnerZ + bo;
184#endif
185 // We probably need to make a PCON here.
a16179cb 186 TShape* shape = new TCONS("FMD3", "FMD3", "", dz,
ba224443 187 fOuter->GetLowR(), y1o, /* fOuterHoneyHighR, */
188 fInner->GetLowR(), y2o, /* fInnerHoneyHighR, */
189 0, 360);
190 mother->cd();
a16179cb 191 zMother = fInnerZ - dz;
ba224443 192 TNode* node = new TNode("FMD3", "FMD3", shape, 0, 0, zMother, 0);
193 node->SetVisibility(0);
194 nodes->Add(node);
195 AliFMDSubDetector::SimpleGeometry(nodes, node, colour, zMother);
196}
197
198//____________________________________________________________________
199void
a16179cb 200AliFMD3::Gsatt()
ba224443 201{
a16179cb 202 AliFMDSubDetector::Gsatt();
203 fSupport.Gsatt();
ba224443 204}
4347b38f 205
206//____________________________________________________________________
207//
208// EOF
209//