]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSt2GeometryBuilder.cxx
Fixing RESOURCE_LEAK reported by Coverity
[u/mrichter/AliRoot.git] / MUON / AliMUONSt2GeometryBuilder.cxx
CommitLineData
30178c30 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 AliMUONSt2GeometryBuilder
20// -------------------------------
5f1df83a 21// MUON Station2 coarse geometry construction class.
22// Extracted from AliMUONv1
d6dd7a27 23// Dummy version of station 2 with the right DE id (Ch. Finck)
3d1463c8 24//-----------------------------------------------------------------------------
d1cd2474 25
26#include <TVirtualMC.h>
27#include <TGeoMatrix.h>
17c7d4c9 28#include <TArrayI.h>
d1cd2474 29
e118b27e 30#include "AliLog.h"
31
d1cd2474 32#include "AliMUONSt2GeometryBuilder.h"
33#include "AliMUON.h"
b7ef3c96 34#include "AliMUONConstants.h"
e118b27e 35#include "AliMUONGeometryModule.h"
a432117a 36#include "AliMUONGeometryEnvelopeStore.h"
d1cd2474 37
5398f946 38/// \cond CLASSIMP
d1cd2474 39ClassImp(AliMUONSt2GeometryBuilder)
5398f946 40/// \endcond
d1cd2474 41
42//______________________________________________________________________________
43AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder(AliMUON* muon)
8cf07955 44 : AliMUONVGeometryBuilder(2, 2),
d1cd2474 45 fMUON(muon)
46{
71a2d3aa 47/// Standard constructor
d1cd2474 48
49}
50
51//______________________________________________________________________________
52AliMUONSt2GeometryBuilder::AliMUONSt2GeometryBuilder()
53 : AliMUONVGeometryBuilder(),
54 fMUON(0)
55{
71a2d3aa 56/// Default constructor
d1cd2474 57}
58
59
d1cd2474 60//______________________________________________________________________________
71a2d3aa 61AliMUONSt2GeometryBuilder::~AliMUONSt2GeometryBuilder()
62{
63/// Destructor
d1cd2474 64}
65
d1cd2474 66//
67// public methods
68//
69
70//______________________________________________________________________________
71void AliMUONSt2GeometryBuilder::CreateGeometry()
72{
71a2d3aa 73/// From AliMUONv1::CreateGeometry()
d1cd2474 74
75//
76//********************************************************************
77// Station 2 **
78//********************************************************************
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
d6dd7a27 86 // Int_t idAlu1=idtmed[1103]; // medium 4
87 // Int_t idAlu2=idtmed[1104]; // medium 5
d1cd2474 88 Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
d6dd7a27 89
90 const Float_t kDeltaQuad = 0.01;//2.6; dummy value til we find the good value
91 const Float_t kDeltaZ = 6.5/2.;
d1cd2474 92
93 // Rotation matrices in the x-y plane
94 // phi= 0 deg
95 Int_t irot1;
96 fMUON->AliMatrix(irot1, 90., 0., 90., 90., 0., 0.);
97 // phi= 90 deg
98 Int_t irot2;
99 fMUON->AliMatrix(irot2, 90., 90., 90., 180., 0., 0.);
100
d1cd2474 101 // Half of the total thickness of frame crosses (including DAlu)
102 // for each chamber in stations 1 and 2:
103 // 3% of X0 of composite material,
104 // but taken as Aluminium here, with same thickness in number of X0
d6dd7a27 105 // Float_t dframez = 3. * 8.9 / 100;
d1cd2474 106 // DGas and DAlu not changed from standard values
d6dd7a27 107 // Double_t zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
d1cd2474 108 // The same parameters are defined in builder for station 1
b7ef3c96 109
110 // sensitive gas gap
111 const Float_t kDGas = 0.5;
112
113 // 3% radiation length of aluminum (X0=8.9 cm)
114 // const Float_t kDAlu = 3.5 * 8.9 / 100.;
d1cd2474 115
116 // Mother volume
117 // Outer excess and inner recess for mother volume radius
118 // with respect to ROuter and RInner
d6dd7a27 119 // Float_t dframep=.001; // Value for station 3 should be 6 ...
d1cd2474 120 // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
121 // Float_t dframep1=.001;
d6dd7a27 122 // Float_t phi=2*TMath::Pi()/12/2;
123 // The same parameters are defined in builder for station 1 (30deg)
d1cd2474 124
d6dd7a27 125 Float_t tpar[5];
126 // Double_t dstation = (-iChamber2->Z()) - (-iChamber1->Z());
d1cd2474 127
a432117a 128
d6dd7a27 129 Float_t posx, posy, posz;
d1cd2474 130// Chamber Material represented by Alu sheet
b7ef3c96 131 tpar[0]= AliMUONConstants::Rmin(1);
132 tpar[1]= AliMUONConstants::Rmax(1);
133 tpar[2] = kDGas/2;
d6dd7a27 134 tpar[3] = 0.;
135 tpar[4] = 90.;
136
d1cd2474 137//
138// Sensitive volumes
d6dd7a27 139 gMC->Gsvolu("S03G", "TUBS", idGas, tpar, 5);
140 gMC->Gsvolu("S04G", "TUBS", idGas, tpar, 5);
141
142 Int_t detElemId;
143
144 posx = kDeltaQuad;
145 posy = kDeltaQuad;
146 posz = -kDeltaZ;
147
148 detElemId = 301;
149 gMC->Gsvolu("LE01", "TUBS", idAir, tpar, 5);
150 GetEnvelopes(2)->AddEnvelope("LE01", detElemId, true, TGeoTranslation(posx, posy, posz),
151 TGeoRotation("rot1",90,0,90,90,0,0) );
152 detElemId = 401;
153 gMC->Gsvolu("LF01", "TUBS", idAir, tpar, 5);
154 GetEnvelopes(3)->AddEnvelope("LF01", detElemId, true, TGeoTranslation(posx, posy, posz),
155 TGeoRotation("rot1",90,0,90,90,0,0) );
156 detElemId = 300;
157 gMC->Gsvolu("LE02", "TUBS", idAir, tpar, 5);
158 GetEnvelopes(2)->AddEnvelope("LE02", detElemId, true, TGeoTranslation(-posx, posy,-posz),
159 TGeoRotation("rot2",90,180,90,90,180,0) );
160 detElemId = 400;
161 gMC->Gsvolu("LF02", "TUBS", idAir, tpar, 5);
162 GetEnvelopes(3)->AddEnvelope("LF02", detElemId, true, TGeoTranslation(-posx, posy,-posz),
163 TGeoRotation("rot2",90,180,90,90,180,0) );
164 detElemId = 302;
165 gMC->Gsvolu("LE03", "TUBS", idAir, tpar, 5);
166 GetEnvelopes(2)->AddEnvelope("LE03", detElemId, true, TGeoTranslation(posx, -posy, -posz),
167 TGeoRotation("rot3",90,0,90,270,180,0) );
168 detElemId = 402;
169 gMC->Gsvolu("LF03", "TUBS", idAir, tpar, 5);
170 GetEnvelopes(3)->AddEnvelope("LF03", detElemId, true, TGeoTranslation(posx, -posy, -posz),
171 TGeoRotation("rot3",90,0,90,270,180,0) );
172 detElemId = 303;
173 gMC->Gsvolu("LE04", "TUBS", idAir, tpar, 5);
174 GetEnvelopes(2)->AddEnvelope("LE04", detElemId, true, TGeoTranslation(-posx, -posy, posz),
175 TGeoRotation("rot4",90,180,90,270,0,0) );
176 detElemId = 403;
177 gMC->Gsvolu("LF04", "TUBS", idAir, tpar, 5);
178 GetEnvelopes(3)->AddEnvelope("LF04", detElemId, true, TGeoTranslation(-posx, -posy, posz),
179 TGeoRotation("rot4",90,180,90,270,0,0) );
180
181 GetEnvelopes(2)->AddEnvelopeConstituent("S03G", "LE01", 1);
182 GetEnvelopes(3)->AddEnvelopeConstituent("S04G", "LF01", 1);
183
184 GetEnvelopes(2)->AddEnvelopeConstituent("S03G", "LE02", 2);
185 GetEnvelopes(3)->AddEnvelopeConstituent("S04G", "LF02", 2);
186
187 GetEnvelopes(2)->AddEnvelopeConstituent("S03G", "LE03", 3);
188 GetEnvelopes(3)->AddEnvelopeConstituent("S04G", "LF03", 3);
189
190 GetEnvelopes(2)->AddEnvelopeConstituent("S03G", "LE04", 4);
191 GetEnvelopes(3)->AddEnvelopeConstituent("S04G", "LF04", 4);
d1cd2474 192}
193
194//______________________________________________________________________________
b96f7067 195void AliMUONSt2GeometryBuilder::SetVolumes()
d1cd2474 196{
b96f7067 197/// Defines the volumes for the station2 chambers.
d1cd2474 198
17832c49 199 // Define chamber volumes as virtual
200 SetVolume(2, "SC03", true);
201 SetVolume(3, "SC04", true);
b96f7067 202}
203
204//______________________________________________________________________________
205void AliMUONSt2GeometryBuilder::SetTransformations()
206{
207/// Defines the transformations for the station2 chambers.
17832c49 208
b7ef3c96 209 Double_t zpos1 = - AliMUONConstants::DefaultChamberZ(2);
210 SetTranslation(2, TGeoTranslation(0., 0., zpos1));
d1cd2474 211
b7ef3c96 212 Double_t zpos2 = - AliMUONConstants::DefaultChamberZ(3);
213 SetTranslation(3, TGeoTranslation(0., 0., zpos2));
d1cd2474 214}
215
216//______________________________________________________________________________
217void AliMUONSt2GeometryBuilder::SetSensitiveVolumes()
218{
71a2d3aa 219/// Defines the sensitive volumes for station2 chambers.
d1cd2474 220
e118b27e 221 GetGeometry(2)->SetSensitiveVolume("S03G");
222 GetGeometry(3)->SetSensitiveVolume("S04G");
d1cd2474 223}