Old style include files needed on HP (aCC)
[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$
b73f53b3 18Revision 1.1 2002/06/16 17:08:19 hristov
19First version of CRT
20
fb7a1f55 21
22*/
23
24///////////////////////////////////////////////////////////////////////////////
25// //
26// Alice COsmic Ray Trigger //
27// //
28// This class contains the functions for version 0 of the Cosmic Rays ALICE //
29// detector. //
30//
31// Authors:
32//
33// Arturo Fernandez <afernand@fcfm.buap.mx>
34// Enrique Gamez <egamez@fcfm.buap.mx>
35//
36// Universidad Autonoma de Puebla
37//
38//
39//Begin_Html
40/*
41<img src="picts/AliCRTv0Class.gif">
42</pre>
43<br clear=left>
44<p>The responsible person for this module is
45<a href="mailto:egamez@fcfm.buap.mx">Enrique Gamez</a>.
46</font>
47<pre>
48*/
49//End_Html
50// //
51///////////////////////////////////////////////////////////////////////////////
52
b73f53b3 53#include <iostream.h>
fb7a1f55 54
55#include <TMath.h>
56#include <TGeometry.h>
57#include <TTUBE.h>
58#include <TNode.h>
59#include <TLorentzVector.h>
60
61#include "AliCRTv0.h"
62#include "AliCRTConstants.h"
63
64#include "AliRun.h"
65#include "AliMC.h"
66#include "AliMagF.h"
67#include "AliConst.h"
68#include "AliPDG.h"
69
70ClassImp(AliCRTv0)
71
72//_____________________________________________________________________________
73AliCRTv0::AliCRTv0() : AliCRT()
74{
75 //
76 // Default constructor for CRT
77 //
78 fMucur = 0;
79}
80
81//_____________________________________________________________________________
82AliCRTv0::AliCRTv0(const char *name, const char *title)
83 : AliCRT(name,title)
84{
85 //
86 // Standard constructor for CRT
87 //
88 //Begin_Html
89 /*
90 <img src="picts/AliCRTv0.gif">
91 */
92 //End_Html
93}
94
95//_____________________________________________________________________________
96void AliCRTv0::BuildGeometry()
97{
98
99}
100
101//_____________________________________________________________________________
102void AliCRTv0::CreateGeometry()
103{
104 //
105 // Create geometry for the CRT array
106 //
107
108 //
109 //-- Create the hall
110 CreateHall();
111
112 Int_t idrotm[2499]; // The rotation matrix.
113
114 // idtmed[1099->1198] equivalent to fIdtmed[0->100]
115 Int_t * idtmed = fIdtmed->GetArray() - 1099 ;
116
117 // In order to generate the more correctly the modules (more datails)
118 // we will create a box (air box) as a (sub)mother volume.
119 // Inside this box we'll put the scintillator tiles, the PMTs the frame
120 // and, maybe, some other things.
121
122 Float_t box[3];
123 box[0] = AliCRTConstants::fgCageLenght/2.; // Half Length of the box along the X axis, cm.
124 box[1] = AliCRTConstants::fgCageHeight/2.; // Half Length of the box along the Y axis, cm.
125 box[2] = AliCRTConstants::fgCageWidth/2.; // Half Length of the box along the Z axis, cm.
126
127
128 // Define the Scintillators. as a big box.
129 Float_t scint[3];
130 scint[0] = AliCRTConstants::fgActiveAreaLenght/2.; // Half Length in X
131 scint[1] = AliCRTConstants::fgActiveAreaHeight/2.; // Half Length in Y
132 scint[2] = AliCRTConstants::fgActiveAreaWidth/2.; // Half Length in Z
133 gMC->Gsvolu("CRT1", "BOX ", idtmed[1102], scint, 3); // Scintillators
134 // Divide the modules in 2 planes.
135 //gMC->Gsdvn("CRT2", "CRT1", 2, 2);
136 // Now divide each plane in 8 palettes
137 //gMC->Gsdvn("CRT3", "CRT1", 8, 3);
138
139
140 //
141 // Define the coordinates where the draw will begin.
142 //
143
144 //
145 // -- X axis.
146 // we'll start dawing from the center.
147 Float_t initX = 0.;
148
149 //
150 // -- Y axis
151 Float_t gapY = 30.; // 30 cms. above the barrel.
152 // For the height we staimate the from the center of the ceiling,
153 // if were a cilinder, must be about 280cm.
154 Float_t barrel = 790.; // Barrel radius.
155 Float_t height = barrel + gapY - 30.;
156 Float_t initY = height;
157
158 //
159 // -- Z axis.
160 // we'll start dawing from the center.
161
162 //
163 // Put 4 modules on the top of the magnet
164 Int_t step = 4;
165 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
166 gMC->Gspos("CRT1", i, "CRTA", initX, initY, (i-step)*box[2], 0, "ONLY");
167 step--;
168 }
169
170 // Modules on the barrel sides.
171 // Because the openenig angle for each face is 22.5, and if we want to
172 // put the modules right in the middle
173 Float_t xtragap = 10.;
174 Float_t initXside = (height+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
175 Float_t initYside = (height+xtragap)*TMath::Cos(2*22.5*kDegrad);
176
177 // Put 4 modules on the left side of the magnet
178 // The rotation matrix parameters, for the left side.
179 AliMatrix(idrotm[232], 90., 315., 90., 45., 0., 337.5);
180 Int_t stepl = 4;
181 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
182 gMC->Gspos("CRT1", i+4, "CRTA", initXside, initYside, (i-stepl)*box[2],
183 idrotm[232], "ONLY");
184 stepl--;
185 }
186
187 // Put 4 modules on the right side of the magnet
188 // The rotation matrix parameters for the right side.
189 AliMatrix(idrotm[231], 90., 45., 90., 315., 180., 202.5);
190 Int_t stepr = 4;
191 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
192 gMC->Gspos("CRT1", i+8, "CRTA", -initXside, initYside, (i-stepr)*box[2],
193 idrotm[231], "ONLY");
194 stepr--;
195 }
196
197}
198
199//_____________________________________________________________________________
200void AliCRTv0::CreateHall()
201{
202
203 Float_t r2;
204 Float_t phid, phim, pbox[3], h, r, tspar[5];
205 Float_t w1, dh, am, bm, dl,cm, hm, dr, dx, xl;
206 Int_t idrotm[1999];
207 Float_t trdpar[4], trapar[11];
208 Float_t phi;
209
210 Int_t *idtmed = fIdtmed->GetArray()-1899;
211
212 // Because the BODY, was "filled with vaccum", we're goin to superimpose
213 // a volume with molasse, then using the boolenaq operations with volumes
214 // we are going the replace, with air, the part closed by the hall walls
215
216 // For the moment, just use the simple mother volume ...
217 Float_t mola[3];
218 mola[0] = 2000.;
219 mola[1] = 2000.;
220 mola[2] = 3000.;
221 gMC->Gsvolu("CRTA", "BOX", idtmed[1905], mola, 3);
222 gMC->Gspos("CRTA", 1, "ALIC", 0., 0., 0., 0, "MANY");
223
224 // Now make a cilinder with the size of the hall (raughtly)
225 // and fill it with air.
226 Float_t hall[3];
227 hall[0] = 0.; // Inner radius
228 hall[1] = 1170.; // Outer radius
229 hall[2] = 2625. + 200.; // Hall lenght
230 gMC->Gsvolu("CRTB", "TUBE", idtmed[1914], hall, 3);
231 // perform the substraction SMOL - SALL, asigning SMOL as MANY and
232 // SALL as ONLY.
233 gMC->Gspos("CRTB", 1, "CRTA", 0., 500., -2*375., 0, "ONLY");
234
235 // RB24/26 TUNNEL FLOOR
236
237 r = 220.;
238 h = 140.;
239 phi = TMath::ACos(h / r);
240 xl = r * TMath::Sin(phi);
241 dr = 100.;
242 dh = dr * TMath::Cos(phi);
243 dl = dr * TMath::Sin(phi);
244
245 AliMatrix(idrotm[1900], 90., 0., 0., 0., 90., 90.);
246 AliMatrix(idrotm[1901], 270., 0., 90., 90., 0., 0.);
247 // END WALL
248
249 pbox[0] = 1200.;
250 pbox[1] = 1300.;
251 pbox[2] = 60.;
252 gMC->Gsvolu("CRTC", "BOX ", idtmed[1956], pbox, 3);
253 gMC->Gspos("CRTC", 1, "CRTA", 0., 404., 1960, 0, "ONLY");
254
255 // hall floor, the interior part (left)
256
257 phid = 16.197;
258 trdpar[0] = 700.;
259 trdpar[1] = TMath::Tan(phid * kDegrad) * 190. + 700.;
260 trdpar[2] = 550.;
261 trdpar[3] = 95.;
262 gMC->Gsvolu("CRTD", "TRD1", idtmed[1956], trdpar, 4);
263 gMC->Gspos("CRTD", 1, "CRTA", 0., -801., 1350., idrotm[1900], "ONLY");
264
265 // hall floor, the outside part
266
267 phid = 16.197;
268 trdpar[0] = 700.;
269 trdpar[1] = TMath::Tan(phid * kDegrad) * 190. + 700.;
270 trdpar[2] = 1325.;
271 trdpar[3] = 95.;
272 gMC->Gsvolu("CRTE", "TRD1", idtmed[1956], trdpar, 4);
273 gMC->Gspos("CRTE", 2, "CRTA", 0., -801., -2125., idrotm[1900], "ONLY");
274
275 // hall side walls
276
277 // Interior walls
278 trapar[0] = 550.;
279 trapar[1] = 0.;
280 trapar[2] = 0.;
281 trapar[3] = 1273.78/2;
282 trapar[4] = 235.;
283 trapar[5] = 50.;
284 trapar[6] = TMath::ATan((trapar[4] - trapar[5]) / 2. / trapar[3]) * kRaddeg;
285 trapar[7] = trapar[3];
286 trapar[8] = trapar[4];
287 trapar[9] = trapar[5];
288 trapar[10] = trapar[6];
289 dx = trapar[4] * 1.5 + 700. - trapar[5] * .5;
290 gMC->Gsvolu("CRTF", "TRAP", idtmed[1956], trapar, 11);// interior wall
291 gMC->Gspos("CRTF", 1, "CRTA", dx, -896+trapar[3], 1350., 0, "ONLY");
292 gMC->Gspos("CRTF", 2, "CRTA",-dx, -896+trapar[3], 1350., idrotm[1901], "ONLY");
293
294 // Exterior walls
295 Float_t trapare[11];
296 trapare[0] = 275.;
297 for ( Int_t i = 1 ; i <= 10 ; i++ ) {
298 trapare[i] = trapar[i];
299 }
300 gMC->Gsvolu("CRTG", "TRAP", idtmed[1956], trapare, 11);// exterior wall
301 gMC->Gspos("CRTG", 1, "CRTA", dx, -896+trapar[3], -1075., 0, "ONLY");
302 gMC->Gspos("CRTG", 2, "CRTA",-dx, -896+trapar[3], -1075., idrotm[1901], "ONLY");
303
304 pbox[0] = 50.;
305 pbox[1] = (500. - (trapar[3] * 2. - 896.)) / 2.;
306 pbox[2] = 1625.;
307 gMC->Gsvolu("CRTH", "BOX ", idtmed[1956], pbox, 3);
308 gMC->Gspos("CRTH", 1, "CRTA", 1120., 500-pbox[1], 275., 0, "ONLY");
309 gMC->Gspos("CRTH", 2, "CRTA", -1120., 500-pbox[1], 275., 0, "ONLY");
310
311 // slanted wall close to L3 magnet
312
313 phim = 45.;
314 hm = 790.;
315 //rm = hm / TMath::Cos(phim / 2. * kDegrad);
316 am = hm * TMath::Tan(phim / 2. * kDegrad);
317 bm = (hm + 76.) / hm * am;
318 cm = bm * 2. / TMath::Sqrt(2.);
319 trapar[0] = 800.;
320 trapar[1] = 0.;
321 trapar[2] = 0.;
322 trapar[3] = (1273.78 - cm) / 2.;
323 trapar[4] = 235. - cm * TMath::Tan(phid * kDegrad) / 2.;
324 trapar[5] = 50.;
325 trapar[6] = TMath::ATan((trapar[4] - trapar[5]) / 2. / trapar[3]) * kRaddeg;
326 trapar[7] = trapar[3];
327 trapar[8] = trapar[4];
328 trapar[9] = trapar[5];
329 trapar[10] = trapar[6];
330 w1 = trapar[4];
331 dx = cm*TMath::Tan(phid * kDegrad) + 700. + trapar[4] * 1.5 - trapar[5] * .5;
332 gMC->Gsvolu("CRTI", "TRAP", idtmed[1956], trapar, 11);
333 r2 = cm - 896. + trapar[3];
334 gMC->Gspos("CRTI", 1, "CRTA", dx, r2, 0., 0, "ONLY");
335 gMC->Gspos("CRTI", 2, "CRTA",-dx, r2, 0., idrotm[1901], "ONLY");
336 trapar[3] = cm / 2.;
337 trapar[4] = w1 + cm / 2.;
338 trapar[5] = w1;
339 trapar[6] = TMath::ATan(.5) * kRaddeg;
340 trapar[7] = trapar[3];
341 trapar[8] = trapar[4];
342 trapar[9] = trapar[5];
343 trapar[10] = trapar[6];
344 dx = 1170. - trapar[4] * .5 - trapar[5] * .5;
345 gMC->Gsvolu("CRTJ", "TRAP", idtmed[1956], trapar, 11);
346 r2 = trapar[3] - 896.;
347 gMC->Gspos("CRTJ", 1, "CRTA", dx, r2, 0., 0, "ONLY");
348 gMC->Gspos("CRTJ", 2, "CRTA",-dx, r2, 0., idrotm[1901], "ONLY");
349
350 tspar[0] = 1070.;
351 tspar[1] = 1170.;
352 tspar[2] = pbox[2];
353 tspar[3] = 0.;
354 tspar[4] = 180.;
355 gMC->Gsvolu("CRTK", "TUBS", idtmed[1956], tspar, 5);
356 gMC->Gspos("CRTK", 1, "CRTA", 0., 500., 300., 0, "ONLY");
357 trdpar[0] = 1170 - trapar[4] * 2.;
358 trdpar[1] = trdpar[0] + TMath::Tan(phim * kDegrad) * 76.;
359 trdpar[2] = 800.;
360 trdpar[3] = 38.;
361 gMC->Gsvolu("CRTL", "TRD1", idtmed[1956], trdpar, 4);
362 gMC->Gspos("CRTL", 1, "CRTA", 0., -858., 0., idrotm[1900], "ONLY");
363
364
365
366 // Define the setion tube of the PX24, at the same level of hall
367 // rotate the tubes around X, Z'=Y, Y'=-Z
368 AliMatrix(idrotm[2001], 0., 0., 90., 0., 90., 90.);
369 Float_t pxi[5];
370 pxi[0] = 1150.; // inside radius
371 pxi[1] = 1250.; // outside radius
372 pxi[2] = 1300.; // half lenght in Z
373 pxi[3] = kRaddeg*TMath::ASin(tspar[0]/pxi[0]);//starting angle of the segment
374 pxi[4] = 360.-pxi[3]; // ending angle of the segment
375 gMC->Gsvolu("CRTM", "TUBS", idtmed[1956], pxi, 5);
376 gMC->Gspos("CRTM", 1, "CRTA", 0., 404., -2300., idrotm[2001], "MANY");
377
378 // Define the setion tube of the PX24, above the hall
379 Float_t pxa[3];
380 pxa[0] = pxi[0];
381 pxa[1] = pxi[1];
382 pxa[2] = 2550. - pxi[2]; // Half lenght
383 gMC->Gsvolu("CRTN", "TUBE", idtmed[1956], pxa, 3);
384 gMC->Gspos("CRTN", 1, "CRTA", 0.,pxi[2]+404+pxa[2], -2300., idrotm[2001], "MANY");
385 // Fill this section with air.
386 Float_t pxb[3];
387 pxb[0] = 0.;
388 pxb[1] = pxa[0];
389 pxb[2] = pxa[2];
390 gMC->Gsvolu("CRTO", "TUBE", idtmed[1914], pxb, 3);
391 gMC->Gspos("CRTO", 1, "CRTA", 0., pxi[2]+404+pxa[2], -2300., idrotm[2001], "ONLY");
392
393
394 // PM25 Acces shaft.
395 Float_t pma[3];
396 pma[0] = 910./2.;// Inner radius
397 pma[1] = pma[0] + 100.; // Outer Radius
398 pma[2] = 5100./2.; // Half lenght
399 gMC->Gsvolu("CRTP", "TUBE", idtmed[1956], pma, 3);
400 gMC->Gspos("CRTP", 1, "CRTA", -2100., 1654., 0., idrotm[2001], "ONLY");
401 // Fill it with air.
402 Float_t pmb[3];
403 pmb[0] = 0.;
404 pmb[1] = pma[0];
405 pmb[2] = pma[2];
406 gMC->Gsvolu("CRTQ", "TUBE", idtmed[1914], pmb, 3);
407 gMC->Gspos("CRTQ", 1, "CRTA", -2100., 1654., 0., idrotm[2001], "ONLY");
408
409
410 // PGC2 Acces shaft.
411 Float_t pgc[3];
412 pgc[0] = 1200./2.;// Inner Radius
413 pgc[1] = pgc[0] + 100.; // outer Radius
414 pgc[2] = 5100./2.; // Half lenght
415 gMC->Gsvolu("CRTR", "TUBE", idtmed[1956], pgc, 3);
416 gMC->Gspos("CRTR", 1, "CRTA", 375., 1654., 4850., idrotm[2001], "ONLY");
417 // Fill it with air.
418 Float_t pgd[3];
419 pgd[0] = 0.;
420 pgd[1] = pgc[0];
421 pgd[2] = pgc[2];
422 gMC->Gsvolu("CRTS", "TUBE", idtmed[1914], pgd, 3);
423 gMC->Gspos("CRTS", 1, "CRTA", 375., 1654., 4850., idrotm[2001], "ONLY");
424
425}
426//_____________________________________________________________________________
427void AliCRTv0::CreateMaterials()
428{
429 //
430 //--
431 //
432
433 // Use the standard materials.
434 AliCRT::CreateMaterials();
435}
436
437
438//_____________________________________________________________________________
439void AliCRTv0::DrawDetector()
440{
441
442}
443
444//_____________________________________________________________________________
445void AliCRTv0::DrawModule()
446{
447 //
448 // Draw a shaded view of the L3 magnet
449 //
450 cout << "AliCRTv0::DrawModule() : Drawing the module" << endl;
451
452 gMC->Gsatt("*", "seen", -1);
453 gMC->Gsatt("alic", "seen", 0);
454
455 gMC->Gsatt("ALIC","seen",0); // Mother volume, pit ceiling
456 gMC->Gsatt("L3MO","seen",1); // L3 Magnet
457 gMC->Gsatt("CRT1","seen",1); // Scintillators (air) box.
458
459 // Draw the volumes for all the hall.
460 gMC->Gsatt("CRTA","seen",1);
461 gMC->Gsatt("CRTB","seen",1);
462 gMC->Gsatt("CRTC","seen",1);
463 gMC->Gsatt("CRTD","seen",1);
464 gMC->Gsatt("CRTE","seen",1);
465 gMC->Gsatt("CRTF","seen",1);
466 gMC->Gsatt("CRTG","seen",1);
467 gMC->Gsatt("CRTH","seen",1);
468 gMC->Gsatt("CRTI","seen",1);
469 gMC->Gsatt("CRTJ","seen",1);
470 gMC->Gsatt("CRTK","seen",1);
471 gMC->Gsatt("CRTL","seen",1);
472 gMC->Gsatt("CRTM","seen",1);
473 gMC->Gsatt("CRTN","seen",1);
474 gMC->Gsatt("CRTO","seen",1);
475 gMC->Gsatt("CRTP","seen",1);
476 gMC->Gsatt("CRTQ","seen",1);
477 gMC->Gsatt("CRTR","seen",1);
478 gMC->Gsatt("CRTS","seen",1);
479
480
481 gMC->Gdopt("hide", "on");
482 gMC->Gdopt("edge","off");
483 gMC->Gdopt("shad", "on");
484 gMC->Gsatt("*", "fill", 7);
485 gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
486 gMC->DefaultRange();
487 gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
488 gMC->Gdhead(1111, "View of CRT(ACORDE)");
489 gMC->Gdman(18, 4, "MAN");
490
491
492}
493
494//_____________________________________________________________________________
495void AliCRTv0::Init()
496{
497 //
498 // Initialise L3 magnet after it has been built
499 Int_t i;
500 //
501 if(fDebug) {
502 printf("\n%s: ",ClassName());
503 for(i=0;i<35;i++) printf("*");
504 printf(" CRTv0_INIT ");
505 for(i=0;i<35;i++) printf("*");
506 printf("\n%s: ",ClassName());
507 //
508 // Here the CRTv0 initialisation code (if any!)
509 for(i=0;i<80;i++) printf("*");
510 printf("\n");
511 }
512
513}
514
515//_____________________________________________________________________________
516void AliCRTv0::StepManager()
517{
518 //
519 // Called for every step in the CRT Detector
520 //
521 Float_t hits[12];
522 Int_t vol[5];
523
524 // Check if this is the last step of the track in the current volume
525 Bool_t laststepvol = gMC->IsTrackEntering();
526 // Obtain the medium
527 TLorentzVector xyz;
528 gMC->TrackPosition(xyz);
529 TLorentzVector pxyz;
530 gMC->TrackMomentum(pxyz);
531
532 if ( laststepvol && (strcmp(gMC->CurrentVolName(),"CRT1") == 0) ) {
533 if ( gMC->TrackCharge() != 0 || gMC->TrackPid() == kGamma ) {
534 Float_t vert[3];
535
536 hits[0] = fMucur++;
537
538 if ( (gMC->TrackPid() != kMuonPlus) && (gMC->TrackPid() != kMuonMinus)) {
539 hits[1] = -(Float_t)gMC->TrackPid();
540 } else {
541 hits[1] = (Float_t)gMC->TrackPid();
542 }
543
544 TLorentzVector xyz;
545 gMC->TrackPosition(xyz);
546 TLorentzVector pxyz;
547 gMC->TrackMomentum(pxyz);
548
549 hits[2] = xyz[0]; // X pit
550 hits[3] = xyz[1]; // Y pit
551 hits[4] = xyz[2]; // Z pit
552 hits[5] = pxyz[0]; // pxug
553 hits[6] = pxyz[1]; // pyug
554 hits[7] = pxyz[2]; // pzug
555
556 hits[8] = gMC->GetMedium(); // layer
557 hits[9] = vert[0]; // xver
558 hits[10] = vert[1]; // yver
559 hits[11] = vert[2]; // zver
560 }
561 }
562
563 // Store the hit.
564 AddHit(gAlice->CurrentTrack(),vol, hits);
565}