MC-dependent part of AliRun extracted in AliMC (F.Carminati)
[u/mrichter/AliRoot.git] / VZERO / AliVZEROv2.cxx
CommitLineData
47d9b1cb 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
88cb7938 16/* $Id$ */
47d9b1cb 17
18//////////////////////////////////////////////////////////////////////
19// //
20// (V-zero) detector version 2 as designed by the Lyon group //
21// All comments should be sent to Brigitte CHEYNIS : //
22// b.cheynis@ipnl.in2p3.fr //
c288a388 23// Geometry of the 4th of november 2002 //
47d9b1cb 24// (circular instead of trapezoidal shapes as in previous versions //
c288a388 25// plus changes in cell dimensions and offsets) //
47d9b1cb 26// //
27//////////////////////////////////////////////////////////////////////
28
88cb7938 29#include <Riostream.h>
30#include <stdlib.h>
31#include <string.h>
32
33#include <TBRIK.h>
34#include <TBox.h>
47d9b1cb 35#include <TCONE.h>
88cb7938 36#include <TClonesArray.h>
37#include <TGeant3.h>
38#include <TGeometry.h>
39#include <TH1.h>
40#include <TLorentzVector.h>
41#include <TMath.h>
42#include <TNode.h>
43#include <TObjectTable.h>
47d9b1cb 44#include <TPCON.h>
88cb7938 45#include <TPGON.h>
47d9b1cb 46#include <TSPHE.h>
88cb7938 47#include <TShape.h>
47d9b1cb 48#include <TTRAP.h>
88cb7938 49#include <TTRD2.h>
47d9b1cb 50#include <TTUBE.h>
88cb7938 51#include <TTUBS.h>
52#include <TVirtualMC.h>
53#include <TParticle.h>
47d9b1cb 54
88cb7938 55#include "AliLoader.h"
47d9b1cb 56#include "AliMagF.h"
88cb7938 57#include "AliRun.h"
47d9b1cb 58#include "AliVZEROdigit.h"
88cb7938 59#include "AliVZEROhit.h"
60#include "AliVZEROv2.h"
5d12ce38 61#include "AliMC.h"
47d9b1cb 62
63ClassImp(AliVZEROv2)
64
65//--------------------------------------------------------------------
66AliVZEROv2:: AliVZEROv2():AliVZERO()
67{
68
47d9b1cb 69}
70//--------------------------------------------------------------------
71AliVZEROv2::AliVZEROv2(const char *name, const char *title):
72 AliVZERO(name,title)
73{
74
75// Standard constructor for V-zeroR Detector (right part) version 0
76
47d9b1cb 77 Int_t i;
78
79 printf("\n");
c288a388 80 for(i=0;i<26;i++) printf("*");
47d9b1cb 81 printf(" Create VZERO object ");
c288a388 82 for(i=0;i<26;i++) printf("*");
47d9b1cb 83 printf("\n");
84
85}
86
87//-------------------------------------------------------------------------
88void AliVZEROv2::CreateGeometry()
89{
90
91// Creates the GEANT geometry of the V-zero Detector version 2
47d9b1cb 92
93 Int_t i;
94
95 printf("\n");
c288a388 96 for(i=0;i<26;i++) printf("*");
47d9b1cb 97 printf(" Create VZERO Geometry ");
c288a388 98 for(i=0;i<26;i++) printf("*");
47d9b1cb 99 printf("\n");
c288a388 100
47d9b1cb 101 Int_t *idtmed = fIdtmed->GetArray()-2999;
102
103 Int_t n_detec_R = 1;
104 Int_t n_detec_L = 1;
105
106 Int_t n_cells_R = 1;
107 Int_t n_cells_L = 1;
108
109 Int_t idrotm[999];
110
111 Float_t height1, height2, height3, height4, height5;
112 Float_t height;
113 Float_t theta;
114
115 Float_t half_thick_qua;
116
117 Float_t zdet;
118 Float_t r0, r5;
119 Float_t pi = TMath::Pi();
c288a388 120
121 height1 = 1.82; // height of cell 1, in cm
122 height2 = 3.81; // height of cell 2, in cm
123 height3 = 4.72; // height of cell 3, in cm
124 height4 = 7.12; // height of cell 4, in cm
125 height5 = 10.83; // height of cell 5, in cm
47d9b1cb 126
127 theta = pi/6.0/2.0; // half angular opening = 15 degrees
c288a388 128
47d9b1cb 129 half_thick_qua = fThickness1/2.0; // half thickness of elementary cell (inner ring)
c288a388 130
131 zdet = 90.0 - 0.6 -fThickness/2.0; // distance to vertex (along Z axis)
132 r0 = 4.05; // closest distance to center of the beam pipe
47d9b1cb 133 height = height1 + height2 + height3 + height4 + height5;
134 r5 = r0 + height;
135
47d9b1cb 136// Creation of mother volume V0LE - left part - :
137// Entrance face at -350.0 cm ...
138
139 Float_t partube[3];
140
141 partube[0] = 4.3;
142 partube[1] = 45.0;
143 partube[2] = fThickness1/2.0;
144
145 gMC->Gsvolu("V0LE","TUBE",idtmed[3005],partube,3);
c288a388 146
47d9b1cb 147// Creation of five rings - left part - :
148// Entrance face at -350.0 cm ...
149
150// Mother volume V0L0 in which will be set 5 scintillator cells
151
47d9b1cb 152 Float_t partubs[5];
153
154 Float_t r0_left = 4.3;
155 Float_t height1_left = 2.6;
156 Float_t height2_left = 4.1;
157 Float_t height3_left = 6.4;
158 Float_t height4_left = 10.2;
159 Float_t height5_left = 16.9;
160 Float_t height_left = height1_left + height2_left + height3_left
161 + height4_left + height5_left;
162 Float_t r5_left = r0_left + height_left;
163
47d9b1cb 164 partubs[0] = r0_left;
165 partubs[1] = r5_left;
166 partubs[2] = fThickness1/2.0;
167 partubs[3] = 90.0-15.0;
168 partubs[4] = 120.0-15.0;
169
170 gMC->Gsvolu("V0L0","TUBS",idtmed[3010],partubs,5); // air volume
171
172 Float_t r1_left = r0_left + height1_left;
173
174 partubs[0] = r0_left;
175 partubs[1] = r1_left;
176
177 gMC->Gsvolu("V0L1","TUBS",idtmed[3005],partubs,5); // quartz volume
178 gMC->Gspos("V0L1",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
179
180 Float_t r2_left = r1_left + height2_left;
181
182 partubs[0] = r1_left;
183 partubs[1] = r2_left;
184
185 gMC->Gsvolu("V0L2","TUBS",idtmed[3005],partubs,5); // quartz volume
186 gMC->Gspos("V0L2",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
187
188 Float_t r3_left = r2_left + height3_left;
189
190 partubs[0] = r2_left;
191 partubs[1] = r3_left;
192
193 gMC->Gsvolu("V0L3","TUBS",idtmed[3005],partubs,5); // quartz volume
194 gMC->Gspos("V0L3",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
195
196 Float_t r4_left = r3_left + height4_left;
197
198 partubs[0] = r3_left;
199 partubs[1] = r4_left;
200
47d9b1cb 201 gMC->Gsvolu("V0L4","TUBS",idtmed[3005],partubs,5); // quartz volume
202 gMC->Gspos("V0L4",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
203
204 partubs[0] = r4_left;
205 partubs[1] = r5_left;
206 partubs[3] = 90.0-15.0;
207 partubs[4] = 120.0-30.0;
208
47d9b1cb 209 gMC->Gsvolu("V0L5","TUBS",idtmed[3005],partubs,5); // quartz volume
210 gMC->Gspos("V0L5",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
211
47d9b1cb 212 partubs[3] = 120.0-30.0;
213 partubs[4] = 120.0-15.0;
214
47d9b1cb 215 gMC->Gsvolu("V0L6","TUBS",idtmed[3005],partubs,5); // quartz volume
216 gMC->Gspos("V0L6",1,"V0L0", 0.0, 0.0 , 0.0, 0,"ONLY");
217
218
219// Creation of mother volume V0RI - right part - :
47d9b1cb 220
221 partube[0] = r0 - 0.2;
222 partube[1] = r5 + 1.0;
223 partube[2] = fThickness/2.0;
c288a388 224
47d9b1cb 225 gMC->Gsvolu("V0RI","TUBE",idtmed[3010],partube,3);
226
c288a388 227// Creation of carbon lids (3 mm thick) to keep V0RI box shut...
47d9b1cb 228
229 partube[0] = r0;
230 partube[1] = r5;
c288a388 231 partube[2] = +0.3/2.0;
232
47d9b1cb 233 gMC->Gsvolu("V0CA","TUBE",idtmed[3001],partube,3);
234 gMC->Gspos("V0CA",1,"V0RI",0.0,0.0, fThickness/2.0-partube[2],0,"ONLY");
235 gMC->Gspos("V0CA",2,"V0RI",0.0,0.0,-fThickness/2.0+partube[2],0,"ONLY");
236
237// Creation of aluminum rings to maintain the V0RI pieces ...
238
239 partube[0] = r0 - 0.2;
240 partube[1] = r0;
241 partube[2] = +fThickness/2.0;
c288a388 242
47d9b1cb 243 gMC->Gsvolu("V0IR","TUBE",idtmed[3003],partube,3);
244 gMC->Gspos("V0IR",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
245
246 partube[0] = r5;
247 partube[1] = r5 + 1.0;
248 partube[2] = +fThickness/2.0;
249
47d9b1cb 250 gMC->Gsvolu("V0ER","TUBE",idtmed[3003],partube,3);
251 gMC->Gspos("V0ER",1,"V0RI",0.0,0.0,0.0,0,"ONLY");
252
253// Mother volume V0R0 in which will be set 5 scintillator cells
47d9b1cb 254
255 partubs[0] = r0;
256 partubs[1] = r5;
257 partubs[2] = fThickness/2.0;
258 partubs[3] = 90.0-15.0;
259 partubs[4] = 120.0-15.0;
260
c288a388 261 gMC->Gsvolu("V0R0","TUBS",idtmed[3010],partubs,5); // air volume
47d9b1cb 262
263// Elementary cell of ring 1 :
264// (the cells will be shifted by 3 mm to output fibers)
265
c288a388 266 Float_t offset_fibers = 0.7;
267 Float_t offset = fThickness/2.0 - 0.3 - fThickness1/2.0;
47d9b1cb 268 Float_t r1 = r0 + height1;
269
270 partubs[0] = r0;
271 partubs[1] = r1;
272 partubs[2] = fThickness1/2.0;
273
274 gMC->Gsvolu("V0R1","TUBS",idtmed[3005],partubs,5); // scintillator volume
c288a388 275 gMC->Gspos("V0R1",1,"V0R0", 0.0, 0.0 , offset, 0,"ONLY");
47d9b1cb 276
277// Elementary cell of ring 2 :
278
279 Float_t r2 = r1 + height2;
280
281 partubs[0] = r1;
282 partubs[1] = r2;
283
284 gMC->Gsvolu("V0R2","TUBS",idtmed[3005],partubs,5); // scintillator volume
c288a388 285 gMC->Gspos("V0R2",1,"V0R0", 0.0, 0.0 , offset - offset_fibers, 0,"ONLY");
47d9b1cb 286
287
288// Elementary cell of ring 3 :
289
290 Float_t r3 = r2 + height3;
291
292 partubs[0] = r2;
293 partubs[1] = r3;
294
295 gMC->Gsvolu("V0R3","TUBS",idtmed[3005],partubs,5); // scintillator volume
c288a388 296 gMC->Gspos("V0R3",1,"V0R0", 0.0, 0.0 , offset - 2.0 * offset_fibers, 0,"ONLY");
47d9b1cb 297
298// Elementary cell of ring 4 :
299
300 Float_t r4 = r3 + height4 ;
301
302 partubs[0] = r3;
303 partubs[1] = r4;
304
305 gMC->Gsvolu("V0R4","TUBS",idtmed[3005],partubs,5); // scintillator volume
c288a388 306 gMC->Gspos("V0R4",1,"V0R0", 0.0, 0.0 , offset - 3.0 * offset_fibers, 0,"ONLY");
47d9b1cb 307
308// Elementary cells of ring 5 :
309
310 partubs[0] = r4;
311 partubs[1] = r5;
312 partubs[3] = 90.0-15.0;
313 partubs[4] = 120.0-30.0;
314
47d9b1cb 315 gMC->Gsvolu("V0R5","TUBS",idtmed[3005],partubs,5); // scintillator volume
c288a388 316 gMC->Gspos("V0R5",1,"V0R0", 0.0, 0.0 , offset - 4.0 * offset_fibers, 0,"ONLY");
47d9b1cb 317
318 partubs[3] = 120.0-30.0;
319 partubs[4] = 120.0-15.0;
320
47d9b1cb 321 gMC->Gsvolu("V0R6","TUBS",idtmed[3005],partubs,5); // scintillator volume
c288a388 322 gMC->Gspos("V0R6",1,"V0R0", 0.0, 0.0 , offset - 4.0 * offset_fibers, 0,"ONLY");
323
47d9b1cb 324 Float_t phi_deg = 180./6.;
325
326// Right part :
327
328 for(Float_t phi = 15.0; phi < 360.0; phi = phi + phi_deg)
329 {
330 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
331 gMC->Gspos("V0R0",n_detec_R,"V0RI",0.0,
c288a388 332 0.0,0.0,idrotm[902],"ONLY");
47d9b1cb 333 n_detec_R++;
334 }
335
650cd9d0 336 gMC->Gspos("V0RI",1,"ALIC",0.0,0.0,zdet,0,"ONLY");
47d9b1cb 337
c288a388 338 n_cells_R = (n_detec_R - 1) * 6;
47d9b1cb 339 printf(" Number of cells on Right side = %d\n", n_cells_R);
340
341// Left part :
342
343 for(Float_t phi = 15.0; phi < 360.0; phi = phi + phi_deg)
344 {
345 AliMatrix(idrotm[902], 90.0, phi, 90.0, 90.0 +phi, 0.0 , 0.0);
346 gMC->Gspos("V0L0",n_detec_L,"V0LE",0.0,
347 0.0,0.0,idrotm[902],"ONLY");
348 n_detec_L++;
349 }
350
650cd9d0 351 gMC->Gspos("V0LE",1,"ALIC",0.0,0.0,-350.0-fThickness1/2.0,0,"ONLY");
47d9b1cb 352
c288a388 353 n_cells_L = (n_detec_L - 1) * 6;
354 printf(" Number of cells on Left side = %d\n", n_cells_L);
355 for(i=0;i<75;i++) printf("*");
356 printf("\n");
357
47d9b1cb 358}
c288a388 359
47d9b1cb 360//_____________________________________________________________________________
361void AliVZEROv2::BuildGeometry()
362{
363
364// Builds simple ROOT TNode geometry for event display
365
47d9b1cb 366 Int_t i;
367
368 printf("\n");
369 for(i=0;i<30;i++) printf("*");
370 printf(" VZERO BuildGeometry ");
371 for(i=0;i<30;i++) printf("*");
372 printf("\n");
373
374 TNode *Top;
375
376 TNode *V0Rnode, *V0Rnode0, *V0Rnode6 , *V0Rnode7, *V0Rnode8, *V0Rnode9;
377 TNode *V0Rnode1, *V0Rnode2, *V0Rnode3, *V0Rnode4, *V0Rnode5;
378 TNode *V0Lnode, *V0Lnode0;
379 TNode *V0Lnode1, *V0Lnode2, *V0Lnode3, *V0Lnode4, *V0Lnode5, *V0Lnode6;
380
381 const int kColorVZERO = kGreen;
382
383 Top = gAlice->GetGeometry()->GetNode("alice");
384
385 Float_t height1, height2, height3, height4, height5;
386 Float_t height;
387 Float_t theta;
388
389 Float_t half_thick_qua;
390 Float_t zdet;
391 Float_t r0, r5;
392 Float_t pi = TMath::Pi();
c288a388 393
394 height1 = 1.82; // height of cell 1, in cm
395 height2 = 3.81; // height of cell 2, in cm
396 height3 = 4.72; // height of cell 3, in cm
397 height4 = 7.12; // height of cell 4, in cm
398 height5 = 10.83; // height of cell 5, in cm
399
47d9b1cb 400 theta = pi/6.0/2.0;
401
402 half_thick_qua = fThickness1/2.0;
403
c288a388 404 zdet = 90.0 - 0.6 - fThickness/2.0;
405 r0 = 4.05;
47d9b1cb 406 height = height1 + height2 + height3 + height4 + height5;
407 r5 = r0 + height;
408
409 Int_t ndiv = 1;
410
411 Float_t partube[3];
412
413 partube[0] = r0 - 0.2;
414 partube[1] = r5 + 1.0;
415 partube[2] = fThickness/2.0;
416
417 TTUBE *V0RI = new TTUBE("V0RI", "V0RI", "void", partube[0], partube[1], partube[2]);
418
419 Top->cd();
420
421 V0Rnode = new TNode("V0RI","V0RI",V0RI,0.0,0.0,+zdet,0);
422
c288a388 423 V0Rnode->SetLineColor(kYellow);
424 fNodes->Add(V0Rnode);
425 V0Rnode->SetVisibility(2);
47d9b1cb 426
c288a388 427// Rondelles de carbone (epaisseur 3 mm) de maintien des cellules ...
428
47d9b1cb 429 partube[0] = r0;
430 partube[1] = r5;
c288a388 431 partube[2] = +0.3/2.0;
47d9b1cb 432
433 TTUBE *V0CA = new TTUBE("V0CA", "V0CA", "void",partube[0], partube[1], partube[2]);
434
435 V0Rnode->cd();
436 V0Rnode6 = new TNode("V0CA", "V0CA",V0CA,0.0,0.0, fThickness/2.0-partube[2],0);
437 V0Rnode6->SetLineColor(kYellow);
438 fNodes->Add(V0Rnode6);
439 V0Rnode->cd();
440 V0Rnode7 = new TNode("V0CA", "V0CA",V0CA,0.0,0.0,-fThickness/2.0+partube[2],0);
441 V0Rnode7->SetLineColor(kYellow);
442 fNodes->Add(V0Rnode7);
443
444 partube[0] = r0 - 0.2;
445 partube[1] = r0;
446 partube[2] = +fThickness/2.0;
447
448 TTUBE *V0IR = new TTUBE("V0IR","V0IR","void", partube[0], partube[1], partube[2]);
47d9b1cb 449
450 V0Rnode->cd();
451 V0Rnode8 = new TNode("V0IR", "V0IR",V0IR,0.0,0.0,0.0,0);
452 V0Rnode8->SetLineColor(kYellow);
453 fNodes->Add(V0Rnode8);
454
455 partube[0] = r5;
456 partube[1] = r5 + 1.0;
457 partube[2] = +fThickness/2.0;
458
459 TTUBE *V0ER = new TTUBE("V0ER","V0ER","void", partube[0], partube[1], partube[2]);
460
461 V0Rnode->cd();
462 V0Rnode9 = new TNode("V0ER", "V0ER",V0ER,0.0,0.0,0.0,0);
463 V0Rnode9->SetLineColor(kYellow);
464 fNodes->Add(V0Rnode9);
465
466 Float_t partubs[5];
467
468 partubs[0] = r0;
469 partubs[1] = r5;
470 partubs[2] = fThickness/2.0;
471 partubs[3] = 90.0-15.0;
472 partubs[4] = 120.0-15.0;
473
47d9b1cb 474 TTUBS *V0R0 = new TTUBS("V0R0", "V0R0", "void",partubs[0], partubs[1], partubs[2],
475 partubs[3], partubs[4]);
476
c288a388 477 V0R0->SetNumberOfDivisions(ndiv);
47d9b1cb 478
479 Float_t r1 = r0 + height1;
c288a388 480 Float_t offset = fThickness/2.0 - 0.3 - fThickness1/2.0;
481 Float_t offset_fibers = 0.7;
47d9b1cb 482
483 partubs[0] = r0;
484 partubs[1] = r1;
485 partubs[2] = fThickness1/2.0;
486
487 TTUBS *V0R1 = new TTUBS("V0R1", "V0R1", "void", partubs[0], partubs[1], partubs[2],
488 partubs[3], partubs[4]);
489
490 V0R1->SetNumberOfDivisions(ndiv);
491
492 Float_t r2 = r1 + height2;
47d9b1cb 493
494 partubs[0] = r1;
495 partubs[1] = r2;
496
497 TTUBS *V0R2 = new TTUBS("V0R2", "V0R2", "void", partubs[0], partubs[1], partubs[2],
498 partubs[3], partubs[4]);
499
500 V0R2->SetNumberOfDivisions(ndiv);
501
502 Float_t r3 = r2 + height3;
47d9b1cb 503
504 partubs[0] = r2;
505 partubs[1] = r3;
506
507 TTUBS *V0R3 = new TTUBS("V0R3", "V0R3", "void", partubs[0], partubs[1], partubs[2],
508 partubs[3], partubs[4]);
509 V0R3->SetNumberOfDivisions(ndiv);
510
511 Float_t r4 = r3 + height4;
512
513 partubs[0] = r3;
514 partubs[1] = r4;
515
516 TTUBS *V0R4 = new TTUBS("V0R4", "V0R4", "void", partubs[0], partubs[1], partubs[2],
517 partubs[3], partubs[4]);
518
519 V0R4->SetNumberOfDivisions(ndiv);
520
521 partubs[0] = r4;
522 partubs[1] = r5;
523 partubs[3] = 90.0-15.0;
524 partubs[4] = 120.0-30.0;
525
526 TTUBS *V0R5 = new TTUBS("V0R5", "V0R5", "void", partubs[0], partubs[1], partubs[2],
527 partubs[3], partubs[4]);
528
47d9b1cb 529 V0R5->SetNumberOfDivisions(ndiv);
530
531 partubs[3] = 120.0-30.0;
532 partubs[4] = 120.0-15.0;
533
534 TTUBS *V0R6 = new TTUBS("V0R6", "V0R6", "void", partubs[0], partubs[1], partubs[2],
535 partubs[3], partubs[4]);
536
47d9b1cb 537 V0R6->SetNumberOfDivisions(ndiv);
47d9b1cb 538
539 Float_t phi;
540 Float_t phi_deg= 180./6.;
c288a388 541
47d9b1cb 542 Int_t n_detec_R = 1;
543
544 char NameNode[12];
47d9b1cb 545
546 for (phi = 15.0; phi < 360.0; phi = phi + phi_deg)
547
548 {
549
550 TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );
c288a388 551
47d9b1cb 552 sprintf(NameNode,"SUBDER%d",n_detec_R);
553
554 V0Rnode->cd();
c288a388 555 V0Rnode0 = new TNode(NameNode,NameNode,V0R0,0.0,0.0, 0.0,mat920);
556 V0Rnode0->SetLineColor(kYellow);
47d9b1cb 557 fNodes->Add(V0Rnode0);
558 n_detec_R++;
559
560 sprintf(NameNode,"SUBDER%d",n_detec_R);
561 V0Rnode0->cd();
c288a388 562 V0Rnode1 = new TNode(NameNode,NameNode,V0R1,0.0,0.0, offset,0);
47d9b1cb 563 V0Rnode1->SetLineColor(kColorVZERO);
564 fNodes->Add(V0Rnode1);
565 n_detec_R++;
566
567 sprintf(NameNode,"SUBDER%d",n_detec_R);
568 V0Rnode0->cd();
c288a388 569 V0Rnode2 = new TNode(NameNode,NameNode,V0R2,0.0,0.0, offset - offset_fibers,0);
47d9b1cb 570 V0Rnode2->SetLineColor(kColorVZERO);
571 fNodes->Add(V0Rnode2);
572 n_detec_R++;
573
47d9b1cb 574 sprintf(NameNode,"SUBDER%d",n_detec_R);
575 V0Rnode0->cd();
c288a388 576 V0Rnode3 = new TNode(NameNode,NameNode,V0R3,0.0,0.0, offset - 2.0*offset_fibers,0);
47d9b1cb 577 V0Rnode3->SetLineColor(kColorVZERO);
578 fNodes->Add(V0Rnode3);
579 n_detec_R++;
580
581 sprintf(NameNode,"SUBDER%d",n_detec_R);
582 V0Rnode0->cd();
c288a388 583 V0Rnode4 = new TNode(NameNode,NameNode,V0R4,0.0,0.0, offset - 3.0*offset_fibers,0);
47d9b1cb 584 V0Rnode4->SetLineColor(kColorVZERO);
585 fNodes->Add(V0Rnode4);
586 n_detec_R++;
587
588 sprintf(NameNode,"SUBDER%d",n_detec_R);
589 V0Rnode0->cd();
c288a388 590 V0Rnode5 = new TNode(NameNode,NameNode,V0R5,0.0,0.0, offset - 4.0*offset_fibers,0);
47d9b1cb 591 V0Rnode5->SetLineColor(kColorVZERO);
592 fNodes->Add(V0Rnode5);
593 n_detec_R++;
594
595 sprintf(NameNode,"SUBDER%d",n_detec_R);
596 V0Rnode0->cd();
c288a388 597 V0Rnode6 = new TNode(NameNode,NameNode,V0R6,0.0,0.0, offset - 4.0*offset_fibers,0);
47d9b1cb 598 V0Rnode6->SetLineColor(kColorVZERO);
599 fNodes->Add(V0Rnode6);
600 n_detec_R++;
601
602 V0Rnode0->SetVisibility(2);
603
604 }
605
47d9b1cb 606// Left side of VZERO :
47d9b1cb 607
608 Float_t r0_left = 4.3;
609 Float_t height1_left = 2.6;
610 Float_t height2_left = 4.1;
611 Float_t height3_left = 6.4;
612 Float_t height4_left = 10.2;
613 Float_t height5_left = 16.9;
614 Float_t height_left = height1_left + height2_left + height3_left
615 + height4_left + height5_left;
616 Float_t r5_left = r0_left + height_left;
617
618 partube[0] = r0_left;
619 partube[1] = r5_left;
620 partube[2] = fThickness1/2.0;
621
622 TTUBE *V0LE = new TTUBE("V0LE", "V0LE", "void", partube[0], partube[1], partube[2]);
623
624 Top->cd();
625
626 V0Lnode = new TNode("V0LE","V0LE",V0LE,0.0,0.0,-350.0-fThickness1/2.0,0);
627
628 V0Lnode->SetLineColor(kBlue);
629 fNodes->Add(V0Lnode);
630
631 V0Lnode->SetVisibility(2);
632
633 partubs[0] = r0_left;
634 partubs[1] = r5_left;
635 partubs[2] = fThickness1/2.0;
636 partubs[3] = 90.0-15.0;
637 partubs[4] = 120.0-15.0;
638
639 TTUBS *V0L0 = new TTUBS("V0L0", "V0L0", "void", partubs[0], partubs[1], partubs[2],
640 partubs[3], partubs[4]);
641
642 V0L0->SetNumberOfDivisions(ndiv);
643 V0L0->SetLineColor(7);
644
645 Float_t offset_left;
646 offset_left = - fThickness1/2.0;
647
648 Float_t r1_left = r0_left + height1_left;
649
650 partubs[0] = r0_left;
651 partubs[1] = r1_left;
652
653 TTUBS *V0L1 = new TTUBS("V0L1", "V0L1", "void", partubs[0], partubs[1], partubs[2],
654 partubs[3], partubs[4]);
655
656 V0L1->SetNumberOfDivisions(ndiv);
657
658 Float_t r2_left = r1_left + height2_left;
659
660 partubs[0] = r1_left;
661 partubs[1] = r2_left;
662
663 TTUBS *V0L2 = new TTUBS("V0L2", "V0L2", "void", partubs[0], partubs[1], partubs[2],
664 partubs[3], partubs[4]);
665
666 V0L2->SetNumberOfDivisions(ndiv);
667
668 Float_t r3_left = r2_left + height3_left;
669
670 partubs[0] = r2_left;
671 partubs[1] = r3_left;
672
673 TTUBS *V0L3 = new TTUBS("V0L3", "V0L3", "void", partubs[0], partubs[1], partubs[2],
674 partubs[3], partubs[4]);
675 V0L3->SetNumberOfDivisions(ndiv);
676
677 Float_t r4_left = r3_left + height4_left;
678
679 partubs[0] = r3_left;
680 partubs[1] = r4_left;
681
682 TTUBS *V0L4 = new TTUBS("V0L4", "V0L4", "void", partubs[0], partubs[1], partubs[2],
683 partubs[3], partubs[4]);
684
685 V0L4->SetNumberOfDivisions(ndiv);
686
687 partubs[0] = r4_left;
688 partubs[1] = r5_left;
689 partubs[3] = 90.0-15.0;
690 partubs[4] = 120.0-30.0;
691
692 TTUBS *V0L5 = new TTUBS("V0L5", "V0L5", "void", partubs[0], partubs[1], partubs[2],
693 partubs[3], partubs[4]);
694
695
696 V0L5->SetNumberOfDivisions(ndiv);
697
698 partubs[3] = 120.0-30.0;
699 partubs[4] = 120.0-15.0;
700
701 TTUBS *V0L6 = new TTUBS("V0L6", "V0L6", "void", partubs[0], partubs[1], partubs[2],
702 partubs[3], partubs[4]);
703
47d9b1cb 704 V0L6->SetNumberOfDivisions(ndiv);
705
706 Int_t n_detec_L = 1;
47d9b1cb 707
708 for (phi = 15.0; phi < 360.0; phi = phi + phi_deg)
709
710 {
711
712 TRotMatrix* mat920 = new TRotMatrix("rot920","rot920", 90.0, +phi, 90., 90.+phi, 0.0, 0.0 );
713
714
715 sprintf(NameNode,"SUBDEL%d",n_detec_L);
716
717 V0Lnode->cd();
718 V0Lnode0 = new TNode(NameNode,NameNode,V0L0,0.0,0.0, offset_left + half_thick_qua,mat920);
719 V0Lnode0->SetLineColor(kColorVZERO);
720 fNodes->Add(V0Lnode0);
721 n_detec_L++;
722
723 sprintf(NameNode,"SUBDEL%d",n_detec_L);
724 V0Lnode0->cd();
725 V0Lnode1 = new TNode(NameNode,NameNode,V0L1,0.0,0.0, 0.0,0);
726 V0Lnode1->SetLineColor(kColorVZERO);
727 fNodes->Add(V0Lnode1);
728 n_detec_L++;
729
730 sprintf(NameNode,"SUBDEL%d",n_detec_L);
731 V0Lnode0->cd();
732 V0Lnode2 = new TNode(NameNode,NameNode,V0L2,0.0,0.0, 0.0,0);
733 V0Lnode2->SetLineColor(kColorVZERO);
734 fNodes->Add(V0Lnode2);
735 n_detec_L++;
736
737
738 sprintf(NameNode,"SUBDEL%d",n_detec_L);
739 V0Lnode0->cd();
740 V0Lnode3 = new TNode(NameNode,NameNode,V0L3,0.0,0.0, 0.0,0);
741 V0Lnode3->SetLineColor(kColorVZERO);
742 fNodes->Add(V0Lnode3);
743 n_detec_L++;
744
745 sprintf(NameNode,"SUBDEL%d",n_detec_L);
746 V0Lnode0->cd();
747 V0Lnode4 = new TNode(NameNode,NameNode,V0L4,0.0,0.0, 0.0,0);
748 V0Lnode4->SetLineColor(kColorVZERO);
749 fNodes->Add(V0Lnode4);
750 n_detec_L++;
751
752 sprintf(NameNode,"SUBDEL%d",n_detec_L);
753 V0Lnode0->cd();
754 V0Lnode5 = new TNode(NameNode,NameNode,V0L5,0.0,0.0, 0.0,0);
755 V0Lnode5->SetLineColor(kColorVZERO);
756 fNodes->Add(V0Lnode5);
757 n_detec_L++;
758
759 sprintf(NameNode,"SUBDEL%d",n_detec_L);
760 V0Lnode0->cd();
761 V0Lnode6 = new TNode(NameNode,NameNode,V0L6,0.0,0.0, 0.0,0);
762 V0Lnode6->SetLineColor(kColorVZERO);
763 fNodes->Add(V0Lnode6);
764 n_detec_L++;
765
766 V0Lnode0->SetVisibility(2);
767
768 }
47d9b1cb 769
770}
771
47d9b1cb 772//------------------------------------------------------------------------
773void AliVZEROv2::CreateMaterials()
774{
775 Int_t i;
776
777 printf("\n");
c288a388 778 for(i=0;i<25;i++) printf("*");
47d9b1cb 779 printf(" VZERO create materials ");
c288a388 780 for(i=0;i<26;i++) printf("*");
47d9b1cb 781 printf("\n");
782
783/*
784 Float_t ppckov[14] = { 5.5e-9, 5.7e-9, 5.9e-9, 6.1e-9, 6.3e-9, 6.5e-9, 6.7e-9,
785 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
786
787
788 Float_t ppckov_alu[14] = { 5.5e-9, 5.7e-9, 5.9e-9, 6.1e-9, 6.3e-9, 6.5e-9, 6.7e-9,
789 6.9e-9, 7.1e-9, 7.3e-9, 7.5e-9, 7.7e-9, 7.9e-9, 8.1e-9 };
790
791 Float_t rindex_quarz[14] = { 1.52398, 1.53090, 1.53835, 1.54641, 1.55513, 1.56458,
792 1.57488, 1.58611, 1.59842, 1.61197, 1.62696, 1.64362,
793 1.662295, 1.68337 };
794
795 Float_t absco_quarz[14] = { 105.8, 45.656, 35.665, 28.598, 25.007, 21.04, 17.525,
796 14.177, 9.282, 4.0925, 1.149, 0.3627, 0.1497, 0.05 };
797
798 Float_t effic_all[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
799
800
801 Float_t rindex_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
802
803
804 Float_t absco_alu[14] = { 1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,1e-4,
805 1e-4,1e-4,1e-4,1e-4 };
806 Float_t effic_alu[14] = { 1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1. };
807
808*/
809
810 Int_t *idtmed = fIdtmed->GetArray()-2999;
811
812// TGeant3 *geant3 = (TGeant3*) gMC;
813
814// Parameters related to Quarz (SiO2) :
815
816 Float_t aqua[2], zqua[2], densqua, wmatqua[2];
817 Int_t nlmatqua;
818
819 aqua[0] = 28.09;
820 aqua[1] = 16.;
821 zqua[0] = 14.;
822 zqua[1] = 8.;
823 densqua = 2.64;
824 nlmatqua = -2;
825 wmatqua[0] = 1.;
826 wmatqua[1] = 2.;
827
828// Parameters related to aluminum sheets :
829
830 Float_t aal = 26.98;
831 Float_t zal = 13.00;
832 Float_t densal= 2.7;
833 Float_t radlal= 8.9;
834
835// Parameters related to scintillator CH :
836
837 Float_t ascin[2] = {1.00794,12.011};
838 Float_t zscin[2] = {1.,6.};
839 Float_t wscin[2] = {1.,1.};
840 Float_t denscin = 1.032;
841
842// Definition of materials :
843
844 AliMaterial( 1, "AIR A$", 14.61, 7.3, .001205, 30420., 67500, 0, 0);
845 AliMaterial(11, "AIR I$", 14.61, 7.3, .001205, 30420., 67500, 0, 0);
846 AliMaterial( 2, "CARBON$" , 12.01, 6.0, 2.265, 18.8, 49.9, 0, 0);
847 AliMixture( 3, "QUA", aqua, zqua, densqua, nlmatqua, wmatqua);
848 AliMaterial( 4, "ALUMINIUM1$", 26.98, 13., 2.7, 8.9, 37.2, 0, 0);
849 AliMaterial( 5, "ALUMINIUM2$", aal, zal, densal, radlal, 0, 0, 0);
850
851 AliMixture( 6, "Scintillator$",ascin,zscin,denscin,-2,wscin);
852
853
854 Int_t ISXFLD = gAlice->Field()->Integ();
855 Float_t SXMGMX = gAlice->Field()->Max();
856
857 Float_t tmaxfd, stemax, deemax, epsil, stmin;
858
859 tmaxfd = 10.;
860 stemax = 0.1;
861 deemax = 0.1;
862 epsil = 0.001;
863 stmin = 0.001;
864
865// Active Air :
866 AliMedium(1, "ACTIVE AIR$", 1, 1, ISXFLD, SXMGMX,
867 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
868
869// Inactive air :
870
871 AliMedium(11, "INACTIVE AIR$", 11, 0, ISXFLD, SXMGMX,
872 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
873
874 AliMedium(2, "CARBON$ ", 2, 1, ISXFLD, SXMGMX,
875 tmaxfd, stemax, deemax, epsil, stmin, 0, 0);
876
877 AliMedium(3, "QUARZ$", 3, 1, ISXFLD, SXMGMX,
878 tmaxfd, fMaxStepQua, fMaxDestepQua, epsil, stmin, 0, 0);
879
880 AliMedium(4,"ALUMINUM1$",4, 1, ISXFLD, SXMGMX,
881 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
882
883
884 AliMedium(5,"ALUMINUM2$",5, 1, ISXFLD, SXMGMX,
885 tmaxfd, fMaxStepAlu, fMaxDestepAlu, epsil, stmin, 0, 0);
886
887 AliMedium(6,"SCINTILLATOR$",6, 1, ISXFLD, SXMGMX, 10.0, 0.1, 0.1, 0.003, 0.003, 0, 0);
888
889 gMC->Gstpar(idtmed[3000], "LOSS", 1.); // [3000] = air ACTIF [3010] = air INACTIF
890 gMC->Gstpar(idtmed[3000], "HADR", 1.);
891 gMC->Gstpar(idtmed[3000], "DCAY", 1.);
892 gMC->Gstpar(idtmed[3000], "DRAY", 1.);
893
894 gMC->Gstpar(idtmed[3001], "LOSS", 1.); // [3001] = carbon
895 gMC->Gstpar(idtmed[3001], "HADR", 1.);
896 gMC->Gstpar(idtmed[3001], "DCAY", 1.);
897 gMC->Gstpar(idtmed[3001], "DRAY", 1.);
898
899 gMC->Gstpar(idtmed[3002], "LOSS", 1.); // [3002] = quartz
900 gMC->Gstpar(idtmed[3002], "HADR", 1.);
901 gMC->Gstpar(idtmed[3002], "DCAY", 1.);
902 gMC->Gstpar(idtmed[3002], "DRAY", 1.);
903 gMC->Gstpar(idtmed[3002], "CUTGAM",0.5E-4) ;
904 gMC->Gstpar(idtmed[3002], "CUTELE",1.0E-4) ;
905
906 gMC->Gstpar(idtmed[3003], "LOSS", 1.); // [3003] = normal aluminum
907 gMC->Gstpar(idtmed[3003], "HADR", 1.);
908 gMC->Gstpar(idtmed[3003], "DCAY", 1.);
909 gMC->Gstpar(idtmed[3003], "DRAY", 1.);
910
911 gMC->Gstpar(idtmed[3004], "LOSS", 1.); // [3004] = reflecting aluminum
912 gMC->Gstpar(idtmed[3004], "HADR", 1.);
913 gMC->Gstpar(idtmed[3004], "DCAY", 1.);
914 gMC->Gstpar(idtmed[3004], "DRAY", 1.);
915 gMC->Gstpar(idtmed[3004], "CUTGAM",0.5E-4) ;
916 gMC->Gstpar(idtmed[3004], "CUTELE",1.0E-4) ;
917
918 gMC->Gstpar(idtmed[3005], "LOSS", 1.); // [3005] = scintillator
919 gMC->Gstpar(idtmed[3005], "HADR", 1.);
920 gMC->Gstpar(idtmed[3005], "DCAY", 1.);
921 gMC->Gstpar(idtmed[3005], "DRAY", 1.);
922 gMC->Gstpar(idtmed[3005], "CUTGAM",0.5E-4) ;
923 gMC->Gstpar(idtmed[3005], "CUTELE",1.0E-4) ;
924
925
926// geant3->Gsckov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
927// geant3->Gsckov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
928
929// gMC->SetCerenkov(idtmed[3002], 14, ppckov, absco_quarz, effic_all,rindex_quarz);
930// gMC->SetCerenkov(idtmed[3004], 14, ppckov_alu, absco_alu, effic_alu, rindex_alu);
931
932
933}
934//---------------------------------------------------------------------
935void AliVZEROv2::DrawModule()
936{
937
938// Drawing is done in DrawVZERO.C
939
940 Int_t i;
941
942 printf("\n");
943 for(i=0;i<30;i++) printf("*");
944 printf(" VZERO DrawModule ");
945 for(i=0;i<30;i++) printf("*");
946 printf("\n");
947
948
949}
950
951//-------------------------------------------------------------------
952void AliVZEROv2::Init()
953{
954// Initialises version 1 of the VZERO Detector
955// Just prints an information message
956
957 printf(" VZERO version %d initialized \n",IsVersion());
958
959// gMC->SetMaxStep(fMaxStepAlu);
960// gMC->SetMaxStep(fMaxStepQua);
961
962 AliVZERO::Init();
963
964}
965
966//-------------------------------------------------------------------
967
968void AliVZEROv2::StepManager()
969{
970
971 Int_t copy;
972 static Int_t vol[4];
c288a388 973 static Float_t hits[19];
47d9b1cb 974 static Float_t eloss, tlength;
975
976 TLorentzVector pos;
977 TLorentzVector mom;
978
979 Float_t theta;
980 Float_t phi;
981 Float_t kRaddeg = 180/TMath::Pi();
982 Float_t RingNumber;
983
984 Int_t ipart;
985 Float_t destep, step;
986
987
988// We keep only charged tracks :
989
990 if ( !gMC->TrackCharge() || !gMC->IsTrackAlive() ) return;
991
992
993 vol[0] = gMC->CurrentVolOffID(1, vol[1]);
994 vol[2] = gMC->CurrentVolID(copy);
995 vol[3] = copy;
996
997
998 if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R1") ||
999 gMC->CurrentVolID(copy) == gMC->VolId("V0L1") )
1000 RingNumber = 1.0;
1001 else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R2") ||
1002 gMC->CurrentVolID(copy) == gMC->VolId("V0L2") )
1003 RingNumber = 2.0;
1004 else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R3") ||
1005 gMC->CurrentVolID(copy) == gMC->VolId("V0L3") )
1006 RingNumber = 3.0;
1007 else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R4") ||
1008 gMC->CurrentVolID(copy) == gMC->VolId("V0L4") )
1009 RingNumber = 4.0;
1010 else if ( gMC->CurrentVolID(copy) == gMC->VolId("V0R5") ||
1011 gMC->CurrentVolID(copy) == gMC->VolId("V0L5") ||
1012 gMC->CurrentVolID(copy) == gMC->VolId("V0L6") ||
1013 gMC->CurrentVolID(copy) == gMC->VolId("V0R6") )
1014 RingNumber = 5.0;
1015 else
1016 RingNumber = 0.0;
1017
1018 if ( RingNumber > 0.5 ) {
1019
1020 destep = gMC->Edep();
1021 step = gMC->TrackStep();
1022 eloss += destep;
1023 tlength += step;
1024
1025
1026 if ( gMC->IsTrackEntering() ) {
1027
1028 gMC->TrackPosition(pos);
1029
1030 gMC->TrackMomentum(mom);
1031 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1032 Double_t Pt = TMath::Sqrt(tc);
1033 Double_t Pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
1034 theta = Float_t(TMath::ATan2(Pt,Double_t(mom[2])))*kRaddeg;
1035 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1036
1037 ipart = gMC->TrackPid();
1038
1039 hits[0] = pos[0];
1040 hits[1] = pos[1];
1041 hits[2] = pos[2];
c288a388 1042 hits[3] = Float_t (ipart);
47d9b1cb 1043
1044 hits[4] = gMC->TrackTime();
1045 hits[5] = gMC->TrackCharge();
1046 hits[6] = theta;
1047 hits[7] = phi;
1048 hits[8] = RingNumber;
1049
1050 hits[9] = Pt;
1051 hits[10] = Pmom;
1052 hits[11] = mom[0];
1053 hits[12] = mom[1];
1054 hits[13] = mom[2];
c288a388 1055
5d12ce38 1056 TParticle *par = gAlice->GetMCApp()->Particle(gAlice->GetMCApp()->GetCurrentTrackNumber());
c288a388 1057 hits[14] = par->Vx();
1058 hits[15] = par->Vy();
1059 hits[16] = par->Vz();
1060
47d9b1cb 1061 tlength = 0.0;
1062 eloss = 0.0;
1063
1064 }
1065
1066 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1067
c288a388 1068 hits[17] = eloss;
1069 hits[18] = tlength;
47d9b1cb 1070
5d12ce38 1071 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(), vol, hits);
c288a388 1072
47d9b1cb 1073 tlength = 0.0;
1074 eloss = 0.0;
1075
1076
1077 }
1078 }
1079
1080}
1081
1082//_____________________________________________________________________________
1083void AliVZEROv2::AddHit(Int_t track, Int_t *vol, Float_t *hits)
1084{
1085
1086 // Add a VZERO hit
1087
1088
1089 TClonesArray &lhits = *fHits;
1090 new(lhits[fNhits++]) AliVZEROhit(fIshunt,track,vol,hits);
1091}
1092
1093//---------------------------------------------------------------------
1094void AliVZEROv2::AddDigits(Int_t *tracks, Int_t* digits)
1095{
1096
1097 TClonesArray &ldigits = *fDigits;
1098 new(ldigits[fNdigits++]) AliVZEROdigit(tracks, digits);
1099}
1100
1101//---------------------------------------------------------------------
1102void AliVZEROv2::MakeBranch(Option_t *option)
1103{
1104
1105 // Creates new branches in the current Root Tree
1106
1107
1108 char branchname[10];
1109 sprintf(branchname,"%s",GetName());
1110 printf(" fBufferSize = %d \n",fBufferSize);
1111
660318ca 1112 const char *H = strstr(option,"H");
47d9b1cb 1113
88cb7938 1114 if (fHits && TreeH() && H) {
1115 TreeH()->Branch(branchname,&fHits, fBufferSize);
47d9b1cb 1116 printf("* AliDetector::MakeBranch * Making Branch %s for hits\n",branchname);
1117 }
1118
660318ca 1119 const char *D = strstr(option,"D");
47d9b1cb 1120 //
88cb7938 1121 if (fDigits && fLoader->TreeD() && D) {
1122 fLoader->TreeD()->Branch(branchname,&fDigits, fBufferSize);
47d9b1cb 1123 printf("* AliDetector::MakeBranch * Making Branch %s for digits\n",branchname);
1124 }
1125
1126}