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