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