Moving to the new VMC naming convention
[u/mrichter/AliRoot.git] / CRT / AliCRTv0.cxx
CommitLineData
fb7a1f55 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$ */
fb7a1f55 17
18///////////////////////////////////////////////////////////////////////////////
19// //
6e9adb00 20// ALICE Cosmic Ray Trigger //
fb7a1f55 21// //
6e9adb00 22// This class contains the functions for version 0 of the ALICE Cosmic Ray //
778e67bd 23// Trigger. This version will be used to simulation comic rays in alice //
24// with all the detectors. //
fb7a1f55 25//
26// Authors:
27//
28// Arturo Fernandez <afernand@fcfm.buap.mx>
29// Enrique Gamez <egamez@fcfm.buap.mx>
30//
31// Universidad Autonoma de Puebla
32//
33//
34//Begin_Html
35/*
36<img src="picts/AliCRTv0Class.gif">
37</pre>
38<br clear=left>
39<p>The responsible person for this module is
40<a href="mailto:egamez@fcfm.buap.mx">Enrique Gamez</a>.
41</font>
42<pre>
43*/
44//End_Html
45// //
46///////////////////////////////////////////////////////////////////////////////
47
83e6a38b 48#include <Riostream.h>
fb7a1f55 49
778e67bd 50#include <TBRIK.h>
88cb7938 51#include <TGeometry.h>
fb7a1f55 52#include <TLorentzVector.h>
88cb7938 53#include <TNode.h>
54#include <TVirtualMC.h>
fb7a1f55 55
88cb7938 56#include "AliCRTConstants.h"
57#include "AliCRTv0.h"
fb7a1f55 58#include "AliConst.h"
88cb7938 59#include "AliMagF.h"
fb7a1f55 60#include "AliPDG.h"
88cb7938 61#include "AliRun.h"
778e67bd 62
fb7a1f55 63ClassImp(AliCRTv0)
64
65//_____________________________________________________________________________
66AliCRTv0::AliCRTv0() : AliCRT()
67{
68 //
778e67bd 69 // Default constructor for CRT v0
fb7a1f55 70 //
fb7a1f55 71}
72
73//_____________________________________________________________________________
74AliCRTv0::AliCRTv0(const char *name, const char *title)
75 : AliCRT(name,title)
76{
77 //
778e67bd 78 // Standard constructor for CRT v0
fb7a1f55 79 //
80 //Begin_Html
81 /*
82 <img src="picts/AliCRTv0.gif">
83 */
84 //End_Html
85}
86
87//_____________________________________________________________________________
778e67bd 88AliCRTv0::AliCRTv0(const AliCRTv0& crt)
89{
90 //
91 // Copy ctor.
92 //
93 crt.Copy(*this);
94}
95
96//_____________________________________________________________________________
97AliCRTv0& AliCRTv0::operator= (const AliCRTv0& crt)
98{
99 //
100 // Asingment operator.
101 //
102 crt.Copy(*this);
103 return *this;
104}
105
106//_____________________________________________________________________________
fb7a1f55 107void AliCRTv0::BuildGeometry()
108{
778e67bd 109 //
110 // Create the ROOT TNode geometry for the CRT
111 //
112
113 TNode *node, *top;
114
115 const Int_t kColorCRT = kRed;
116
117 // Find the top node alice.
118 top = gAlice->GetGeometry()->GetNode("alice");
119
120 new TBRIK("S_CRT_A", "CRT box", "void",
121 AliCRTConstants::fgActiveAreaLenght/2.,
122 AliCRTConstants::fgActiveAreaHeight/2.,
123 AliCRTConstants::fgActiveAreaWidth/2.);
124
125
126 new TRotMatrix("Left", "Left", 90., 315., 90., 45., 0., 337.5);
127 new TRotMatrix("Right", "Right", 90., 45., 90., 315., 180., 202.5);
128 new TRotMatrix("Up", "Up", 90., 0., 90., 90., 0., 90.);
129 top->cd();
130
131 //
132 // Put 4 modules on the top of the magnet
133 Float_t box = AliCRTConstants::fgCageWidth/2.;
134 top->cd();
135 node = new TNode("upper1", "upper1", "S_CRT_A", 0., 790., 3.*box, "Up");
136 node->SetLineColor(kColorCRT);
137 fNodes->Add(node);
138
139 top->cd();
140 node = new TNode("upper2", "upper2", "S_CRT_A", 0., 790., box, "Up");
141 node->SetLineColor(kColorCRT);
142 fNodes->Add(node);
143
144 top->cd();
145 node = new TNode("upper3", "upper3", "S_CRT_A", 0., 790., -1.*box, "Up");
146 node->SetLineColor(kColorCRT);
147 fNodes->Add(node);
148
149 top->cd();
150 node = new TNode("upper4", "upper4", "S_CRT_A", 0., 790., -3.*box, "Up");
151 node->SetLineColor(kColorCRT);
152 fNodes->Add(node);
153
154
155 // Modules on the left side.
156 Float_t xtragap = 10.;
157 Float_t initXside = (790.+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
158 Float_t initYside = (790.+xtragap)*TMath::Cos(2*22.5*kDegrad);
159 top->cd();
160 node = new TNode("upper5", "upper5", "S_CRT_A", initXside, initYside, 3.*box, "Left");
161 node->SetLineColor(kColorCRT);
162 fNodes->Add(node);
163
164 top->cd();
165 node = new TNode("upper6", "upper6", "S_CRT_A", initXside, initYside, box, "Left");
166 node->SetLineColor(kColorCRT);
167 fNodes->Add(node);
168
169 top->cd();
170 node = new TNode("upper7", "upper7", "S_CRT_A", initXside, initYside, -1.*box, "Left");
171 node->SetLineColor(kColorCRT);
172 fNodes->Add(node);
173
174 top->cd();
175 node = new TNode("upper8", "upper8", "S_CRT_A", initXside, initYside, -3.*box, "Left");
176 node->SetLineColor(kColorCRT);
177 fNodes->Add(node);
178
179
180 // Modules on the right side.
181 top->cd();
182 node = new TNode("upper9", "upper9", "S_CRT_A", -initXside, initYside, 3.*box, "Right");
183 node->SetLineColor(kColorCRT);
184 fNodes->Add(node);
185
186 top->cd();
187 node = new TNode("upper10", "upper10", "S_CRT_A", -initXside, initYside, box, "Right");
188 node->SetLineColor(kColorCRT);
189 fNodes->Add(node);
190
191 top->cd();
192 node = new TNode("upper11","upper11", "S_CRT_A", -initXside, initYside, -1.*box, "Right");
193 node->SetLineColor(kColorCRT);
194 fNodes->Add(node);
195
196 top->cd();
197 node = new TNode("upper12","upper12", "S_CRT_A", -initXside, initYside, -3.*box, "Right");
198 node->SetLineColor(kColorCRT);
199 fNodes->Add(node);
200
fb7a1f55 201
202}
203
204//_____________________________________________________________________________
205void AliCRTv0::CreateGeometry()
206{
207 //
208 // Create geometry for the CRT array
209 //
778e67bd 210 Int_t idrotm[2499]; // The rotation matrix.
211
212 Int_t * idtmed = fIdtmed->GetArray() - 1099 ;
213
214 //
215 // Molasse
216 CreateMolasse();
217
218 //
219 // Scintillators
220
221 Float_t box[3];
222 box[0] = AliCRTConstants::fgCageLenght/2.; // Half Length of the box along the X axis, cm.
223 box[1] = AliCRTConstants::fgCageHeight/2.; // Half Length of the box along the Y axis, cm.
224 box[2] = AliCRTConstants::fgCageWidth/2.; // Half Length of the box along the Z axis, cm.
225
226
227 // Define the Scintillators. as a big box.
228 Float_t scint[3];
229 scint[0] = AliCRTConstants::fgActiveAreaLenght/2.; // Half Length in X
230 scint[1] = AliCRTConstants::fgActiveAreaHeight/2.; // Half Length in Y
231 scint[2] = AliCRTConstants::fgActiveAreaWidth/2.; // Half Length in Z
232 gMC->Gsvolu("CRT1", "BOX ", idtmed[1112], scint, 3); // Scintillators
233
234 //
235 // Define the coordinates where the draw will begin.
236 //
237
238 //
239 // -- X axis.
240 // we'll start dawing from the center.
241 Float_t initX = 0.;
242
243 //
244 // -- Y axis
245 Float_t gapY = 30.; // 30 cms. above the barrel.
246 // For the height we staimate the from the center of the ceiling,
247 // if were a cilinder, must be about 280cm.
248 Float_t barrel = 790.; // Barrel radius.
249 Float_t height = barrel + gapY - 30.;
250 Float_t initY = height;
251
252 //
253 // -- Z axis.
254 // we'll start dawing from the center.
255
256 //
257 // Put 4 modules on the top of the magnet
258 Int_t step = 4;
259 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
260 gMC->Gspos("CRT1", i, "ALIC", initX, initY, (i-step)*box[2], 0, "ONLY");
261 step--;
262 }
263
264 // Modules on the barrel sides.
265 // Because the openenig angle for each face is 22.5, and if we want to
266 // put the modules right in the middle
267 Float_t xtragap = 10.;
268 Float_t initXside = (height+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
269 Float_t initYside = (height+xtragap)*TMath::Cos(2*22.5*kDegrad);
270
271 // Put 4 modules on the left side of the magnet
272 // The rotation matrix parameters, for the left side.
273 AliMatrix(idrotm[232], 90., 315., 90., 45., 0., 337.5);
274 Int_t stepl = 4;
275 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
276 gMC->Gspos("CRT1", i+4, "ALIC", initXside, initYside, (i-stepl)*box[2],
277 idrotm[232], "ONLY");
278 stepl--;
279 }
280
281 // Put 4 modules on the right side of the magnet
282 // The rotation matrix parameters for the right side.
283 AliMatrix(idrotm[231], 90., 45., 90., 315., 180., 202.5);
284 Int_t stepr = 4;
285 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
286 gMC->Gspos("CRT1", i+8, "ALIC", -initXside, initYside, (i-stepr)*box[2],
287 idrotm[231], "ONLY");
288 stepr--;
289 }
fb7a1f55 290
778e67bd 291 // Divide the modules in 2 planes.
292 //gMC->Gsdvn("CRT2", "CRT1", 2, 2);
293 // Now divide each plane in 8 palettes
294 //gMC->Gsdvn("CRT3", "CRT2", 8, 3);
295
296}
297
298//_____________________________________________________________________________
299void AliCRTv0::CreateMolasse()
300{
fb7a1f55 301 Int_t idrotm[2499]; // The rotation matrix.
302
fb7a1f55 303 Int_t * idtmed = fIdtmed->GetArray() - 1099 ;
304
6e9adb00 305 //
306 // Molasse
307 //
308
309 // Exactly above the hall
310 Float_t tspar[5];
311 tspar[0] = 1170.;
312 tspar[1] = 1170. + 375.;
313 tspar[2] = (1900.+1150.)/2.+100.;
314 tspar[3] = 0.;
315 tspar[4] = 180.;
7cedada3 316 gMC->Gsvolu("CMO1", "TUBS", idtmed[1123], tspar, 5);
6e9adb00 317 gMC->Gspos("CMO1", 1, "ALIC", 0., 500., 1900.-tspar[2]+400., 0, "MANY");
318
319 Float_t tbox[3];
320 tbox[0] = 1250.;
321 tbox[1] = (4420. - 1670.)/2.;
322 tbox[2] = (1900.+1150.)/2. + 200.;
7cedada3 323 gMC->Gsvolu("CM12", "BOX", idtmed[1123], tbox, 3);
6e9adb00 324 gMC->Gspos("CM12", 1, "ALIC", 0., 4420. -tbox[1], 1900.-tbox[2]+400., 0, "MANY");
325
326 AliMatrix(idrotm[2003], 0., 0., 90., 0., 90., 90.);
327 // Along the PM25
328 Float_t tube[3];
329 tube[0] = 455. + 100.;
330 tube[1] = 555. + 375.;
331 tube[2] = (5150. - 1166.)/2.;
7cedada3 332 gMC->Gsvolu("CMO2", "TUBE", idtmed[1123], tube, 3);
6e9adb00 333 gMC->Gspos("CMO2", 1, "ALIC", -2100., 4420.-tube[2], 0., idrotm[2003], "MANY");
334
335
336 // Along the PGC2
337 tube[0] = 650.;
338 tube[1] = 2987.7;
339 tube[2] = (5150. - 690.)/2.;
7cedada3 340 gMC->Gsvolu("CMO3", "TUBE", idtmed[1123], tube, 3);
6e9adb00 341 gMC->Gspos("CMO3", 1, "ALIC", 375., 4420.-tube[2], 1900.+2987.7, idrotm[2003], "MANY");
342 // Behind the PGC2 up to the end of the M. volume.
343 tbox[0] = 12073.;
344 tbox[1] = 2575. + 95.;
778e67bd 345 tbox[2] = (12073. - 1900.-2987.7-650.)/2.;
7cedada3 346 gMC->Gsvolu("CMO7", "BOX", idtmed[1123], tbox, 3);
6e9adb00 347 gMC->Gspos("CMO7", 1, "ALIC", 0., 4420.-tbox[1], 1900.+2987.7+650.+tbox[2], 0, "MANY");
348
349 // Along the PX24 , upper part.
350 tube[0] = 1250.;
351 tube[1] = 2300;
352 tube[2] = 2575. - 1300. + 95.;
7cedada3 353 gMC->Gsvolu("CMO4", "TUBE", idtmed[1123], tube, 3);
6e9adb00 354 gMC->Gspos("CMO4", 1, "ALIC", 0., 404.+1300.+tube[2], -2300., idrotm[2003], "MANY");
355
356 // Along the PX24 , lower part
357 tspar[0] = 1250.;
358 tspar[1] = 2300;
359 tspar[2] = 1300.;
360 tspar[3] = kRaddeg*TMath::ASin(1070./1150.);
361 tspar[4] = 360. - tspar[3];
7cedada3 362 gMC->Gsvolu("CMO5", "TUBS", idtmed[1123], tspar, 5);
6e9adb00 363 gMC->Gspos("CMO5", 1, "ALIC", 0., 404., -2300., idrotm[2003], "MANY");
364 // behind the PX24
365 tbox[0] = 12073.;
366 tbox[1] = 2575. + 95.;
367 tbox[2] = 8523./2.;
7cedada3 368 gMC->Gsvolu("CMO6", "BOX", idtmed[1123], tbox, 3);
6e9adb00 369 gMC->Gspos("CMO6", 1, "ALIC", 0., 4420.-tbox[1], -3550.-tbox[2], 0, "MANY");
370
371
372 // On the right side of th hall
373 tbox[0] = (12073. - 1250.)/2.;
374 tbox[1] = 2575. + 95.;
375 tbox[2] = (8437.7+650.)/2.;
7cedada3 376 gMC->Gsvolu("CMO8", "BOX", idtmed[1123], tbox, 3);
6e9adb00 377 gMC->Gspos("CMO8", 1, "ALIC", 1250.+tbox[0], 4420.-tbox[1], -3550.+tbox[2], 0, "MANY");
378
379 // on the left side of the hall, behind
380 tbox[0] = (12073. - 2755.)/2.;
381 tbox[1] = 2575. + 95.;
382 tbox[2] = (8437.7+650.)/2.;
7cedada3 383 gMC->Gsvolu("CMO9", "BOX", idtmed[1123], tbox, 3);
6e9adb00 384 gMC->Gspos("CMO9", 1, "ALIC", -2755.-tbox[0], 4420.-tbox[1], -3550.+tbox[2], 0, "MANY");
385
386
387 // Molasse betwen the PX24 & PM25 on the left side.
388 tbox[0] = (2755. - 1250.)/2.;
389 tbox[1] = 2575. + 95.;
390 tbox[2] = (3550. - 555.)/2.;
7cedada3 391 gMC->Gsvolu("CM10", "BOX", idtmed[1123], tbox, 3);
6e9adb00 392 gMC->Gspos("CM10", 1, "ALIC", -1250.-tbox[0], 4420.-tbox[1], -tbox[2]-555., 0, "MANY");
393
394
395 // Molasse betwen the PGC2 & PM25 on the left side.
396 tbox[0] = (2755. - 1250.)/2.;
397 tbox[1] = 2575. + 95.;
398 tbox[2] = (1900.+2987.7 - 555. + 650.)/2.;
7cedada3 399 gMC->Gsvolu("CM11", "BOX", idtmed[1123], tbox, 3);
6e9adb00 400 gMC->Gspos("CM11", 1, "ALIC", -1250.-tbox[0], 4420.-tbox[1], 555.+tbox[2], 0, "MANY");
401
fb7a1f55 402
778e67bd 403}
404
405//_____________________________________________________________________________
406void AliCRTv0::CreateShafts()
407{
408 //
409 //
410 //
411 Int_t idrotm[2499]; // The rotation matrix.
fb7a1f55 412
778e67bd 413 Int_t * idtmed = fIdtmed->GetArray() - 1099 ;
fb7a1f55 414
778e67bd 415 // HAll ceiling
416 Float_t ptubs[5];
417 ptubs[0] = 1070.;
418 ptubs[1] = 1170.;
419 ptubs[2] = 1900.;
420 ptubs[3] = 0.;
421 ptubs[4] = 180.;
422 gMC->Gsvolu("CHC1", "TUBS", idtmed[1116], ptubs, 5);
423 gMC->Gspos("CHC1", 1, "ALIC", 0., 500., 0., 0, "ONLY");
fb7a1f55 424
425
426 //
778e67bd 427 // Acces shafts
fb7a1f55 428 //
778e67bd 429 AliMatrix(idrotm[2001], 0., 0., 90., 0., 90., 90.);
430
431 // PX24
432 ptubs[0] = 1150.;
433 ptubs[1] = 1250.;
434 ptubs[2] = 1300.;
435 ptubs[3] = kRaddeg*TMath::ASin(1070./ptubs[0]);
436 ptubs[4] = 360 - ptubs[3];
437 gMC->Gsvolu("CSF1", "TUBS", idtmed[1116], ptubs, 5);
438 gMC->Gspos("CSF1", 1, "ALIC", 0., 404., -2300., idrotm[2001], "MANY");
439
440 Float_t ptube[3];
441 ptube[0] = ptubs[0];
442 ptube[1] = ptubs[1];
443 ptube[2] = 2575. - ptubs[2] + 95.;
444 gMC->Gsvolu("CSF2", "TUBE", idtmed[1116], ptube, 3);
445 gMC->Gspos("CSF2", 1, "ALIC", 0., 404.+ptubs[2]+ptube[2], -2300., idrotm[2001], "MANY");
446
447 // Concrete walls along the shaft
448 Float_t pbox[3];
449 pbox[0] = 585./2.;
450 pbox[1] = 2575. + 95.;
451 pbox[2] = 20.;
452 gMC->Gsvolu("CSW1", "BOX", idtmed[1116], pbox, 3);
453 gMC->Gspos("CSW1", 1, "ALIC", -290-pbox[0], 404.-1300.+pbox[1], -3450.+210.*2, 0, "MANY");
454
fb7a1f55 455 //
778e67bd 456 pbox[0] = 750./2.;
457 pbox[1] = 2575. + 95.;
458 pbox[2] = 20.;
459 gMC->Gsvolu("CSW3", "BOX", idtmed[1116], pbox, 3);
460 gMC->Gspos("CSW3", 1, "ALIC", 420.-290.+pbox[0], 404.-1300.+pbox[1], -3450.+210.*2, 0, "MANY");
461
fb7a1f55 462 //
778e67bd 463 pbox[0] = 60.;
464 pbox[1] = 2575. + 95.;
465 pbox[2] = 210.;
466 gMC->Gsvolu("CSW2", "BOX", idtmed[1116], pbox, 3);
467 gMC->Gspos("CSW2", 1, "ALIC", -290-pbox[0], 404.-1300.+pbox[1], -3450.+pbox[2], 0, "MANY");
468 gMC->Gspos("CSW2", 2, "ALIC", 420.-290.+pbox[0], 404.-1300.+pbox[1], -3450.+pbox[2], 0, "MANY");
469
470
471 //
472 pbox[0] = 1000.;
473 pbox[1] = 80.;
474 pbox[2] = 200.;
475 gMC->Gsvolu("CSP1", "BOX", idtmed[1116], pbox, 3);
476 gMC->Gspos("CSP1", 1, "ALIC", 0., 2600.-700., -1150-pbox[2], 0, "MANY");
477
fb7a1f55 478 //
778e67bd 479 pbox[0] = 340.8;
480 pbox[1] = 300./2.;
481 pbox[2] = 460./2.;
482 gMC->Gsvolu("CSP2", "BOX", idtmed[1116], pbox, 3);
483 gMC->Gspos("CSP2", 1, "ALIC", 0., 2950.-700., -3450+pbox[2], 0, "MANY");
484
fb7a1f55 485 //
778e67bd 486 pbox[0] = 600.;
487 pbox[1] = 150.;
488 pbox[2] = 75.;
489 gMC->Gsvolu("CSP3", "BOX", idtmed[1116], pbox, 3);
490 gMC->Gspos("CSP3", 1, "ALIC", 0., 2950.-700., -1150.-210.-pbox[2], 0, "MANY");
491
492 //
493 pbox[0] = 600.;
494 pbox[1] = 250.;
495 pbox[2] = 38.;
496 gMC->Gsvolu("CSP4", "BOX", idtmed[1116], pbox, 3);
497 gMC->Gspos("CSP4", 1, "ALIC", 0., 2950.-700.+155.+pbox[1], -1150.-210.-pbox[2], 0, "MANY");
498
499
500 // Shielding plug
501 pbox[0] = 850.;
502 pbox[1] = 90.;
503 pbox[2] = 720.;
504 gMC->Gsvolu("CSP5", "BOX", idtmed[1116], pbox, 3);
505 gMC->Gspos("CSP5", 1, "ALIC", 0., 2950.-700., -3450.+460.+pbox[2], 0, "MANY");
506
507 //
508 pbox[0] = 80.;
509 pbox[1] = 150.;
510 pbox[2] = 720.;
511 gMC->Gsvolu("CSP6", "BOX", idtmed[1116], pbox, 3);
512 gMC->Gspos("CSP6", 1, "ALIC", 1150.-600., 2950.-700., -3450.+460.+pbox[2], 0, "MANY");
513 gMC->Gspos("CSP6", 2, "ALIC", -1150.+600., 2950.-700., -3450.+460.+pbox[2], 0, "MANY");
514
515
516 //
517 pbox[0] = 130.;
518 pbox[1] = 60.;
519 pbox[2] = 750.;
520 gMC->Gsvolu("CSP7", "BOX", idtmed[1116], pbox, 3);
521 gMC->Gspos("CSP7", 1, "ALIC", 850.+pbox[0], 2950.-700.+100., -3450.+460.+pbox[2], 0, "MANY");
522 gMC->Gspos("CSP7", 2, "ALIC", -850.-pbox[0], 2950.-700.+100., -3450.+460.+pbox[2], 0, "MANY");
523
524
525 // PM25 Acces Shaft
526 ptube[0] = 910./2.;
527 ptube[1] = ptube[0] + 100.;
528 ptube[2] = (5150. - 1166.)/2.;
529 gMC->Gsvolu("CSF3", "TUBE", idtmed[1116], ptube, 3);
530 gMC->Gspos("CSF3", 1, "ALIC", -2100., AliCRTConstants::fgDepth-ptube[2], 0., idrotm[2001], "MANY");
531
532 // PGC2 Access Shaft
533 ptube[0] = 1100./2.;
534 ptube[1] = ptube[0] + 100.;
535 ptube[2] = (5150. - 690.)/2.;
536 gMC->Gsvolu("CSF4", "TUBE", idtmed[1116], ptube, 3);
537 gMC->Gspos("CSF4", 1, "ALIC", 375., AliCRTConstants::fgDepth-ptube[2], 1900.+2987.7, idrotm[2001], "MANY");
fb7a1f55 538
539}
540
541//_____________________________________________________________________________
778e67bd 542
fb7a1f55 543void AliCRTv0::CreateMaterials()
544{
fb7a1f55 545 // Use the standard materials.
778e67bd 546 AliCRT::CreateMaterials();
fb7a1f55 547}
548
549
550//_____________________________________________________________________________
551void AliCRTv0::DrawDetector()
552{
fb7a1f55 553 //
554 // Draw a shaded view of the L3 magnet
555 //
556 cout << "AliCRTv0::DrawModule() : Drawing the module" << endl;
557
558 gMC->Gsatt("*", "seen", -1);
559 gMC->Gsatt("alic", "seen", 0);
560
6e9adb00 561 gMC->Gsatt("ALIC","seen",0);
fb7a1f55 562 gMC->Gsatt("L3MO","seen",1); // L3 Magnet
6e9adb00 563 gMC->Gsatt("CRT1","seen",1); // Scintillators
564
565 // Draw the molasse volumes
566 gMC->Gsatt("CMO1","seen",0); // Exactly above the HALL
567 gMC->Gsatt("CMO2","seen",0); // Molasse, along the PM25
568 gMC->Gsatt("CMO3","seen",0); // molasse along the PGC2
569 gMC->Gsatt("CMO4","seen",0); // Molasse, behind the PX24 upper part
570 gMC->Gsatt("CMO5","seen",0); // molasse behind px24, lower part
571 gMC->Gsatt("CMO6","seen",0); // behind the PX24
572 gMC->Gsatt("CMO7","seen",0); // behind the PGC2
573 gMC->Gsatt("CMO8","seen",0); // on the right side.
574 gMC->Gsatt("CMO9","seen",0); // on the left side.
575 gMC->Gsatt("CM10","seen",0); // betwen PX24 & PM25.
576 gMC->Gsatt("CM11","seen",0); // betwen PGC2 & PM25.
577 gMC->Gsatt("CM12","seen",0); // box above the hall.
fb7a1f55 578
579 gMC->Gdopt("hide", "on");
580 gMC->Gdopt("edge","off");
581 gMC->Gdopt("shad", "on");
582 gMC->Gsatt("*", "fill", 7);
583 gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
584 gMC->DefaultRange();
585 gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
586 gMC->Gdhead(1111, "View of CRT(ACORDE)");
587 gMC->Gdman(18, 4, "MAN");
588
589
590}
591
592//_____________________________________________________________________________
593void AliCRTv0::Init()
594{
595 //
596 // Initialise L3 magnet after it has been built
597 Int_t i;
598 //
599 if(fDebug) {
600 printf("\n%s: ",ClassName());
601 for(i=0;i<35;i++) printf("*");
602 printf(" CRTv0_INIT ");
603 for(i=0;i<35;i++) printf("*");
604 printf("\n%s: ",ClassName());
605 //
606 // Here the CRTv0 initialisation code (if any!)
607 for(i=0;i<80;i++) printf("*");
608 printf("\n");
609 }
610
611}
612
613//_____________________________________________________________________________
614void AliCRTv0::StepManager()
615{
616 //
67721dc4 617 // Called for every step in the Cosmic Ray Trigger
fb7a1f55 618 //
67721dc4 619 static Int_t vol[5];
778e67bd 620 Int_t copy;
67721dc4 621 Int_t ipart;
622 TLorentzVector pos;
623 TLorentzVector mom;
624
e760b04a 625 static Float_t hits[14];
642f15cf 626 Int_t tracknumber = gAlice->GetCurrentTrackNumber();
67721dc4 627
778e67bd 628 static Float_t eloss;
629 static Float_t tlength;
630 Float_t theta;
631 Float_t phi;
67721dc4 632
778e67bd 633 if ( !gMC->IsTrackAlive() ) return;
bd1047f8 634
778e67bd 635 if (gMC->IsNewTrack()) {
636 // Reset the deposited energy
637 eloss = 0.;
638 }
639
640 eloss += gMC->Edep(); // Store the energy loss along the trajectory.
641 tlength += gMC->TrackStep();
bd1047f8 642
778e67bd 643 if (gMC->IsTrackEntering() && (strcmp(gMC->CurrentVolName(),"CM12") == 0) ) {
67721dc4 644
778e67bd 645 // Get current particle id (ipart), track position (pos) and momentum (mom)
646 gMC->TrackPosition(pos);
647 gMC->TrackMomentum(mom);
648 ipart = gMC->TrackPid();
649
650 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
651 Double_t pt = TMath::Sqrt(tc);
652 theta = Float_t(TMath::ATan2(pt,Double_t(mom[2])))*kRaddeg;
653 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
654
655
656 vol[0] = gMC->CurrentVolOffID(1, vol[1]);
657 vol[2] = gMC->CurrentVolID(copy);
658 vol[3] = copy;
659
67721dc4 660 hits[0] = 0.f; // (fnmou)
661 hits[1] = (Float_t)ipart; // (fId)
662
663 hits[2] = pos[0]; // X coordinate (fX)
664 hits[3] = pos[1]; // Y coordinate (fY)
665 hits[4] = pos[2]; // Z coordinate (fZ)
666 hits[5] = mom[0]; // Px (fpxug)
667 hits[6] = mom[1]; // Py (fpyug)
668 hits[7] = mom[2]; // Pz (fpzug)
669
670 hits[8] = gMC->GetMedium();//layer(flay)
778e67bd 671 hits[9] = theta; // arrival angle
672 hits[10] = phi; //
673 hits[11] = eloss; // Energy loss
674 hits[12] = tlength; // Trajectory lenght
675 hits[13] = (Float_t)tracknumber;
67721dc4 676
642f15cf 677 AddHit(gAlice->GetCurrentTrackNumber(),vol, hits);
778e67bd 678
67721dc4 679 }
680
681}
778e67bd 682