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