]> git.uio.no Git - u/mrichter/AliRoot.git/blame - AD/ADsim/AliADv1.cxx
Update of simulation
[u/mrichter/AliRoot.git] / AD / ADsim / AliADv1.cxx
CommitLineData
5e319bd5 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
16/* $Id: AliAD.cxx $ */
17
18///////////////////////////////////////////////////////////////////////////
19// //
20// AD (ALICE Diffractive) Detector //
21// //
22// This class contains the base procedures for the AD detector //
23// Default geometry of 2013: 16 modules //
24// All comments should be sent to : //
25// //
26// //
27///////////////////////////////////////////////////////////////////////////
28
29// --- Standard libraries ---
30#include <Riostream.h>
31
32// --- ROOT libraries ---
33#include <TMath.h>
34#include <TString.h>
35#include <TVirtualMC.h>
36#include <TGeoManager.h>
37#include <TGeoMatrix.h>
38#include <TGeoTube.h>
dd27c420 39#include <TGeoPcon.h>
5e319bd5 40#include <TGeoCone.h>
41#include <TGeoShape.h>
42#include <TTree.h>
43#include <TSystem.h>
dd27c420 44// #include <TGeoCompositeShape.h> // included in .h
5e319bd5 45#include <TGeoGlobalMagField.h>
46#include <TGeoMaterial.h>
47#include <TGeoMedium.h>
48#include <TGeoVolume.h>
49#include <TGeoArb8.h>
50#include <TClonesArray.h>
51#include <TGeoTrd2.h>
52#include <TParticle.h>
53
54#include <TH2F.h>
55#include <TCanvas.h>
56
57// --- AliRoot header files ---
58
59
60#include "AliADhit.h"
61#include "AliADdigit.h"
62#include "AliADv1.h"
63#include "AliLog.h"
64#include "AliConst.h"
65#include "AliMagF.h"
66#include "AliRun.h"
67#include "AliMC.h"
68
69
70ClassImp(AliADv1)
71//__________________________________________________________________
dd27c420 72AliADv1::AliADv1() :
73 AliAD(),
74 fADCstruct(kTRUE),
75 fADCPosition(kADCInTunnel),
5e319bd5 76 fADCLightYield(93.75),
77 fADCPhotoCathodeEfficiency(0.18),
78 fADALightYield(93.75),
79 fADAPhotoCathodeEfficiency(0.18)
5e319bd5 80{
81 // Default Constructor
82 fHits = 0;
83}
84
85//_____________________________________________________________________________
86AliADv1::AliADv1(const char *name, const char *title) :
87 AliAD(name,title),
dd27c420 88 fADCstruct(kTRUE),
89 fADCPosition(kADCInTunnel),
5e319bd5 90 fADCLightYield(93.75),
91 fADCPhotoCathodeEfficiency(0.18),
92 fADALightYield(93.75),
93 fADAPhotoCathodeEfficiency(0.18)
94{
95 // Standard constructor for AD Detector
96
97 AliModule* pipe = gAlice->GetModule("PIPE");
98 if( (!pipe) ) {
99 Error("Constructor","AD needs PIPE!!!\n");
100 exit(1);
101 }
102 fHits = new TClonesArray("AliADhit",400);
103 gAlice->GetMCApp()->AddHitList(fHits);
104}
105
106//_____________________________________________________________________________
107AliADv1::~AliADv1()
108{
109 // default destructor
110}
111//_____________________________________________________________________________
112void AliADv1::Init()
113{
114 // Initialise L3 magnet after it has been built
115 Int_t i;
116 if(AliLog::GetGlobalDebugLevel()>0) {
117 printf("\n%s: ",ClassName());
118 for(i=0;i<35;i++) printf("*");
119 printf(" ADv1_INIT ");
120 for(i=0;i<35;i++) printf("*");
121 printf("\n%s: ",ClassName());
122 for(i=0;i<80;i++) printf("*");
123 printf("\n");
124 }
125}
126
127//_____________________________________________________________________________
128void AliADv1::CreateGeometry()
129{
130 //
131 // Create the geometry for the AD arrays
132 //
5e319bd5 133 CreateAD();
134
135}
dd27c420 136//_____________________________________________________________________________
137void AliADv1::ReadADCFromEnv() {
138 if (! gSystem->Getenv("CONFIG_ADC_POS"))
139 return;
5e319bd5 140
dd27c420 141 TString str(gSystem->Getenv("CONFIG_ADC_POS"));
142
143 if (0==str.CompareTo ("kADCInTunnel")) {
144 fADCPosition = kADCInTunnel;
145 printf("fADCPosition set to kADCInTunnel\n");
146 //
147 } else if (0==str.CompareTo ("kADCInCavern")) {
148 fADCPosition = kADCInCavern;
149 printf("fADCPosition set to kADCInCavern\n");
150 //
151 } else if (0==str.CompareTo ("kADCInBoth")) {
152 fADCPosition = kADCInBoth;
153 printf("fADCPosition set to kADCInBoth\n");
154 }
155}
156//_____________________________________________________________________________
157TGeoCompositeShape * AliADv1::MakeShapeADCpadH(const Double_t W, const Double_t H, const Double_t dz) {
158 /////////////////////////////////////////////////////////////////////////////
159 /// ADC pad in the cavern (H shapped hole) ///
160 /////////////////////////////////////////////////////////////////////////////
161 // const Double_t W = kADCCellSide; // Width of Scintillator pad
162 // const Double_t H = kADCCellSide; // Height of Scintillator pad
163 // Coordinates of ADC pad vertexes
164 Double_t pad0_x [] = { 10., 10., W, W };
165 Double_t pad0_y [] = { 0., 11., 11., 0. };
166 Double_t pad1_x [] = { 15., 15., W, W };
167 Double_t pad1_y [] = { 11., 15., 15., 11. };
168 Double_t pad2_x [] = { 0., 0., W, W };
169 Double_t pad2_y [] = { 15., H , H, 15. };
170 TGeoArb8 * shADCpad0H = new TGeoArb8("shADCpad0H", dz/2.);
171 TGeoArb8 * shADCpad1H = new TGeoArb8("shADCpad1H", dz/2.);
172 TGeoArb8 * shADCpad2H = new TGeoArb8("shADCpad2H", dz/2.);
173 for (Int_t i=0; i<4; i++) {
174 // -dz
175 shADCpad0H -> SetVertex(i, pad0_x[i], pad0_y[i]);
176 shADCpad1H -> SetVertex(i, pad1_x[i], pad1_y[i]);
177 shADCpad2H -> SetVertex(i, pad2_x[i], pad2_y[i]);
178 // +dz
179 shADCpad0H -> SetVertex(i+4, pad0_x[i], pad0_y[i]);
180 shADCpad1H -> SetVertex(i+4, pad1_x[i], pad1_y[i]);
181 shADCpad2H -> SetVertex(i+4, pad2_x[i], pad2_y[i]);
182 }
183 return new TGeoCompositeShape("shADCpadH","shADCpad0H + shADCpad1H + shADCpad2H");
184}
5e319bd5 185
186//_____________________________________________________________________________
187void AliADv1::CreateAD()
188{
dd27c420 189 //
190 // Read fADCPosition from environment and assign it three possible values:
191 // fADCPosition = kADCInTunnel;
192 // fADCPosition = kADCInCavern;
193 // fADCPosition = kADCInBoth;
194 //
195 // ReadADCFromEnv();
196 //
197 // Define Rotations used
198 //
199 TGeoRotation * Rx180, * Rz180, * Ry180, * Rx90, * Rx90m, * Ry90m;
200 Rx90m = new TGeoRotation("Rx90m", 0., -90., 0.) ;
201 Rx90 = new TGeoRotation("Rx90" , 0., 90., 0.) ;
202 Rx180 = new TGeoRotation("Rx180", 0., 180., 0.) ; // 4 | 1
203 Rz180 = new TGeoRotation("Rz180", 180., 0., 0.) ; // ---------------> x
204 Ry180 = new TGeoRotation("Ry180", 180., 180., 0.) ; // 3 | 2
205 Ry90m = new TGeoRotation("Ry90m", 90., -90., -90.) ;
206
207 TGeoMedium * kMedAlu = gGeoManager->GetMedium("AD_Alum"); // Aluminium
208 TGeoMedium * kMedSteelSh = gGeoManager->GetMedium("AD_ST_C0"); // Stainless Steel
209 TGeoMedium * kMedVacuum = gGeoManager->GetMedium("AD_VA_C0"); // Stainless Steel
210 //
211 // Private comunication by Arturo Tauro (2014, Apr 23)
212 // According to last survey measurement done this morning,
213 // the C-side wall is at Z = - 18959mm.
214 //
215 const Double_t kZwall = 1895.9 ; // Aluminium plate z position
216 const Double_t kZendAbs = 1880.75; // End of CC block absorber
217 const Double_t kZbegVMAOI = 1919.2 ; // Begining of Warm Module
218 const Double_t kZbegValve = 1910.7 ; // Begining of Valve
219 const Double_t kZbegFrontBar = 1949.1 ; // Begining of Front Bar
220 const Double_t kZbegCoil = 1959.4 ; // Begining of compensator coil
5e319bd5 221
dd27c420 222 // Define Ion Pump ??
223 // Drawing LHCVBU__0052
224 // Vacuum - Bellows - U type
225 // BODY 1 PORTS
226 //
227 (new TGeoCombiTrans("ctPumpVB2", 0., -13./2., 6.8-11.5/2., Rx90))->RegisterYourself();
228 // Rx90->RegisterYourself();
229 new TGeoTube("shIonPumpVB1o", 0.0, 10.3 /2., 11.5/2. );
230 new TGeoTube("shIonPumpVB2o", 0.0, 7.0 /2., 13.0/2. );
231 new TGeoTube("shIonPumpVB1i", 0.0, 10.0 /2., 11.5/2.+2.);
232 new TGeoTube("shIonPumpVB2i", 0.0, 6.7 /2., 13.0/2.+2.);
233 new TGeoCompositeShape("shIonPumpVBo", "shIonPumpVB1o+shIonPumpVB2o:ctPumpVB2");
234 //
235 // Continue definition of LHCVBU__0052
236 //
237 new TGeoCompositeShape("shIonPumpVBi", "shIonPumpVB1i+shIonPumpVB2i:ctPumpVB2");
238 TGeoShape * sh3 = new TGeoCompositeShape("shIonPumpVB", "shIonPumpVBo-shIonPumpVBi");
239 TGeoVolume * voIonPumpVB = new TGeoVolume("voIonPumpVB", sh3, kMedAlu);
240 // Variables
241 Double_t alpha, beta, tga2, tga, sa, ca, ctgb, d, Ro, Ri, phi1, dphi, H, L, z;
242 // Drawing: LHCVSR__0054
243 // Vacuum Screen - RF
244 // transition flange
245 alpha = 15. * TMath::DegToRad();
246 beta = 15. * TMath::DegToRad();
247 tga2 = TMath::Tan(alpha*0.5);
248 tga = TMath::Tan(alpha);
249 ctgb = 1./TMath::Tan(beta );
250 ca = TMath::Cos(alpha );
251 d = 0.3; // thickness of transition flange
252 Double_t h = d/ca; // vertical distance between parallel surfaces tilted alpha degrees
253 TGeoPcon * shVSRflange = new TGeoPcon("shVSRflange", 0.0, 360.0, 7);
254 Ri = 9.71/2.; Ro = 11.16/2.;
255 shVSRflange->DefineSection(0, 0. , Ri, Ro);
256 Ri = Ri - 0.25 * tga;
257 shVSRflange->DefineSection(1, 0.25, Ri, Ro);
258 Ro = Ri + d*tga;
259 shVSRflange->DefineSection(2, 0.25, Ri, Ro);
260 Ri = 6.3/2.; Ro = Ri + h;
261 z = (9.71/2. - Ri) / tga;
262 shVSRflange->DefineSection(3, z, Ri, Ro);
263 //
264 Double_t Dtga = 6.6*tga - 0.5*(9.71-6.3) ;
265 Double_t x = (h - 0.11 - Dtga) / (ctgb - tga) ;
266 Double_t y = x * ctgb;
267 z = 6.6 - x;
268 Ro = Ri + 0.11 + y;
269 shVSRflange->DefineSection(4, z, Ri, Ro);
270 z = 6.6;
271 Ro = Ri + 0.11;
272 shVSRflange->DefineSection(5, z, Ri, Ro);
273 z = 7.1;
274 shVSRflange->DefineSection(6, z, Ri, Ro);
275 TGeoVolume * voVSRflange = new TGeoVolume("voVSRflange", shVSRflange, kMedAlu);
276 //
277 // Drawing: LHCVSR__0053
278 // Vacuum Screen - RF
279 // transition tube
280 alpha = 10. * TMath::DegToRad();
281 tga2 = TMath::Tan(alpha*0.5);
282 tga = TMath::Tan(alpha);
283 ca = TMath::Cos(alpha );
284 d = 0.3; // thickness of Vacuum Screen RF
285 Ro = 6.7/2.; //
286 Ri = 0.;
287 phi1 = 90. - 15.;
288 dphi = 30.;
289 TGeoPcon * shVSR0 = new TGeoPcon("shVSR0", phi1, dphi, 6);
290 shVSR0->DefineSection(0, 0. , Ro-0.09, Ro);
291 shVSR0->DefineSection(1, 0.45, Ro-0.09, Ro);
292 Ri=Ro-d;
293 shVSR0->DefineSection(2, 0.45, Ri, Ro);
294 shVSR0->DefineSection(3, 13.37-d*tga2, Ri, Ro);
295 Ro = Ri + d/ca;
296 shVSR0->DefineSection(4, 13.37, Ri, Ro);
297 Ri += 0.63*tga;
298 Ro = Ri + d/ca;
299 shVSR0->DefineSection(5, 14.0 , Ri, Ro);
beca6103 300 //printf(" Ro: %8.2f\n", Ro);
dd27c420 301 // Make holes
302 new TGeoBBox("shHoleBody" , 0.15, 0.60, 0.3);
303 new TGeoTube("shHoleEnd", 0. , 0.15, 0.3);
304 (new TGeoTranslation("trHoleBody", 0., -0.6, 0.))->RegisterYourself();
305 (new TGeoTranslation("trHoleEnd" , 0., -1.2, 0.))->RegisterYourself();
306 new TGeoCompositeShape("shHole","shHoleEnd + shHoleEnd:trHoleEnd + shHoleBody:trHoleBody");
307 // Single hole made. Now define some combitrans to position holes
308 z = 1.3; Ro = (6.7 - d)*0.5;
309 (new TGeoCombiTrans("ctHole1", 0., Ro , z, Rx90m))->RegisterYourself();
310 z = 1.3 + 1*2.5;
311 (new TGeoCombiTrans("ctHole2", 0., Ro , z, Rx90m))->RegisterYourself();
312 z = 1.3 + 2*2.5;
313 (new TGeoCombiTrans("ctHole3", 0., Ro , z, Rx90m))->RegisterYourself();
314 z = 1.3 + 3*2.5;
315 (new TGeoCombiTrans("ctHole4", 0., Ro , z, Rx90m))->RegisterYourself();
316 // Now make a sector of RF transition tube
317 new TGeoCompositeShape("shVSRsec",
318 "shVSR0 - (shHole:ctHole1 + shHole:ctHole2 + shHole:ctHole3 + shHole:ctHole4)");
319 // Now define rotations for each sector
320 TString strSh = "shVSRsec ";
321 for (Int_t i=1; i<=11; i++) {
322 (new TGeoRotation(Form("rSec%d",i), 30. * i, 0. , 0.))->RegisterYourself();
323 strSh+=Form("+ shVSRsec:rSec%d",i);
324 }
beca6103 325 //printf("%s\n", strSh.Data());
dd27c420 326 TGeoCompositeShape * shVSR = new TGeoCompositeShape("shVSR", strSh.Data());
327 // Now assembly the sector to form VSR RF transition tube !
328 TGeoVolume * voVSR = new TGeoVolume("voVSR", shVSR, kMedAlu);
329 //
330 // Drawing: LHCVSR__0057
331 // RF CONTACT
332 //
333 Ro = 0.5 * 6.3;
334 d = 0.03;
335 Ri = Ro - d;
336 // alpha = TMath::ArcSin((7.35-1.75)/Ri); <-- No!
337 H = 0.5 * 6.9 - Ri;
338 L = 28. - 7.1 + 0.45 -14. - 1.75;//7.35 - 1.75;
339 // Double_t Delta = TMath::Sqrt( L*L + 4.*(H-d)*H );
340 Double_t R = TMath::Sqrt((H-d)*(H-d) + L*L);
341 alpha = TMath::ASin(d/R) + TMath::ASin((H-d)/R);
beca6103 342 //printf("alpha: %8.2f \n", alpha * TMath::RadToDeg());
dd27c420 343 sa = TMath::Sin(alpha);
344 ca = TMath::Cos(alpha);
345 x = d*sa;
346 y = d*ca;
347 Double_t R0 = 1.75;
348 Double_t R1 = 10.48;
349 Double_t R2 = 0.81 + 0.28;
350 phi1 = 0.; dphi = 360.;
5e319bd5 351
dd27c420 352 TGeoPcon * shVSRcontact = new TGeoPcon("shVSRcont", phi1, dphi, 6);
353 z = 0.;
354 shVSRcontact->DefineSection(0, -z, Ri, Ro);
355 z = R0;
356 shVSRcontact->DefineSection(1, -z, Ri, Ro);
357 z += x;
358 Ri += y;
359 Ro = Ri + d;
360 shVSRcontact->DefineSection(2, -z, Ri, Ro);
361 z += (R1 - R0) * ca;
362 Ri += (R1 - R0) * sa;
363 Ro = Ri + d;
364 shVSRcontact->DefineSection(3, -z, Ri, Ro);
365 // Last sections (R2)
366 Double_t ab = alpha + 21. * TMath::DegToRad();
367 Double_t sab = TMath::Sin(ab);
368 Double_t cab = TMath::Cos(ab);
369 x = d * sab;
370 y = d/ca - d*cab;
371 z += x;
372 Ri += y;
373 Ro = Ri + d/cab;
374 shVSRcontact->DefineSection(4, -z, Ri, Ro);
375 z += R2 * cab;
376 Ri += R2 * sab;
377 Ro = Ri + d/cab;
378 shVSRcontact->DefineSection(5, -z, Ri, Ro);
379 TGeoVolume * voVSRcontD = new TGeoVolume("voVSRcontD", shVSRcontact, kMedAlu);
380 // Drawing: LHCVSR__0017
381 // Vacuum Screen - RF
382 // RF Contact flange
383 phi1 = 0.;
384 dphi = 360.;
5e319bd5 385
dd27c420 386 TGeoPcon * shVSRcontFlange = new TGeoPcon("shVSRcontFlange", phi1, dphi, 11);
387 Ri = 6.30 /2.; Ro = 11.16 /2.; z = 0;
388 shVSRcontFlange->DefineSection( 0, -z, Ri, Ro);
389 Ri = 6.30 /2.; Ro = 11.16 /2.; z = 0.1;
390 shVSRcontFlange->DefineSection( 1, -z, Ri, Ro);
391 Ri = 6.36 /2.; Ro = 11.16 /2.; z = 0.1;
392 shVSRcontFlange->DefineSection( 2, -z, Ri, Ro);
393 Ri = 6.36 /2.; Ro = 11.16 /2.; z = 0.25;
394 shVSRcontFlange->DefineSection( 3, -z, Ri, Ro);
395 Ri = 6.36 /2.; Ro = 9.30 /2.; z = 0.25;
396 shVSRcontFlange->DefineSection( 4, -z, Ri, Ro);
397 Ri = 6.36 /2.; Ro = 9.30 /2.; z = 0.30;
398 shVSRcontFlange->DefineSection( 5, -z, Ri, Ro);
399 Ri = 6.36 /2.; Ro = 6.90 /2.; z = 0.30;
400 shVSRcontFlange->DefineSection( 6, -z, Ri, Ro);
401 Ri = 6.36 /2.; Ro = 6.90 /2.; z = 1.10;
402 shVSRcontFlange->DefineSection( 7, -z, Ri, Ro);
403 Ri = 6.36 /2.; Ro = 6.85 /2.; z = 1.15;
404 shVSRcontFlange->DefineSection( 8, -z, Ri, Ro);
405 Ri = 6.36 /2.; Ro = 6.50 /2.; z = 1.15;
406 shVSRcontFlange->DefineSection( 9, -z, Ri, Ro);
407 Ri = 6.36 /2.; Ro = 6.50 /2.; z = 1.30;
408 shVSRcontFlange->DefineSection(10, -z, Ri, Ro);
409 TGeoVolume * voVSRcontF = new TGeoVolume("voVSRcontF", shVSRcontFlange, kMedAlu);
410 // Drawing: LHCVBU__0002
411 // Bellows + End Parts
412 // Vacuum - Bellows - U type
5e319bd5 413
dd27c420 414 // First make end part
415 phi1 = 0. ; dphi = 360. ;
416 TGeoPcon * shVBUend = new TGeoPcon("shVBUend", phi1, dphi, 6);
417 Ri = 5.176; Ro = 5.4; z = 0;
418 shVBUend->DefineSection( 0, z, Ri, Ro);
419 Double_t dz = 0.03;
420 Ri -= dz * TMath::Tan(45. * TMath::DegToRad());
421 z += dz;
422 shVBUend->DefineSection( 1, z, Ri, Ro);
423 dz = 0.04;
424 Ro -= dz * TMath::Tan(15. * TMath::DegToRad());
425 Ri -= dz * TMath::Tan(45. * TMath::DegToRad());
426 z += dz;
427 shVBUend->DefineSection( 2, z, Ri, Ro);
428 Ro = 5.250 ;
429 Ri = 5.073;
430 z = 0.103;
431 shVBUend->DefineSection( 3, z, Ri, Ro);
432 Ro = 5.25;
433 Ri = 5.02;
434 z = 0.18;
435 shVBUend->DefineSection( 4, z, Ri, Ro);
436 Ro = 5.15;
437 Ri = 5.00;
438 z = 0.28;
439 shVBUend->DefineSection( 5, z, Ri, Ro);
5e319bd5 440
dd27c420 441 TGeoPcon * shVBUtube26mm = new TGeoPcon("shVBUtube26mm", 0., 360., 2);
442 shVBUtube26mm->DefineSection( 0, 0.28, 5.0, 5.15);
443 shVBUtube26mm->DefineSection( 1, 2.60, 5.0, 5.15);
444 TGeoPcon * shVBUtube9mm = new TGeoPcon("shVBUtube9mm" , 0., 360., 2);
445 shVBUtube9mm ->DefineSection( 0, 0.00, 5.0, 5.15);
446 shVBUtube9mm ->DefineSection( 1, 0.62, 5.0, 5.15);
447 // central part of bellow (TODO: Add plies)
448 TGeoPcon * shVBUcent = new TGeoPcon("shVBUcent" , 0., 360., 6);
449 const Int_t nsec = 6;
450 Double_t az [nsec] = {0.9, 0.915, 0.915, 11.885, 11.885, 11.9};
451 Double_t aRi[nsec] = {5.0, 5.0 , 5.685, 5.685, 5.0 , 5.0};
452 for (Int_t i=0; i<nsec; i++) {
453 z=az[i]; Ri = aRi[i]; Ro = 5.7;
beca6103 454 //printf(" i: %2d z: %8.2f Ri: %8.2f Ro: %8.2f\n", i, z, Ri, Ro );
dd27c420 455 shVBUcent ->DefineSection( i, z, Ri, Ro);
456 }
5e319bd5 457
dd27c420 458 ( new TGeoCombiTrans("ctEnd9mm", 0., 0., 0.9, Ry180)) -> RegisterYourself();
5e319bd5 459
dd27c420 460 TGeoCompositeShape * shVBU9mm = new TGeoCompositeShape("shVBU9mm" , "shVBUend:ctEnd9mm + shVBUtube9mm");
461 TGeoCompositeShape * shVBU26mm = new TGeoCompositeShape("shVBU26mm", "shVBUend + shVBUtube26mm");
5e319bd5 462
dd27c420 463 const Int_t nsec2 = 10;
464 Double_t az2 [nsec2] = {0. , 0.43, 0.43, 0.58, 0.58 , 0.73 , 0.73, 1.05, 1.05, 1.31} ;
465 Double_t aRi2[nsec2] = {5.15, 5.15, 5.03, 5.03, 5.455, 5.455, 5.03, 5.03, 5.59, 5.59} ;
466 TGeoPcon * shVBUrotFlg = new TGeoPcon("shVBUrotFlg" , 0., 360., nsec2);
467 for (Int_t i=0; i<nsec2; i++) {
468 z=az2[i]; Ri = aRi2[i]; Ro = 6.02;
beca6103 469 //printf(" i: %2d z: %8.2f Ri: %8.2f Ro: %8.2f\n", i, z, Ri, Ro );
dd27c420 470 shVBUrotFlg ->DefineSection( i, z, Ri, Ro);
471 }
472 TGeoVolume * voVBUrotFlg = new TGeoVolume("voVBUrotFlg", shVBUrotFlg, kMedAlu);
5e319bd5 473
dd27c420 474 // Flange
475 TGeoPcon * shVBUflg = new TGeoPcon("shVBUflg" , 0., 360., 4);
476 z = 0;
477 Ri = 6.02; Ro = 7.6;
478 shVBUflg->DefineSection(0, z, Ri, Ro);
479 z = 1.31;
480 shVBUflg->DefineSection(1, z, Ri, Ro);
481 z = 1.31;
482 Ri = 5.15;
483 shVBUflg->DefineSection(2, z, Ri, Ro);
484 z = 2.0;
485 shVBUflg->DefineSection(3, z, Ri, Ro);
486 TGeoVolume * voVBUflg = new TGeoVolume("voVBUflg", shVBUflg, kMedAlu);
5e319bd5 487
5e319bd5 488
dd27c420 489 // Add the metal plate at the end of Absorber
490 // Plate: 80 cm x 80 cm x 1.95 cm (Thickness is aproximatted) (ernesto.calvo@pucp.edu.pe)
491 // The End of the concrete abosorber is at kZendAbs = 1880.75
5e319bd5 492
dd27c420 493 new TGeoBBox("shBasePlate", 80./2., 80./2., 1.95/2.);
494 new TGeoTube("shHolePlate", 0. , 12.3 , 1.95 );
495 TGeoVolume* voSaa3EndPlate = new TGeoVolume("voYSaa3EndPlate",
496 new TGeoCompositeShape("shYSaa3EndPlate","shBasePlate-shHolePlate"),
497 kMedSteelSh);
498 //
499 // Add Rods
500 //
501 // dimensions of rods
502 const Double_t dzRodL = 27.0;
503 const Double_t dzRodA = 4.3;
504 const Double_t dzRodB = 1.3;
505 new TGeoTube("shLargeRod", 0., 1.6/2., dzRodL/2.);
506 new TGeoTube("shRodA", 0., 3.0/2., dzRodA/2.);
507 new TGeoTube("shRodB", 0., 2.3/2., dzRodB/2.);
508 //
509 ( new TGeoTranslation("trRod1", 0., 0., -dzRodL/2. + dzRodA/2.) )->RegisterYourself();
510 ( new TGeoTranslation("trRod2", 0., 0., -dzRodL/2. + dzRodA + dzRodB/2.) )->RegisterYourself();
511 ( new TGeoTranslation("trRod3", 0., 0., dzRodL/2. - dzRodB/2.) )->RegisterYourself();
512 TGeoVolume * voSaa3Rod = new TGeoVolume("YSAA3Rod",
513 new TGeoCompositeShape("shLargeRod+shRodA:trRod1 + shRodB:trRod2 + shRodB:trRod3"),
514 kMedSteelSh);
515 //
516 // Define Valve support (VS) (ernesto.calvo@pucp.edu.pe)
517 //
518 const Double_t dyVS = 5.5;
519 const Double_t dxVS = 30.0;
520 const Double_t dzVS = 1.0;
521 TGeoVolume * voVS = new TGeoVolume("voVS",
522 new TGeoBBox("shVS", dxVS/2., dyVS/2., dzVS/2.),
523 kMedSteelSh);
5e319bd5 524
dd27c420 525 // Add Valve (Valve is divided in parts VA,VB,VC and VD) (ernesto.calvo@pucp.edu.pe)
526 TGeoVolumeAssembly * voValve = new TGeoVolumeAssembly("voValve");
527 //
528 // Define volume VA (ernesto.calvo@pucp.edu.pe)
529 const Double_t dxVA = 20.3;
530 const Double_t dyVA = 48.0;
531 const Double_t dzVA = 6.0; // Width
532 const Double_t dz2VA = 8.5; // Full width including protuding boxes
533 // Valve position (ernesto.calvo@pucp.edu.pe)
534 const Double_t zPosValve = kZbegValve + dz2VA/2.;
535 //
536 new TGeoBBox("shVAbox", dxVA/2., dyVA/2., dzVA/2.);
537 new TGeoBBox("shVAHbox", -1.+dxVA/2., 3./2., dz2VA/2.);
538 new TGeoTube("shVAC", 0., 7.9, dz2VA/2.);
539 new TGeoTube("shVACh", 0., 5.3, dz2VA );
540 // translation for shVAHbox (ernesto.calvo@pucp.edu.pe)
541 ( new TGeoTranslation("trVAH1", 0., 12.75, 0.) )->RegisterYourself();
542 ( new TGeoTranslation("trVAH2", 0., -12.75, 0.) )->RegisterYourself();
5e319bd5 543
dd27c420 544 TGeoVolume * voValveVA = new TGeoVolume("voValveVA",
545 new TGeoCompositeShape("(shVAbox + shVAHbox:trVAH1 + shVAHbox:trVAH2 + shVAC)-shVACh"),
546 kMedSteelSh);
547 voValve->AddNode(voValveVA, 1, 0);
548 // Define Vacuum Hole of Valve
549 TGeoTube * shVACvach = new TGeoTube("shVACvach", 0., 5.3, dz2VA/2.);
550 TGeoVolume * voValveVAvh = new TGeoVolume("voValveVAvacuum", shVACvach, kMedVacuum);
551 voValve->AddNode(voValveVAvh,1,0);
552 // Also add valve Support (ernesto.calvo@pucp.edu.pe)
553 voValve->AddNode(voVS, 1, new TGeoTranslation(0., 12.75, -dz2VA/2.-dzVS/2.));
554 voValve->AddNode(voVS, 2, new TGeoTranslation(0., -12.75, -dz2VA/2.-dzVS/2.));
555
556 // Define Volume VB (ernesto.calvo@pucp.edu.pe)
557 const Double_t dxVB = 23.5;
558 const Double_t dyVB = 5.0;
559 const Double_t dzVB = 9.4;
560 TGeoVolume * voValveVB = new TGeoVolume("voValveVB",
561 new TGeoBBox("shVBbox", dxVB/2., dyVB/2., dzVB/2.),
562 kMedSteelSh);
563 voValve->AddNode(voValveVB, 1, new TGeoTranslation( 0., dyVA/2. +dyVB/2. , 0));
564 // Define Volume VC (ernesto.calvo@pucp.edu.pe)
565 const Double_t R1VC = 4.5 /2.;
566 const Double_t R2VC = 8.1 /2.;
567 const Double_t dy1VC = 10.0;
568 const Double_t dy2VC = 0.75;
569 new TGeoTube("shVC1", 0., R1VC, dy1VC/2.);
570 new TGeoTube("shVC2", 0., R2VC, dy2VC/2.);
571 ( new TGeoTranslation("trVC21", 0., 0., dy1VC/2. - dy2VC/2.) )->RegisterYourself();
572 ( new TGeoTranslation("trVC22", 0., 0., -dy1VC/2. + dy2VC/2.) )->RegisterYourself();
573 TGeoVolume * voValveVC = new TGeoVolume("voValveVC",
574 new TGeoCompositeShape("shVC1 + shVC2:trVC21 + shVC2:trVC22"),
575 kMedSteelSh);
576 voValve->AddNode(voValveVC, 1, new TGeoCombiTrans(
577 0., dyVA/2. + dyVB + dy1VC/2. , 0, Rx90) );
578 // Define volume VD (ernesto.calvo@pucp.edu.pe)
579 const Double_t dxVD = 15.9;
580 const Double_t dyVD = 23.0;
581 const Double_t dzVD = 14.0;
582 TGeoVolume * voValveVD = new TGeoVolume("voValveVD",
583 new TGeoBBox("shVD", dxVD/2., dyVD/2., dzVD/2.),
584 kMedSteelSh);
585 voValve->AddNode(voValveVD, 1,
586 new TGeoTranslation( 1.25, dyVA/2. + dyVB + dy1VC + dyVD/2. , 0) );
587
588 //
589 // Define volume Front Bar (ernesto.calvo@pucp.edu.pe)
590 //
591 const Double_t dxF = 67.4;
592 const Double_t dyF = 4.0;
593 const Double_t dzF = 2.0;
594 const Double_t R1FC = 8.1;
595 const Double_t R2FC = 11.5;
596 const Double_t dxFA = (dxF-R1FC)/2.;
5e319bd5 597
dd27c420 598 new TGeoBBox("shFA", dxFA/2., dyF/2., dzF/2.);
599 new TGeoTube("shFC", 0., R2FC, dzF/2.);
600 new TGeoTube("shFCH", 0., R1FC, 2.*dzF);
601 ( new TGeoTranslation("trFA1", R1FC +dxFA/2., 0., 0.) )->RegisterYourself();
602 ( new TGeoTranslation("trFA2", -R1FC -dxFA/2., 0., 0.) )->RegisterYourself();
603 TGeoVolume * voFrontBar = new TGeoVolume("voFrontBar",
604 new TGeoCompositeShape("shFA:trFA1 + shFA:trFA2 + (shFC - shFCH)"),
605 kMedSteelSh);
606 // Make Lateral Bars
607 const Double_t kdzLatBar = 22.9;
608 TGeoVolume * voLatBar = new TGeoVolume("voLatBar",
609 new TGeoTube("shLatBar",0., dyF/2., kdzLatBar/2.), kMedSteelSh);
610 //
611 // Define Compensator Magnet coils
612 //
613 dz = 12.5;
614 Ro = 15.0;
615 Ri = 1.9;
616 new TGeoTubeSeg("shCoilRo", 0., Ro, dz/2., 90., 180.);
617 new TGeoTubeSeg("shCoilRi", 0., Ri, dz , 90., 185.);
618 (new TGeoTranslation("trCoilRo", Ro, 10.4, 0.)) -> RegisterYourself();
619 (new TGeoTranslation("trCoilRi", Ro, 9.6, 0.)) -> RegisterYourself();
620 new TGeoBBox("shBoxCoilRo", 15.0/2., 10.4/2., dz/2.);
621 new TGeoBBox("shBoxCoilRi", 1.9/2., 9.6 , dz );
622 (new TGeoTranslation("trBoxCoilRo", 15.0/2., 10.4/2., 0.)) -> RegisterYourself();
623 (new TGeoTranslation("trBoxCoilRi", 13.1 + 1.9/2., 0. , 0.)) -> RegisterYourself();
624 new TGeoBBox("shBoxCoil0", 10./2., 30., dz);
625 (new TGeoTranslation("trBoxCoil0", 14.6 + 10./2., 0. , 0.)) -> RegisterYourself();
626 strSh = "";
627 strSh += "(shCoilRo:trCoilRo + shBoxCoilRo:trBoxCoilRo) - ";
628 strSh += "(shCoilRi:trCoilRi + shBoxCoilRi:trBoxCoilRi +" ;
629 strSh += " shBoxCoil0:trBoxCoil0 )" ;
630 TGeoCompositeShape * shCoil = new TGeoCompositeShape("shCoil0", strSh);
631 TGeoVolume * voCoil = new TGeoVolume("voCoil", shCoil, kMedSteelSh);
632
633 //
634 // ALUMINIUM PLATES
635 //
636
637 // Shape for aluminium Plate separating cavern and LHC tunnel
638 const Double_t dAlWallThick = 0.5; // thickness of aluminium plates (cm)
639 //
640 // RB24/26 Tunnel Floor
641 R = 220.;
642 // h = 140.;
643 // phi = TMath::ACos(h / r);
644 // xl = r * TMath::Sin(phi);
645 // dr = 1600.;
646 // dh = dr * TMath::Cos(phi);
647 // dl = dr * TMath::Sin(phi);
648
649 new TGeoTube("shWallBase", 0., R, dAlWallThick*0.5); // base shape for shWallBigPlate
650 new TGeoBBox("shWallCutBot",270., 110., dAlWallThick ); // to be substracted from base
651 // Translation for cutting circular and square hole in the plates
652 (new TGeoTranslation("trAntiBeamAxis", -70., 40., 0.)) -> RegisterYourself();
653 (new TGeoTranslation("trHUWAT3", -70., -110. - 140. +40., 0.)) -> RegisterYourself();
654
655 //
656 // Wall Big Aluminium Plate with Squared Hole
657 //
658 const Double_t dSqrHoleSide = 33.0; // Side
659 new TGeoBBox("shWallSqrHole", dSqrHoleSide*0.5, dSqrHoleSide*0.5, dAlWallThick);
660 strSh = "";
661 strSh += "shWallBase:trAntiBeamAxis - ";
662 strSh += " ( shWallCutBot:trHUWAT3" ;
663 strSh += " + shWallSqrHole )";
664 TGeoVolume* voWallBigPlate = new TGeoVolume("voWallBigPlate",
665 new TGeoCompositeShape("shWallBigPlate", strSh), kMedAlu );
666 //
667 // Wall Squared Aluminium Plate
668 //
669 const Double_t dCircHoleRad = 9.5; // Radius
670 new TGeoTube("shCircHole", 0., dCircHoleRad, dAlWallThick);
671 // Make holes for bars
672 new TGeoTube("shRodHole", 0., 1.7/2., 2*dAlWallThick);
673 ( new TGeoTranslation("trWallRod1", 12.5, -12.75, 0.)) -> RegisterYourself();
674 ( new TGeoTranslation("trWallRod2", 12.5, 12.75, 0.)) -> RegisterYourself();
675 ( new TGeoTranslation("trWallRod3", -12.5, -12.75, 0.)) -> RegisterYourself();
676 ( new TGeoTranslation("trWallRod4", -12.5, 12.75, 0.)) -> RegisterYourself();
677 new TGeoBBox("shWallSqrPlateBase", dSqrHoleSide*0.5 + 5.0, dSqrHoleSide*0.5 + 5.0, dAlWallThick/2.);
678 strSh = " ((((";
679 strSh += " ( shWallSqrPlateBase - shCircHole )";
680 strSh += " - shRodHole:trWallRod1)" ;
681 strSh += " - shRodHole:trWallRod2)" ;
682 strSh += " - shRodHole:trWallRod3)" ;
683 strSh += " - shRodHole:trWallRod4)" ;
684 TGeoVolume* voWallSqrPlate = new TGeoVolume("HUWAT_AlWall02",
685 new TGeoCompositeShape("shWallSqrPlate", strSh ), kMedAlu);
686 // ==========================================================================
687 //
688 // Define Mother Vacuum volume of VMAOI (need shIonPumpVBo)
689 //
690 // ==========================================================================
691 const Double_t kdzMoFlange = 2.0;
692 const Double_t kdzMoBellow = 15.6;
693 const Double_t kdzTTube = 11.5; // Bellow starts here
694 const Double_t kziTTube = 1.0; // Ion Pum Tube starts here
695 new TGeoTube( "shMoFlange", 0., 15.2/2., kdzMoFlange/2.0);
696 new TGeoTube( "shMoBellow", 0., 11.4/2., kdzMoBellow/2.0);
697 (new TGeoTranslation("trMoFlange1", 0., 0., 0.5*kdzMoFlange )) -> RegisterYourself();
698 (new TGeoTranslation("trMoFlange2", 0., 0., 28.0 - 0.5*kdzMoFlange )) -> RegisterYourself();
699 (new TGeoTranslation("trMoBellow" , 0., 0., 28.0 - 0.5*kdzMoBellow )) -> RegisterYourself();
700 (new TGeoTranslation("trMoTTube" , 0., 0., kziTTube + 0.5*kdzTTube )) -> RegisterYourself();
701
702 TGeoCompositeShape * shMoVMAOI =
703 new TGeoCompositeShape("shMoVMAOI",
704 "shMoFlange:trMoFlange1 + shMoBellow:trMoBellow + shMoFlange:trMoFlange2 + shIonPumpVBo:trMoTTube");
705 TGeoVolume * voMoVMAOI = new TGeoVolume("voMoVMAOI", shMoVMAOI, kMedVacuum);
706 voMoVMAOI->AddNode(voVSR ,1, new TGeoTranslation(0., 0., 7.1 - 0.45));
707 voMoVMAOI->AddNode(voIonPumpVB,1, new TGeoTranslation(0., 0., 1 + 11.5/2.));
708 voMoVMAOI->AddNode(voVSRflange,1, new TGeoTranslation(0.,0.,0.));
709 voMoVMAOI->AddNode(voVSRcontD ,1, new TGeoTranslation(0.,0.,28.));
710 voMoVMAOI->AddNode(voVSRcontF ,1, new TGeoTranslation(0.,0.,28.));
711 z = 1.0 + 11.5;
712 voMoVMAOI->AddNode( new TGeoVolume("voVBU9mm", shVBU9mm, kMedAlu),
713 1, new TGeoTranslation(0.,0., z) );
714 voMoVMAOI->AddNode( new TGeoVolume("voVBU26mm", shVBU26mm, kMedAlu),
715 1, new TGeoTranslation(0.,0., z + 11.9) );
716 voMoVMAOI->AddNode( new TGeoVolume("voVBUcent", shVBUcent, kMedAlu),
717 1, new TGeoTranslation(0.,0., z) );
718 voMoVMAOI->AddNode( voVBUrotFlg, 1,
719 new TGeoCombiTrans(0.,0.,1.31, Ry180) );
720 voMoVMAOI->AddNode( voVBUrotFlg, 2,
721 new TGeoTranslation(0.,0.,28. - 1.31) );
722 voMoVMAOI->AddNode( voVBUflg, 1,
723 new TGeoTranslation(0.,0.,0.) );
724 voMoVMAOI->AddNode( voVBUflg, 2,
725 new TGeoCombiTrans(0.,0.,28., Ry180) );
726
727 // ==========================================================================
728 //
729 // Define ADA
730 //
731 // ==========================================================================
732
733 TGeoVolume *ad = new TGeoVolumeAssembly("AD");
734
735 // Get medium for ADA
736 TGeoMedium * medADASci = gGeoManager->GetMedium("AD_NE102"); // AD Scin.
737 // TGeoMedium * medADALG = gGeoManager->GetMedium("AD_PMMA"); // lightGuide
738 // TGeoMedium * medADAPMGlass = gGeoManager->GetMedium("AD_Glass"); // Glass for Aluminium simulation
739 // TGeoMedium * medADAPMAlum = gGeoManager->GetMedium("AD_Alum");
740
741 // Get Medium for ADC
742 TGeoMedium * medADCSci = gGeoManager->GetMedium("AD_NE102");
743 // TGeoMedium * medADCLG = gGeoManager->GetMedium("AD_PMMA");
744 // TGeoMedium * medADCPMGlass = gGeoManager->GetMedium("AD_Glass");
745 // TGeoMedium * medADCPMAlum = gGeoManager->GetMedium("AD_Alum");
746
747 // ADA Scintillator Pad
748 const Double_t kADACellSideY = 21.7;
749 const Double_t kADACellSideX = 18.2;
750 // ADC Scintillator Pad
751 const Double_t kADCCellSideY = 21.7;
752 const Double_t kADCCellSideX = 18.2;
753 // WLS bar : 0.40 cm ( 4.0 mm )
754 // Wrapping : 0.20 cm ( 2.0 mm )
755 // Aluminnized Mylar: 0.01 cm ( 0.1 mm )
756 // Fishing line : 0.04 cm ( 0.4 mm )
757 // total shift on X : 0.65 cm
758 // total shift on Y : 0.21 cm
759 const Double_t kShiftX = 0.65;
760 const Double_t kShiftY = 0.20;
761 const Double_t kADACelldz = 2.50;
762 const Double_t kADCCelldz = 2.50;
763 const Double_t kADABeamPipeR = 6.20; // Radius of beam pipe hole for ADA (Diameter 7 cm)
764 const Double_t kADCBeamPipeR = 3.70; // Radius of beam pipe hole for ADC (Diameter 12 cm)
765 const Int_t kColorADA = kGreen;
766 const Int_t kColorADC = kGreen;
767 Double_t X = kShiftX + kADACellSideX * 0.5;
768 Double_t Y = kShiftY + kADACellSideY * 0.5;
769 Double_t WLS_dx = 0.4;
770 Double_t WLS_dz = 2.5;
771 Double_t WLS_SideA_Long_dy = 24.20; // 24.2;
772 Double_t WLS_SideC_Long_dy = 24.20; // 24.2;
773 Double_t WLS_SideA_Short_dy = 18.20; // 18.41;
774 Double_t WLS_SideC_Short_dy = 20.70; // 20.91;
775 // Creating ADA WLS bars
776 TGeoVolume * vADA_WLS_s = new TGeoVolume( "ADAWLSshort",
777 new TGeoBBox( "shADAWLSbarShort" , WLS_dx/2.0, WLS_SideA_Short_dy/2.0, WLS_dz/2.0),
778 medADASci);
779 TGeoVolume * vADA_WLS_l = new TGeoVolume( "ADAWLSlong" ,
780 new TGeoBBox( "shADAWLSbarLong" , WLS_dx/2.0, WLS_SideA_Long_dy /2.0, WLS_dz/2.0),
781 medADASci);
782 vADA_WLS_l->SetLineColor( kRed );
783 vADA_WLS_s->SetLineColor( kRed );
784 // Creating ADC WLS bars
785 TGeoVolume * vADC_WLS_s = new TGeoVolume( "ADCWLSshort",
786 new TGeoBBox( "shADCWLSbarShort" , WLS_dx/2.0, WLS_SideC_Short_dy/2.0, WLS_dz/2.0),
787 medADCSci);
788 TGeoVolume * vADC_WLS_l = new TGeoVolume( "ADCWLSlong" ,
789 new TGeoBBox( "shADCWLSbarLong" , WLS_dx/2.0, WLS_SideC_Long_dy /2.0, WLS_dz/2.0),
790 medADCSci);
791 vADC_WLS_l->SetLineColor(kRed);
792 vADC_WLS_s->SetLineColor(kRed);
793 // Make ADA scintillator pad
794 new TGeoBBox( "shADAbox" , kADACellSideX/2.0, kADACellSideY/2.0, kADACelldz/2.0 );
795 new TGeoTube( "shADAHole", 0. , kADABeamPipeR , kADACelldz );
796 ( new TGeoTranslation("trADAbox", X, Y, 0.)) -> RegisterYourself();
797 //
798 TGeoVolume * vADA1 = new TGeoVolume( "ADApad",
799 new TGeoCompositeShape("shADApad", "shADAbox:trADAbox-shADAHole"), medADASci );
800 vADA1->SetLineColor( kColorADA );
801
802 TGeoVolume *secADA = new TGeoVolumeAssembly( "ADAsec" );
803 // Add PAD
804 secADA->AddNode( vADA1, 1, 0);
805 secADA->AddNode( vADA_WLS_s, 1,
806 new TGeoTranslation(0.21 + WLS_dx/2.0, kADABeamPipeR + WLS_SideA_Short_dy/2.0, 0.0) );
807 // new TGeoTranslation(0.21 + WLS_dx/2.0, kADABeamPipeR + kShiftY + WLS_SideA_Short_dy/2.0, 0.0) );
808 secADA->AddNode( vADA_WLS_l, 1,
809 new TGeoTranslation(kShiftX + WLS_dx/2.0 + kADACellSideX + 0.04, kShiftY + WLS_SideA_Long_dy/2.0, 0.0) );
810
811 /// Assembling ADA adding 4 sectors // Sectors
812 TGeoVolume *vADAarray = new TGeoVolumeAssembly( "ADA" ); // ^ y
813 vADAarray->AddNode( secADA, 1 ); // |
814 vADAarray->AddNode( secADA, 2, Ry180 ); // 2 | 1
815 vADAarray->AddNode( secADA, 3, Rz180 ); // ---------------> x
816 vADAarray->AddNode( secADA, 4, Rx180 ); // 3 | 4
817 // // |
818 // TGeoRotation *rotADA90 = new TGeoRotation("adarot",0,0,0); <--Delete this
819 // Add ADA layer 2 and 3 to AD volume
820 const Float_t kPosAD2 = 1695.0;
821 const Float_t kPosAD3 = 1700.0;
822 ad->AddNode(vADAarray,1, new TGeoTranslation(0., 0., kPosAD2));
823 ad->AddNode(vADAarray,2, new TGeoTranslation(0., 0., kPosAD3));
824
825 // if (GetADATwoInstalled())
826 // {
827 // const Float_t kPosADA2 = kPosADA - 5.0;
828 // ad->AddNode(vADAarray,2, new TGeoCombiTrans("ada",0,0,kPosADA2,rotADA90));
829 // }
830
831 // ==========================================================================
832 //
833 // Define ADC (2014, Aug 20)
834 //
835 // ==========================================================================
836
837 /// Creation of assembly of one ADC sector
838
839 /////////////////////////////////////////////////////////////////////////////
840 /// ADC in the tunnel ///
841 /////////////////////////////////////////////////////////////////////////////
842 new TGeoBBox( "shADCbox" , kADCCellSideX/2.0, kADCCellSideY/2.0, kADCCelldz/2.0 );
843 new TGeoTube( "shADCHole", 0. , kADCBeamPipeR , kADCCelldz );
844 X = kShiftX + kADCCellSideX * 0.5;
845 Y = kShiftY + kADCCellSideY * 0.5;
846 ( new TGeoTranslation("trADCbox", X, Y, 0.) ) -> RegisterYourself();
847 //
848 TGeoVolume * vADCpad = new TGeoVolume( "ADCpad",
849 new TGeoCompositeShape("shADCpad", "shADCbox:trADCbox-shADCHole"), medADCSci );
850 vADCpad->SetLineColor( kColorADC );
851
852 /// Creating Sector for Tunnel (Asembly: Scintillator Pad + Light guide + PM )
853 TGeoVolume *voADC = new TGeoVolumeAssembly("ADCsec");
854 // Add PAD
855 voADC->AddNode( vADCpad, 1, 0);
856 // Add ADC WLS Short bar
857 voADC->AddNode( vADC_WLS_s, 1,
858 new TGeoTranslation( 0.21 + WLS_dx/2.0, kADCBeamPipeR + WLS_SideC_Short_dy/2.0, 0.0) );
859 // new TGeoTranslation( 0.21 + WLS_dx/2.0, kADCBeamPipeR + kShiftY + WLS_SideC_Short_dy/2.0, 0.0) );
860 // Add ADC WLS Long bar
861 voADC->AddNode( vADC_WLS_l, 1,
862 new TGeoTranslation( 0.04 + WLS_dx/2.0 + kADCCellSideX + kShiftX, kShiftY + WLS_SideC_Long_dy/2.0, 0.0) );
863
864 /// Assembling ADC adding the 4 sectors // Sectors
865 TGeoVolume *vADCarray = new TGeoVolumeAssembly("ADC"); // ^ y
866 vADCarray->AddNode( voADC, 1 ); // |
867 vADCarray->AddNode( voADC, 2, Ry180 ); // 2 | 1
868 vADCarray->AddNode( voADC, 3, Rz180 ); // ---------------> x
869 vADCarray->AddNode( voADC, 4, Rx180 ); // 3 | 4
870 // |
871
872
873 // ==========================================================================
874 //
875 // Add ADC to AD volume
876 //
877 // Note to future maintainers:
878 // In previous AliRoot versions the position z = -1900.75 corresponded
879 // to the end of the YSAA3_CC_BLOCK (concrete block shielding just before
880 // the C-Side LHC wall). Now this has been fixed to agree with reality.
881 // The YSAA3_CC_BLOCK starts at 1800.75 and ends at 1880.75 cm.
882 //
883 // Ernesto Calvo and Alberto Gago.
884 // - ecalvovi@cern.ch
885 // - agago@pucp.edu.pe
886 //
887 // ==========================================================================
888
889
890
891 switch (fADCPosition ) {
892 case kADCInTunnel:
893 {
894 const Float_t kZbegADC1 = -kZbegFrontBar-2.; // (ecalvovi@cern.ch)
895 const Float_t kZendADC2 = -1959.0; // (ecalvovi@cern.ch)
896 ad -> AddNode(vADCarray , 1, new TGeoTranslation(0., 0., kZendADC2 + kADCCelldz/2.)); // Tunnel
897 ad -> AddNode(vADCarray , 2, new TGeoTranslation(0., 0., kZbegADC1 - kADCCelldz/2.)); // Tunnel
898 break;
899 }
900 case kADCInCavern:
901 {
902 printf("FATAL: vADCInCavern is now obsolete!");
903 exit(1);
904 // const Float_t kZbegADC1 = -1890.0; // (ecalvovi@cern.ch)
905 // const Float_t kZbegADC2 = -1885.0; // (ecalvovi@cern.ch)
906 // ad -> AddNode(vADCarrayH, 1, new TGeoTranslation(0., 0., kZbegADC1 - kADCCelldz/2.)); // Cavern
907 // ad -> AddNode(vADCarrayH, 2, new TGeoTranslation(0., 0., kZbegADC2 - kADCCelldz/2.)); // Cavern
908 break;
909 }
910 case kADCInBoth:
911 {
912 printf("FATAL: vADCInBoth is now obsolete!");
913 exit(1);
914 // const Float_t kZbegADC1 = -kZbegFrontBar-2.; // (ecalvovi@cern.ch)
915 // const Float_t kZbegADC2 = -1885.0; // (ecalvovi@cern.ch)
916 // ad -> AddNode(vADCarray , 1, new TGeoTranslation(0., 0., kZbegADC1 - kADCCelldz/2.)); // Tunnel
917 // ad -> AddNode(vADCarrayH, 2, new TGeoTranslation(0., 0., kZbegADC2 - kADCCelldz/2.)); // Cavern
918 break;
919 }
920 }
921
922
923 // ==========================================================================
924 //
925 // Add volumes to Top volume
926 //
927 // ==========================================================================
928
929 TGeoVolumeAssembly * top = new TGeoVolumeAssembly("voADStruct");
930 top->AddNode(voSaa3EndPlate, 1, new TGeoTranslation( 0., 0., kZendAbs + 1.95/2.));
931 z = kZwall;
932 top->AddNode(voWallBigPlate, 1, new TGeoTranslation(0., 0., z - 0.5 * dAlWallThick ));
933 top->AddNode(voWallSqrPlate, 1, new TGeoTranslation(0., 0., z + 0.5 * dAlWallThick ));
934 z = kZendAbs + 1.95 + dzRodL/2.;
935 top->AddNode(voSaa3Rod, 1, new TGeoTranslation( 12.5, -12.75, z));
936 top->AddNode(voSaa3Rod, 2, new TGeoTranslation( 12.5, 12.75, z));
937 top->AddNode(voSaa3Rod, 3, new TGeoTranslation( -12.5, -12.75, z));
938 top->AddNode(voSaa3Rod, 4, new TGeoTranslation( -12.5, 12.75, z));
939 top->AddNode(voValve, 1, new TGeoTranslation( 0., 0., zPosValve));
940 //
941 top->AddNode(voMoVMAOI, 1, new TGeoTranslation( 0., 0., kZbegVMAOI));
942 //
943 top->AddNode(voFrontBar, 1, new TGeoTranslation( 0., 0., kZbegFrontBar + dzF/2.));
944 z = kZbegCoil;
945 top->AddNode(voCoil, 1, new TGeoCombiTrans( 3.6 + dz/2., 0., z, Ry90m));
946 top->AddNode(voCoil, 2, new TGeoCombiTrans( 3.6 + dz/2., 0., z, new TGeoRotation((*Ry90m)*(*Rx180))));
947 top->AddNode(voCoil, 3, new TGeoCombiTrans( -3.6 - dz/2., 0., z, Ry90m));
948 top->AddNode(voCoil, 4, new TGeoCombiTrans( -3.6 - dz/2., 0., z, new TGeoRotation((*Ry90m)*(*Rx180))));
949 z = kZbegFrontBar + dzF + kdzLatBar/2.;
950 top->AddNode(voLatBar, 1, new TGeoTranslation( 31.9, 0., z));
951 top->AddNode(voLatBar, 2, new TGeoTranslation( -31.9, 0., z));
952 //
953 // Add Everything to ALICE
954 //
955 TGeoVolume *alice = gGeoManager->GetVolume("ALIC");
956 // Add structures to AD
957 if (fADCstruct) {
958 ad->AddNode(top,1, Ry180);
959 }
960
961 // Add AD to ALICE
962 alice->AddNode(ad, 1);
5e319bd5 963
5e319bd5 964
dd27c420 965 // gGeoManager->DefaultColors();
966 // gGeoManager->CloseGeometry();
967 // gGeoManager->SetVisLevel(10);
968 // gGeoManager->SetVisOption(0);
969 // alice->Draw("ogl");
5e319bd5 970
dd27c420 971 return;
5e319bd5 972}
973
974//_____________________________________________________________________________
975void AliADv1::AddAlignableVolumes() const
976{
977 //
978 // Create entries for alignable volumes associating the symbolic volume
979 // name with the corresponding volume path. Needs to be syncronized with
980 // eventual changes in the geometry.
981 //
982 // ADA and ADC
dd27c420 983 TString volpath1, volpath2, volpath3, volpath4;
984 TString symname1, symname2, symname3, symname4;
5e319bd5 985
dd27c420 986 symname1 = "AD/ADC1";
987 symname2 = "AD/ADC2";
988 symname3 = "AD/ADA1";
989 symname4 = "AD/ADA2";
990 switch (fADCPosition) {
991 case kADCInTunnel:
992 volpath1 = "/ALIC_1/AD_1/ADC_1";
993 volpath2 = "/ALIC_1/AD_1/ADC_2";
994 break;
995 case kADCInCavern:
996 volpath1 = "/ALIC_1/AD_1/ADCh_1";
997 volpath2 = "/ALIC_1/AD_1/ADCh_2";
998 break;
999 case kADCInBoth:
1000 volpath1 = "/ALIC_1/AD_1/ADC_1";
1001 volpath2 = "/ALIC_1/AD_1/ADCh_2";
1002 break;
1003 }
1004 volpath3 = "/ALIC_1/AD_1/ADA_1";
1005 volpath4 = "/ALIC_1/AD_1/ADA_2";
5e319bd5 1006
5e319bd5 1007 if ( !gGeoManager->SetAlignableEntry(symname1.Data(), volpath1.Data()) )
1008 AliFatal(Form( "Alignable entry %s not created. Volume path %s not valid", symname1.Data(), volpath1.Data()) );
dd27c420 1009 if ( GetADCTwoInstalled() && !gGeoManager->SetAlignableEntry(symname2.Data(), volpath2.Data()) )
5e319bd5 1010 AliFatal(Form( "Alignable entry %s not created. Volume path %s not valid", symname2.Data(), volpath2.Data()) );
1011 if ( !gGeoManager->SetAlignableEntry(symname3.Data(), volpath3.Data()) )
1012 AliFatal(Form( "Alignable entry %s not created. Volume path %s not valid", symname3.Data(), volpath3.Data()) );
dd27c420 1013 if ( GetADATwoInstalled() && !gGeoManager->SetAlignableEntry(symname4.Data(), volpath4.Data()) )
5e319bd5 1014 AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname4.Data(), volpath4.Data()) );
1015
1016}
1017
1018
1019//_____________________________________________________________________________
1020void AliADv1::StepManager()
1021{
1022
1023 //
1024 // Routine called at every step in the AD
1025 //
1026
1027 // ADA and ADC static Variables //
dd27c420 1028 // static Int_t numStep_ad = 0; //
1029 // static Int_t vol_ad[2]; //
5e319bd5 1030
1031 /////////////////////////////////////////////////////////////////////////
dd27c420 1032 // ADA and ADC //
5e319bd5 1033 /////////////////////////////////////////////////////////////////////////
1034
1035
1036 // Get sensitive volumes id (scintillator pads)
dd27c420 1037 static Int_t idADA = gMC->VolId( "ADApad" );
1038 static Int_t idADC = gMC->VolId( "ADCpad" );
1039 // static Int_t idADCh = gMC->VolId( "ADCpadH" );
5e319bd5 1040
dd27c420 1041 static Bool_t fOnlyOnce = kTRUE;
1042 if (fOnlyOnce) {
beca6103 1043 //printf(" gMC->VolId(\"ADApad\" ) = %3d\n", idADA);
1044 //printf(" gMC->VolId(\"ADCpad\" ) = %3d\n", idADC);
dd27c420 1045 // printf(" gMC->VolId(\"ADCpadH\") = %3d\n", idADCh);
1046 fOnlyOnce = kFALSE;
1047 }
1048
5e319bd5 1049 // We keep only charged tracks :
aa8120bb 1050 // if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
5e319bd5 1051 // We keep charged and non-charged tracks :
aa8120bb 1052 if ( !gMC->IsTrackAlive() ) return;
5e319bd5 1053
1054 Int_t copy;
aa8120bb 1055 Int_t current_volid = gMC->CurrentVolID( copy );
5e319bd5 1056
1057 // check is the track is in a sensitive volume
dd27c420 1058 // if( current_volid != idADA && current_volid != idADC && current_volid != idADCh ) {
5e319bd5 1059 if( current_volid != idADA && current_volid != idADC ) {
1060 return; // not in the sensitive volume
1061 }
1062
dd27c420 1063 // First read the position, otherwise weird results! //ecv
5e319bd5 1064 Double_t s[3];
1065 Float_t x[3];
aa8120bb 1066 gMC->TrackPosition( s[0], s[1], s[2] );
5e319bd5 1067 for ( Int_t j=0; j<3; j++ ) x[j] = s[j];
1068
5e319bd5 1069 // Get sector copy (1,2,3,4) ( 1 level up from pad )
1070 Int_t sect;
aa8120bb 1071 gMC->CurrentVolOffID( 1, sect );
dd27c420 1072
5e319bd5 1073 // Get Detector copy (1,2) ( 2 levels up from pad )
1074 Int_t detc;
aa8120bb 1075 gMC->CurrentVolOffID( 2, detc );
dd27c420 1076
1077 // Set detector type: ADA or ADC
1078 Int_t ADlayer = (current_volid == idADC ) ? 0 : 2;
1079
beca6103 1080 //printf("CurVolID: %d | sect: %2d | detc: %2d\n", current_volid, sect, detc);
dd27c420 1081
1082 sect--; // sector within layer [0-3]
1083 detc--; // detector copy [0-1]
1084 ADlayer += detc; // global layer number [0-3]
1085
1086 Int_t ADsector = ADlayer*4 + sect; // Global AD sector number [0-15]
1087 // Layer Sector Number
1088 // ADC 0 = 0- 3
1089 // ADC 1 = 4- 7
1090 // ADA 2 = 8-11
1091 // ADA 3 = 12-15
beca6103 1092 //printf("\n ADsector: %2d | ADlayer: %2d | sect: %2d | x: %8.2f | y: %8.2f | z: %8.2f\n", ADsector, ADlayer, sect, x[0], x[1], x[2]); // Debug ECV
5e319bd5 1093
1094 Double_t lightYield_ad;
1095 Double_t photoCathodeEfficiency;
1096
dd27c420 1097 if( ADlayer <2 ) {
5e319bd5 1098 lightYield_ad = fADCLightYield;
1099 photoCathodeEfficiency = fADCPhotoCathodeEfficiency;
1100 } else {
1101 lightYield_ad = fADALightYield;
1102 photoCathodeEfficiency = fADAPhotoCathodeEfficiency;
1103 }
1104
aa8120bb 1105 Float_t destep_ad = gMC->Edep();
1106 Float_t step_ad = gMC->TrackStep();
5e319bd5 1107 Int_t nPhotonsInStep_ad = Int_t( destep_ad / (lightYield_ad * 1e-9) );
1108 nPhotonsInStep_ad = gRandom->Poisson( nPhotonsInStep_ad );
1109
1110 static Float_t eloss_ad = 0.;
1111 static Float_t tlength_ad = 0.;
1112 static Int_t nPhotons_ad = 0;
1113 static Float_t hits_ad[11];
1114 static Int_t vol_ad[5];
1115
1116 eloss_ad += destep_ad;
1117 tlength_ad += step_ad;
1118
aa8120bb 1119 if ( gMC->IsTrackEntering() ) {
5e319bd5 1120 nPhotons_ad = nPhotonsInStep_ad;
1121 Double_t p[4];
aa8120bb 1122 gMC->TrackMomentum( p[0], p[1], p[2], p[3] );
5e319bd5 1123 Float_t pt = TMath::Sqrt( p[0]*p[0] + p[1]*p[1] + p[2]*p[2] );
1124 TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
1125 Int_t imo = par->GetFirstMother();
1126 Int_t pdgMo = 0;
1127 if ( imo > 0 ) {
1128 TParticle * pmot = gAlice->GetMCApp()->Particle(imo);
1129 pdgMo = pmot->GetPdgCode();
1130 }
1131
1132 // Set integer values
1133 vol_ad[0] = par->GetStatusCode(); // secondary flag //ecv
1134 vol_ad[1] = par->GetPdgCode(); // PDG code
1135 vol_ad[2] = pdgMo; // PDG of the mother
1136 // Set float values
1137 hits_ad[0] = x[0]; // X
1138 hits_ad[1] = x[1]; // Y
1139 hits_ad[2] = x[2]; // Z
1140 hits_ad[3] = p[3]; // kinetic energy of the entering particle
1141 hits_ad[4] = pt; // Pt
1142 hits_ad[5] = p[0]; // Px
1143 hits_ad[6] = p[1]; // Py
1144 hits_ad[7] = p[2]; // Pz
aa8120bb 1145 hits_ad[8] = 1.0e09*gMC->TrackTime(); // in ns!
5e319bd5 1146
1147 tlength_ad = 0.0;
1148 eloss_ad = 0.0;
1149
1150 return; // without return, we count 2 times nPhotonsInStep_ad !!!???
1151 }
1152
1153 nPhotons_ad += nPhotonsInStep_ad;
1154
aa8120bb 1155 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared() ) {
5e319bd5 1156
1157 // Set integer values
1158 vol_ad[3] = nPhotons_ad;
dd27c420 1159 vol_ad[4] = ADsector; // sector number (scintillator ID)
5e319bd5 1160 // Set float values
1161 hits_ad[9] = tlength_ad; // track lenght inside ADC or ADA
1162 hits_ad[10] = eloss_ad; // energy loss
1163 Int_t track = gAlice->GetMCApp()->GetCurrentTrackNumber();
1164 AddHit( track, vol_ad, hits_ad ); // <-- this is in AliAD.cxx
1165 tlength_ad = 0.0;
1166 eloss_ad = 0.0;
1167 nPhotons_ad = 0;
1168 }
1169
1170 // Do we need track reference ????
aa8120bb 1171 // if( gMC->IsTrackEntering() || gMC->IsTrackExiting() ) {
5e319bd5 1172 // AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), 49);
1173 // }
1174}
1175//_________________________________________________________
1176void AliADv1::AddHit(Int_t track, Int_t *vol, Float_t *hits)
1177{
1178 TClonesArray &lhits = *fHits;
1179 new(lhits[fNhits++]) AliADhit(fIshunt,track,vol,hits);
1180}
1181//_________________________________________________________
dd27c420 1182// void AliADv1::AddDigits(Int_t* track, Int_t module, Float_t time)
1183// {
1184// TClonesArray &ldigits = *fDigits;
1185// new(ldigits[fNdigits++]) AliADdigit(track,module,time);
1186// }
1187//_________________________________________________________
5e319bd5 1188void AliADv1::MakeBranch(Option_t *option)
1189{
1190
1191 // Create branches in the current tree
1192 TString branchname(Form("%s",GetName()));
1193 AliDebug(2,Form("fBufferSize = %d",fBufferSize));
1194 const char *cH = strstr(option,"H");
1195 if (fHits && fLoader->TreeH() && cH)
1196 {
1197 fLoader->TreeH()->Branch(branchname.Data(),&fHits,fBufferSize);
1198 AliDebug(2,Form("Making Branch %s for hits",branchname.Data()));
1199 }
1200 const char *cD = strstr(option,"D");
1201 if (fDigits && fLoader->TreeD() && cD)
1202 {
1203 fLoader->TreeD()->Branch(branchname.Data(),&fDigits, fBufferSize);
1204 AliDebug(2,Form("Making Branch %s for digits",branchname.Data()));
1205 }
1206}