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