- Updated for changes in AliMUONSegmentation
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1GeometryBuilder.cxx
CommitLineData
e118b27e 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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
d1cd2474 16// $Id$
17//
18// Class AliMUONSt1GeometryBuilder
19// -------------------------------
20// MUON Station1 coarse geometry construction class.
d1cd2474 21// Extracted from AliMUONv1
22// by Ivana Hrivnacova, IPN Orsay
5f1df83a 23// Included in AliRoot 2004/01/23
d1cd2474 24
25#include <TVirtualMC.h>
26#include <TGeoMatrix.h>
27
e118b27e 28#include "AliLog.h"
29
d1cd2474 30#include "AliMUONSt1GeometryBuilder.h"
31#include "AliMUON.h"
b7ef3c96 32#include "AliMUONConstants.h"
e118b27e 33#include "AliMUONGeometryModule.h"
a432117a 34#include "AliMUONGeometryEnvelopeStore.h"
d1cd2474 35
5398f946 36/// \cond CLASSIMP
d1cd2474 37ClassImp(AliMUONSt1GeometryBuilder)
5398f946 38/// \endcond
d1cd2474 39
40//______________________________________________________________________________
41AliMUONSt1GeometryBuilder::AliMUONSt1GeometryBuilder(AliMUON* muon)
b7ef3c96 42 : AliMUONVGeometryBuilder(0, 1),
d1cd2474 43 fMUON(muon)
44{
5398f946 45/// Standard constructor
d1cd2474 46
47}
48
49//______________________________________________________________________________
50AliMUONSt1GeometryBuilder::AliMUONSt1GeometryBuilder()
51 : AliMUONVGeometryBuilder(),
52 fMUON(0)
53{
5398f946 54/// Default constructor
d1cd2474 55}
56
d1cd2474 57//______________________________________________________________________________
5398f946 58AliMUONSt1GeometryBuilder::~AliMUONSt1GeometryBuilder()
59{
60/// Destructor
d1cd2474 61}
62
d1cd2474 63//
64// public methods
65//
66
67//______________________________________________________________________________
68void AliMUONSt1GeometryBuilder::CreateGeometry()
69{
5398f946 70/// From AliMUONv1::CreateGeometry()
d1cd2474 71
72//********************************************************************
73// Station 1 **
74//********************************************************************
75// CONCENTRIC
76 // indices 1 and 2 for first and second chambers in the station
77 // iChamber (first chamber) kept for other quanties than Z,
78 // assumed to be the same in both chambers
79
80 // Get tracking medias Ids
81 Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
82 Int_t idAir= idtmed[1100]; // medium 1
83 Int_t idAlu1=idtmed[1103]; // medium 4
84 Int_t idAlu2=idtmed[1104]; // medium 5
85 Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
86 Bool_t frameCrosses=kTRUE;
87
88 // Rotation matrices in the x-y plane
89 // phi= 0 deg
90 Int_t irot1;
91 fMUON->AliMatrix(irot1, 90., 0., 90., 90., 0., 0.);
92 // phi= 90 deg
93 Int_t irot2;
94 fMUON->AliMatrix(irot2, 90., 90., 90., 180., 0., 0.);
95
d1cd2474 96 // DGas decreased from standard one (0.5)
b7ef3c96 97 const Float_t kDGas = 0.4;
d1cd2474 98
99 // DAlu increased from standard one (3% of X0),
100 // because more electronics with smaller pads
b7ef3c96 101 const Float_t kDAlu = 3.5 * 8.9 / 100.;
d1cd2474 102
103 // Half of the total thickness of frame crosses (including DAlu)
104 // for each chamber in stations 1 and 2:
105 // 3% of X0 of composite material,
106 // but taken as Aluminium here, with same thickness in number of X0
107 Float_t dframez = 3. * 8.9 / 100;
b7ef3c96 108 Float_t zfpos=-(kDGas+dframez+kDAlu)/2;
d1cd2474 109 // The same parameters are defined in builder for station 2
110
111 // Mother volume
112 // Outer excess and inner recess for mother volume radius
113 // with respect to ROuter and RInner
114 Float_t dframep=.001; // Value for station 3 should be 6 ...
115 // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
116 // Float_t dframep1=.001;
117 Float_t dframep1 = 11.0;
118 Float_t phi=2*TMath::Pi()/12/2;
119 // The same parameters are defined in builder for station 2
120
121 Float_t tpar[3];
b7ef3c96 122 Float_t dstation = (-AliMUONConstants::DefaultChamberZ(1)) -
123 (-AliMUONConstants::DefaultChamberZ(0));
124 tpar[0] = AliMUONConstants::Rmin(0)-dframep;
125 tpar[1] = (AliMUONConstants::Rmax(0)+dframep)/TMath::Cos(phi);
d1cd2474 126 tpar[2] = dstation/5;
127
128 gMC->Gsvolu("S01M", "TUBE", idAir, tpar, 3);
129 gMC->Gsvolu("S02M", "TUBE", idAir, tpar, 3);
130
131 // CHANGED
132 //gMC->Gspos("S01M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
a432117a 133 //gMC->Gspos("S02M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
134
135 GetEnvelopes(0)->AddEnvelope("S01M", 100, false);
136 GetEnvelopes(1)->AddEnvelope("S02M", 200, false);
137
d1cd2474 138
139// // Aluminium frames
140// // Outer frames
141// pgpar[0] = 360/12/2;
142// pgpar[1] = 360.;
143// pgpar[2] = 12.;
144// pgpar[3] = 2;
145// pgpar[4] = -dframez/2;
b7ef3c96 146// pgpar[5] = AliMUONConstants::Rmax(0);
d1cd2474 147// pgpar[6] = pgpar[5]+dframep1;
148// pgpar[7] = +dframez/2;
149// pgpar[8] = pgpar[5];
150// pgpar[9] = pgpar[6];
151// gMC->Gsvolu("S01O", "PGON", idAlu1, pgpar, 10);
152// gMC->Gsvolu("S02O", "PGON", idAlu1, pgpar, 10);
153// gMC->Gspos("S01O",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
154// gMC->Gspos("S01O",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
155// gMC->Gspos("S02O",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
156// gMC->Gspos("S02O",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
157// //
158// // Inner frame
b7ef3c96 159// tpar[0]= AliMUONConstants::Rmin(0)-dframep1;
160// tpar[1]= AliMUONConstants::Rmin(0);
d1cd2474 161// tpar[2]= dframez/2;
162// gMC->Gsvolu("S01I", "TUBE", idAlu1, tpar, 3);
163// gMC->Gsvolu("S02I", "TUBE", idAlu1, tpar, 3);
164
165// gMC->Gspos("S01I",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
166// gMC->Gspos("S01I",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
167// gMC->Gspos("S02I",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
168// gMC->Gspos("S02I",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
169//
170// Frame Crosses
171 if (frameCrosses) {
172 // outside gas
173 // security for inside mother volume
174 Float_t bpar[3];
b7ef3c96 175 bpar[0] = (AliMUONConstants::Rmax(0) - AliMUONConstants::Rmin(0))
d1cd2474 176 * TMath::Cos(TMath::ASin(dframep1 /
b7ef3c96 177 (AliMUONConstants::Rmax(0) - AliMUONConstants::Rmin(0))))
d1cd2474 178 / 2.0;
179 bpar[1] = dframep1/2;
180 // total thickness will be (4 * bpar[2]) for each chamber,
181 // which has to be equal to (2 * dframez) - DAlu
b7ef3c96 182 bpar[2] = (2.0 * dframez - kDAlu) / 4.0;
d1cd2474 183 gMC->Gsvolu("S01B", "BOX", idAlu1, bpar, 3);
184 gMC->Gsvolu("S02B", "BOX", idAlu1, bpar, 3);
185
b7ef3c96 186 gMC->Gspos("S01B",1,"S01M", +AliMUONConstants::Rmin(0)+bpar[0] , 0,-zfpos,
d1cd2474 187 irot1,"ONLY");
b7ef3c96 188 gMC->Gspos("S01B",2,"S01M", -AliMUONConstants::Rmin(0)-bpar[0] , 0,-zfpos,
d1cd2474 189 irot1,"ONLY");
b7ef3c96 190 gMC->Gspos("S01B",3,"S01M", 0, +AliMUONConstants::Rmin(0)+bpar[0] ,-zfpos,
d1cd2474 191 irot2,"ONLY");
b7ef3c96 192 gMC->Gspos("S01B",4,"S01M", 0, -AliMUONConstants::Rmin(0)-bpar[0] ,-zfpos,
d1cd2474 193 irot2,"ONLY");
b7ef3c96 194 gMC->Gspos("S01B",5,"S01M", +AliMUONConstants::Rmin(0)+bpar[0] , 0,+zfpos,
d1cd2474 195 irot1,"ONLY");
b7ef3c96 196 gMC->Gspos("S01B",6,"S01M", -AliMUONConstants::Rmin(0)-bpar[0] , 0,+zfpos,
d1cd2474 197 irot1,"ONLY");
b7ef3c96 198 gMC->Gspos("S01B",7,"S01M", 0, +AliMUONConstants::Rmin(0)+bpar[0] ,+zfpos,
d1cd2474 199 irot2,"ONLY");
b7ef3c96 200 gMC->Gspos("S01B",8,"S01M", 0, -AliMUONConstants::Rmin(0)-bpar[0] ,+zfpos,
d1cd2474 201 irot2,"ONLY");
202
b7ef3c96 203 gMC->Gspos("S02B",1,"S02M", +AliMUONConstants::Rmin(0)+bpar[0] , 0,-zfpos,
d1cd2474 204 irot1,"ONLY");
b7ef3c96 205 gMC->Gspos("S02B",2,"S02M", -AliMUONConstants::Rmin(0)-bpar[0] , 0,-zfpos,
d1cd2474 206 irot1,"ONLY");
b7ef3c96 207 gMC->Gspos("S02B",3,"S02M", 0, +AliMUONConstants::Rmin(0)+bpar[0] ,-zfpos,
d1cd2474 208 irot2,"ONLY");
b7ef3c96 209 gMC->Gspos("S02B",4,"S02M", 0, -AliMUONConstants::Rmin(0)-bpar[0] ,-zfpos,
d1cd2474 210 irot2,"ONLY");
b7ef3c96 211 gMC->Gspos("S02B",5,"S02M", +AliMUONConstants::Rmin(0)+bpar[0] , 0,+zfpos,
d1cd2474 212 irot1,"ONLY");
b7ef3c96 213 gMC->Gspos("S02B",6,"S02M", -AliMUONConstants::Rmin(0)-bpar[0] , 0,+zfpos,
d1cd2474 214 irot1,"ONLY");
b7ef3c96 215 gMC->Gspos("S02B",7,"S02M", 0, +AliMUONConstants::Rmin(0)+bpar[0] ,+zfpos,
d1cd2474 216 irot2,"ONLY");
b7ef3c96 217 gMC->Gspos("S02B",8,"S02M", 0, -AliMUONConstants::Rmin(0)-bpar[0] ,+zfpos,
d1cd2474 218 irot2,"ONLY");
219 }
220//
221// Chamber Material represented by Alu sheet
b7ef3c96 222 tpar[0]= AliMUONConstants::Rmin(0);
223 tpar[1]= AliMUONConstants::Rmax(0);
224 tpar[2] = (kDGas+kDAlu)/2;
d1cd2474 225 gMC->Gsvolu("S01A", "TUBE", idAlu2, tpar, 3);
226 gMC->Gsvolu("S02A", "TUBE",idAlu2, tpar, 3);
227 gMC->Gspos("S01A", 1, "S01M", 0., 0., 0., 0, "ONLY");
228 gMC->Gspos("S02A", 1, "S02M", 0., 0., 0., 0, "ONLY");
229//
230// Sensitive volumes
b7ef3c96 231 // tpar[2] = kDGas;
232 tpar[2] = kDGas/2;
d1cd2474 233 gMC->Gsvolu("S01G", "TUBE", idGas, tpar, 3);
234 gMC->Gsvolu("S02G", "TUBE", idGas, tpar, 3);
235 gMC->Gspos("S01G", 1, "S01A", 0., 0., 0., 0, "ONLY");
236 gMC->Gspos("S02G", 1, "S02A", 0., 0., 0., 0, "ONLY");
237//
238// Frame Crosses to be placed inside gas
239 // NONE: chambers are sensitive everywhere
240// if (frameCrosses) {
241
b7ef3c96 242// dr = (AliMUONConstants::Rmax(0) - AliMUONConstants::Rmin(0));
d1cd2474 243// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
244// bpar[1] = dframep1/2;
b7ef3c96 245// bpar[2] = kDGas/2;
d1cd2474 246// gMC->Gsvolu("S01F", "BOX", idAlu1, bpar, 3);
247// gMC->Gsvolu("S02F", "BOX", idAlu1, bpar, 3);
248
b7ef3c96 249// gMC->Gspos("S01F",1,"S01G", +AliMUONConstants::Rmin(0)+bpar[0] , 0, 0,
d1cd2474 250// irot1,"ONLY");
b7ef3c96 251// gMC->Gspos("S01F",2,"S01G", -AliMUONConstants::Rmin(0)-bpar[0] , 0, 0,
d1cd2474 252// irot1,"ONLY");
b7ef3c96 253// gMC->Gspos("S01F",3,"S01G", 0, +AliMUONConstants::Rmin(0)+bpar[0] , 0,
d1cd2474 254// irot2,"ONLY");
b7ef3c96 255// gMC->Gspos("S01F",4,"S01G", 0, -AliMUONConstants::Rmin(0)-bpar[0] , 0,
d1cd2474 256// irot2,"ONLY");
257
b7ef3c96 258// gMC->Gspos("S02F",1,"S02G", +AliMUONConstants::Rmin(0)+bpar[0] , 0, 0,
d1cd2474 259// irot1,"ONLY");
b7ef3c96 260// gMC->Gspos("S02F",2,"S02G", -AliMUONConstants::Rmin(0)-bpar[0] , 0, 0,
d1cd2474 261// irot1,"ONLY");
b7ef3c96 262// gMC->Gspos("S02F",3,"S02G", 0, +AliMUONConstants::Rmin(0)+bpar[0] , 0,
d1cd2474 263// irot2,"ONLY");
b7ef3c96 264// gMC->Gspos("S02F",4,"S02G", 0, -AliMUONConstants::Rmin(0)-bpar[0] , 0,
d1cd2474 265// irot2,"ONLY");
266// }
267}
268
269//______________________________________________________________________________
270void AliMUONSt1GeometryBuilder::SetTransformations()
271{
5398f946 272/// Define the transformations for the station2 chambers.
d1cd2474 273
b7ef3c96 274 Double_t zpos1= - AliMUONConstants::DefaultChamberZ(0);
275 SetTranslation(0, TGeoTranslation(0., 0., zpos1));
d1cd2474 276
b7ef3c96 277 Double_t zpos2 = - AliMUONConstants::DefaultChamberZ(1);
278 SetTranslation(0, TGeoTranslation(0., 0., zpos2));
d1cd2474 279}
280
281//______________________________________________________________________________
282void AliMUONSt1GeometryBuilder::SetSensitiveVolumes()
283{
5398f946 284/// Define the sensitive volumes for station1 chambers.
d1cd2474 285
e118b27e 286 GetGeometry(0)->SetSensitiveVolume("S01G");
287 GetGeometry(1)->SetSensitiveVolume("S02G");
d1cd2474 288}