CreateHall() removed, and new Molasse volumes
[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$
6e9adb00 18Revision 1.2 2002/07/09 08:45:35 hristov
19Old style include files needed on HP (aCC)
20
b73f53b3 21Revision 1.1 2002/06/16 17:08:19 hristov
22First version of CRT
23
fb7a1f55 24
25*/
26
27///////////////////////////////////////////////////////////////////////////////
28// //
6e9adb00 29// ALICE Cosmic Ray Trigger //
fb7a1f55 30// //
6e9adb00 31// This class contains the functions for version 0 of the ALICE Cosmic Ray //
32// Trigger. //
fb7a1f55 33//
34// Authors:
35//
36// Arturo Fernandez <afernand@fcfm.buap.mx>
37// Enrique Gamez <egamez@fcfm.buap.mx>
38//
39// Universidad Autonoma de Puebla
40//
41//
42//Begin_Html
43/*
44<img src="picts/AliCRTv0Class.gif">
45</pre>
46<br clear=left>
47<p>The responsible person for this module is
48<a href="mailto:egamez@fcfm.buap.mx">Enrique Gamez</a>.
49</font>
50<pre>
51*/
52//End_Html
53// //
54///////////////////////////////////////////////////////////////////////////////
55
b73f53b3 56#include <iostream.h>
fb7a1f55 57
58#include <TMath.h>
59#include <TGeometry.h>
60#include <TTUBE.h>
61#include <TNode.h>
62#include <TLorentzVector.h>
63
64#include "AliCRTv0.h"
65#include "AliCRTConstants.h"
66
67#include "AliRun.h"
68#include "AliMC.h"
69#include "AliMagF.h"
70#include "AliConst.h"
71#include "AliPDG.h"
72
73ClassImp(AliCRTv0)
74
75//_____________________________________________________________________________
76AliCRTv0::AliCRTv0() : AliCRT()
77{
78 //
79 // Default constructor for CRT
80 //
81 fMucur = 0;
82}
83
84//_____________________________________________________________________________
85AliCRTv0::AliCRTv0(const char *name, const char *title)
86 : AliCRT(name,title)
87{
88 //
89 // Standard constructor for CRT
90 //
91 //Begin_Html
92 /*
93 <img src="picts/AliCRTv0.gif">
94 */
95 //End_Html
96}
97
98//_____________________________________________________________________________
99void AliCRTv0::BuildGeometry()
100{
101
102}
103
104//_____________________________________________________________________________
105void AliCRTv0::CreateGeometry()
106{
107 //
108 // Create geometry for the CRT array
109 //
110
fb7a1f55 111 Int_t idrotm[2499]; // The rotation matrix.
112
fb7a1f55 113 Int_t * idtmed = fIdtmed->GetArray() - 1099 ;
114
6e9adb00 115 //
116 // Molasse
117 //
118
119 // Exactly above the hall
120 Float_t tspar[5];
121 tspar[0] = 1170.;
122 tspar[1] = 1170. + 375.;
123 tspar[2] = (1900.+1150.)/2.+100.;
124 tspar[3] = 0.;
125 tspar[4] = 180.;
126 gMC->Gsvolu("CMO1", "TUBS", idtmed[1103], tspar, 5);
127 gMC->Gspos("CMO1", 1, "ALIC", 0., 500., 1900.-tspar[2]+400., 0, "MANY");
128
129 Float_t tbox[3];
130 tbox[0] = 1250.;
131 tbox[1] = (4420. - 1670.)/2.;
132 tbox[2] = (1900.+1150.)/2. + 200.;
133 gMC->Gsvolu("CM12", "BOX", idtmed[1103], tbox, 3);
134 gMC->Gspos("CM12", 1, "ALIC", 0., 4420. -tbox[1], 1900.-tbox[2]+400., 0, "MANY");
135
136 AliMatrix(idrotm[2003], 0., 0., 90., 0., 90., 90.);
137 // Along the PM25
138 Float_t tube[3];
139 tube[0] = 455. + 100.;
140 tube[1] = 555. + 375.;
141 tube[2] = (5150. - 1166.)/2.;
142 gMC->Gsvolu("CMO2", "TUBE", idtmed[1103], tube, 3);
143 gMC->Gspos("CMO2", 1, "ALIC", -2100., 4420.-tube[2], 0., idrotm[2003], "MANY");
144
145
146 // Along the PGC2
147 tube[0] = 650.;
148 tube[1] = 2987.7;
149 tube[2] = (5150. - 690.)/2.;
150 gMC->Gsvolu("CMO3", "TUBE", idtmed[1103], tube, 3);
151 gMC->Gspos("CMO3", 1, "ALIC", 375., 4420.-tube[2], 1900.+2987.7, idrotm[2003], "MANY");
152 // Behind the PGC2 up to the end of the M. volume.
153 tbox[0] = 12073.;
154 tbox[1] = 2575. + 95.;
155 tbox[2] = (12073. - 1900.+2987.7+650.)/2.;
156 gMC->Gsvolu("CMO7", "BOX", idtmed[1103], tbox, 3);
157 gMC->Gspos("CMO7", 1, "ALIC", 0., 4420.-tbox[1], 1900.+2987.7+650.+tbox[2], 0, "MANY");
158
159 // Along the PX24 , upper part.
160 tube[0] = 1250.;
161 tube[1] = 2300;
162 tube[2] = 2575. - 1300. + 95.;
163 gMC->Gsvolu("CMO4", "TUBE", idtmed[1103], tube, 3);
164 gMC->Gspos("CMO4", 1, "ALIC", 0., 404.+1300.+tube[2], -2300., idrotm[2003], "MANY");
165
166 // Along the PX24 , lower part
167 tspar[0] = 1250.;
168 tspar[1] = 2300;
169 tspar[2] = 1300.;
170 tspar[3] = kRaddeg*TMath::ASin(1070./1150.);
171 tspar[4] = 360. - tspar[3];
172 gMC->Gsvolu("CMO5", "TUBS", idtmed[1103], tspar, 5);
173 gMC->Gspos("CMO5", 1, "ALIC", 0., 404., -2300., idrotm[2003], "MANY");
174 // behind the PX24
175 tbox[0] = 12073.;
176 tbox[1] = 2575. + 95.;
177 tbox[2] = 8523./2.;
178 gMC->Gsvolu("CMO6", "BOX", idtmed[1103], tbox, 3);
179 gMC->Gspos("CMO6", 1, "ALIC", 0., 4420.-tbox[1], -3550.-tbox[2], 0, "MANY");
180
181
182 // On the right side of th hall
183 tbox[0] = (12073. - 1250.)/2.;
184 tbox[1] = 2575. + 95.;
185 tbox[2] = (8437.7+650.)/2.;
186 gMC->Gsvolu("CMO8", "BOX", idtmed[1103], tbox, 3);
187 gMC->Gspos("CMO8", 1, "ALIC", 1250.+tbox[0], 4420.-tbox[1], -3550.+tbox[2], 0, "MANY");
188
189 // on the left side of the hall, behind
190 tbox[0] = (12073. - 2755.)/2.;
191 tbox[1] = 2575. + 95.;
192 tbox[2] = (8437.7+650.)/2.;
193 gMC->Gsvolu("CMO9", "BOX", idtmed[1103], tbox, 3);
194 gMC->Gspos("CMO9", 1, "ALIC", -2755.-tbox[0], 4420.-tbox[1], -3550.+tbox[2], 0, "MANY");
195
196
197 // Molasse betwen the PX24 & PM25 on the left side.
198 tbox[0] = (2755. - 1250.)/2.;
199 tbox[1] = 2575. + 95.;
200 tbox[2] = (3550. - 555.)/2.;
201 gMC->Gsvolu("CM10", "BOX", idtmed[1103], tbox, 3);
202 gMC->Gspos("CM10", 1, "ALIC", -1250.-tbox[0], 4420.-tbox[1], -tbox[2]-555., 0, "MANY");
203
204
205 // Molasse betwen the PGC2 & PM25 on the left side.
206 tbox[0] = (2755. - 1250.)/2.;
207 tbox[1] = 2575. + 95.;
208 tbox[2] = (1900.+2987.7 - 555. + 650.)/2.;
209 gMC->Gsvolu("CM11", "BOX", idtmed[1103], tbox, 3);
210 gMC->Gspos("CM11", 1, "ALIC", -1250.-tbox[0], 4420.-tbox[1], 555.+tbox[2], 0, "MANY");
211
212 //
213 // Scintillators
fb7a1f55 214
215 Float_t box[3];
216 box[0] = AliCRTConstants::fgCageLenght/2.; // Half Length of the box along the X axis, cm.
217 box[1] = AliCRTConstants::fgCageHeight/2.; // Half Length of the box along the Y axis, cm.
218 box[2] = AliCRTConstants::fgCageWidth/2.; // Half Length of the box along the Z axis, cm.
219
220
221 // Define the Scintillators. as a big box.
222 Float_t scint[3];
223 scint[0] = AliCRTConstants::fgActiveAreaLenght/2.; // Half Length in X
224 scint[1] = AliCRTConstants::fgActiveAreaHeight/2.; // Half Length in Y
225 scint[2] = AliCRTConstants::fgActiveAreaWidth/2.; // Half Length in Z
226 gMC->Gsvolu("CRT1", "BOX ", idtmed[1102], scint, 3); // Scintillators
227 // Divide the modules in 2 planes.
6e9adb00 228 gMC->Gsdvn("CRT2", "CRT1", 2, 2);
fb7a1f55 229 // Now divide each plane in 8 palettes
6e9adb00 230 gMC->Gsdvn("CRT3", "CRT1", 8, 3);
fb7a1f55 231
232
233 //
234 // Define the coordinates where the draw will begin.
235 //
236
237 //
238 // -- X axis.
239 // we'll start dawing from the center.
240 Float_t initX = 0.;
241
242 //
243 // -- Y axis
244 Float_t gapY = 30.; // 30 cms. above the barrel.
245 // For the height we staimate the from the center of the ceiling,
246 // if were a cilinder, must be about 280cm.
247 Float_t barrel = 790.; // Barrel radius.
248 Float_t height = barrel + gapY - 30.;
249 Float_t initY = height;
250
251 //
252 // -- Z axis.
253 // we'll start dawing from the center.
254
255 //
256 // Put 4 modules on the top of the magnet
257 Int_t step = 4;
258 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
6e9adb00 259 gMC->Gspos("CRT1", i, "ALIC", initX, initY, (i-step)*box[2], 0, "ONLY");
fb7a1f55 260 step--;
261 }
262
263 // Modules on the barrel sides.
264 // Because the openenig angle for each face is 22.5, and if we want to
265 // put the modules right in the middle
266 Float_t xtragap = 10.;
267 Float_t initXside = (height+xtragap)*TMath::Sin(2*22.5*kDegrad); //rigth side
268 Float_t initYside = (height+xtragap)*TMath::Cos(2*22.5*kDegrad);
269
270 // Put 4 modules on the left side of the magnet
271 // The rotation matrix parameters, for the left side.
272 AliMatrix(idrotm[232], 90., 315., 90., 45., 0., 337.5);
273 Int_t stepl = 4;
274 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
6e9adb00 275 gMC->Gspos("CRT1", i+4, "ALIC", initXside, initYside, (i-stepl)*box[2],
fb7a1f55 276 idrotm[232], "ONLY");
277 stepl--;
278 }
279
280 // Put 4 modules on the right side of the magnet
281 // The rotation matrix parameters for the right side.
282 AliMatrix(idrotm[231], 90., 45., 90., 315., 180., 202.5);
283 Int_t stepr = 4;
284 for ( Int_t i = 1 ; i <= 4 ; i++ ) {
6e9adb00 285 gMC->Gspos("CRT1", i+8, "ALIC", -initXside, initYside, (i-stepr)*box[2],
fb7a1f55 286 idrotm[231], "ONLY");
287 stepr--;
288 }
289
290}
291
fb7a1f55 292//_____________________________________________________________________________
293void AliCRTv0::CreateMaterials()
294{
295 //
296 //--
297 //
298
299 // Use the standard materials.
300 AliCRT::CreateMaterials();
301}
302
303
304//_____________________________________________________________________________
305void AliCRTv0::DrawDetector()
306{
307
308}
309
310//_____________________________________________________________________________
311void AliCRTv0::DrawModule()
312{
313 //
314 // Draw a shaded view of the L3 magnet
315 //
316 cout << "AliCRTv0::DrawModule() : Drawing the module" << endl;
317
318 gMC->Gsatt("*", "seen", -1);
319 gMC->Gsatt("alic", "seen", 0);
320
6e9adb00 321 gMC->Gsatt("ALIC","seen",0);
fb7a1f55 322 gMC->Gsatt("L3MO","seen",1); // L3 Magnet
6e9adb00 323 gMC->Gsatt("CRT1","seen",1); // Scintillators
324
325 // Draw the molasse volumes
326 gMC->Gsatt("CMO1","seen",0); // Exactly above the HALL
327 gMC->Gsatt("CMO2","seen",0); // Molasse, along the PM25
328 gMC->Gsatt("CMO3","seen",0); // molasse along the PGC2
329 gMC->Gsatt("CMO4","seen",0); // Molasse, behind the PX24 upper part
330 gMC->Gsatt("CMO5","seen",0); // molasse behind px24, lower part
331 gMC->Gsatt("CMO6","seen",0); // behind the PX24
332 gMC->Gsatt("CMO7","seen",0); // behind the PGC2
333 gMC->Gsatt("CMO8","seen",0); // on the right side.
334 gMC->Gsatt("CMO9","seen",0); // on the left side.
335 gMC->Gsatt("CM10","seen",0); // betwen PX24 & PM25.
336 gMC->Gsatt("CM11","seen",0); // betwen PGC2 & PM25.
337 gMC->Gsatt("CM12","seen",0); // box above the hall.
fb7a1f55 338
339 gMC->Gdopt("hide", "on");
340 gMC->Gdopt("edge","off");
341 gMC->Gdopt("shad", "on");
342 gMC->Gsatt("*", "fill", 7);
343 gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
344 gMC->DefaultRange();
345 gMC->Gdraw("alic", 40, 30, 0, 10, 9.5, .009, .009);
346 gMC->Gdhead(1111, "View of CRT(ACORDE)");
347 gMC->Gdman(18, 4, "MAN");
348
349
350}
351
352//_____________________________________________________________________________
353void AliCRTv0::Init()
354{
355 //
356 // Initialise L3 magnet after it has been built
357 Int_t i;
358 //
359 if(fDebug) {
360 printf("\n%s: ",ClassName());
361 for(i=0;i<35;i++) printf("*");
362 printf(" CRTv0_INIT ");
363 for(i=0;i<35;i++) printf("*");
364 printf("\n%s: ",ClassName());
365 //
366 // Here the CRTv0 initialisation code (if any!)
367 for(i=0;i<80;i++) printf("*");
368 printf("\n");
369 }
370
371}
372
373//_____________________________________________________________________________
374void AliCRTv0::StepManager()
375{
376 //
377 // Called for every step in the CRT Detector
378 //
379 Float_t hits[12];
380 Int_t vol[5];
381
382 // Check if this is the last step of the track in the current volume
383 Bool_t laststepvol = gMC->IsTrackEntering();
384 // Obtain the medium
385 TLorentzVector xyz;
386 gMC->TrackPosition(xyz);
387 TLorentzVector pxyz;
388 gMC->TrackMomentum(pxyz);
389
390 if ( laststepvol && (strcmp(gMC->CurrentVolName(),"CRT1") == 0) ) {
391 if ( gMC->TrackCharge() != 0 || gMC->TrackPid() == kGamma ) {
392 Float_t vert[3];
393
394 hits[0] = fMucur++;
395
396 if ( (gMC->TrackPid() != kMuonPlus) && (gMC->TrackPid() != kMuonMinus)) {
397 hits[1] = -(Float_t)gMC->TrackPid();
398 } else {
399 hits[1] = (Float_t)gMC->TrackPid();
400 }
401
402 TLorentzVector xyz;
403 gMC->TrackPosition(xyz);
404 TLorentzVector pxyz;
405 gMC->TrackMomentum(pxyz);
406
407 hits[2] = xyz[0]; // X pit
408 hits[3] = xyz[1]; // Y pit
409 hits[4] = xyz[2]; // Z pit
410 hits[5] = pxyz[0]; // pxug
411 hits[6] = pxyz[1]; // pyug
412 hits[7] = pxyz[2]; // pzug
413
414 hits[8] = gMC->GetMedium(); // layer
415 hits[9] = vert[0]; // xver
416 hits[10] = vert[1]; // yver
417 hits[11] = vert[2]; // zver
418 }
419 }
420
421 // Store the hit.
422 AddHit(gAlice->CurrentTrack(),vol, hits);
423}