Separating run-dependent mapping data from data, which are not
[u/mrichter/AliRoot.git] / MUON / AliMUONSlatGeometryBuilder.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//
2057e0cc 18
3d1463c8 19//-----------------------------------------------------------------------------
71a2d3aa 20/// \class AliMUONSlatGeometryBuilder
21/// This Builder is designed according to the enveloppe methode. The basic idea is to be able to allow moves
22/// of the slats on the support panels.
23/// Those moves can be described with a simple set of parameters. The next step should be now to describe all
24/// the slats and their places by a unique
25/// class, which would make the SlatBuilder far more compact since now only three parameters can define a slat
26/// and its position, like:
27/// - Bool_t rounded_shape_slat
28/// - Float_t slat_length
29/// - Float_t slat_number or Float_t slat_position
30/// Reference system is the one described in the note ALICE-INT-2003-038 v.2 EDMS Id 406391
31///
32/// \author Eric Dumonteil (dumontei@cea.fr)
3d1463c8 33//-----------------------------------------------------------------------------
cd8824a7 34
35#include "AliMUONSlatGeometryBuilder.h"
36#include "AliMUON.h"
37#include "AliMUONConstants.h"
38#include "AliMUONGeometryModule.h"
39#include "AliMUONGeometryEnvelopeStore.h"
40#include "AliMUONConstants.h"
41
42#include "AliMpDEManager.h"
43
44#include "AliRun.h"
45#include "AliLog.h"
2057e0cc 46
d1cd2474 47#include <TVirtualMC.h>
ed6f6d60 48#include <TGeoBBox.h>
49#include <TGeoVolume.h>
50#include <TGeoManager.h>
d1cd2474 51#include <TGeoMatrix.h>
ed6f6d60 52#include <TGeoCompositeShape.h>
53#include <TGeoTube.h>
30178c30 54#include <Riostream.h>
d1cd2474 55
5398f946 56/// \cond CLASSIMP
d1cd2474 57ClassImp(AliMUONSlatGeometryBuilder)
5398f946 58/// \endcond
d1cd2474 59
60//______________________________________________________________________________
61AliMUONSlatGeometryBuilder::AliMUONSlatGeometryBuilder(AliMUON* muon)
cd8824a7 62 : AliMUONVGeometryBuilder(4, 12),
d1cd2474 63 fMUON(muon)
64{
71a2d3aa 65/// Standard constructor
d1cd2474 66
67}
68
69//______________________________________________________________________________
70AliMUONSlatGeometryBuilder::AliMUONSlatGeometryBuilder()
71 : AliMUONVGeometryBuilder(),
72 fMUON(0)
73{
71a2d3aa 74/// Default constructor
d1cd2474 75}
76
d1cd2474 77//______________________________________________________________________________
71a2d3aa 78AliMUONSlatGeometryBuilder::~AliMUONSlatGeometryBuilder()
79{
80/// Destructor
d1cd2474 81}
82
d1cd2474 83//
84// public methods
85//
86
87//______________________________________________________________________________
88void AliMUONSlatGeometryBuilder::CreateGeometry()
89{
71a2d3aa 90 /// CreateGeometry is the method containing all the informations concerning Stations 345 geometry.
91 /// It includes description and placements of support panels and slats.
92 /// The code comes directly from what was written in AliMUONv1.cxx before, with modifications concerning
93 /// the use of Enveloppe method to place the Geant volumes.
94 /// Now, few changes would allow the creation of a Slat methode where slat could be described by few parameters,
95 /// and this builder would then be dedicated only to the
96 /// placements of the slats. Those modifications could shorten the Station 345 geometry by a non-negligeable factor...
d1cd2474 97
e516b01d 98 Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
99
100 Float_t angle;
101 Float_t *dum=0;
102
103 // define the id of tracking media:
cd8824a7 104 // Int_t idAir = idtmed[1100]; // medium 1
e516b01d 105 Int_t idGas = idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
106 Int_t idCopper = idtmed[1110];
107 Int_t idG10 = idtmed[1111];
108 Int_t idCarbon = idtmed[1112];
109 Int_t idRoha = idtmed[1113];
110 Int_t idNomex = idtmed[1114]; // honey comb
111 Int_t idNoryl = idtmed[1115];
112 Int_t idNomexB = idtmed[1116]; // bulk material
ed6f6d60 113
114 // Getting mediums for pannel support geometry
115 TGeoMedium* kMedNomex = gGeoManager->GetMedium("MUON_Nomex");
116 TGeoMedium* kMedCarbon = gGeoManager->GetMedium("MUON_CARBON");
e516b01d 117
118 // sensitive area: 40*40 cm**2
119 const Float_t kSensLength = 40.;
120 const Float_t kSensHeight = 40.;
1c334adf 121 const Float_t kSensWidth = AliMUONConstants::Pitch()*2;// 0.5 cm, according to TDR fig 2.120
e516b01d 122 const Int_t kSensMaterial = idGas;
123 // const Float_t kYoverlap = 1.5;
124
125 // PCB dimensions in cm; width: 30 mum copper
126 const Float_t kPcbLength = kSensLength;
127 const Float_t kPcbHeight = 58.; // updated Ch. Finck
128 const Float_t kPcbWidth = 0.003;
129 const Int_t kPcbMaterial = idCopper;
130
131 // Insulating material: 220 mum G10 fiber glued to pcb
132 const Float_t kInsuLength = kPcbLength;
133 const Float_t kInsuHeight = kPcbHeight;
134 const Float_t kInsuWidth = 0.022; // updated Ch. Finck
135 const Int_t kInsuMaterial = idG10;
136
137 // Carbon fiber panels: 200mum carbon/epoxy skin
138 const Float_t kCarbonWidth = 0.020;
139 const Int_t kCarbonMaterial = idCarbon;
140
141 // Nomex (honey comb) between the two panel carbon skins
142 const Float_t kNomexLength = kSensLength;
143 const Float_t kNomexHeight = kSensHeight;
144 const Float_t kNomexWidth = 0.8; // updated Ch. Finck
145 const Int_t kNomexMaterial = idNomex;
146
147 // Bulk Nomex under panel sandwich Ch. Finck
148 const Float_t kNomexBWidth = 0.025;
149 const Int_t kNomexBMaterial = idNomexB;
150
151 // Panel sandwich 0.02 carbon*2 + 0.8 nomex
152 const Float_t kPanelLength = kSensLength;
153 const Float_t kPanelHeight = kSensHeight;
154 const Float_t kPanelWidth = 2 * kCarbonWidth + kNomexWidth;
155
f4a7360f 156 // Frame along the rounded (spacers) slats
157 const Float_t kRframeHeight = 2.00;
158
e516b01d 159 // spacer around the slat: 2 sticks along length,2 along height
160 // H: the horizontal ones
161 const Float_t kHframeLength = kPcbLength;
162 const Float_t kHframeHeight = 1.95; // updated Ch. Finck
163 const Float_t kHframeWidth = kSensWidth;
164 const Int_t kHframeMaterial = idNoryl;
165
166 // V: the vertical ones; vertical spacers
167 const Float_t kVframeLength = 2.5;
168 const Float_t kVframeHeight = kSensHeight + kHframeHeight;
169 const Float_t kVframeWidth = kSensWidth;
170 const Int_t kVframeMaterial = idNoryl;
171
253d1046 172 // R: rounded part of vertical spacers
173 const Float_t kRframeLength = 2.0;
174 const Float_t kRframeWidth = kSensWidth;
175 const Int_t kRframeMaterial = idNoryl;
176
e516b01d 177 // B: the horizontal border filled with rohacell: ok Ch. Finck
178 const Float_t kBframeLength = kHframeLength;
179 const Float_t kBframeHeight = (kPcbHeight - kSensHeight)/2. - kHframeHeight;
180 const Float_t kBframeWidth = kHframeWidth;
181 const Int_t kBframeMaterial = idRoha;
182
183 // NULOC: 30 mum copper + 200 mum vetronite (same radiation length as 14mum copper) for electronics
184 const Float_t kNulocLength = 2.5;
185 const Float_t kNulocHeight = kBframeHeight;
186 const Float_t kNulocWidth = 0.0030 + 0.0014; // equivalent copper width of vetronite;
187 const Int_t kNulocMaterial = idCopper;
188
253d1046 189 // Readout cables: Equivalent to 260 mum copper
190 const Float_t kCableHeight = 2.6;
191 const Float_t kCableWidth = 0.026;
192 const Int_t kCableMaterial = idCopper;
193
e516b01d 194 // Slat parameters
195 const Float_t kSlatHeight = kPcbHeight;
196 const Float_t kSlatWidth = kSensWidth + 2.*(kPcbWidth + kInsuWidth + kPanelWidth
197 + kNomexBWidth); //replaced rohacell with Nomex Ch. Finck
eb1c3e3a 198 // const Int_t kSlatMaterial = idAir;
e516b01d 199 const Float_t kDslatLength = -1.25; // position of the slat respect to the beam plane (half vertical spacer) Ch. Finck
200 Float_t zSlat = AliMUONConstants::DzSlat();// implemented Ch. Finck
201 Float_t dzCh = AliMUONConstants::DzCh();
202
203 Float_t spar[3];
204 Int_t i, j;
205 Int_t detElemId;
cd8824a7 206 Int_t moduleId;
e516b01d 207
208 // the panel volume contains the nomex
209 Float_t panelpar[3] = { kPanelLength/2., kPanelHeight/2., kPanelWidth/2. };
210 Float_t nomexpar[3] = { kNomexLength/2., kNomexHeight/2., kNomexWidth/2. };
211 Float_t twidth = kPanelWidth + kNomexBWidth;
212 Float_t nomexbpar[3] = {kNomexLength/2., kNomexHeight/2.,twidth/2. };// bulk nomex
213
214 // insulating material contains PCB-> gas
215 twidth = 2*(kInsuWidth + kPcbWidth) + kSensWidth ;
216 Float_t insupar[3] = {kInsuLength/2., kInsuHeight/2., twidth/2. };
217 twidth -= 2 * kInsuWidth;
218 Float_t pcbpar[3] = {kPcbLength/2., kPcbHeight/2., twidth/2. };
219 Float_t senspar[3] = {kSensLength/2., kSensHeight/2., kSensWidth/2. };
220 Float_t theight = 2 * kHframeHeight + kSensHeight;
221 Float_t hFramepar[3] = {kHframeLength/2., theight/2., kHframeWidth/2.};
222 Float_t bFramepar[3] = {kBframeLength/2., kBframeHeight/2., kBframeWidth/2.};
223 Float_t vFramepar[3] = {kVframeLength/2., kVframeHeight/2., kVframeWidth/2.};
224 Float_t nulocpar[3] = {kNulocLength/2., kNulocHeight/2., kNulocWidth/2.};
225
226 Float_t xx;
227 Float_t xxmax = (kBframeLength - kNulocLength)/2.;
228 Int_t index=0;
e516b01d 229 Int_t* fStations = new Int_t[5];
c0bd5e65 230 for (Int_t iSt=0; iSt<5; iSt++) fStations[iSt] = 1;
e516b01d 231 fStations[2] = 1;
232
233 if (fStations[2])
d1cd2474 234 {
e516b01d 235 //********************************************************************
e118b27e 236 // Station 3 **
237 //********************************************************************
cd8824a7 238 // Mother volume for each chamber in St3 is an envelop (or assembly)
239 // There is one assembly mother per half a chamber
240 // Mother volume for each chamber in St3 is an envelop (or assembly)
241 // There is one assembly mother per half a chamber called SC05I, SC05O, SC06I and SC06O
e516b01d 242 // volumes for slat geometry (xx=5,..,10 chamber id):
243 // Sxx0 Sxx1 Sxx2 Sxx3 --> Slat Mother volumes
244 // SxxG --> Sensitive volume (gas)
245 // SxxP --> PCB (copper)
246 // SxxI --> Insulator (G10)
247 // SxxC --> Carbon panel
248 // SxxN --> Nomex comb
249 // SxxX --> Nomex bulk
250 // SxxH, SxxV --> Horizontal and Vertical frames (Noryl)
251 // SB5x --> Volumes for the 35 cm long PCB
252 // slat dimensions: slat is a MOTHER volume!!! made of air
cd8824a7 253 // Only for chamber 5: slat 1 has a PCB shorter by 5cm!
e516b01d 254
255 Float_t tlength = 35.;
256 Float_t panelpar2[3] = { tlength/2., panelpar[1], panelpar[2]};
257 Float_t nomexpar2[3] = { tlength/2., nomexpar[1], nomexpar[2]};
258 Float_t nomexbpar2[3] = { tlength/2., nomexbpar[1], nomexbpar[2]};
259 Float_t insupar2[3] = { tlength/2., insupar[1], insupar[2]};
260 Float_t pcbpar2[3] = { tlength/2., pcbpar[1], pcbpar[2]};
261 Float_t senspar2[3] = { tlength/2., senspar[1], senspar[2]};
262 Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]};
263 Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]};
e516b01d 264 Float_t pcbDLength3 = (kPcbLength - tlength);
253d1046 265
266 // For rounded pcb of central slat
267 Float_t csvPcbLength = 59.25-40.; // PQ-LAT-SR1
268 Float_t panelpar3[3] = { csvPcbLength/2., panelpar[1], panelpar[2]};
269 Float_t nomexpar3[3] = { csvPcbLength/2., nomexpar[1], nomexpar[2]};
270 Float_t nomexbpar3[3] = { csvPcbLength/2., nomexbpar[1], nomexbpar[2]};
271 Float_t insupar3[3] = { csvPcbLength/2., insupar[1], insupar[2]};
272 Float_t pcbpar3[3] = { csvPcbLength/2., pcbpar[1], pcbpar[2]};
273 Float_t senspar3[3] = { csvPcbLength/2., senspar[1], senspar[2]};
274 Float_t hFramepar3[3] = { csvPcbLength/2., hFramepar[1], hFramepar[2]};
275 Float_t bFramepar3[3] = { csvPcbLength/2., bFramepar[1], bFramepar[2]};
276 Float_t cPhi = TMath::RadToDeg()*(TMath::Pi()/2.-TMath::ACos(hFramepar3[1]/(AliMUONConstants::Rmin(2)-kRframeLength)));
277 Float_t cFramepar3[5] = { AliMUONConstants::Rmin(2)-kRframeLength, AliMUONConstants::Rmin(2), kRframeWidth, -cPhi, cPhi};
e516b01d 278
279 const Int_t kNslats3 = 5; // number of slats per quadrant
280 const Int_t kNPCB3[kNslats3] = {4, 4, 4, 3, 2}; // n PCB per slat
281 const Float_t kXpos3[kNslats3] = {0., 0., 0., 0., 0.};//{31., 0., 0., 0., 0.};
282 const Float_t kYpos3[kNslats3] = {0, 37.8, 37.7, 37.3, 33.7};
283 Float_t slatLength3[kNslats3];
284
253d1046 285 Float_t rPhi1 = TMath::RadToDeg()*(TMath::ASin((kYpos3[1]-hFramepar3[1])/(AliMUONConstants::Rmin(2))));
286 Float_t rPhi2 = TMath::RadToDeg()*(TMath::ACos(-vFramepar[0]/(AliMUONConstants::Rmin(2)-kRframeLength)));
287 Float_t rFramepar3[5] = { AliMUONConstants::Rmin(2)-kRframeLength, AliMUONConstants::Rmin(2), kRframeWidth, rPhi1, rPhi2};
288 Float_t vrFrameHeight = hFramepar3[1]+kYpos3[1]-AliMUONConstants::Rmin(2)+kRframeLength;
289
e516b01d 290 // create and position the slat (mother) volumes
291
292 char idSlatCh5[5];
293 char idSlatCh6[5];
294 Float_t xSlat3;
295 Float_t ySlat3 = 0;
c0bd5e65 296 angle = 0.;
297
e516b01d 298 Float_t spar2[3];
299 for (i = 0; i < kNslats3; i++){
300
301 slatLength3[i] = kPcbLength * kNPCB3[i] + 2.* kVframeLength;
302 xSlat3 = slatLength3[i]/2. + kDslatLength + kXpos3[i];
303 ySlat3 += kYpos3[i];
304
305 spar[0] = slatLength3[i]/2.;
306 spar[1] = kSlatHeight/2.;
307 spar[2] = kSlatWidth/2.;
308 // take away 5 cm from the first slat in chamber 5
7ddb761c 309 if (i == 0 || i == 1 || i == 2) { // 1 pcb is shortened by 5cm
e516b01d 310 spar2[0] = spar[0] - pcbDLength3/2.;
311 } else {
312 spar2[0] = spar[0];
313 }
314 spar2[1] = spar[1];
315 spar2[2] = spar[2];
316 Float_t dzCh3 = dzCh;
50eaffbd 317 Float_t dzSlat3 = -0.25; // see drawing PQ7EN345-6 (Delta_slat=80mm instead 85mm)
318 Float_t zSlat3 = (i%2 ==0)? -(zSlat+dzSlat3) : (zSlat+dzSlat3); // seems not that zSlat3 = zSlat4 & 5 refering to plan PQ7EN345-6 ? -> Indeed, fixed J.C.
e516b01d 319
e856ab99 320 sprintf(idSlatCh5,"LA%d",i+kNslats3-1);
e856ab99 321 detElemId = 509 - (i + kNslats3-1-4);
cd8824a7 322 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 323 if (detElemId % 2 == 0)
324 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(xSlat3, ySlat3, -zSlat3 + dzCh3),
325 TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
326 else
327 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(xSlat3, ySlat3, -zSlat3 + dzCh3),
328 TGeoRotation("rot1",90,angle,90,270+angle,180,0) );
e516b01d 329
330 sprintf(idSlatCh5,"LA%d",3*kNslats3-2+i);
e856ab99 331 detElemId = 500 + (i + kNslats3-1-4);
cd8824a7 332 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 333 if (detElemId % 2 == 0)
334 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(-xSlat3, ySlat3, zSlat3 - dzCh3),
335 TGeoRotation("rot2",90,180+angle,90,270+angle,0,0) );
336 else
337 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(-xSlat3, ySlat3, zSlat3 - dzCh3),
338 TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
cd8824a7 339
e516b01d 340 if (i > 0) {
341 sprintf(idSlatCh5,"LA%d",kNslats3-1-i);
e856ab99 342 detElemId = 509 + (i + kNslats3-1-4);
cd8824a7 343 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 344 if (detElemId % 2 == 0 && detElemId != 510)
345 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(xSlat3, -ySlat3, -zSlat3 + dzCh3),
346 TGeoRotation("rot3",90,angle,90,90+angle,0,0) );
347 else
348 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(xSlat3, -ySlat3, -zSlat3 + dzCh3),
349 TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
e516b01d 350
351 sprintf(idSlatCh5,"LA%d",3*kNslats3-2-i);
e856ab99 352 detElemId = 518 - (i + kNslats3-1-4);
cd8824a7 353 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 354 if (detElemId % 2 == 1 && detElemId != 517)
355 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(-xSlat3, -ySlat3, zSlat3 - dzCh3),
356 TGeoRotation("rot4",90,180+angle,90,90+angle,180,0) );
357 else
358 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh5, detElemId, true, TGeoTranslation(-xSlat3, -ySlat3, zSlat3 - dzCh3),
359 TGeoRotation("rot4",90,180+angle,90,270+angle,0,0) );
e516b01d 360 }
361
362 sprintf(idSlatCh6,"LB%d",kNslats3-1+i);
e856ab99 363 detElemId = 609 - (i + kNslats3-1-4);
cd8824a7 364 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 365 if (detElemId % 2 == 0)
366 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(xSlat3, ySlat3, -zSlat3 + dzCh3),
e516b01d 367 TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
5fa6d4cf 368 else
369 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(xSlat3, ySlat3, -zSlat3 + dzCh3),
370 TGeoRotation("rot5",90,angle,90,270+angle,180,0) );
cd8824a7 371
e516b01d 372 sprintf(idSlatCh6,"LB%d",3*kNslats3-2+i);
e856ab99 373 detElemId = 600 + (i + kNslats3-1-4);
cd8824a7 374 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 375 if (detElemId % 2 == 0)
376 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(-xSlat3, ySlat3, zSlat3 - dzCh3),
377 TGeoRotation("rot6",90,180+angle,90,270+angle,0,0) );
378 else
379 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(-xSlat3, ySlat3, zSlat3 - dzCh3),
380 TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
cd8824a7 381
e516b01d 382 if (i > 0) {
383 sprintf(idSlatCh6,"LB%d",kNslats3-1-i);
e856ab99 384 detElemId = 609 + (i + kNslats3-1-4);
cd8824a7 385 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 386 if (detElemId % 2 == 0 && detElemId != 610)
387 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(xSlat3, -ySlat3, -zSlat3 + dzCh3),
388 TGeoRotation("rot7",90,angle,90,90+angle,0,0) );
389 else
390 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(xSlat3, -ySlat3, -zSlat3 + dzCh3),
391 TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
e516b01d 392 sprintf(idSlatCh6,"LB%d",3*kNslats3-2-i);
e856ab99 393 detElemId = 618 - (i + kNslats3-1-4);
cd8824a7 394 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 395 if (detElemId % 2 == 1 && detElemId != 617)
396 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(-xSlat3, -ySlat3, zSlat3 - dzCh3),
397 TGeoRotation("rot8",90,180+angle,90,90+angle,180,0) );
398 else
399 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh6, detElemId, true, TGeoTranslation(-xSlat3, -ySlat3, zSlat3 - dzCh3),
400 TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
e516b01d 401 }
402 }
d1cd2474 403
e516b01d 404 // create the panel volume
d1cd2474 405
e516b01d 406 gMC->Gsvolu("S05C","BOX",kCarbonMaterial,panelpar,3);
407 gMC->Gsvolu("SB5C","BOX",kCarbonMaterial,panelpar2,3);
253d1046 408 gMC->Gsvolu("SC5C","BOX",kCarbonMaterial,panelpar3,3);
409 gMC->Gsvolu("SD5C","BOX",kCarbonMaterial,panelpar,3);
e516b01d 410 gMC->Gsvolu("S06C","BOX",kCarbonMaterial,panelpar,3);
253d1046 411 gMC->Gsvolu("SC6C","BOX",kCarbonMaterial,panelpar3,3);
412 gMC->Gsvolu("SD6C","BOX",kCarbonMaterial,panelpar,3);
4846c3ab 413
e516b01d 414 // create the nomex volume (honey comb)
d1cd2474 415
e516b01d 416 gMC->Gsvolu("S05N","BOX",kNomexMaterial,nomexpar,3);
417 gMC->Gsvolu("SB5N","BOX",kNomexMaterial,nomexpar2,3);
253d1046 418 gMC->Gsvolu("SC5N","BOX",kNomexMaterial,nomexpar3,3);
419 gMC->Gsvolu("SD5N","BOX",kNomexMaterial,nomexpar,3);
e516b01d 420 gMC->Gsvolu("S06N","BOX",kNomexMaterial,nomexpar,3);
253d1046 421 gMC->Gsvolu("SC6N","BOX",kNomexMaterial,nomexpar3,3);
422 gMC->Gsvolu("SD6N","BOX",kNomexMaterial,nomexpar,3);
4846c3ab 423
e516b01d 424 // create the nomex volume (bulk)
425
426 gMC->Gsvolu("S05X","BOX",kNomexBMaterial,nomexbpar,3);
427 gMC->Gsvolu("SB5X","BOX",kNomexBMaterial,nomexbpar2,3);
253d1046 428 gMC->Gsvolu("SC5X","BOX",kNomexBMaterial,nomexbpar3,3);
429 gMC->Gsvolu("SD5X","BOX",kNomexBMaterial,nomexbpar,3);
e516b01d 430 gMC->Gsvolu("S06X","BOX",kNomexBMaterial,nomexbpar,3);
253d1046 431 gMC->Gsvolu("SC6X","BOX",kNomexBMaterial,nomexbpar3,3);
432 gMC->Gsvolu("SD6X","BOX",kNomexBMaterial,nomexbpar,3);
d1cd2474 433
e516b01d 434 // create the insulating material volume
435
436 gMC->Gsvolu("S05I","BOX",kInsuMaterial,insupar,3);
437 gMC->Gsvolu("SB5I","BOX",kInsuMaterial,insupar2,3);
253d1046 438 gMC->Gsvolu("SC5I","BOX",kInsuMaterial,insupar3,3);
439 gMC->Gsvolu("SD5I","BOX",kInsuMaterial,insupar,3);
e516b01d 440 gMC->Gsvolu("S06I","BOX",kInsuMaterial,insupar,3);
253d1046 441 gMC->Gsvolu("SC6I","BOX",kInsuMaterial,insupar3,3);
442 gMC->Gsvolu("SD6I","BOX",kInsuMaterial,insupar,3);
4846c3ab 443
e516b01d 444 // create the PCB volume
d1cd2474 445
e516b01d 446 gMC->Gsvolu("S05P","BOX",kPcbMaterial,pcbpar,3);
447 gMC->Gsvolu("SB5P","BOX",kPcbMaterial,pcbpar2,3);
253d1046 448 gMC->Gsvolu("SC5P","BOX",kPcbMaterial,pcbpar3,3);
449 gMC->Gsvolu("SD5P","BOX",kPcbMaterial,pcbpar,3);
e516b01d 450 gMC->Gsvolu("S06P","BOX",kPcbMaterial,pcbpar,3);
253d1046 451 gMC->Gsvolu("SC6P","BOX",kPcbMaterial,pcbpar3,3);
452 gMC->Gsvolu("SD6P","BOX",kPcbMaterial,pcbpar,3);
d1cd2474 453
e516b01d 454 // create the sensitive volumes,
4846c3ab 455
e516b01d 456 gMC->Gsvolu("S05G","BOX",kSensMaterial,dum,0);
253d1046 457 gMC->Gsvolu("SC5G","BOX",kSensMaterial,senspar3,3);
458 gMC->Gsvolu("SD5G","BOX",kSensMaterial,senspar,3);
e516b01d 459 gMC->Gsvolu("S06G","BOX",kSensMaterial,dum,0);
253d1046 460 gMC->Gsvolu("SC6G","BOX",kSensMaterial,senspar3,3);
461 gMC->Gsvolu("SD6G","BOX",kSensMaterial,senspar,3);
d1cd2474 462
e516b01d 463 // create the vertical frame volume
d1cd2474 464
e516b01d 465 gMC->Gsvolu("S05V","BOX",kVframeMaterial,vFramepar,3);
466 gMC->Gsvolu("S06V","BOX",kVframeMaterial,vFramepar,3);
d1cd2474 467
253d1046 468 // create the rounded vertical frame volume
469
470 gMC->Gsvolu("SC5D","TUBS",kRframeMaterial,cFramepar3,5);
471 gMC->Gsvolu("SD5D","TUBS",kRframeMaterial,rFramepar3,5);
472 gMC->Gsvolu("SC6D","TUBS",kRframeMaterial,cFramepar3,5);
473 gMC->Gsvolu("SD6D","TUBS",kRframeMaterial,rFramepar3,5);
474
e516b01d 475 // create the horizontal frame volume
d1cd2474 476
e516b01d 477 gMC->Gsvolu("S05H","BOX",kHframeMaterial,hFramepar,3);
478 gMC->Gsvolu("SB5H","BOX",kHframeMaterial,hFramepar2,3);
253d1046 479 gMC->Gsvolu("SC5H","BOX",kHframeMaterial,hFramepar3,3);
480 gMC->Gsvolu("SD5H","BOX",kHframeMaterial,hFramepar,3);
e516b01d 481 gMC->Gsvolu("S06H","BOX",kHframeMaterial,hFramepar,3);
253d1046 482 gMC->Gsvolu("SC6H","BOX",kHframeMaterial,hFramepar3,3);
483 gMC->Gsvolu("SD6H","BOX",kHframeMaterial,hFramepar,3);
4846c3ab 484
e516b01d 485 // create the horizontal border volume
d1cd2474 486
e516b01d 487 gMC->Gsvolu("S05B","BOX",kBframeMaterial,bFramepar,3);
488 gMC->Gsvolu("SB5B","BOX",kBframeMaterial,bFramepar2,3);
253d1046 489 gMC->Gsvolu("SC5B","BOX",kBframeMaterial,bFramepar3,3);
490 gMC->Gsvolu("SD5B","BOX",kBframeMaterial,bFramepar,3);
e516b01d 491 gMC->Gsvolu("S06B","BOX",kBframeMaterial,bFramepar,3);
253d1046 492 gMC->Gsvolu("SC6B","BOX",kBframeMaterial,bFramepar3,3);
493 gMC->Gsvolu("SD6B","BOX",kBframeMaterial,bFramepar,3);
494
495 // Replace the volume shape with a composite shape
496 // with substracted overlap with beam shield
497 if ( gMC->IsRootGeometrySupported() ) {
498
499 // Get shape
500 Int_t nSlatType = 2;
501 Int_t nVol = 8;
b2f96010 502 const char* slatType = "CD"; // C: central slat; D: rounded slat
503 const char* volLetter = "CNXIPHBG";
504 TString volName;
505 TString compName;
506 TString csName;
253d1046 507 TGeoVolume *mVol = 0x0;
c15bef4d 508 TObjArray centerSlat(nSlatType*((nVol+1)*2));
509 TObjArray composite(nSlatType*((nVol+1)*2));
510
253d1046 511 // Beam shield recess
253d1046 512 new TGeoTube("tubeCut", 0., AliMUONConstants::Rmin(2), kSlatWidth/2.+0.001);
513 // Displacement
514 TGeoTranslation* trCTube = new TGeoTranslation("trCTube", -(kPcbLength-csvPcbLength/2.+kVframeLength/2.), 0., 0.);
515 trCTube->RegisterYourself();
516 TGeoTranslation* trDTube = new TGeoTranslation("trDTube", -(kPcbLength+kVframeLength)/2., -kYpos3[1], 0.);
517 trDTube->RegisterYourself();
71db1057 518 TGeoTranslation* trCBTube = new TGeoTranslation("trCBTube", 0., ( kPcbHeight - kBframeHeight ) / 2., 0.);
519 trCBTube->Add(trCTube);
520 trCBTube->RegisterYourself();
521 TGeoTranslation* trDBTube = new TGeoTranslation("trDBTube", 0., ( kPcbHeight - kBframeHeight ) / 2., 0.);
522 trDBTube->Add(trDTube);
523 trDBTube->RegisterYourself();
253d1046 524
525 Float_t cPhi2 = (TMath::Pi()/2.-TMath::ACos((kSensHeight/2.)/(AliMUONConstants::Rmin(2)-kRframeLength)));
526 TGeoBBox *boxCCut = new TGeoBBox("boxCCut",(cFramepar3[1]-cFramepar3[0]*TMath::Cos(cPhi2))/2., hFramepar3[1], cFramepar3[2]+0.001);
527 // Displacement
528 TGeoTranslation* trCBox = new TGeoTranslation("trCBox",cFramepar3[0]*TMath::Cos(cPhi2)+boxCCut->GetDX(), 0., 0.);
529 trCBox->RegisterYourself();
253d1046 530 new TGeoBBox("boxDCut",(kPcbLength+kVframeLength)/2., hFramepar3[1], vFramepar[2]+0.001);
531 // Displacement
532 TGeoTranslation* trDBox = new TGeoTranslation("trDBox",kPcbLength/2., kYpos3[1], 0.);
533 trDBox->RegisterYourself();
534
535 TGeoBBox *boxVframe = new TGeoBBox("boxVframe",vFramepar[0],vrFrameHeight/2., vFramepar[2]);
536 TGeoTranslation* trVBox = new TGeoTranslation("trVBox", 0., AliMUONConstants::Rmin(2)-kRframeLength + boxVframe->GetDY(), 0.);
537 trVBox->RegisterYourself();
538
539 for(int iCh=5; iCh<=6; iCh++){
540 for (int iSlatType = 0; iSlatType<nSlatType; iSlatType++) {
541 for (int iVol = 0; iVol<nVol; iVol++){
542 Int_t lIndex = (iCh-5)*(nSlatType*(nVol+1))+iSlatType*(nVol+1)+iVol;
b2f96010 543 volName=Form("S%c%d%c",slatType[iSlatType],iCh,volLetter[iVol]);
253d1046 544 mVol = gGeoManager->FindVolumeFast(volName);
545 if ( !mVol ) {
546 AliErrorStream()
547 << "Slat volume " << volName << " not found" << endl;
548 }
549 else {
550 centerSlat[lIndex] = mVol->GetShape();
b2f96010 551 csName=Form("centerSlat%c%d%c",slatType[iSlatType],iCh,volLetter[iVol]);
c15bef4d 552 ((TGeoShape*)centerSlat[lIndex])->SetName(csName);
553
253d1046 554 // Composite shape
555 TString compOperation(csName);
556 compOperation+="-tubeCut:tr";
557 compOperation+=slatType[iSlatType];
253d1046 558 if (strstr(volName,"B")){
71db1057 559 compOperation+="B";
253d1046 560 }
71db1057 561 compOperation+="Tube";
b2f96010 562 compName=Form("composite%d%c",iCh,volLetter[iVol]);
253d1046 563 composite[lIndex] = new TGeoCompositeShape(compName, compOperation.Data());
564
565 // Reset shape to volume
c15bef4d 566 mVol->SetShape((TGeoShape*)composite[lIndex]);
253d1046 567 }
568 }
569
570 // For rounded spacer
571 Int_t lIndex = (iCh-5)*(nSlatType*(nVol+1))+iSlatType*(nVol+1)+nVol;
b2f96010 572 volName=Form("S%c%dD",slatType[iSlatType],iCh);
253d1046 573 mVol = gGeoManager->FindVolumeFast(volName);
574 if ( !mVol ) {
575 AliErrorStream()
576 << "Slat volume " << volName << " not found" << endl;
577 }
578 else {
579 centerSlat[lIndex] = mVol->GetShape();
b2f96010 580 csName=Form("centerSlat%c%dD",slatType[iSlatType],iCh);
c15bef4d 581 ((TGeoShape*)centerSlat[lIndex])->SetName(csName);
253d1046 582
583 // Composite shape
584 TString compOperation(csName);
585 if (strstr(volName,"SC")){
586 compOperation+="*boxCCut:trCBox";
587 }
588 if (strstr(volName,"SD")){
589 compOperation.Prepend("(");
590 compOperation+="+boxVframe:trVBox)*boxDCut:trDBox";
591 }
b2f96010 592 compName=Form("composite%c%dD",slatType[iSlatType],iCh);
253d1046 593 composite[lIndex] = new TGeoCompositeShape(compName, compOperation.Data());
594 // Reset shape to volume
c15bef4d 595 mVol->SetShape((TGeoShape*)composite[lIndex]);
253d1046 596 }
597 }
598 }
599 }
600
e516b01d 601 index = 0;
602 for (i = 0; i<kNslats3; i++){
603 for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
604
605 if (i == 0 && quadrant == 2) continue;
606 if (i == 0 && quadrant == 4) continue;
607
608 sprintf(idSlatCh5,"LA%d",ConvertSlatNum(i,quadrant,kNslats3-1));
609 sprintf(idSlatCh6,"LB%d",ConvertSlatNum(i,quadrant,kNslats3-1));
cd8824a7 610 Int_t moduleSlatCh5 = GetModuleId(idSlatCh5);
611 Int_t moduleSlatCh6 = GetModuleId(idSlatCh6);
e516b01d 612 Float_t xvFrame = (slatLength3[i] - kVframeLength)/2.;
253d1046 613 Float_t xvFrame2 = xvFrame;
e516b01d 614
253d1046 615 if (i == 0 || i == 1 || i == 2) xvFrame2 -= pcbDLength3; // Correct position (J.C.)
e516b01d 616
617 // position the vertical frames
618 if ( i > 2) {
cd8824a7 619 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("S05V", idSlatCh5,
e516b01d 620 (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
cd8824a7 621 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("S05V", idSlatCh5,
e516b01d 622 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
cd8824a7 623 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("S06V", idSlatCh6,
e516b01d 624 (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
cd8824a7 625 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("S06V", idSlatCh6,
e516b01d 626 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
627 }
628
629 if (i == 2) {
cd8824a7 630 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("S05V", idSlatCh5,
253d1046 631 (2*i-1)*10+quadrant,TGeoTranslation(xvFrame2,0.,0.));
cd8824a7 632 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("S05V", idSlatCh5,
e516b01d 633 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
cd8824a7 634 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("S06V", idSlatCh6,
e516b01d 635 (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
cd8824a7 636 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("S06V", idSlatCh6,
e516b01d 637 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
638 }
639
253d1046 640 if (i == 0 || i == 1) { // first vertical spacers
cd8824a7 641 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("S05V", idSlatCh5,
253d1046 642 (2*i-1)*10+quadrant,TGeoTranslation(xvFrame2,0.,0.));
643 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("S06V", idSlatCh6,
644 (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
645 if (i == 0) { // rounded spacer for central slat (J.C.)
646 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SC5D", idSlatCh5,
647 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
648 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("SC6D", idSlatCh6,
649 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
650
651 }
652 if (i == 1) { // rounded + vertical spacer for rounded slat (J.C.)
653 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SD5D", idSlatCh5,
654 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,-kYpos3[1],0.));
655 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("SD6D", idSlatCh6,
656 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,-kYpos3[1],0.));
657 }
e516b01d 658 }
659
660 // position the panels and the insulating material
661 for (j = 0; j < kNPCB3[i]; j++){
e516b01d 662 index++;
c0bd5e65 663 xx = kSensLength * (-kNPCB3[i]/2. + j + 0.5);
e516b01d 664 Float_t xx2 = xx - pcbDLength3/2.;
253d1046 665 Float_t xx3 = xx + (kSensLength-csvPcbLength)/2.;
666
e516b01d 667 Float_t zPanel = spar[2] - nomexbpar[2];
668
253d1046 669 if (i==0 && j==0){ // Rounded pcb of central slat (SR1, NR1)
670 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SC5X", idSlatCh5, 2*index-1,TGeoTranslation(xx3,0.,zPanel));
671 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SC5X", idSlatCh5, 2*index,TGeoTranslation(xx3,0.,-zPanel));
672 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SC5I", idSlatCh5, index,TGeoTranslation(xx3,0.,0.));
673 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("SC6X", idSlatCh6, 2*index-1,TGeoTranslation(xx3,0.,zPanel));
674 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("SC6X", idSlatCh6, 2*index,TGeoTranslation(xx3,0.,-zPanel));
675 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("SC6I", idSlatCh6, index,TGeoTranslation(xx3,0.,0.));
676 } else {
677 if (i==1 && j==0){ // Rounded pcb of rounded slats (SR2. NR2)
678 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SD5X", idSlatCh5, 2*index-1,TGeoTranslation(xx,0.,zPanel));
679 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SD5X", idSlatCh5, 2*index,TGeoTranslation(xx,0.,-zPanel));
680 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SD5I", idSlatCh5, index,TGeoTranslation(xx,0.,0.));
681 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("SD6X", idSlatCh6, 2*index-1,TGeoTranslation(xx,0.,zPanel));
682 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("SD6X", idSlatCh6, 2*index,TGeoTranslation(xx,0.,-zPanel));
683 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("SD6I", idSlatCh6, index,TGeoTranslation(xx,0.,0.));
684 } else {
685 if ( (i == 0 || i == 1 || i == 2) && j == kNPCB3[i]-1) { // 1 pcb is shortened by 5cm
686 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SB5X", idSlatCh5, 2*index-1,TGeoTranslation(xx2,0.,zPanel));
687 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SB5X", idSlatCh5, 2*index,TGeoTranslation(xx2,0.,-zPanel));
688 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("SB5I", idSlatCh5, index,TGeoTranslation(xx2,0.,0.));
689 } else {
690 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("S05X", idSlatCh5, 2*index-1,TGeoTranslation(xx,0.,zPanel));
691 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("S05X", idSlatCh5, 2*index,TGeoTranslation(xx,0.,-zPanel));
692 GetEnvelopes(moduleSlatCh5)->AddEnvelopeConstituent("S05I", idSlatCh5, index,TGeoTranslation(xx,0.,0.));
693 }
694 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("S06X", idSlatCh6, 2*index-1,TGeoTranslation(xx,0.,zPanel));
695 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("S06X", idSlatCh6, 2*index,TGeoTranslation(xx,0.,-zPanel));
696 GetEnvelopes(moduleSlatCh6)->AddEnvelopeConstituent("S06I", idSlatCh6, index,TGeoTranslation(xx,0.,0.));
697 }
e516b01d 698 }
253d1046 699 }
e516b01d 700 }
701 }
253d1046 702
e516b01d 703 // position the nomex volume inside the panel volume
704 gMC->Gspos("S05N",1,"S05C",0.,0.,0.,0,"ONLY");
705 gMC->Gspos("SB5N",1,"SB5C",0.,0.,0.,0,"ONLY");
253d1046 706 gMC->Gspos("SC5N",1,"SC5C",0.,0.,0.,0,"ONLY");
707 gMC->Gspos("SD5N",1,"SD5C",0.,0.,0.,0,"ONLY");
e516b01d 708 gMC->Gspos("S06N",1,"S06C",0.,0.,0.,0,"ONLY");
253d1046 709 gMC->Gspos("SC6N",1,"SC6C",0.,0.,0.,0,"ONLY");
710 gMC->Gspos("SD6N",1,"SD6C",0.,0.,0.,0,"ONLY");
4846c3ab 711
e516b01d 712 // position panel volume inside the bulk nomex material volume
713 gMC->Gspos("S05C",1,"S05X",0.,0.,kNomexBWidth/2.,0,"ONLY");
714 gMC->Gspos("SB5C",1,"SB5X",0.,0.,kNomexBWidth/2.,0,"ONLY");
253d1046 715 gMC->Gspos("SC5C",1,"SC5X",0.,0.,kNomexBWidth/2.,0,"ONLY");
716 gMC->Gspos("SD5C",1,"SD5X",0.,0.,kNomexBWidth/2.,0,"ONLY");
e516b01d 717 gMC->Gspos("S06C",1,"S06X",0.,0.,kNomexBWidth/2.,0,"ONLY");
253d1046 718 gMC->Gspos("SC6C",1,"SC6X",0.,0.,kNomexBWidth/2.,0,"ONLY");
719 gMC->Gspos("SD6C",1,"SD6X",0.,0.,kNomexBWidth/2.,0,"ONLY");
e516b01d 720
721 // position the PCB volume inside the insulating material volume
722 gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY");
723 gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY");
253d1046 724 gMC->Gspos("SC5P",1,"SC5I",0.,0.,0.,0,"ONLY");
725 gMC->Gspos("SD5P",1,"SD5I",0.,0.,0.,0,"ONLY");
e516b01d 726 gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY");
253d1046 727 gMC->Gspos("SC6P",1,"SC6I",0.,0.,0.,0,"ONLY");
728 gMC->Gspos("SD6P",1,"SD6I",0.,0.,0.,0,"ONLY");
4846c3ab 729
e516b01d 730 // position the horizontal frame volume inside the PCB volume
731 gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY");
732 gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY");
253d1046 733 gMC->Gspos("SC5H",1,"SC5P",0.,0.,0.,0,"ONLY");
734 gMC->Gspos("SD5H",1,"SD5P",0.,0.,0.,0,"ONLY");
e516b01d 735 gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY");
253d1046 736 gMC->Gspos("SC6H",1,"SC6P",0.,0.,0.,0,"ONLY");
737 gMC->Gspos("SD6H",1,"SD6P",0.,0.,0.,0,"ONLY");
4846c3ab 738
e516b01d 739 // position the sensitive volume inside the horizontal frame volume
740 gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3);
741 gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3);
253d1046 742 gMC->Gspos("SC5G",1,"SC5H",0.,0.,0.,0,"ONLY");
743 gMC->Gspos("SD5G",1,"SD5H",0.,0.,0.,0,"ONLY");
e516b01d 744 gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3);
253d1046 745 gMC->Gspos("SC6G",1,"SC6H",0.,0.,0.,0,"ONLY");
746 gMC->Gspos("SD6G",1,"SD6H",0.,0.,0.,0,"ONLY");
4846c3ab 747
748
e516b01d 749 // position the border volumes inside the PCB volume
750 Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.;
253d1046 751 Int_t rotB = 0;
752 gMC->Matrix(rotB,90,0,90,270,180,0); // rotation around x for second border
753
e516b01d 754 gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY");
755 gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY");
756 gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY");
757 gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY");
71db1057 758 gMC->Gspos("SC5B",1,"SC5P",0., yborder,0.,rotB,"ONLY");
759 gMC->Gspos("SC5B",2,"SC5P",0.,-yborder,0.,0,"ONLY");
253d1046 760 gMC->Gspos("S05B",1,"SD5P",0., yborder,0.,0,"ONLY");
71db1057 761 gMC->Gspos("SD5B",1,"SD5P",0.,-yborder,0.,0,"ONLY");
e516b01d 762
763 gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY");
764 gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY");
71db1057 765 gMC->Gspos("SC6B",1,"SC6P",0., yborder,0.,rotB,"ONLY");
766 gMC->Gspos("SC6B",2,"SC6P",0.,-yborder,0.,0,"ONLY");
253d1046 767 gMC->Gspos("S06B",1,"SD6P",0., yborder,0.,0,"ONLY");
71db1057 768 gMC->Gspos("SD6B",1,"SD6P",0.,-yborder,0.,0,"ONLY");
4846c3ab 769
e516b01d 770 // create the NULOC volume and position it in the horizontal frame
771 gMC->Gsvolu("S05E","BOX",kNulocMaterial,nulocpar,3);
772 gMC->Gsvolu("S06E","BOX",kNulocMaterial,nulocpar,3);
773 index = 0;
774 Float_t xxmax2 = xxmax - pcbDLength3/2.;
253d1046 775 Float_t xxmax3 = xxmax - (kPcbLength-csvPcbLength)/2.;
776 Float_t rPhi3 = TMath::ASin((kYpos3[1]-kPcbHeight/2.)/AliMUONConstants::Rmin(2));
777 Float_t xxmax4 = (AliMUONConstants::Rmin(2)*TMath::Cos(rPhi3)-kVframeLength/2.) - (kBframeLength - kNulocLength)/2.;
e516b01d 778 for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) {
779 index++;
780 gMC->Gspos("S05E",2*index-1,"S05B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
781 gMC->Gspos("S05E",2*index ,"S05B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
782 gMC->Gspos("S06E",2*index-1,"S06B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
783 gMC->Gspos("S06E",2*index ,"S06B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
784 if (xx > -xxmax2 && xx< xxmax2) {
785 gMC->Gspos("S05E",2*index-1,"SB5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
786 gMC->Gspos("S05E",2*index ,"SB5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
787 }
253d1046 788 if (xx > -xxmax3 && xx< xxmax3) {
71db1057 789 gMC->Gspos("S05E",2*index-1,"SC5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2., 0, "ONLY");
790 gMC->Gspos("S05E",2*index ,"SC5B", xx, 0., kBframeWidth/2.- kNulocWidth/2., 0, "ONLY");
791 gMC->Gspos("S06E",2*index-1,"SC6B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
792 gMC->Gspos("S06E",2*index ,"SC6B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
e516b01d 793 }
253d1046 794 if (xx > xxmax4 && xx< xxmax) {
71db1057 795 gMC->Gspos("S05E",2*index-1,"SD5B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
796 gMC->Gspos("S05E",2*index ,"SD5B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
797 gMC->Gspos("S06E",2*index-1,"SD6B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
798 gMC->Gspos("S06E",2*index ,"SD6B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
e516b01d 799 }
e516b01d 800 }
cd8824a7 801
802 //
803 //Geometry of the support pannel Verticla length 3.62m, horizontal length 1.62m, internal radius dMotherInner of SC05 and SC06 (F. Orsini, Saclay)
804 //Carbon fiber of 0.3 mm thick (2 layers) and a central layer of Nomex of 15mm thick.
805 // Outer excess and inner recess for mother volume radius
806 // with respect to ROuter and RInner
807 Float_t dMotherInner = AliMUONConstants::Rmin(2)-kRframeHeight;
808 Float_t nomexthickness = 1.5;
809 Float_t carbonthickness = 0.03;
253d1046 810 Float_t supporthlength = 162.; // chamber 5
811 Float_t supporthlengthCh6 = 167.; // chamber 6
cd8824a7 812 Float_t supportvlength = 362.;
253d1046 813
cd8824a7 814 // Generating the composite shape of the carbon and nomex pannels
253d1046 815 new TGeoBBox("shNomexBoxSt3",supporthlength/2., supportvlength/2. ,nomexthickness/2.+carbonthickness+3*kCableWidth);
cd8824a7 816 new TGeoBBox("shCarbonBoxSt3",supporthlength/2., supportvlength/2. ,carbonthickness/2.);
253d1046 817 new TGeoBBox("shNomexBoxSt3Ch6",(supporthlengthCh6)/2., supportvlength/2. ,nomexthickness/2.+carbonthickness+3*kCableWidth);
818 new TGeoBBox("shCarbonBoxSt3Ch6",(supporthlengthCh6)/2., supportvlength/2. ,carbonthickness/2.);
819 new TGeoTubeSeg("shNomexHoleSt3",0., dMotherInner, nomexthickness/2.+carbonthickness+3*kCableWidth+0.001, -90. ,90.);
cd8824a7 820 new TGeoTubeSeg("shCarbonHoleSt3",0., dMotherInner, carbonthickness/2.+0.001, -90. ,90.);
5fa6d4cf 821 TGeoTranslation* trHoleSt3 = new TGeoTranslation("trHoleSt3",-supporthlength/2.,0.,0.);
cd8824a7 822 trHoleSt3->RegisterYourself();
253d1046 823 TGeoTranslation* trHoleSt3Ch6 = new TGeoTranslation("trHoleSt3Ch6",-(supporthlengthCh6)/2.,0.,0.);
824 trHoleSt3Ch6->RegisterYourself();
5fa6d4cf 825 TGeoCompositeShape* shNomexSupportSt3 = new TGeoCompositeShape("shNomexSupportSt3","shNomexBoxSt3-shNomexHoleSt3:trHoleSt3");
826 TGeoCompositeShape* shCarbonSupportSt3 = new TGeoCompositeShape("shCarbonSupportSt3","shCarbonBoxSt3-shCarbonHoleSt3:trHoleSt3");
253d1046 827 TGeoCompositeShape* shNomexSupportSt3Ch6 = new TGeoCompositeShape("shNomexSupportSt3Ch6","shNomexBoxSt3Ch6-shNomexHoleSt3:trHoleSt3Ch6");
828 TGeoCompositeShape* shCarbonSupportSt3Ch6 = new TGeoCompositeShape("shCarbonSupportSt3Ch6","shCarbonBoxSt3Ch6-shCarbonHoleSt3:trHoleSt3Ch6");
829
cd8824a7 830 // Generating Nomex and Carbon pannel volumes
831 TGeoVolume * voNomexSupportSt3 = new TGeoVolume("S05S", shNomexSupportSt3, kMedNomex);
832 TGeoVolume * voCarbonSupportSt3 = new TGeoVolume("S05K", shCarbonSupportSt3, kMedCarbon);
253d1046 833 TGeoVolume * voNomexSupportSt3Ch6 = new TGeoVolume("S06S", shNomexSupportSt3Ch6, kMedNomex);
834 TGeoVolume * voCarbonSupportSt3Ch6 = new TGeoVolume("S06K", shCarbonSupportSt3Ch6, kMedCarbon);
835
cd8824a7 836 TGeoTranslation *trCarbon1St3 = new TGeoTranslation("trCarbon1St3",0.,0., -(nomexthickness+carbonthickness)/2.);
837 TGeoTranslation *trCarbon2St3 = new TGeoTranslation("trCarbon2St3",0.,0., (nomexthickness+carbonthickness)/2.);
838 voNomexSupportSt3->AddNode(voCarbonSupportSt3,1,trCarbon1St3);
839 voNomexSupportSt3->AddNode(voCarbonSupportSt3,2,trCarbon2St3);
253d1046 840 voNomexSupportSt3Ch6->AddNode(voCarbonSupportSt3Ch6,1,trCarbon1St3);
841 voNomexSupportSt3Ch6->AddNode(voCarbonSupportSt3Ch6,2,trCarbon2St3);
842
843
844 // Add readout cables
845 gMC->Gsvolu("S05L","BOX",kCableMaterial,dum,0);
846 gMC->Gsvolu("S06L","BOX",kCableMaterial,dum,0);
847
848 ySlat3 = 0.;
849 Float_t lCableX = 0.;
850 Float_t lCableX6 = 0.;
851 Float_t lCableY = 0.;
852 Float_t lCableZ = 0.;
853 Float_t cablepar[3] = {supporthlength/2., kCableHeight/2., kCableWidth/2.};
854 Float_t cablepar6[3] = {supporthlengthCh6/2., kCableHeight/2., kCableWidth/2.};
855 Float_t lCableDY = 0.;
856 Int_t cIndex = 0;
857 Int_t cIndex6 = 0;
858 for (i = 0; i<kNslats3; i++){
859 Int_t iCable = 1;
860 cIndex = 0;
861 cIndex6 = 0;
862 ySlat3 += kYpos3[i];
863 lCableY = ySlat3;
864
865 // Cables going out from the start of slat
866 if(kNPCB3[i]>=4){ // Only if 4 or more pcb
867 // First top cables
868 cablepar[0] = supporthlength/2.;
869 lCableX = 0.;
870 cablepar6[0] = supporthlengthCh6/2.;
871 lCableX6 = 0.;
872 lCableDY = (kYpos3[i+1]+kYpos3[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
75b41f84 873 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
253d1046 874 if(i==0){ // central slat is shorter (rounded)
875 cablepar[0] -= (kPcbLength-csvPcbLength)/2.;
876 lCableX = (kPcbLength-csvPcbLength)/2.;
877 cablepar6[0] -= (kPcbLength-csvPcbLength)/2.;
878 lCableX6 = (kPcbLength-csvPcbLength)/2.;
879 }
880 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
881 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
882 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);
883 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
884
885 // Then bottom cables
886 if(i>0){
887 if(i==1){ // Rounded slat. Bottom cable starts at dMotherInner (beam pipe)
888 cablepar[0] -= dMotherInner/2.;
889 lCableX += dMotherInner/2.;
890 cablepar6[0] -= dMotherInner/2.;
891 lCableX6 += dMotherInner/2.;
892 lCableDY = (kYpos3[i]+kYpos3[i])/2.-cablepar[1];
893 }
894 if(i>=2){
895 lCableDY = (kYpos3[i]+kYpos3[i-1])/2.-cablepar[1]; // half way between 2 slats on same side
896 if ((lCableY-lCableDY)<(dMotherInner+cablepar[1])){
897 lCableDY = lCableY - dMotherInner - cablepar[1];
898 }
899 }
900 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
901 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
902 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3);
903 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3);
904 }
905 }
906
907 // Rounded slats have an extra cable starting at second pcb
908 if(i==1){
909 // First top cables
910 cablepar[0] = (supporthlength-kPcbLength-kVframeLength)/2.;
911 lCableX = (kPcbLength+kVframeLength)/2.;
912 cablepar6[0] = (supporthlengthCh6-kPcbLength-kVframeLength)/2.;
913 lCableX6 = (kPcbLength+kVframeLength)/2.;
914 lCableDY = (kYpos3[i+1]+kYpos3[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
75b41f84 915 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
253d1046 916 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
917 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
918 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);
919 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
920 // Then bottom cables
921 lCableDY = (kYpos3[i]+kYpos3[i])/2.-cablepar[1];
922 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
923 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
924 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3);
925 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3);
926 }
927
928 // Cables going out from the end of the slats
929 // First top cables
930 cablepar[0] = (supporthlength-(slatLength3[i]+kDslatLength)+kVframeLength)/2.;
931 lCableX = slatLength3[i]-kVframeLength+kDslatLength+cablepar[0]-supporthlength/2.;
932 cablepar6[0] = (supporthlengthCh6-(slatLength3[i]+kDslatLength)+kVframeLength)/2.;
933 lCableX6 = slatLength3[i]-kVframeLength+kDslatLength+cablepar6[0]-supporthlengthCh6/2.;
934 if(i+1>=kNslats3 || i+2>=kNslats3){ // If no more higher slats, then use distance to lower slat
935 lCableDY = kPcbHeight/2.+cablepar[1];
936 }
937 else {
938 lCableDY = (kYpos3[i+1]+kYpos3[i+2])/2.-cablepar[1];
939 }
75b41f84 940 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
941
253d1046 942 if (i<=2){ // shortened pcb
943 cablepar[0] += pcbDLength3/2.;
944 lCableX -= pcbDLength3/2.;
945 }
946 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
947 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
948 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar6,3);
949 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar6,3);
950 // Then bottom cables
951 if(i>0){ // Loop is over top half of slats, lower half are symmetric
952 if (i==1) {
953 lCableDY = (kYpos3[i]+kYpos3[i])/2.-cablepar[1];
954 }
955 else{
956 lCableDY = (kYpos3[i]+kYpos3[i-1])/2.-cablepar[1]; // half way between 2 slats on same side
957 }
958 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
959 gMC->Gsposp("S05L",100*i+cIndex++,"S05S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
960 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar6,3);
961 gMC->Gsposp("S06L",100*i+cIndex6++,"S06S",lCableX6,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar6,3);
962 }
963 }
964
cd8824a7 965 Float_t dzCh5 = dzCh;
5fa6d4cf 966 TGeoTranslation* trSupport1St3 = new TGeoTranslation("trSupport1St3", supporthlength/2., 0. , dzCh5);
967 TGeoRotation* roSupportSt3 = new TGeoRotation("roSupportSt3",90.,180.,-90.);
968 TGeoCombiTrans* coSupport2St3 = new TGeoCombiTrans(-supporthlength/2., 0., -dzCh5, roSupportSt3);
253d1046 969 TGeoTranslation* trSupport1St3Ch6 = new TGeoTranslation("trSupport1St3Ch6", supporthlengthCh6/2., 0. , dzCh5);
970 TGeoCombiTrans* coSupport2St3Ch6 = new TGeoCombiTrans(-supporthlengthCh6/2., 0., -dzCh5, roSupportSt3);
cd8824a7 971 GetEnvelopes(5)->AddEnvelope("S05S", 0, 1, *trSupport1St3);
ed6f6d60 972 GetEnvelopes(4)->AddEnvelope("S05S", 0, 2, *coSupport2St3);
253d1046 973 GetEnvelopes(7)->AddEnvelope("S06S", 0, 1, *trSupport1St3Ch6);
974 GetEnvelopes(6)->AddEnvelope("S06S", 0, 2, *coSupport2St3Ch6);
cd8824a7 975 // End of pannel support geometry
976
977 // cout << "Geometry for Station 3...... done" << endl;
d1cd2474 978 }
e516b01d 979 if (fStations[3]) {
d1cd2474 980
981
e516b01d 982 // //********************************************************************
983 // // Station 4 **
984 // //********************************************************************
cd8824a7 985 // Mother volume for each chamber in St4 is an envelop (or assembly)
986 // There is one assembly mother per half a chamber called SC07I, SC07O, SC08I and SC08O
987 // Same volume name definitions as in St3
e516b01d 988 const Int_t kNslats4 = 7; // number of slats per quadrant
989 const Int_t kNPCB4[kNslats4] = {5, 6, 5, 5, 4, 3, 2}; // n PCB per slat
b0e65056 990 const Float_t kXpos4[kNslats4] = {38.75, 0., 0., 0., 0., 0., 0.}; // J.C. Correct value
e516b01d 991 const Float_t kYpos41[kNslats4] = {0., 38.2, 34.40, 36.60, 29.3, 37.0, 28.6};
992 const Float_t kYpos42[kNslats4] = {0., 38.2, 37.85, 37.55, 29.4, 37.0, 28.6};
e516b01d 993 Float_t slatLength4[kNslats4];
253d1046 994
995 Float_t rPhi1 = TMath::RadToDeg()*(TMath::ASin((kYpos41[1]-hFramepar[1])/(AliMUONConstants::Rmin(3))));
996 Float_t rPhi2 = TMath::RadToDeg()*(TMath::ACos(-vFramepar[0]/(AliMUONConstants::Rmin(3)-kRframeLength)));
997 Float_t rFramepar4[5] = { AliMUONConstants::Rmin(3)-kRframeLength, AliMUONConstants::Rmin(3), kRframeWidth, rPhi1, rPhi2};
998 Float_t vrFrameHeight = hFramepar[1]+kYpos41[1]-AliMUONConstants::Rmin(3)+kRframeLength;
6ffd4cb7 999
e516b01d 1000 char idSlatCh7[5];
1001 char idSlatCh8[5];
1002 Float_t xSlat4;
1003 Float_t ySlat41 = 0;
1004 Float_t ySlat42 = 0;
e516b01d 1005 angle = 0.;
1006
1007 for (i = 0; i<kNslats4; i++){
1008 slatLength4[i] = kPcbLength * kNPCB4[i] + 2. * kVframeLength;
1009 xSlat4 = slatLength4[i]/2. + kDslatLength + kXpos4[i];
1010 ySlat41 += kYpos41[i];
1011 ySlat42 += kYpos42[i];
1012
1013 spar[0] = slatLength4[i]/2.;
1014 spar[1] = kSlatHeight/2.;
1015 spar[2] = kSlatWidth/2.;
1016 Float_t dzCh4 = dzCh;
1017 Float_t zSlat4 = (i%2 ==0)? -zSlat : zSlat;
1018
1019 sprintf(idSlatCh7,"LC%d",kNslats4-1+i);
e856ab99 1020 detElemId = 713 - (i + kNslats4-1-6);
cd8824a7 1021 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1022 if (detElemId % 2 == 0)
1023 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(xSlat4, ySlat41, -zSlat4 + dzCh4),
e516b01d 1024 TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
5fa6d4cf 1025 else
1026 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(xSlat4, ySlat41, -zSlat4 + dzCh4),
1027 TGeoRotation("rot1",90,angle,90,270+angle,180,0) );
e516b01d 1028
1029 sprintf(idSlatCh7,"LC%d",3*kNslats4-2+i);
e856ab99 1030 detElemId = 700 + (i + kNslats4-1-6);
cd8824a7 1031 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1032 if (detElemId % 2 == 0)
1033 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(-xSlat4, ySlat41, zSlat4 - dzCh4),
1034 TGeoRotation("rot2",90,180+angle,90,270+angle,0,0) );
1035 else
1036 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(-xSlat4, ySlat41, zSlat4 - dzCh4),
e516b01d 1037 TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
e516b01d 1038 if (i > 0) {
1039 sprintf(idSlatCh7,"LC%d",kNslats4-1-i);
e856ab99 1040 detElemId = 713 + (i + kNslats4-1-6);
cd8824a7 1041 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1042 if (detElemId % 2 == 0 && detElemId != 714)
1043 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(xSlat4, -ySlat41, -zSlat4 + dzCh4),
1044 TGeoRotation("rot3",90,angle,90,90+angle,0,0) );
1045 else
1046 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(xSlat4, -ySlat41, -zSlat4 + dzCh4),
1047 TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
e516b01d 1048 sprintf(idSlatCh7,"LC%d",3*kNslats4-2-i);
e856ab99 1049 detElemId = 726 - (i + kNslats4-1-6);
cd8824a7 1050 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1051 if (detElemId % 2 == 1 && detElemId != 725 )
1052 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(-xSlat4, -ySlat41, zSlat4 - dzCh4),
1053 TGeoRotation("rot4",90,180+angle,90,90+angle,180,0) );
1054 else
1055 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh7, detElemId, true, TGeoTranslation(-xSlat4, -ySlat41, zSlat4 - dzCh4),
1056 TGeoRotation("rot4",90,180+angle,90,270+angle,0,0) );
e516b01d 1057 }
1058
1059 sprintf(idSlatCh8,"LD%d",kNslats4-1+i);
e856ab99 1060 detElemId = 813 - (i + kNslats4-1-6);
cd8824a7 1061 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1062 if (detElemId % 2 == 0)
1063 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(xSlat4, ySlat42, -zSlat4 + dzCh4),
e516b01d 1064 TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
5fa6d4cf 1065 else
1066 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(xSlat4, ySlat42, -zSlat4 + dzCh4),
1067 TGeoRotation("rot5",90,angle,90,270+angle,180,0) );
e516b01d 1068
1069 sprintf(idSlatCh8,"LD%d",3*kNslats4-2+i);
e856ab99 1070 detElemId = 800 + (i + kNslats4-1-6);
cd8824a7 1071 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1072 if (detElemId % 2 == 0)
1073 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(-xSlat4, ySlat42, zSlat4 - dzCh4),
1074 TGeoRotation("rot6",90,180+angle,90,270+angle,0,0) );
1075 else
1076 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(-xSlat4, ySlat42, zSlat4 - dzCh4),
e516b01d 1077 TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
1078 if (i > 0) {
1079 sprintf(idSlatCh8,"LD%d",kNslats4-1-i);
e856ab99 1080 detElemId = 813 + (i + kNslats4-1-6);
cd8824a7 1081 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1082 if (detElemId % 2 == 0 && detElemId != 814)
1083 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(xSlat4, -ySlat42, -zSlat4 + dzCh4),
1084 TGeoRotation("rot7",90,angle,90,90+angle,0,0) );
1085 else
1086 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(xSlat4, -ySlat42, -zSlat4 + dzCh4),
1087 TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
e516b01d 1088 sprintf(idSlatCh8,"LD%d",3*kNslats4-2-i);
e856ab99 1089 detElemId = 826 - (i + kNslats4-1-6);
cd8824a7 1090 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1091 if (detElemId % 2 == 1 && detElemId != 825 )
1092 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(-xSlat4, -ySlat42, zSlat4 - dzCh4),
1093 TGeoRotation("rot8",90,180+angle,90,90+angle,180,0) );
1094 else
1095 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh8, detElemId, true, TGeoTranslation(-xSlat4, -ySlat42, zSlat4 - dzCh4),
e516b01d 1096 TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
5fa6d4cf 1097
e516b01d 1098 }
1099 }
d1cd2474 1100
e516b01d 1101 // create the panel volume
d1cd2474 1102
e516b01d 1103 gMC->Gsvolu("S07C","BOX",kCarbonMaterial,panelpar,3);
253d1046 1104 gMC->Gsvolu("SD7C","BOX",kCarbonMaterial,panelpar,3);
e516b01d 1105 gMC->Gsvolu("S08C","BOX",kCarbonMaterial,panelpar,3);
253d1046 1106 gMC->Gsvolu("SD8C","BOX",kCarbonMaterial,panelpar,3);
d1cd2474 1107
e516b01d 1108 // create the nomex volume
d1cd2474 1109
e516b01d 1110 gMC->Gsvolu("S07N","BOX",kNomexMaterial,nomexpar,3);
253d1046 1111 gMC->Gsvolu("SD7N","BOX",kNomexMaterial,nomexpar,3);
e516b01d 1112 gMC->Gsvolu("S08N","BOX",kNomexMaterial,nomexpar,3);
253d1046 1113 gMC->Gsvolu("SD8N","BOX",kNomexMaterial,nomexpar,3);
d1cd2474 1114
d1cd2474 1115
e516b01d 1116 // create the nomex volume (bulk)
d1cd2474 1117
e516b01d 1118 gMC->Gsvolu("S07X","BOX",kNomexBMaterial,nomexbpar,3);
253d1046 1119 gMC->Gsvolu("SD7X","BOX",kNomexBMaterial,nomexbpar,3);
e516b01d 1120 gMC->Gsvolu("S08X","BOX",kNomexBMaterial,nomexbpar,3);
253d1046 1121 gMC->Gsvolu("SD8X","BOX",kNomexBMaterial,nomexbpar,3);
d1cd2474 1122
e516b01d 1123 // create the insulating material volume
1124
1125 gMC->Gsvolu("S07I","BOX",kInsuMaterial,insupar,3);
253d1046 1126 gMC->Gsvolu("SD7I","BOX",kInsuMaterial,insupar,3);
e516b01d 1127 gMC->Gsvolu("S08I","BOX",kInsuMaterial,insupar,3);
253d1046 1128 gMC->Gsvolu("SD8I","BOX",kInsuMaterial,insupar,3);
e516b01d 1129
1130 // create the PCB volume
1131
1132 gMC->Gsvolu("S07P","BOX",kPcbMaterial,pcbpar,3);
253d1046 1133 gMC->Gsvolu("SD7P","BOX",kPcbMaterial,pcbpar,3);
e516b01d 1134 gMC->Gsvolu("S08P","BOX",kPcbMaterial,pcbpar,3);
253d1046 1135 gMC->Gsvolu("SD8P","BOX",kPcbMaterial,pcbpar,3);
d1cd2474 1136
e516b01d 1137 // create the sensitive volumes,
1138
1139 gMC->Gsvolu("S07G","BOX",kSensMaterial,dum,0);
253d1046 1140 gMC->Gsvolu("SD7G","BOX",kSensMaterial,senspar,3);
e516b01d 1141 gMC->Gsvolu("S08G","BOX",kSensMaterial,dum,0);
253d1046 1142 gMC->Gsvolu("SD8G","BOX",kSensMaterial,senspar,3);
e516b01d 1143
1144 // create the vertical frame volume
1145
1146 gMC->Gsvolu("S07V","BOX",kVframeMaterial,vFramepar,3);
1147 gMC->Gsvolu("S08V","BOX",kVframeMaterial,vFramepar,3);
1148
253d1046 1149 // create the rounded vertical frame volume
1150
1151 gMC->Gsvolu("SD7D","TUBS",kRframeMaterial,rFramepar4,5);
1152 gMC->Gsvolu("SD8D","TUBS",kRframeMaterial,rFramepar4,5);
1153
e516b01d 1154 // create the horizontal frame volume
1155
1156 gMC->Gsvolu("S07H","BOX",kHframeMaterial,hFramepar,3);
253d1046 1157 gMC->Gsvolu("SD7H","BOX",kHframeMaterial,hFramepar,3);
e516b01d 1158 gMC->Gsvolu("S08H","BOX",kHframeMaterial,hFramepar,3);
253d1046 1159 gMC->Gsvolu("SD8H","BOX",kHframeMaterial,hFramepar,3);
e516b01d 1160
1161 // create the horizontal border volume
1162
1163 gMC->Gsvolu("S07B","BOX",kBframeMaterial,bFramepar,3);
253d1046 1164 gMC->Gsvolu("SD7B","BOX",kBframeMaterial,bFramepar,3);
e516b01d 1165 gMC->Gsvolu("S08B","BOX",kBframeMaterial,bFramepar,3);
253d1046 1166 gMC->Gsvolu("SD8B","BOX",kBframeMaterial,bFramepar,3);
1167
1168 // Replace the volume shape with a composite shape
1169 // with substracted overlap with beam shield
1170 if ( gMC->IsRootGeometrySupported() ) {
1171
1172 // Get shape
1173 Int_t nSlatType = 1;
1174 Int_t nVol = 8;
b2f96010 1175 const char* slatType = "D"; // D: Rounded slat
1176 const char* volLetter = "CNXIPHBG";
1177 TString volName;
1178 TString compName;
1179 TString csName;
253d1046 1180 TGeoVolume *mVol = 0x0;
1181 // Beam shield recess
253d1046 1182 new TGeoTube("tube4Cut", 0., AliMUONConstants::Rmin(3), kSlatWidth/2.+0.001);
c15bef4d 1183 TObjArray rounded4Slat(nSlatType*((nVol+1)*2));
253d1046 1184 // Displacement
1185 TGeoTranslation* trDTube4 = new TGeoTranslation("trDTube4", -(kPcbLength+kVframeLength)/2., -kYpos41[1], 0.);
1186 trDTube4->RegisterYourself();
71db1057 1187 TGeoTranslation* trDBTube4 = new TGeoTranslation("trDBTube4", 0., ( kPcbHeight - kBframeHeight ) / 2., 0.);
1188 trDBTube4->Add(trDTube4);
1189 trDBTube4->RegisterYourself();
1190
c15bef4d 1191 TObjArray composite4(nSlatType*((nVol+1)*2));
253d1046 1192 new TGeoBBox("box4DCut",(kPcbLength+kVframeLength)/2., hFramepar[1], vFramepar[2]+0.001);
1193 // Displacement
1194 TGeoTranslation* trDBox4 = new TGeoTranslation("trDBox4",kPcbLength/2., kYpos41[1], 0.);
1195 trDBox4->RegisterYourself();
1196
1197 TGeoBBox *box4Vframe = new TGeoBBox("box4Vframe",vFramepar[0],vrFrameHeight/2., vFramepar[2]);
1198 TGeoTranslation* trVBox4 = new TGeoTranslation("trVBox4", 0., AliMUONConstants::Rmin(3)-kRframeLength + box4Vframe->GetDY(), 0.);
1199 trVBox4->RegisterYourself();
1200
1201 for(int iCh=7; iCh<=8; iCh++){
1202 for (int iSlatType = 0; iSlatType<nSlatType; iSlatType++) {
1203 for (int iVol = 0; iVol<nVol; iVol++){
1204 Int_t lIndex = (iCh-7)*(nSlatType*(nVol+1))+iSlatType*(nVol+1)+iVol;
b2f96010 1205 volName=Form("S%c%d%c",slatType[iSlatType],iCh,volLetter[iVol]);
253d1046 1206 mVol = gGeoManager->FindVolumeFast(volName);
1207 if ( !mVol ) {
1208 AliErrorStream()
1209 << "Slat volume " << volName << " not found" << endl;
1210 }
1211 else {
1212 rounded4Slat[lIndex] = mVol->GetShape();
b2f96010 1213 csName=Form("rounded4Slat%c%d%c",slatType[iSlatType],iCh,volLetter[iVol]);
c15bef4d 1214 ((TGeoShape*)rounded4Slat[lIndex])->SetName(csName);
253d1046 1215
1216 // Composite shape
1217 TString compOperation(csName);
1218 compOperation+="-tube4Cut:tr";
1219 compOperation+=slatType[iSlatType];
253d1046 1220 if (strstr(volName,"B")){
71db1057 1221 compOperation+="B";
1222 }
1223 compOperation+="Tube4";
b2f96010 1224 compName=Form("composite4%d%c",iCh,volLetter[iVol]);
253d1046 1225 composite4[lIndex] = new TGeoCompositeShape(compName, compOperation.Data());
1226
1227 // Reset shape to volume
c15bef4d 1228 mVol->SetShape((TGeoShape*)composite4[lIndex]);
253d1046 1229 }
1230 }
1231
1232 // For rounded spacer
1233 Int_t lIndex = (iCh-7)*(nSlatType*(nVol+1))+iSlatType*(nVol+1)+nVol;
b2f96010 1234 volName=Form("S%c%dD",slatType[iSlatType],iCh);
253d1046 1235 mVol = gGeoManager->FindVolumeFast(volName);
1236 if ( !mVol ) {
1237 AliErrorStream()
1238 << "Slat volume " << volName << " not found" << endl;
1239 }
1240 else {
1241 rounded4Slat[lIndex] = mVol->GetShape();
b2f96010 1242 csName=Form("rounded4Slat%c%dD",slatType[iSlatType],iCh);
c15bef4d 1243 ((TGeoShape*)rounded4Slat[lIndex])->SetName(csName);
253d1046 1244
1245 // Composite shape
1246 TString compOperation(csName);
1247 if (strstr(volName,"SD")){
1248 compOperation.Prepend("(");
1249 compOperation+="+box4Vframe:trVBox4)*box4DCut:trDBox4";
1250 }
b2f96010 1251 compName=Form("composite4%c%dD",slatType[iSlatType],iCh);
253d1046 1252 composite4[lIndex] = new TGeoCompositeShape(compName, compOperation.Data());
1253 // Reset shape to volume
c15bef4d 1254 mVol->SetShape((TGeoShape*)composite4[lIndex]);
253d1046 1255 }
1256 }
1257 }
1258 }
1259
e516b01d 1260
1261 index = 0;
1262 for (i = 0; i < kNslats4; i++){
1263 for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
1264
1265 if (i == 0 && quadrant == 2) continue;
1266 if (i == 0 && quadrant == 4) continue;
1267
1268 sprintf(idSlatCh7,"LC%d",ConvertSlatNum(i,quadrant,kNslats4-1));
1269 sprintf(idSlatCh8,"LD%d",ConvertSlatNum(i,quadrant,kNslats4-1));
cd8824a7 1270 Int_t moduleSlatCh7 = GetModuleId(idSlatCh7);
1271 Int_t moduleSlatCh8 = GetModuleId(idSlatCh8);
1272
e516b01d 1273 Float_t xvFrame = (slatLength4[i] - kVframeLength)/2.;
1274
1275 // position the vertical frames
1276 if (i != 1) {
cd8824a7 1277 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
1278 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
1279 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
1280 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
253d1046 1281 } else { // Vertical and Rounded+Vertical spacer
cd8824a7 1282 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
253d1046 1283 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("SD7D", idSlatCh7, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,-kYpos41[1],0.));
cd8824a7 1284 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
253d1046 1285 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("SD8D", idSlatCh8, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,-kYpos42[1],0.));
e516b01d 1286 }
1287 // position the panels and the insulating material
1288 for (j = 0; j < kNPCB4[i]; j++){
e516b01d 1289 index++;
c0bd5e65 1290 xx = kSensLength * (-kNPCB4[i]/2.+j+.5);
e516b01d 1291 Float_t zPanel = spar[2] - nomexbpar[2];
253d1046 1292 if (i==1 && j==0){ // Rounded pcb of rounded slat
1293 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("SD7X", idSlatCh7, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1294 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("SD7X", idSlatCh7, 2*index,TGeoTranslation(xx,0.,-zPanel));
1295 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("SD7I", idSlatCh7, index,TGeoTranslation(xx,0.,0.));
1296 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("SD8X", idSlatCh8, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1297 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("SD8X", idSlatCh8, 2*index,TGeoTranslation(xx,0.,-zPanel));
1298 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("SD8I", idSlatCh8, index,TGeoTranslation(xx,0.,0.));
1299 } else {
1300 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("S07X", idSlatCh7, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1301 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("S07X", idSlatCh7, 2*index,TGeoTranslation(xx,0.,-zPanel));
1302 GetEnvelopes(moduleSlatCh7)->AddEnvelopeConstituent("S07I", idSlatCh7, index,TGeoTranslation(xx,0.,0.));
1303 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("S08X", idSlatCh8, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1304 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("S08X", idSlatCh8, 2*index,TGeoTranslation(xx,0.,-zPanel));
1305 GetEnvelopes(moduleSlatCh8)->AddEnvelopeConstituent("S08I", idSlatCh8, index,TGeoTranslation(xx,0.,0.));
1306 }
e516b01d 1307 }
1308 }
1309 }
1310
1311 // position the nomex volume inside the panel volume
1312 gMC->Gspos("S07N",1,"S07C",0.,0.,0.,0,"ONLY");
253d1046 1313 gMC->Gspos("SD7N",1,"SD7C",0.,0.,0.,0,"ONLY");
e516b01d 1314 gMC->Gspos("S08N",1,"S08C",0.,0.,0.,0,"ONLY");
253d1046 1315 gMC->Gspos("SD8N",1,"SD8C",0.,0.,0.,0,"ONLY");
e516b01d 1316
1317 // position panel volume inside the bulk nomex material volume
1318 gMC->Gspos("S07C",1,"S07X",0.,0.,kNomexBWidth/2.,0,"ONLY");
253d1046 1319 gMC->Gspos("SD7C",1,"SD7X",0.,0.,kNomexBWidth/2.,0,"ONLY");
e516b01d 1320 gMC->Gspos("S08C",1,"S08X",0.,0.,kNomexBWidth/2.,0,"ONLY");
253d1046 1321 gMC->Gspos("SD8C",1,"SD8X",0.,0.,kNomexBWidth/2.,0,"ONLY");
e516b01d 1322
1323 // position the PCB volume inside the insulating material volume
1324 gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY");
253d1046 1325 gMC->Gspos("SD7P",1,"SD7I",0.,0.,0.,0,"ONLY");
e516b01d 1326 gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY");
253d1046 1327 gMC->Gspos("SD8P",1,"SD8I",0.,0.,0.,0,"ONLY");
e516b01d 1328
1329 // position the horizontal frame volume inside the PCB volume
1330 gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY");
253d1046 1331 gMC->Gspos("SD7H",1,"SD7P",0.,0.,0.,0,"ONLY");
e516b01d 1332 gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY");
253d1046 1333 gMC->Gspos("SD8H",1,"SD8P",0.,0.,0.,0,"ONLY");
e516b01d 1334
1335 // position the sensitive volume inside the horizontal frame volume
1336 gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3);
253d1046 1337 gMC->Gspos("SD7G",1,"SD7H",0.,0.,0.,0,"ONLY");
e516b01d 1338 gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3);
253d1046 1339 gMC->Gspos("SD8G",1,"SD8H",0.,0.,0.,0,"ONLY");
e516b01d 1340
1341 // position the border volumes inside the PCB volume
1342 Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.;
1343 gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY");
253d1046 1344 gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY");
71db1057 1345 gMC->Gspos("S07B",1,"SD7P",0., yborder,0.,0,"ONLY");
1346 gMC->Gspos("SD7B",1,"SD7P",0.,-yborder,0.,0,"ONLY");
e516b01d 1347 gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY");
1348 gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY");
253d1046 1349 gMC->Gspos("S08B",1,"SD8P",0., yborder,0.,0,"ONLY");
71db1057 1350 gMC->Gspos("SD8B",1,"SD8P",0.,-yborder,0.,0,"ONLY");
e516b01d 1351
1352 // create the NULOC volume and position it in the horizontal frame
1353
1354 gMC->Gsvolu("S07E","BOX",kNulocMaterial,nulocpar,3);
1355 gMC->Gsvolu("S08E","BOX",kNulocMaterial,nulocpar,3);
1356 index = 0;
253d1046 1357 Float_t rPhi3 = TMath::ASin((kYpos41[1]-kPcbHeight/2.)/AliMUONConstants::Rmin(3));
1358 Float_t xxmax4 = (AliMUONConstants::Rmin(3)*TMath::Cos(rPhi3)-kVframeLength/2.) - (kBframeLength - kNulocLength)/2.;
e516b01d 1359 for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) {
1360 index++;
1361 gMC->Gspos("S07E",2*index-1,"S07B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
1362 gMC->Gspos("S07E",2*index ,"S07B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
1363 gMC->Gspos("S08E",2*index-1,"S08B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
1364 gMC->Gspos("S08E",2*index ,"S08B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
1365 }
253d1046 1366 if (xx > xxmax4 && xx< xxmax) {
71db1057 1367 gMC->Gspos("S07E",2*index-1,"SD7B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
1368 gMC->Gspos("S07E",2*index ,"SD7B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
1369 gMC->Gspos("S08E",2*index-1,"SD8B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
1370 gMC->Gspos("S08E",2*index ,"SD8B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
d12a7158 1371 }
ed6f6d60 1372
253d1046 1373 //
cd8824a7 1374 //Geometry of the support pannel Verticla length 5.3m, horizontal length 2.6m, internal radius dMotherInner o SC07 and SC08 (F. Orsini, Saclay)
ed6f6d60 1375 //Carbon fiber of 0.3 mm thick (2 layers) and a central layer of Nomex of 15mm thick.
cd8824a7 1376 Float_t dMotherInner = AliMUONConstants::Rmin(3)-kRframeHeight;
ed6f6d60 1377 Float_t nomexthickness = 1.5;
1378 Float_t carbonthickness = 0.03;
1379 Float_t supporthlength = 260.;
1380 Float_t supportvlength = 530.;
1381 // Generating the composite shape of the carbon and nomex pannels
253d1046 1382 new TGeoBBox("shNomexBoxSt4",supporthlength/2., supportvlength/2. ,nomexthickness/2.+carbonthickness+3*kCableWidth);
ed6f6d60 1383 new TGeoBBox("shCarbonBoxSt4",supporthlength/2., supportvlength/2. ,carbonthickness/2.);
253d1046 1384 new TGeoTubeSeg("shNomexHoleSt4",0., dMotherInner, nomexthickness/2.+carbonthickness+3*kCableWidth+0.001, -90. ,90.);
ed6f6d60 1385 new TGeoTubeSeg("shCarbonHoleSt4",0., dMotherInner, carbonthickness/2.+0.001, -90. ,90.);
5fa6d4cf 1386 TGeoTranslation* trHoleSt4 = new TGeoTranslation("trHoleSt4",-supporthlength/2.,0.,0.);
ed6f6d60 1387 trHoleSt4->RegisterYourself();
5fa6d4cf 1388 TGeoCompositeShape* shNomexSupportSt4 = new TGeoCompositeShape("shNomexSupportSt4","shNomexBoxSt4-shNomexHoleSt4:trHoleSt4");
1389 TGeoCompositeShape* shCarbonSupportSt4 = new TGeoCompositeShape("shCarbonSupportSt4","shCarbonBoxSt4-shCarbonHoleSt4:trHoleSt4");
ed6f6d60 1390
1391 // Generating Nomex and Carbon pannel volumes
5fa6d4cf 1392 TGeoVolume* voNomexSupportSt4 = new TGeoVolume("S07S", shNomexSupportSt4, kMedNomex);
1393 TGeoVolume* voCarbonSupportSt4 = new TGeoVolume("S07K", shCarbonSupportSt4, kMedCarbon);
253d1046 1394 TGeoVolume* voNomexSupportSt4Ch8 = new TGeoVolume("S08S", shNomexSupportSt4, kMedNomex);
1395 TGeoVolume* voCarbonSupportSt4Ch8 = new TGeoVolume("S08K", shCarbonSupportSt4, kMedCarbon);
5fa6d4cf 1396 TGeoTranslation* trCarbon1St4 = new TGeoTranslation("trCarbon1St4",0.,0., -(nomexthickness+carbonthickness)/2.);
1397 TGeoTranslation* trCarbon2St4 = new TGeoTranslation("trCarbon2St4",0.,0., (nomexthickness+carbonthickness)/2.);
ed6f6d60 1398 voNomexSupportSt4->AddNode(voCarbonSupportSt4,1,trCarbon1St4);
1399 voNomexSupportSt4->AddNode(voCarbonSupportSt4,2,trCarbon2St4);
253d1046 1400 voNomexSupportSt4Ch8->AddNode(voCarbonSupportSt4Ch8,1,trCarbon1St4);
1401 voNomexSupportSt4Ch8->AddNode(voCarbonSupportSt4Ch8,2,trCarbon2St4);
1402
1403 // Add readout cables
1404 gMC->Gsvolu("S07L","BOX",kCableMaterial,dum,0);
1405 gMC->Gsvolu("S08L","BOX",kCableMaterial,dum,0);
1406
1407 ySlat41 = 0.;
1408 ySlat42 = 0.;
1409 Float_t lCableX = 0.;
1410 Float_t lCableY = 0.;
1411 Float_t lCableY8 = 0.;
1412 Float_t lCableZ = 0.;
1413 Float_t cablepar[3] = {supporthlength/2., kCableHeight/2., kCableWidth/2.};
1414 Float_t lCableDY = 0.;
1415 Float_t lCableDY8 = 0.;
1416 for (i = 0; i<kNslats4; i++){
1417 Int_t iCable = 1;
1418 Int_t cIndex = 0;
1419 Int_t cIndex8 = 0;
1420 ySlat41 += kYpos41[i];
1421 ySlat42 += kYpos42[i];
1422
1423 lCableY = ySlat41;
1424 lCableY8 = ySlat42;
1425
1426 // Cables going out from the start of slat
1427 if(kNPCB4[i]>=4){ // Only if 4 or more pcb
1428 // First top cables
1429 cablepar[0] = (supporthlength-kXpos4[i])/2.;
1430 lCableX = kXpos4[i]/2.;
1431 lCableDY = (kYpos41[i+1]+kYpos41[i+2])/2.-cablepar[1];
1432 lCableDY8 = (kYpos42[i+1]+kYpos42[i+2])/2.-cablepar[1];
75b41f84 1433 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
253d1046 1434 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
1435 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
1436 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3);
1437 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3);
1438 // Then bottom cables
1439 if (i>0){
1440 if (i==1) { // Rounded slat. Bottom cable starts at dMotherInner (beam pipe)
1441 cablepar[0] = (supporthlength-kXpos4[i]-dMotherInner)/2.;
1442 lCableX = (kXpos4[i]+dMotherInner)/2.;
1443 lCableDY = (kYpos41[i]+kYpos41[i])/2.-cablepar[1];
1444 lCableDY8 = (kYpos42[i]+kYpos42[i])/2.-cablepar[1];
1445 }
1446 if (i>=2) {
1447 lCableDY = (kYpos41[i]+kYpos41[i-1])/2.-cablepar[1];
1448 if ((lCableY-lCableDY)<(dMotherInner+cablepar[1])){
1449 lCableDY = lCableY - dMotherInner - cablepar[1];
1450 }
1451 lCableDY8 = (kYpos42[i]+kYpos42[i-1])/2.-cablepar[1];
1452 if ((lCableY8-lCableDY8)<(dMotherInner+cablepar[1])){
1453 lCableDY8 = lCableY8 - dMotherInner - cablepar[1];
1454 }
1455 }
1456 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
1457 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
1458 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8-lCableDY8,lCableZ,0,"ONLY",cablepar,3);
1459 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8-lCableDY8),lCableZ,0,"ONLY",cablepar,3);
1460 }
1461 }
1462
1463 // Rounded slats have an extra cable starting at second pcb
1464 if(i==1){
1465 // Only on top
1466 cablepar[0] = (supporthlength-kPcbLength-kVframeLength)/2.;
1467 lCableX = (kPcbLength+kVframeLength)/2.;
1468 lCableDY = (kYpos41[i+1]+kYpos41[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
1469 lCableDY8 = (kYpos42[i+1]+kYpos42[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
75b41f84 1470 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
253d1046 1471 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
1472 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
1473 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3);
1474 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3);
1475 }
1476
1477 // Cables going out from the end of the slats
1478 cablepar[0] = (supporthlength-(slatLength4[i]+kXpos4[i]+kDslatLength)+kVframeLength)/2.;
1479 lCableX = slatLength4[i]+kXpos4[i]-kVframeLength+kDslatLength+cablepar[0]-supporthlength/2.;
1480 if(i+1>=kNslats4 || i+2>=kNslats4){ // If no more higher slats, then use distance to lower slat
1481 lCableDY = kPcbHeight/2.+cablepar[1];
1482 lCableDY8 = lCableDY;
1483 }
1484 else {
1485 lCableDY = (kYpos41[i+1]+kYpos41[i+2])/2.-cablepar[1];
1486 lCableDY8 = (kYpos42[i+1]+kYpos42[i+2])/2.-cablepar[1];
1487 }
75b41f84 1488 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
253d1046 1489 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
1490 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
1491 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8+lCableDY8,lCableZ,0,"ONLY",cablepar,3);
1492 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8+lCableDY8),lCableZ,0,"ONLY",cablepar,3);
1493 // Then bottom cables
1494 if(i>0){
1495 if (i==1) {
1496 lCableDY = (kYpos41[i]+kYpos41[i])/2.-cablepar[1];
1497 lCableDY8 = (kYpos42[i]+kYpos42[i])/2.-cablepar[1];
1498 }
1499 else{
1500 lCableDY = (kYpos41[i]+kYpos41[i-1])/2.-cablepar[1]; // half way between 2 slats on same side
1501 if ((lCableY-lCableDY)<(dMotherInner+cablepar[1])){
1502 lCableDY = lCableY - dMotherInner - cablepar[1];
1503 }
1504 lCableDY8 = (kYpos42[i]+kYpos42[i-1])/2.-cablepar[1]; // half way between 2 slats on same side
1505 if ((lCableY8-lCableDY8)<(dMotherInner+cablepar[1])){
1506 lCableDY8 = lCableY8 - dMotherInner - cablepar[1];
1507 }
1508 }
1509 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
1510 gMC->Gsposp("S07L",10*i+cIndex++,"S07S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
1511 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,lCableY8-lCableDY8,lCableZ,0,"ONLY",cablepar,3);
1512 gMC->Gsposp("S08L",10*i+cIndex8++,"S08S",lCableX,-(lCableY8-lCableDY8),lCableZ,0,"ONLY",cablepar,3);
1513 }
1514 }
1515
ed6f6d60 1516 Float_t dzCh7 = dzCh;
5fa6d4cf 1517 TGeoTranslation* trSupport1St4 = new TGeoTranslation("trSupport1St4", supporthlength/2., 0. , dzCh7);
1518 TGeoRotation* roSupportSt4 = new TGeoRotation("roSupportSt4",90.,180.,-90.);
1519 TGeoCombiTrans* coSupport2St4 = new TGeoCombiTrans(-supporthlength/2., 0., -dzCh7, roSupportSt4);
cd8824a7 1520 GetEnvelopes(9)->AddEnvelope("S07S", 0, 1, *trSupport1St4);
1521 GetEnvelopes(8)->AddEnvelope("S07S", 0, 2, *coSupport2St4);
253d1046 1522 GetEnvelopes(11)->AddEnvelope("S08S", 0, 1, *trSupport1St4);
1523 GetEnvelopes(10)->AddEnvelope("S08S", 0, 2, *coSupport2St4);
cd8824a7 1524
ed6f6d60 1525 // End of pannel support geometry
1526
e516b01d 1527 // cout << "Geometry for Station 4...... done" << endl;
1528
1529 }
d1cd2474 1530
e516b01d 1531 if (fStations[4]) {
6296ba34 1532
d1cd2474 1533
e516b01d 1534 // //********************************************************************
1535 // // Station 5 **
1536 // //********************************************************************
cd8824a7 1537 // Mother volume for each chamber in St4 is an envelop (or assembly)
1538 // There is one assembly mother per half a chamber called SC09I, SC09O, SC10I and SC10O
1539 // Same volume name definitions as in St3
1540
e516b01d 1541 const Int_t kNslats5 = 7; // number of slats per quadrant
1542 const Int_t kNPCB5[kNslats5] = {5, 6, 6, 6, 5, 4, 3}; // n PCB per slat
b0e65056 1543 const Float_t kXpos5[kNslats5] = {38.75, 0., 0., 0., 0., 0., 0.}; // J.C. Correct value
e516b01d 1544 const Float_t kYpos5[kNslats5] = {0., 38.2, 37.9, 37.6, 37.3, 37.05, 36.75};
1545 Float_t slatLength5[kNslats5];
1546
253d1046 1547 Float_t rPhi1 = TMath::RadToDeg()*(TMath::ASin((kYpos5[1]-hFramepar[1])/(AliMUONConstants::Rmin(4))));
1548 Float_t rPhi2 = TMath::RadToDeg()*(TMath::ACos(-vFramepar[0]/(AliMUONConstants::Rmin(4)-kRframeLength)));
1549 Float_t rFramepar5[5] = { AliMUONConstants::Rmin(4)-kRframeLength, AliMUONConstants::Rmin(4), kRframeWidth, rPhi1, rPhi2};
1550 Float_t vrFrameHeight = hFramepar[1]+kYpos5[1]-AliMUONConstants::Rmin(4)+kRframeLength;
e516b01d 1551
1552 char idSlatCh9[5];
1553 char idSlatCh10[5];
1554 Float_t xSlat5;
1555 Float_t ySlat5 = 0;
1556 angle = 0.;
1557
1558 for (i = 0; i < kNslats5; i++){
1559
1560 slatLength5[i] = kPcbLength * kNPCB5[i] + 2.* kVframeLength;
1561 xSlat5 = slatLength5[i]/2. + kDslatLength + kXpos5[i];
1562 ySlat5 += kYpos5[i];
1563
1564 spar[0] = slatLength5[i]/2.;
1565 spar[1] = kSlatHeight/2.;
1566 spar[2] = kSlatWidth/2.;
1567
1568 Float_t dzCh5 = dzCh;
1569 Float_t zSlat5 = (i%2 ==0)? -zSlat : zSlat;
1570
1571 sprintf(idSlatCh9,"LE%d",kNslats5-1+i);
e856ab99 1572 detElemId = 913 - (i + kNslats5-1-6);
cd8824a7 1573 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1574 if (detElemId % 2 == 0)
1575 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(xSlat5, ySlat5, -zSlat5 + dzCh5),
1576 TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
1577 else
1578 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(xSlat5, ySlat5, -zSlat5 + dzCh5),
1579 TGeoRotation("rot1",90,angle,90,270+angle,180,0) );
e516b01d 1580 sprintf(idSlatCh9,"LE%d",3*kNslats5-2+i);
e856ab99 1581 detElemId = 900 + (i + kNslats5-1-6);
cd8824a7 1582 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1583 if (detElemId % 2 == 0)
1584 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(-xSlat5, ySlat5, zSlat5 - dzCh5),
1585 TGeoRotation("rot2",90,180+angle,90,270+angle,0,0) );
1586 else
1587 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(-xSlat5, ySlat5, zSlat5 - dzCh5),
1588 TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
e516b01d 1589 if (i > 0) {
1590 sprintf(idSlatCh9,"LE%d",kNslats5-1-i);
e856ab99 1591 detElemId = 913 + (i + kNslats5-1-6);
cd8824a7 1592 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1593 if (detElemId % 2 == 0 && detElemId != 914)
1594 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(xSlat5, -ySlat5, -zSlat5 + dzCh5),
1595 TGeoRotation("rot3",90,angle,90,90+angle,0,0) );
1596 else
1597 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(xSlat5, -ySlat5, -zSlat5 + dzCh5),
e516b01d 1598 TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
e516b01d 1599 sprintf(idSlatCh9,"LE%d",3*kNslats5-2-i);
e856ab99 1600 detElemId = 926 - (i + kNslats5-1-6);
cd8824a7 1601 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1602 if (detElemId % 2 == 1 && detElemId != 925 )
1603 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(-xSlat5, -ySlat5, zSlat5 - dzCh5),
1604 TGeoRotation("rot4",90,180+angle,90,90+angle,180,0) );
1605 else
1606 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh9, detElemId, true, TGeoTranslation(-xSlat5, -ySlat5, zSlat5 - dzCh5),
1607 TGeoRotation("rot4",90,180+angle,90,270+angle,0,0) );
e516b01d 1608 }
1609
1610 sprintf(idSlatCh10,"LF%d",kNslats5-1+i);
e856ab99 1611 detElemId = 1013 - (i + kNslats5-1-6);
cd8824a7 1612 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1613 if (detElemId % 2 == 0)
1614 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(xSlat5, ySlat5, -zSlat5 + dzCh5),
1615 TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
1616 else
1617 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(xSlat5, ySlat5, -zSlat5 + dzCh5),
1618 TGeoRotation("rot5",90,angle,90,270+angle,180,0) );
e516b01d 1619
1620 sprintf(idSlatCh10,"LF%d",3*kNslats5-2+i);
e856ab99 1621 detElemId = 1000 + (i + kNslats5-1-6);
cd8824a7 1622 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1623 if (detElemId % 2 == 0)
1624 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(-xSlat5, ySlat5, zSlat5 - dzCh5),
1625 TGeoRotation("rot6",90,180+angle,90,270+angle,0,0) );
1626 else
1627 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(-xSlat5, ySlat5, zSlat5 - dzCh5),
1628 TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
e516b01d 1629 if (i > 0) {
1630 sprintf(idSlatCh10,"LF%d",kNslats5-1-i);
e856ab99 1631 detElemId = 1013 + (i + kNslats5-1-6);
cd8824a7 1632 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1633 if (detElemId % 2 == 0 && detElemId != 1014)
1634 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(xSlat5, -ySlat5, -zSlat5 + dzCh5),
1635 TGeoRotation("rot7",90,angle,90,90+angle,0,0) );
1636 else
1637 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(xSlat5, -ySlat5, -zSlat5 + dzCh5),
e516b01d 1638 TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
1639 sprintf(idSlatCh10,"LF%d",3*kNslats5-2-i);
e856ab99 1640 detElemId = 1026 - (i + kNslats5-1-6);
cd8824a7 1641 moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
5fa6d4cf 1642 if (detElemId % 2 == 1 && detElemId != 1025 )
1643 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(-xSlat5, -ySlat5, zSlat5 - dzCh5),
1644 TGeoRotation("rot8",90,180+angle,90,90+angle,180,0) );
1645 else
1646 GetEnvelopes(moduleId)->AddEnvelope(idSlatCh10, detElemId, true, TGeoTranslation(-xSlat5, -ySlat5, zSlat5 - dzCh5),
1647 TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
e516b01d 1648 }
1649 }
1650
1651 // create the panel volume
d12a7158 1652
e516b01d 1653 gMC->Gsvolu("S09C","BOX",kCarbonMaterial,panelpar,3);
253d1046 1654 gMC->Gsvolu("SD9C","BOX",kCarbonMaterial,panelpar,3);
e516b01d 1655 gMC->Gsvolu("S10C","BOX",kCarbonMaterial,panelpar,3);
253d1046 1656 gMC->Gsvolu("SD0C","BOX",kCarbonMaterial,panelpar,3);
e516b01d 1657
1658 // create the nomex volume
1659
1660 gMC->Gsvolu("S09N","BOX",kNomexMaterial,nomexpar,3);
253d1046 1661 gMC->Gsvolu("SD9N","BOX",kNomexMaterial,nomexpar,3);
e516b01d 1662 gMC->Gsvolu("S10N","BOX",kNomexMaterial,nomexpar,3);
253d1046 1663 gMC->Gsvolu("SD0N","BOX",kNomexMaterial,nomexpar,3);
d1cd2474 1664
d1cd2474 1665
e516b01d 1666 // create the nomex volume (bulk)
d1cd2474 1667
e516b01d 1668 gMC->Gsvolu("S09X","BOX",kNomexBMaterial,nomexbpar,3);
253d1046 1669 gMC->Gsvolu("SD9X","BOX",kNomexBMaterial,nomexbpar,3);
e516b01d 1670 gMC->Gsvolu("S10X","BOX",kNomexBMaterial,nomexbpar,3);
253d1046 1671 gMC->Gsvolu("SD0X","BOX",kNomexBMaterial,nomexbpar,3);
d1cd2474 1672
e516b01d 1673 // create the insulating material volume
d1cd2474 1674
e516b01d 1675 gMC->Gsvolu("S09I","BOX",kInsuMaterial,insupar,3);
253d1046 1676 gMC->Gsvolu("SD9I","BOX",kInsuMaterial,insupar,3);
e516b01d 1677 gMC->Gsvolu("S10I","BOX",kInsuMaterial,insupar,3);
253d1046 1678 gMC->Gsvolu("SD0I","BOX",kInsuMaterial,insupar,3);
c3b69531 1679
e516b01d 1680 // create the PCB volume
1681
1682 gMC->Gsvolu("S09P","BOX",kPcbMaterial,pcbpar,3);
253d1046 1683 gMC->Gsvolu("SD9P","BOX",kPcbMaterial,pcbpar,3);
e516b01d 1684 gMC->Gsvolu("S10P","BOX",kPcbMaterial,pcbpar,3);
253d1046 1685 gMC->Gsvolu("SD0P","BOX",kPcbMaterial,pcbpar,3);
d1cd2474 1686
e516b01d 1687 // create the sensitive volumes,
1688
1689 gMC->Gsvolu("S09G","BOX",kSensMaterial,dum,0);
253d1046 1690 gMC->Gsvolu("SD9G","BOX",kSensMaterial,senspar,3);
e516b01d 1691 gMC->Gsvolu("S10G","BOX",kSensMaterial,dum,0);
253d1046 1692 gMC->Gsvolu("SD0G","BOX",kSensMaterial,senspar,3);
e516b01d 1693
1694 // create the vertical frame volume
1695
1696 gMC->Gsvolu("S09V","BOX",kVframeMaterial,vFramepar,3);
1697 gMC->Gsvolu("S10V","BOX",kVframeMaterial,vFramepar,3);
1698
253d1046 1699 // create the rounded vertical frame volume
1700
1701 gMC->Gsvolu("SD9D","TUBS",kRframeMaterial,rFramepar5,5);
1702 gMC->Gsvolu("SD0D","TUBS",kRframeMaterial,rFramepar5,5);
1703
e516b01d 1704 // create the horizontal frame volume
1705
1706 gMC->Gsvolu("S09H","BOX",kHframeMaterial,hFramepar,3);
253d1046 1707 gMC->Gsvolu("SD9H","BOX",kHframeMaterial,hFramepar,3);
e516b01d 1708 gMC->Gsvolu("S10H","BOX",kHframeMaterial,hFramepar,3);
253d1046 1709 gMC->Gsvolu("SD0H","BOX",kHframeMaterial,hFramepar,3);
e516b01d 1710
1711 // create the horizontal border volume
1712
1713 gMC->Gsvolu("S09B","BOX",kBframeMaterial,bFramepar,3);
253d1046 1714 gMC->Gsvolu("SD9B","BOX",kBframeMaterial,bFramepar,3);
e516b01d 1715 gMC->Gsvolu("S10B","BOX",kBframeMaterial,bFramepar,3);
253d1046 1716 gMC->Gsvolu("SD0B","BOX",kBframeMaterial,bFramepar,3);
1717
1718 // Replace the volume shape with a composite shape
1719 // with substracted overlap with beam shield
1720 if ( gMC->IsRootGeometrySupported() ) {
1721
1722 // Get shape
1723 Int_t nSlatType = 1;
1724 Int_t nVol = 8;
b2f96010 1725 const char* slatType = "D"; // D: Rounde slat
1726 const char* volLetter = "CNXIPHBG";
1727 TString volName;
1728 TString compName;
1729 TString csName;
253d1046 1730 TGeoVolume *mVol = 0x0;
1731 // Beam shield recess
253d1046 1732 new TGeoTube("tube5Cut", 0., AliMUONConstants::Rmin(4), kSlatWidth/2.+0.001);
c15bef4d 1733 TObjArray rounded5Slat(nSlatType*((nVol+1)*2));
253d1046 1734 // Displacement
1735 TGeoTranslation* trDTube5 = new TGeoTranslation("trDTube5", -(kPcbLength+kVframeLength)/2., -kYpos5[1], 0.);
1736 trDTube5->RegisterYourself();
71db1057 1737 TGeoTranslation* trDBTube5 = new TGeoTranslation("trDBTube5", 0., ( kPcbHeight - kBframeHeight ) / 2., 0.);
1738 trDBTube5->Add(trDTube5);
1739 trDBTube5->RegisterYourself();
1740
c15bef4d 1741 TObjArray composite5(nSlatType*((nVol+1)*2));
253d1046 1742 new TGeoBBox("box5DCut",(kPcbLength+kVframeLength)/2., hFramepar[1], vFramepar[2]+0.001);
1743 // Displacement
1744 TGeoTranslation* trDBox5 = new TGeoTranslation("trDBox5",kPcbLength/2., kYpos5[1], 0.);
1745 trDBox5->RegisterYourself();
1746
1747 TGeoBBox *box5Vframe = new TGeoBBox("box5Vframe",vFramepar[0],vrFrameHeight/2., vFramepar[2]);
1748 TGeoTranslation* trVBox5 = new TGeoTranslation("trVBox5", 0., AliMUONConstants::Rmin(4)-kRframeLength + box5Vframe->GetDY(), 0.);
1749 trVBox5->RegisterYourself();
1750
1751 for(int iCh=9; iCh<=10; iCh++){
1752 for (int iSlatType = 0; iSlatType<nSlatType; iSlatType++) {
1753 for (int iVol = 0; iVol<nVol; iVol++){
1754 Int_t lIndex = (iCh-9)*(nSlatType*(nVol+1))+iSlatType*(nVol+1)+iVol;
b2f96010 1755 volName=Form("S%c%d%c",slatType[iSlatType],iCh%10,volLetter[iVol]);
253d1046 1756 mVol = gGeoManager->FindVolumeFast(volName);
1757 if ( !mVol ) {
1758 AliErrorStream()
1759 << "Slat volume " << volName << " not found" << endl;
1760 }
1761 else {
1762 rounded5Slat[lIndex] = mVol->GetShape();
b2f96010 1763 csName=Form("rounded5Slat%c%d%c",slatType[iSlatType],iCh%10,volLetter[iVol]);
c15bef4d 1764 ((TGeoShape*)rounded5Slat[lIndex])->SetName(csName);
253d1046 1765
1766 // Composite shape
1767 TString compOperation(csName);
1768 compOperation+="-tube5Cut:tr";
1769 compOperation+=slatType[iSlatType];
253d1046 1770 if (strstr(volName,"B")){
71db1057 1771 compOperation+="B";
253d1046 1772 }
71db1057 1773 compOperation+="Tube5";
b2f96010 1774 compName=Form("composite5%d%c",iCh,volLetter[iVol]);
253d1046 1775 composite5[lIndex] = new TGeoCompositeShape(compName, compOperation.Data());
1776
1777 // Reset shape to volume
c15bef4d 1778 mVol->SetShape((TGeoShape*)composite5[lIndex]);
253d1046 1779 }
1780 }
e516b01d 1781
253d1046 1782 // For rounded spacer
1783 Int_t lIndex = (iCh-9)*(nSlatType*(nVol+1))+iSlatType*(nVol+1)+nVol;
b2f96010 1784 volName=Form("S%c%dD",slatType[iSlatType],iCh%10);
253d1046 1785 mVol = gGeoManager->FindVolumeFast(volName);
1786 if ( !mVol ) {
1787 AliErrorStream()
1788 << "Slat volume " << volName << " not found" << endl;
1789 }
1790 else {
1791 rounded5Slat[lIndex] = mVol->GetShape();
b2f96010 1792 csName=Form("rounded5Slat%c%dD",slatType[iSlatType],iCh%10);
c15bef4d 1793 ((TGeoShape*)rounded5Slat[lIndex])->SetName(csName);
253d1046 1794
1795 // Composite shape
1796 TString compOperation(csName);
1797 if (strstr(volName,"SD")){
1798 compOperation.Prepend("(");
1799 compOperation+="+box5Vframe:trVBox5)*box5DCut:trDBox5";
1800 }
b2f96010 1801 compName=Form("composite5%c%dD",slatType[iSlatType],iCh%10);
253d1046 1802 composite5[lIndex] = new TGeoCompositeShape(compName, compOperation.Data());
1803 // Reset shape to volume
c15bef4d 1804 mVol->SetShape((TGeoShape*)composite5[lIndex]);
253d1046 1805 }
1806 }
1807 }
1808 }
1809
e516b01d 1810 index = 0;
1811 for (i = 0; i < kNslats5; i++){
1812 for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
1813
1814 if (i == 0 && quadrant == 2) continue;
1815 if (i == 0 && quadrant == 4) continue;
1816
1817 sprintf(idSlatCh9,"LE%d",ConvertSlatNum(i,quadrant,kNslats5-1));
1818 sprintf(idSlatCh10,"LF%d",ConvertSlatNum(i,quadrant,kNslats5-1));
cd8824a7 1819 Int_t moduleSlatCh9 = GetModuleId(idSlatCh9);
1820 Int_t moduleSlatCh10 = GetModuleId(idSlatCh10);
e516b01d 1821 Float_t xvFrame = (slatLength5[i] - kVframeLength)/2.; // ok
1822
1823 // position the vertical frames (spacers)
1824 if (i != 1) {
cd8824a7 1825 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
1826 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
1827 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
1828 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
253d1046 1829 } else { // Vertical and Rounded+Vertical spacer
cd8824a7 1830 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
253d1046 1831 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("SD9D", idSlatCh9, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,-kYpos5[1],0.));
cd8824a7 1832 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
253d1046 1833 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("SD0D", idSlatCh10, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,-kYpos5[1],0.));
e516b01d 1834 }
1835
1836 // position the panels and the insulating material
1837 for (j = 0; j < kNPCB5[i]; j++){
e516b01d 1838 index++;
c0bd5e65 1839 xx = kSensLength * (-kNPCB5[i]/2.+j+.5);
e516b01d 1840
1841 Float_t zPanel = spar[2] - nomexbpar[2];
253d1046 1842 if (i==1 && j==0){ // Rounded pcb of rounded slat
1843 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("SD9X", idSlatCh9, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1844 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("SD9X", idSlatCh9, 2*index,TGeoTranslation(xx,0.,-zPanel));
1845 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("SD9I", idSlatCh9, index,TGeoTranslation(xx,0.,0.));
1846 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("SD0X", idSlatCh10, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1847 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("SD0X", idSlatCh10, 2*index,TGeoTranslation(xx,0.,-zPanel));
1848 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("SD0I", idSlatCh10, index,TGeoTranslation(xx,0.,0.));
1849 } else {
1850 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("S09X", idSlatCh9, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1851 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("S09X", idSlatCh9, 2*index,TGeoTranslation(xx,0.,-zPanel));
1852 GetEnvelopes(moduleSlatCh9)->AddEnvelopeConstituent("S09I", idSlatCh9, index,TGeoTranslation(xx,0.,0.));
1853
1854 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("S10X", idSlatCh10, 2*index-1,TGeoTranslation(xx,0.,zPanel));
1855 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("S10X", idSlatCh10, 2*index,TGeoTranslation(xx,0.,-zPanel));
1856 GetEnvelopes(moduleSlatCh10)->AddEnvelopeConstituent("S10I", idSlatCh10, index,TGeoTranslation(xx,0.,0.));
1857 }
1858 }
1859 }
e516b01d 1860 }
1861
1862 // position the nomex volume inside the panel volume
1863 gMC->Gspos("S09N",1,"S09C",0.,0.,0.,0,"ONLY");
253d1046 1864 gMC->Gspos("SD9N",1,"SD9C",0.,0.,0.,0,"ONLY");
e516b01d 1865 gMC->Gspos("S10N",1,"S10C",0.,0.,0.,0,"ONLY");
253d1046 1866 gMC->Gspos("SD0N",1,"SD0C",0.,0.,0.,0,"ONLY");
e516b01d 1867
1868 // position panel volume inside the bulk nomex material volume
1869 gMC->Gspos("S09C",1,"S09X",0.,0.,kNomexBWidth/2.,0,"ONLY");
253d1046 1870 gMC->Gspos("SD9C",1,"SD9X",0.,0.,kNomexBWidth/2.,0,"ONLY");
e516b01d 1871 gMC->Gspos("S10C",1,"S10X",0.,0.,kNomexBWidth/2.,0,"ONLY");
253d1046 1872 gMC->Gspos("SD0C",1,"SD0X",0.,0.,kNomexBWidth/2.,0,"ONLY");
e516b01d 1873
1874 // position the PCB volume inside the insulating material volume
1875 gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY");
253d1046 1876 gMC->Gspos("SD9P",1,"SD9I",0.,0.,0.,0,"ONLY");
e516b01d 1877 gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY");
253d1046 1878 gMC->Gspos("SD0P",1,"SD0I",0.,0.,0.,0,"ONLY");
e516b01d 1879
1880 // position the horizontal frame volume inside the PCB volume
1881 gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY");
253d1046 1882 gMC->Gspos("SD9H",1,"SD9P",0.,0.,0.,0,"ONLY");
e516b01d 1883 gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY");
253d1046 1884 gMC->Gspos("SD0H",1,"SD0P",0.,0.,0.,0,"ONLY");
e516b01d 1885
1886 // position the sensitive volume inside the horizontal frame volume
1887 gMC->Gsposp("S09G",1,"S09H",0.,0.,0.,0,"ONLY",senspar,3);
253d1046 1888 gMC->Gspos("SD9G",1,"SD9H",0.,0.,0.,0,"ONLY");
e516b01d 1889 gMC->Gsposp("S10G",1,"S10H",0.,0.,0.,0,"ONLY",senspar,3);
253d1046 1890 gMC->Gspos("SD0G",1,"SD0H",0.,0.,0.,0,"ONLY");
e516b01d 1891
1892 // position the border volumes inside the PCB volume
1893 Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.;
1894 gMC->Gspos("S09B",1,"S09P",0., yborder,0.,0,"ONLY");
1895 gMC->Gspos("S09B",2,"S09P",0.,-yborder,0.,0,"ONLY");
253d1046 1896 gMC->Gspos("S09B",1,"SD9P",0., yborder,0.,0,"ONLY");
71db1057 1897 gMC->Gspos("SD9B",1,"SD9P",0.,-yborder,0.,0,"ONLY");
e516b01d 1898 gMC->Gspos("S10B",1,"S10P",0., yborder,0.,0,"ONLY");
1899 gMC->Gspos("S10B",2,"S10P",0.,-yborder,0.,0,"ONLY");
253d1046 1900 gMC->Gspos("S10B",1,"SD0P",0., yborder,0.,0,"ONLY");
71db1057 1901 gMC->Gspos("SD0B",1,"SD0P",0.,-yborder,0.,0,"ONLY");
e516b01d 1902
1903 // // create the NULOC volume and position it in the horizontal frame
1904
1905 gMC->Gsvolu("S09E","BOX",kNulocMaterial,nulocpar,3);
1906 gMC->Gsvolu("S10E","BOX",kNulocMaterial,nulocpar,3);
1907 index = 0;
253d1046 1908 Float_t rPhi3 = TMath::ASin((kYpos5[1]-kPcbHeight/2.)/AliMUONConstants::Rmin(4));
1909 Float_t xxmax4 = (AliMUONConstants::Rmin(4)*TMath::Cos(rPhi3)-kVframeLength/2.) - (kBframeLength - kNulocLength)/2.;
e516b01d 1910 for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) {
1911 index++;
1912 gMC->Gspos("S09E",2*index-1,"S09B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
1913 gMC->Gspos("S09E",2*index ,"S09B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
1914 gMC->Gspos("S10E",2*index-1,"S10B", xx, 0.,-kBframeWidth/2. + kNulocWidth/2, 0, "ONLY");
1915 gMC->Gspos("S10E",2*index ,"S10B", xx, 0., kBframeWidth/2. - kNulocWidth/2, 0, "ONLY");
1916 }
253d1046 1917 if (xx > xxmax4 && xx< xxmax) {
71db1057 1918 gMC->Gspos("S09E",2*index-1,"SD9B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
1919 gMC->Gspos("S09E",2*index ,"SD9B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
1920 gMC->Gspos("S10E",2*index-1,"SD0B", xx, 0.,-kBframeWidth/2.+ kNulocWidth/2, 0, "ONLY");
1921 gMC->Gspos("S10E",2*index ,"SD0B", xx, 0., kBframeWidth/2.- kNulocWidth/2, 0, "ONLY");
d1cd2474 1922 }
253d1046 1923
1924 //
cd8824a7 1925 //Geometry of the support pannel Verticla length 5.7m, horizontal length 2.6m, internal radius dMotherInner o SC09 and SC10 (F. Orsini, Saclay)
ed6f6d60 1926 //Carbon fiber of 0.3 mm thick (2 layers) and a central layer of Nomex of 15mm thick.
cd8824a7 1927 Float_t dMotherInner = AliMUONConstants::Rmin(4)-kRframeHeight;
ed6f6d60 1928 Float_t nomexthickness = 1.5;
1929 Float_t carbonthickness = 0.03;
1930 Float_t supporthlength = 260.;
1931 Float_t supportvlength = 570.;
1932 // Generating the composite shape of the carbon and nomex pannels
253d1046 1933 new TGeoBBox("shNomexBoxSt5",supporthlength/2., supportvlength/2. ,nomexthickness/2.+carbonthickness+3*kCableWidth);
ed6f6d60 1934 new TGeoBBox("shCarbonBoxSt5",supporthlength/2., supportvlength/2. ,carbonthickness/2.);
253d1046 1935 new TGeoTubeSeg("shNomexHoleSt5",0., dMotherInner, nomexthickness/2.+carbonthickness+3*kCableWidth+0.001, -90. ,90.);
ed6f6d60 1936 new TGeoTubeSeg("shCarbonHoleSt5",0., dMotherInner, carbonthickness/2.+0.001, -90. ,90.);
5fa6d4cf 1937 TGeoTranslation* trHoleSt5 = new TGeoTranslation("trHoleSt5",-supporthlength/2.,0.,0.);
ed6f6d60 1938 trHoleSt5->RegisterYourself();
5fa6d4cf 1939 TGeoCompositeShape* shNomexSupportSt5 = new TGeoCompositeShape("shNomexSupportSt5","shNomexBoxSt5-shNomexHoleSt5:trHoleSt5");
1940 TGeoCompositeShape* shCarbonSupportSt5 = new TGeoCompositeShape("shCarbonSupportSt5","shCarbonBoxSt5-shCarbonHoleSt5:trHoleSt5");
253d1046 1941
ed6f6d60 1942 // Generating Nomex and Carbon pannel volumes
5fa6d4cf 1943 TGeoVolume* voNomexSupportSt5 = new TGeoVolume("S09S", shNomexSupportSt5, kMedNomex);
1944 TGeoVolume* voCarbonSupportSt5 = new TGeoVolume("S09K", shCarbonSupportSt5, kMedCarbon);
1945 TGeoTranslation* trCarbon1St5 = new TGeoTranslation("trCarbon1St5",0.,0., -(nomexthickness+carbonthickness)/2.);
1946 TGeoTranslation* trCarbon2St5 = new TGeoTranslation("trCarbon2St5",0.,0., (nomexthickness+carbonthickness)/2.);
ed6f6d60 1947 voNomexSupportSt5->AddNode(voCarbonSupportSt5,1,trCarbon1St5);
1948 voNomexSupportSt5->AddNode(voCarbonSupportSt5,2,trCarbon2St5);
253d1046 1949
1950 // Add readout cables
1951 gMC->Gsvolu("S09L","BOX",kCableMaterial,dum,0);
1952
1953 ySlat5 = 0.;
1954 Float_t lCableX = 0.;
1955 Float_t lCableY = 0.;
1956 Float_t lCableZ = 0.;
1957 Float_t cablepar[3] = {supporthlength/2., kCableHeight/2., kCableWidth/2.};
1958 Float_t lCableDY = 0.;
1959 for (i = 0; i<kNslats5; i++){
1960 Int_t iCable = 1;
1961 Int_t cIndex = 0;
1962 ySlat5 += kYpos5[i];
1963
1964 lCableY = ySlat5;
1965
1966 // Cables going out from the start of slat
1967 if(kNPCB5[i]>=4){ // Only if 4 or more pcb
1968 // First top cables
1969 cablepar[0] = (supporthlength-kXpos5[i])/2.;
1970 lCableX = kXpos5[i]/2.;
1971 if(i+1>=kNslats5 || i+2>=kNslats5){ // If no more higher slats, then use distance to lower slat
1972 lCableDY = (kYpos5[i]+kYpos5[i-1])/2.-cablepar[1];
1973 }
1974 else {
1975 lCableDY = (kYpos5[i+1]+kYpos5[i+2])/2.-cablepar[1];
1976 }
75b41f84 1977 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
253d1046 1978 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
1979 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
1980 // Then bottom cables
1981 if (i>0) {
1982 if (i==1) { // Rounded slat. Bottom cable starts at dMotherInner (beam pipe)
1983 cablepar[0] = (supporthlength-kXpos5[i]-dMotherInner)/2.;
1984 lCableX = (kXpos5[i]+dMotherInner)/2.;
1985 lCableDY = (kYpos5[i]+kYpos5[i])/2.-cablepar[1];
1986 }
1987 else {
1988 lCableDY = (kYpos5[i]+kYpos5[i-1])/2.-cablepar[1];
1989 if ((lCableY-lCableDY)<(dMotherInner+cablepar[1])){
1990 lCableDY = lCableY - dMotherInner - cablepar[1];
1991 }
1992 }
1993 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
1994 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
1995 }
1996 }
1997
1998 // Rounded slats have an extra cable starting at second pcb
1999 if(i==1){
2000 // Only on top
2001 cablepar[0] = (supporthlength-kPcbLength-kVframeLength)/2.;
2002 lCableX = (kPcbLength+kVframeLength)/2.;
2003 lCableDY = (kYpos5[i+1]+kYpos5[i+2])/2.-cablepar[1]; // half way between 2 slats on same side
75b41f84 2004 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
253d1046 2005 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
2006 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
2007 }
2008
2009 // Cables going out from the end of the slats
2010 // First top cables
2011 cablepar[0] = (supporthlength-(slatLength5[i]+kXpos5[i]+kDslatLength)+kVframeLength)/2.;
2012 lCableX = slatLength5[i]+kXpos5[i]-kVframeLength+kDslatLength+cablepar[0]-supporthlength/2.;
2013 if(i+1>=kNslats5 || i+2>=kNslats5){ // If no more higher slats, then use distance to lower slat
2014 lCableDY = (kYpos5[i]+kYpos5[i-1])/2.-cablepar[1];
2015 }
2016 else {
2017 lCableDY = (kYpos5[i+1]+kYpos5[i+2])/2.-cablepar[1];
2018 }
75b41f84 2019 lCableZ = TMath::Power(-1,i)*(nomexthickness/2.+carbonthickness+(-1+iCable++)*kCableWidth+kCableWidth/2.);
253d1046 2020 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,lCableY+lCableDY,lCableZ,0,"ONLY",cablepar,3);
2021 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,-(lCableY+lCableDY),lCableZ,0,"ONLY",cablepar,3);
2022 if(i>0){
2023 if (i==1) { // Rounded slat. Bottom cable starts at dMotherInner (beam pipe)
2024 lCableDY = (kYpos5[i]+kYpos5[i])/2.-cablepar[1];
2025 }
2026 else {
2027 lCableDY = (kYpos5[i]+kYpos5[i-1])/2.-cablepar[1];
2028 if ((lCableY-lCableDY)<(dMotherInner+cablepar[1])){
2029 lCableDY = lCableY - dMotherInner - cablepar[1];
2030 }
2031 }
2032 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,lCableY-lCableDY,lCableZ,0,"ONLY",cablepar,3);
2033 gMC->Gsposp("S09L",10*i+cIndex++,"S09S",lCableX,-(lCableY-lCableDY),lCableZ,0,"ONLY",cablepar,3);
2034 }
2035 }
2036
ed6f6d60 2037 Float_t dzCh9 = dzCh;
5fa6d4cf 2038 TGeoTranslation* trSupport1St5 = new TGeoTranslation("trSupport1St5", supporthlength/2., 0. , dzCh9);
2039 TGeoRotation* roSupportSt5 = new TGeoRotation("roSupportSt5",90.,180.,-90.);
2040 TGeoCombiTrans* coSupport2St5 = new TGeoCombiTrans(-supporthlength/2., 0., -dzCh9, roSupportSt5);
cd8824a7 2041 GetEnvelopes(13)->AddEnvelope("S09S", 0, 1, *trSupport1St5);
2042 GetEnvelopes(12)->AddEnvelope("S09S", 0, 2, *coSupport2St5);
2043 GetEnvelopes(15)->AddEnvelope("S09S", 0, 3, *trSupport1St5);
2044 GetEnvelopes(14)->AddEnvelope("S09S", 0, 4, *coSupport2St5);
2045
2046
ed6f6d60 2047 // End of pannel support geometry
2048
e516b01d 2049 // cout << "Geometry for Station 5...... done" << endl;
2050
2051 }
69776907 2052
2053 delete [] fStations;
2054
d1cd2474 2055}
2056
d1cd2474 2057//______________________________________________________________________________
b96f7067 2058void AliMUONSlatGeometryBuilder::SetVolumes()
d1cd2474 2059{
b96f7067 2060/// Defines the volumes for the station345 chambers.
eb1c3e3a 2061
2062 if (gAlice->GetModule("DIPO")) {
2063 // if DIPO is preset, the whole station will be placed in DDIP volume
2064 SetMotherVolume(4, "DDIP");
2065 SetMotherVolume(5, "DDIP");
cd8824a7 2066 SetMotherVolume(6, "DDIP");
2067 SetMotherVolume(7, "DDIP");
2068 }
2069 SetVolume(4, "SC05I", true);
2070 SetVolume(5, "SC05O", true);
2071 SetVolume(6, "SC06I", true);
2072 SetVolume(7, "SC06O", true);
2073
c0404a6c 2074 if (gAlice->GetModule("SHIL")) {
c0404a6c 2075 SetMotherVolume(8, "YOUT2");
2076 SetMotherVolume(9, "YOUT2");
cd8824a7 2077 SetMotherVolume(10, "YOUT2");
2078 SetMotherVolume(11, "YOUT2");
2079 SetMotherVolume(12, "YOUT2");
2080 SetMotherVolume(13, "YOUT2");
2081 SetMotherVolume(14, "YOUT2");
2082 SetMotherVolume(15, "YOUT2");
eb1c3e3a 2083 }
c0404a6c 2084
cd8824a7 2085 SetVolume( 8, "SC07I", true);
2086 SetVolume( 9, "SC07O", true);
2087 SetVolume(10, "SC08I", true);
2088 SetVolume(11, "SC08O", true);
2089 SetVolume(12, "SC09I", true);
2090 SetVolume(13, "SC09O", true);
2091 SetVolume(14, "SC10I", true);
2092 SetVolume(15, "SC10O", true);
b96f7067 2093}
2094
2095
2096//______________________________________________________________________________
2097void AliMUONSlatGeometryBuilder::SetTransformations()
2098{
2099/// Defines the transformations for the station345 chambers.
eb1c3e3a 2100
2c9844e7 2101// Stations 345 are not perpendicular to the beam axis
2102// See AliMUONConstants class
2103 TGeoRotation st345inclination("rot99");
2104 st345inclination.RotateX(AliMUONConstants::St345Inclination());
2105
aa431521 2106// The rotation of the half-chamber is done with respect the center of the chamber.
2107// the distance beween the roation axis and the chamber position is
2108// AliMUONConstants::DzCh()+AliMUONConstants::DzSlat()
2109// Therefore the position of the half-chamber has to be corrected by a traslation in Z and Y axis
08299247 2110 Double_t deltaY = (AliMUONConstants::DzCh()+AliMUONConstants::DzSlat())*
aa431521 2111 TMath::Sin(AliMUONConstants::St345Inclination() * TMath::Pi()/180.);
08299247 2112 Double_t deltaZ = (AliMUONConstants::DzCh()+AliMUONConstants::DzSlat())*
aa431521 2113 (1.-TMath::Cos(AliMUONConstants::St345Inclination() * TMath::Pi()/180.));
2114
2115
b7ef3c96 2116 Double_t zpos1= - AliMUONConstants::DefaultChamberZ(4);
08299247 2117 SetTransformation(4, TGeoTranslation(0., -deltaY, -deltaZ+zpos1), st345inclination);
2118 SetTransformation(5, TGeoTranslation(0., deltaY, deltaZ+zpos1), st345inclination);
b7ef3c96 2119
2120 zpos1= - AliMUONConstants::DefaultChamberZ(5);
08299247 2121 SetTransformation(6, TGeoTranslation(0., -deltaY, -deltaZ+zpos1), st345inclination);
2122 SetTransformation(7, TGeoTranslation(0., deltaY, deltaZ+zpos1), st345inclination);
b7ef3c96 2123
2124 zpos1 = - AliMUONConstants::DefaultChamberZ(6);
08299247 2125 SetTransformation(8, TGeoTranslation(0., -deltaY, -deltaZ+zpos1), st345inclination);
2126 SetTransformation(9, TGeoTranslation(0., deltaY, deltaZ+zpos1), st345inclination);
b7ef3c96 2127
2128 zpos1 = - AliMUONConstants::DefaultChamberZ(7);
08299247 2129 SetTransformation(10, TGeoTranslation(0., -deltaY, -deltaZ+zpos1), st345inclination );
2130 SetTransformation(11, TGeoTranslation(0., deltaY, deltaZ+zpos1), st345inclination );
b7ef3c96 2131
2132 zpos1 = - AliMUONConstants::DefaultChamberZ(8);
08299247 2133 SetTransformation(12, TGeoTranslation(0., -deltaY, -deltaZ+zpos1), st345inclination);
2134 SetTransformation(13, TGeoTranslation(0., deltaY, deltaZ+zpos1), st345inclination);
b7ef3c96 2135
2136 zpos1 = - AliMUONConstants::DefaultChamberZ(9);
08299247 2137 SetTransformation(14, TGeoTranslation(0., -deltaY, -deltaZ+zpos1), st345inclination);
2138 SetTransformation(15, TGeoTranslation(0., deltaY, deltaZ+zpos1), st345inclination);
d1cd2474 2139
2140}
2141
2142//______________________________________________________________________________
2143void AliMUONSlatGeometryBuilder::SetSensitiveVolumes()
2144{
71a2d3aa 2145/// Defines the sensitive volumes for slat stations chambers.
d1cd2474 2146
cd8824a7 2147 GetGeometry( 4)->SetSensitiveVolume("S05G");
253d1046 2148 GetGeometry( 4)->SetSensitiveVolume("SC5G");
2149 GetGeometry( 4)->SetSensitiveVolume("SD5G");
cd8824a7 2150 GetGeometry( 5)->SetSensitiveVolume("S05G");
253d1046 2151 GetGeometry( 5)->SetSensitiveVolume("SC5G");
2152 GetGeometry( 5)->SetSensitiveVolume("SD5G");
cd8824a7 2153 GetGeometry( 6)->SetSensitiveVolume("S06G");
253d1046 2154 GetGeometry( 6)->SetSensitiveVolume("SC6G");
2155 GetGeometry( 6)->SetSensitiveVolume("SD6G");
cd8824a7 2156 GetGeometry( 7)->SetSensitiveVolume("S06G");
253d1046 2157 GetGeometry( 7)->SetSensitiveVolume("SC6G");
2158 GetGeometry( 7)->SetSensitiveVolume("SD6G");
cd8824a7 2159 GetGeometry( 8)->SetSensitiveVolume("S07G");
253d1046 2160 GetGeometry( 8)->SetSensitiveVolume("SD7G");
cd8824a7 2161 GetGeometry( 9)->SetSensitiveVolume("S07G");
253d1046 2162 GetGeometry( 9)->SetSensitiveVolume("SD7G");
cd8824a7 2163 GetGeometry(10)->SetSensitiveVolume("S08G");
253d1046 2164 GetGeometry(10)->SetSensitiveVolume("SD8G");
cd8824a7 2165 GetGeometry(11)->SetSensitiveVolume("S08G");
253d1046 2166 GetGeometry(11)->SetSensitiveVolume("SD8G");
cd8824a7 2167 GetGeometry(12)->SetSensitiveVolume("S09G");
253d1046 2168 GetGeometry(12)->SetSensitiveVolume("SD9G");
cd8824a7 2169 GetGeometry(13)->SetSensitiveVolume("S09G");
253d1046 2170 GetGeometry(13)->SetSensitiveVolume("SD9G");
cd8824a7 2171 GetGeometry(14)->SetSensitiveVolume("S10G");
253d1046 2172 GetGeometry(14)->SetSensitiveVolume("SD0G");
cd8824a7 2173 GetGeometry(15)->SetSensitiveVolume("S10G");
253d1046 2174 GetGeometry(15)->SetSensitiveVolume("SD0G");
d1cd2474 2175}
2176
2177//______________________________________________________________________________
2178Int_t AliMUONSlatGeometryBuilder::ConvertSlatNum(Int_t numslat, Int_t quadnum, Int_t fspq) const
2179{
71a2d3aa 2180/// On-line function establishing the correspondance between numslat (the slat number on a particular quadrant (numslat->0....4 for St3))
2181/// and slatnum (the slat number on the whole panel (slatnum->1...18 for St3)
c10e6eaf 2182 numslat += 1;
2183 if (quadnum==2 || quadnum==3)
2184 numslat += fspq;
2185 else
2186 numslat = fspq + 2-numslat;
2187 numslat -= 1;
d1cd2474 2188
c10e6eaf 2189 if (quadnum==3 || quadnum==4) numslat += 2*fspq+1;
2190
2191 return numslat;
d1cd2474 2192}