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