]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMD3.cxx
Adding missing include
[u/mrichter/AliRoot.git] / FMD / AliFMD3.cxx
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
18 //____________________________________________________________________
19 //                                                                          
20 // Concrete implementation of AliFMDSubDetector 
21 //
22 // This implements the geometry for FMD3
23 //
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
32
33 //____________________________________________________________________
34 ClassImp(AliFMD3);
35
36 //____________________________________________________________________
37 AliFMD3::AliFMD3() 
38   : AliFMDSubDetector(3), 
39     fVolumeId(0),
40     fDz(0)
41 {
42   // Default constructor for the FMD3 sub-detector 
43 }
44
45
46 //____________________________________________________________________
47 AliFMD3::~AliFMD3() 
48 {
49   // Destructor - does nothing 
50 }
51
52
53 //____________________________________________________________________
54 void 
55 AliFMD3::SetupGeometry(Int_t airId, Int_t kaptionId) 
56 {
57   // Setup the FMD3 sub-detector geometry 
58   // 
59   // Parameters:
60   // 
61   //     airId         Id # of the Air medium 
62   //     kaptionId     Id # of the Aluminium medium 
63   // 
64   fInnerHoneyLowR  = fInner->GetLowR() + 1;
65   fInnerHoneyHighR = fInner->GetHighR() + 1;
66   fOuterHoneyLowR  = fOuter->GetLowR() + 1;
67   fOuterHoneyHighR = fOuter->GetHighR() + 1;
68
69   CalculateDz();
70   Double_t par[3];
71   par[0] = fInner->GetLowR();
72   par[1] = fOuterHoneyHighR;
73   par[2] = fDz;
74   fVolumeId = gMC->Gsvolu("FMD3", "TUBE", airId, par, 3);
75
76   gMC->Matrix(fRotationId, 90, 0, 90, 90, 0, 0); 
77   //0, 180, 90, 90, 180, 0);
78
79   AliFMDSubDetector::SetupGeometry(airId, kaptionId);
80 }
81
82 //____________________________________________________________________
83 void 
84 AliFMD3::Geometry(const char* mother, Int_t pbRotId, 
85                   Int_t idRotId, Double_t z) 
86 {
87   // Position the FMD3 sub-detector volume 
88   // 
89   // Parameters 
90   //
91   //     mother     name of the mother volume 
92   //     pbRotId    Printboard roation matrix ID 
93   //     idRotId    Identity rotation matrix ID 
94   //     z          Z position (not really used here, but passed down)
95   //
96   z = fInnerZ - fDz;
97   gMC->Gspos("FMD3", 1, mother, 0, 0, z, fRotationId);
98   
99   AliFMDSubDetector::Geometry("FMD3", pbRotId, idRotId, z);
100 }
101
102   
103 //____________________________________________________________________
104 void 
105 AliFMD3::SimpleGeometry(TList* nodes, 
106                         TNode* mother, 
107                         Int_t colour, 
108                         Double_t zMother) 
109 {
110   // We need to get the equation for the line that connects the 
111   // outer circumfrences of the two rings, as  well as for the line
112   // that connects the inner curcumfrences, so that we can project to
113   // where the honey-comb actually ends. 
114   // 
115   // we have 
116   //   
117   //   y = a * x + b 
118   //   b = y - a * x;
119   // 
120   // For the outer line, we have the two equations 
121   // 
122   //    fOuterHoneyHighR = a * x1 + b;
123   //    fInnerHoneyHighR = a * x2 + b; 
124   // 
125   // where 
126   // 
127   //    x1 = (fOuterZ + fOuter->fSiThickness + fOuter->fPrintboardThickness 
128   //          + fOuter->fLegLength + fModuleSpacing) 
129   //       = fInner - fDz + fHoneycombThickness
130   //    x2 = (fInnerZ + fInner->fSiThickness + fInner->fPrintboardThickness 
131   //          + fInner->fLegLength + fModuleSpacing)
132   // 
133   // and 
134   //
135   //    a  = (fOuterHoneyHighR - fInnerHoneyHighR) / (x1 - x2)
136   //    
137   // 
138   CalculateDz();
139 #if 1
140   Double_t x1  = (fOuterZ - (fOuter->GetSiThickness() 
141                              + fOuter->GetPrintboardThickness() 
142                              + fOuter->GetLegLength() 
143                              + fOuter->GetModuleSpacing()));
144   Double_t x2  = (fInnerZ - (fInner->GetSiThickness() 
145                              + fInner->GetPrintboardThickness() 
146                              + fInner->GetLegLength() 
147                              + fInner->GetModuleSpacing()));
148   Double_t ao   = 0;
149   Double_t ao1  = (fOuterHoneyHighR - fInnerHoneyHighR) / (x1 - x2);
150   Double_t ao2  = ((fOuter->GetHighR() - fInner->GetHighR()) 
151                    / (fOuterZ - fInnerZ));
152   Double_t bo   = 0;
153   if (ao2 > ao1) {
154     // std::cout << "Wafer determinds the size" << std::endl;
155     ao  = ao2;
156     bo  = fInner->GetHighR() - ao * fInnerZ;
157   }
158   else {
159     ao = ao1;
160     bo = fOuterHoneyHighR - ao * x1;
161   }
162   
163   Double_t y1o = ao * (fInnerZ - 2 * fDz) + bo;
164   Double_t y2o = ao * fInnerZ + bo;
165 #endif
166   // We probably need to make a PCON here. 
167   TShape* shape = new TCONS("FMD3", "FMD3", "", fDz, 
168                             fOuter->GetLowR(),  y1o, /* fOuterHoneyHighR, */
169                             fInner->GetLowR(),  y2o, /* fInnerHoneyHighR, */
170                             0, 360);
171   mother->cd();
172   zMother = fInnerZ - fDz;  
173   TNode* node = new TNode("FMD3", "FMD3", shape, 0, 0, zMother, 0);
174   node->SetVisibility(0);
175   nodes->Add(node);
176   AliFMDSubDetector::SimpleGeometry(nodes, node, colour, zMother);
177 }
178
179 //____________________________________________________________________
180 void 
181 AliFMD3::CalculateDz() 
182 {
183   if (fDz > 0) return;
184   fDz = (TMath::Abs(fInnerZ - fOuterZ) 
185          + fOuter->GetSiThickness() 
186          + fOuter->GetPrintboardThickness() 
187          + fOuter->GetLegLength() 
188          + fOuter->GetModuleSpacing() 
189          + fHoneycombThickness) / 2;
190 }
191
192 //____________________________________________________________________
193 //
194 // EOF
195 //