]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDSubDetector.cxx
Additional include files. Removing useles protection
[u/mrichter/AliRoot.git] / FMD / AliFMDSubDetector.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 // Utility class to help implement the FMD geometry.  This provides
21 // the interface for the concrete geometry implementations of the FMD
22 // sub-detectors. 
23 //
24 // The AliFMD object owns the AliFMDSubDetector objects
25 //
26 // Latest changes by Christian Holm Christensen
27 //
28 //////////////////////////////////////////////////////////////////////////////
29
30 #ifndef ALIFMDSUBDETECTOR_H
31 # include "AliFMDSubDetector.h"
32 #endif
33 #ifndef ALILOG_H
34 # include "AliLog.h"
35 #endif
36 #ifndef ROOT_TVirtualMC
37 # include <TVirtualMC.h>
38 #endif
39 #ifndef ROOT_TList
40 # include <TList.h>
41 #endif
42 #ifndef ROOT_TString
43 # include <TString.h>
44 #endif
45 #ifndef __IOSTREAM__
46 # include <iostream>
47 #endif
48
49 ClassImp(AliFMDSubDetector);
50
51 //____________________________________________________________________
52 AliFMDSubDetector::AliFMDSubDetector(Int_t n)
53   : fId(n), 
54     fInnerZ(0), 
55     fOuterZ(0), 
56     fInner(0), 
57     fOuter(0)
58 {}
59
60 //____________________________________________________________________
61 void 
62 AliFMDSubDetector::Draw(Option_t* /* opt */) const 
63 {
64   // DebugGuard guard("AliFMDSubDetector::Draw");
65   AliDebug(10, "AliFMDSubDetector::Draw");
66 }
67
68 //____________________________________________________________________
69 Bool_t
70 AliFMDSubDetector::CheckHit(Char_t ring, Int_t module, Double_t x, Double_t y) 
71 {
72   // Check if a hit (x,y) in module module of ring ring is within the
73   // actual shape. 
74   Bool_t ret = kFALSE;
75   switch (ring) {
76   case 'i':
77   case 'I': 
78     if (!fInner) break;
79     ret = fInner->IsWithin(module, x, y);
80     break;
81   case 'o':
82   case 'O': 
83     if (!fOuter) break;
84     ret = fOuter->IsWithin(module, x, y);
85     break;
86   }
87   return ret;
88 }
89
90 //____________________________________________________________________
91 void 
92 AliFMDSubDetector::SimpleGeometry(TList* nodes, 
93                                   TNode* mother, 
94                                   Int_t colour, 
95                                   Double_t zMother) 
96 {
97   // Make a simplified geometry for event display 
98   // 
99   // Parameters
100   // 
101   //    nodes     List of nodes to register all create nodes in 
102   //    mother    Mother node to put the ring in. 
103   //    colour    Colour of the nodes 
104   //    zMother   Z position of the node in the mother volume 
105   // 
106   for (int i = 0; i < 2; i++) {
107     AliFMDRing* r = 0;
108     Double_t z = 0;
109     switch (i) {
110     case 0: 
111       r     = fInner;
112       z     = fInnerZ;
113       break;
114     case 1: 
115       r     =  fOuter;
116       z     =  fOuterZ;
117       break;
118     }
119     if (!r) continue;
120
121     // Make the coordinates relative to the mother volume.   If we're
122     // on the positive side, then we need to flip the z-coordinate, as
123     // we'll rotate the whole sub-detector afterwards. 
124     z -= zMother;
125     if (zMother > 0) z *= -1;
126     
127     r->SimpleGeometry(nodes, mother, colour, z, fId);
128   }
129 }
130
131   
132 //____________________________________________________________________
133 void 
134 AliFMDSubDetector::SetupGeometry(Int_t airId, Int_t kaptionId) 
135 {
136   // Set up the geometry of this particular detector. 
137   // 
138   // In this class, it defines the support honey comp calls and
139   // nothing else. 
140   // 
141   // Parameters
142   //   airId           Medium of inactive virtual volumes 
143   //   kaptionId       Medium of honeycomb
144   // 
145   // DebugGuard guard("AliFMDSubDetector::SetupGeometry");
146   AliDebug(10, "AliFMDSubDetector::SetupGeometry");
147   TString name;
148   Double_t par[5];
149
150   for (int i = 0; i < 2; i++) {
151     AliFMDRing* r       = 0;
152     char  c = '\0';
153     switch (i) {
154     case 0: 
155       r      = fInner;
156       c      = 'I';
157       par[0] = fInnerHoneyLowR;
158       par[1] = fInnerHoneyHighR;
159       break;
160     case 1: 
161       r     = fOuter;
162       c     = 'O';
163       par[0] = fOuterHoneyLowR;
164       par[1] = fOuterHoneyHighR;
165       break;
166     }
167     if (!r) continue;
168     // Top of honeycomb, inner ring 
169     par[2] = fHoneycombThickness / 2;
170     par[3] = 0;
171     par[4] = 180;
172     name   = Form("HT%c%d", c, fId);
173     gMC->Gsvolu(name.Data(), "TUBS", kaptionId, par, 5);
174     
175     // Bottom of honeycomb, inner ring 
176     par[3] = 180;
177     par[4] = 360;
178     name   = Form("HB%c%d", c, fId);
179     gMC->Gsvolu(name.Data(), "TUBS", kaptionId, par, 5);
180     
181     // Air in top of honeycomb, inner ring 
182     par[0] += fKaptionThickness;
183     par[1] -= fKaptionThickness;
184     par[2] -= fKaptionThickness;
185     par[3] = 0;
186     par[4] = 180;
187     name   = Form("GT%c%d", c, fId);
188     gMC->Gsvolu(name.Data(), "TUBS", airId, par, 5);
189     
190     // Air in bottom of honeycomb, inner ring 
191     par[3] = 180;
192     par[4] = 360;
193     name   = Form("GB%c%d", c, fId);
194     gMC->Gsvolu(name.Data(), "TUBS", airId, par, 5);
195   }
196 }
197
198 //____________________________________________________________________
199 void 
200 AliFMDSubDetector::Geometry(const char* mother, Int_t pbRotId, Int_t idRotId, 
201                       Double_t zMother) 
202 {
203   // Place the volume inside mother volume. 
204   // 
205   // Parameters
206   // 
207   //     mother     Volume to position this detector in 
208   //     pbRotId    Print board rotation matrix, 
209   //     idRotId    Identity rotation matrix 
210   //     zMother    The Z passed in, is the position of the middle
211   //                point of the mother volume. 
212   // 
213   // In this base class, it asks the contained rings to position
214   // themselves in the mother volume, and positions the honey comb
215   // support in the mother volume 
216   // 
217   // DebugGuard guard("AliFMDSubDetector::Geometry");
218   AliDebug(10, "AliFMDSubDetector::Geometry");
219
220   Double_t  ringW;
221   Double_t  z = 0;
222   // Double_t* b = 0;
223   TString name;
224   TString name2;
225   
226   for (int i = 0; i < 2; i++) {
227     AliFMDRing* r = 0;
228     char  c = '\0';
229     switch (i) {
230     case 0: 
231       r     = fInner;
232       c     = 'I';
233       z     = fInnerZ;
234       break;
235     case 1: 
236       r     =  fOuter;
237       c     =  'O';
238       z     =  fOuterZ;
239       break;
240     }
241     if (!r) continue;
242
243     // Make the coordinates relative to the mother volume.   If we're
244     // on the positive side, then we need to flip the z-coordinate, as
245     // we'll rotate the whole sub-detector afterwards. 
246     z -= zMother;
247     if (zMother > 0) z *= -1;
248     
249     r->Geometry(mother, fId, z, pbRotId, idRotId);
250     ringW =  r->GetRingDepth();
251     z     -= ringW + fHoneycombThickness / 2;
252
253     // Top of honeycomb
254     name = Form("HT%c%d", c, fId);
255     gMC->Gspos(name.Data(), 1, mother, 0, 0, z, idRotId);
256
257     // Air in top of honeycomb
258     name2 = name;
259     name  = Form("GT%c%d", c, fId);
260     gMC->Gspos(name.Data(), 1, name2.Data(),0,fKaptionThickness,0,idRotId);
261     
262     // Bottom of honeycomb
263     name = Form("HB%c%d", c, fId);
264     gMC->Gspos(name.Data(), 1, mother, 0, 0, z, idRotId);
265
266     // Air in bottom of honeycomb
267     name2 = name;
268     name  = Form("GB%c%d", c, fId);
269     gMC->Gspos(name.Data(),1,name2.Data(),0,-fKaptionThickness,0,idRotId);
270   }
271 }
272
273 //____________________________________________________________________
274 void
275 AliFMDSubDetector::Gsatt() 
276 {
277   // Set drawing attributes for the detector 
278   // 
279   // DebugGuard guard("AliFMDSubDetector::Gsatt");
280   AliDebug(10, "AliFMDSubDetector::Gsatt");
281   TString name(Form("FMD%d", fId));
282   gMC->Gsatt(name.Data(), "SEEN", 0);
283 }
284
285
286 //____________________________________________________________________
287 // 
288 // EOF
289 //