]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CRT/AliCRTv1.cxx
Number of pads along z is corrected
[u/mrichter/AliRoot.git] / CRT / AliCRTv1.cxx
CommitLineData
53d2a7cd 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$ */
53d2a7cd 17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// ALICE Cosmic Ray Trigger //
21// //
22// This class contains the functions for version 0 of the ALICE Cosmic Ray //
23// Trigger. This vesion is suposed to work as standalone module //
24// //
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/AliCRTv1Class.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
0b61c88b 48#include "AliCRTv1.h"
53d2a7cd 49
0b61c88b 50#include <TClonesArray.h>
53d2a7cd 51#include <TLorentzVector.h>
116cbefd 52#include <TPDGCode.h>
5d12ce38 53#include <TVirtualMC.h>
53d2a7cd 54
116cbefd 55#include "AliRun.h"
0b61c88b 56#include "AliConst.h"
57
58#include "AliCRThit.h"
7b213e3c 59#include "AliCRTModule.h"
0b61c88b 60#include "AliCRTConstants.h"
5d12ce38 61#include "AliMC.h"
4951e003 62#include "AliLog.h"
53d2a7cd 63
64ClassImp(AliCRTv1)
65
66//_____________________________________________________________________________
0b61c88b 67AliCRTv1::AliCRTv1()
fddb5247 68 : AliCRT()
53d2a7cd 69{
70 //
0b61c88b 71 // Default constructor
53d2a7cd 72 //
0b61c88b 73 fIshunt = 0;
74 fHits = 0;
53d2a7cd 75}
76
77//_____________________________________________________________________________
78AliCRTv1::AliCRTv1(const char *name, const char *title)
fddb5247 79 : AliCRT(name, title)
53d2a7cd 80{
81 //
0b61c88b 82 // Standard constructor
53d2a7cd 83 //
84 //Begin_Html
85 /*
86 <img src="picts/AliCRTv1.gif">
87 */
88 //End_Html
7b213e3c 89 fIshunt = 1; // All hits are associated with primary particles
0b61c88b 90
91 fHits = new TClonesArray("AliCRThit",400);
5d12ce38 92 gAlice->GetMCApp()->AddHitList(fHits);
53d2a7cd 93
0b61c88b 94 SetMarkerColor(7);
95 SetMarkerStyle(2);
96 SetMarkerSize(0.4);
53d2a7cd 97}
98
99//_____________________________________________________________________________
100AliCRTv1::AliCRTv1(const AliCRTv1& crt)
fddb5247 101 : AliCRT(crt)
53d2a7cd 102{
103 //
104 // Copy ctor.
105 //
106 crt.Copy(*this);
107}
108
109//_____________________________________________________________________________
0b61c88b 110AliCRTv1::~AliCRTv1()
111{
112 //
113 // Default destructor
114 //
115}
116
117//_____________________________________________________________________________
118AliCRTv1& AliCRTv1::operator=(const AliCRTv1& crt)
53d2a7cd 119{
120 //
121 // Asingment operator
122 //
123 crt.Copy(*this);
124 return *this;
125}
126
0b61c88b 127//_____________________________________________________________________________
128void AliCRTv1::CreateMaterials()
129{
130 //
131 // Create Materials.
132 // Use the parent class definition of the materials
133 //
134 AliCRT::CreateMaterials();
135}
136
53d2a7cd 137//_____________________________________________________________________________
138void AliCRTv1::CreateGeometry()
139{
140 //
141 // Create geometry for the CRT array
142 //
143
144 Int_t idrotm[2499]; // The rotation matrix.
0b61c88b 145 Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
7b213e3c 146 AliCRTConstants* crtConstants = AliCRTConstants::Instance();
147
148 // Create the mother volume, the one which will contain all the material
149 // above the hall.
150 Float_t pbox[3];
151 pbox[0] = AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
152 //pbox[0] = 12073;
153 pbox[1] = crtConstants->Depth();
154 pbox[2] = pbox[0];
155 gMC->Gsvolu("CRT", "BOX", idtmed[1114], pbox, 3);
156 gMC->Gspos("CRT", 1, "ALIC", 0, 0, 0, 0, "ONLY");
53d2a7cd 157
53d2a7cd 158 // Shafts.
159 this->CreateShafts();
160
53d2a7cd 161 // Molasse.
162 this->CreateMolasse();
163
7b213e3c 164 // This volume can be seen as the volume which ACORDE will ocupate
165 // above the upper face of the L3 magnet. Inside this volume the detectors
166 // aboce the magnet will be, then there will be two copies of this volume,
167 // one for each side.
168 Float_t box[3];
169 //box[0] = 2*crtConstants->MagMinRadius()*TMath::Sin(kDegrad*22.5);
170 box[0] = crtConstants->MagMinRadius()*TMath::Sin(kDegrad*22.5);
171 box[1] = crtConstants->MagMaxRadius() - crtConstants->MagMinRadius();
172 box[2] = crtConstants->MagnetLenght()/2;
bbd4837f 173 gMC->Gsvolu("CRT1", "BOX", idtmed[1134], box, 3);
7b213e3c 174
175 // Check if the AliCRTModule instance have been set, otherwise
176 // use the default values
177 if ( !fModule ) {
178 Info("CreateGeometry", "Using default dimensions");
179 fModule = new AliCRTModule("CRTmod", "Default module dimensions");
180 }
fddb5247 181
7b213e3c 182 // The full module volume.
183 // This volume will be ocupied by all the material of the module
184 // the scintillators, the aluminium frame, etc.
185 box[0] = fModule->FrameLength()/2;
186 box[1] = fModule->FrameThickness()/2;
187 box[2] = fModule->FrameWidth()/2;
188 gMC->Gsvolu("CRT2", "BOX", idtmed[1114], box, 3);
53d2a7cd 189
7b213e3c 190 // The scintillators
fddb5247 191 box[0] = crtConstants->SinglePaletteLenght()/4;
7b213e3c 192 box[1] = crtConstants->SinglePaletteHeight();
fddb5247 193 box[2] = crtConstants->SinglePaletteWidth()/2;
7b213e3c 194 gMC->Gsvolu("CRT3", "BOX", idtmed[1112], box, 3);
195 gMC->Gspos("CRT3", 1, "CRT2", 0, 2, 0, 0, "ONLY");
196
197 // The metallic frame
198 box[0] = fModule->FrameLength()/2;
199 box[1] = fModule->FrameThickness()/2;
200 box[2] = 2;
201 gMC->Gsvolu("CRT4", "BOX", idtmed[1108], box, 3);
202 gMC->Gspos("CRT4", 1, "CRT2", 0, 0, 13 - box[2], 0, "MANY");
203 gMC->Gspos("CRT4", 2, "CRT2", 0, 0, -13 + box[2], 0, "MANY");
204
205 box[0] = 2;
206 box[1] = fModule->FrameThickness()/2;
207 box[2] = fModule->FrameWidth()/2;
208 gMC->Gsvolu("CRT5", "BOX", idtmed[1108], box, 3);
209 gMC->Gspos("CRT5", 1, "CRT2", 140 - box[0], 0, 0, 0, "MANY");
210 gMC->Gspos("CRT5", 2, "CRT2", -140 + box[0], 0, 0, 0, "MANY");
211
212 // The support bars
213 box[0] = 2;
214 box[1] = fModule->FrameThickness()/2;
215 box[2] = 500;
216 gMC->Gsvolu("CRT6", "BOX", idtmed[1108], box, 3);
217
218 // Now put into the volume CR11 all the above volumes.
219 // 20 scintillation modules
220 // 4 support bars
221 Int_t copyNumber = 0;
222 for ( Int_t k = 0; k < fModule->NumberOfRows(); k++ ) {
223 Float_t zCoordinate = k*fModule->ZGap() - 450;
224 gMC->Gspos("CRT2",++copyNumber,"CRT1",-150, 15, zCoordinate, 0, "MANY");
225 gMC->Gspos("CRT2",++copyNumber,"CRT1",150, 15, zCoordinate, 0, "MANY");
53d2a7cd 226
7b213e3c 227 }
228
229 // Put the support bars
230 gMC->Gspos("CRT6", 1, "CRT1", -75, 5, 0, 0, "ONLY");
231 gMC->Gspos("CRT6", 2, "CRT1", -225, 5, 0, 0, "ONLY");
232 gMC->Gspos("CRT6", 3, "CRT1", 75, 5, 0, 0, "ONLY");
233 gMC->Gspos("CRT6", 4, "CRT1", 225, 5, 0, 0, "ONLY");
53d2a7cd 234
7b213e3c 235 // Now put a copy of CR11 on the 3 upper faces of the magnet
236 // In the right side side of the magnet
237 AliMatrix(idrotm[231], 90, 45, 90, 135, 0, 0);
0b61c88b 238 // In the left side side of the magnet
7b213e3c 239 AliMatrix(idrotm[232], 90, 315, 90, 45, 0, 0);
53d2a7cd 240
bbd4837f 241 Float_t x = crtConstants->MagMaxRadius();
7b213e3c 242 gMC->Gspos("CRT1", 1, "ALIC", 0, x, 0, 0, "MANY");
243 gMC->Gspos("CRT1", 2, "ALIC", -x*TMath::Sin(kDegrad*45), x*TMath::Cos(kDegrad*45), 0, idrotm[231], "MANY");
244 gMC->Gspos("CRT1", 3, "ALIC", x*TMath::Sin(kDegrad*45), x*TMath::Cos(kDegrad*45), 0, idrotm[232], "MANY");
53d2a7cd 245
246}
247
53d2a7cd 248//_____________________________________________________________________________
249void AliCRTv1::CreateMolasse()
250{
251 //
252 //
253 //
53d2a7cd 254 Int_t idrotm[2499]; // The rotation matrix.
0b61c88b 255 Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
53d2a7cd 256
7b213e3c 257 Float_t px24radius = 2300/2;
258 Float_t px24X = 0;
259 //Float_t px24Y = ;
260 Float_t px24Z = 2300;
261
262 Float_t pm25radius = 910/2;
263 Float_t pm25X = 2100;
264 //Float_t pm25Y = ;
265 Float_t pm25Z = 0;
266
267 Float_t pgc2radius = 1100/2;
268 Float_t pgc2X = -375;
269 //Float_t pgc2Y = ;
270 Float_t pgc2Z = -(1900 + 2987.7);
271
272 Float_t concreteWidth = 100; // Standard width of the hall walls.
273
274
275 // Create a local mother volume.
276 Float_t pbox[3];
277 pbox[0] = AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
278 pbox[1] = AliCRTConstants::Instance()->Depth()/2;
279 pbox[2] = pbox[0];
280 gMC->Gsvolu("CMO1", "BOX", idtmed[1114], pbox, 3);
281
282 // Now put the molasse exactly above the hall. OK
283 // Above the ceiling
284 Float_t ptubs[5];
285 ptubs[0] = 1170;
286 ptubs[1] = 2100 - pm25radius;
287 ptubs[2] = 1900/2 + px24radius;
288 ptubs[3] = 0;
289 ptubs[4] = 180;
290 gMC->Gsvolu("CMO2", "TUBS", idtmed[1123], ptubs, 5);
291 gMC->Gspos("CMO2", 1, "CMO1", 0, 500-AliCRTConstants::Instance()->Depth()/2, ptubs[2]-1900, 0, "MANY");
292
293 // Molasse around the RB24/26 Wall. OK
294 ptubs[0] = 220 + 1600;
295 ptubs[1] = AliCRTConstants::Instance()->Depth() - ptubs[0];
296 ptubs[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
297 ptubs[3] = 0;
298 ptubs[4] = 180;
299 gMC->Gsvolu("CMO3", "TUBS", idtmed[1123], ptubs, 5);
300 gMC->Gspos("CMO3", 1, "CMO1", 70, 40-AliCRTConstants::Instance()->Depth()/2, -1900 - ptubs[2], 0, "MANY");
301
302 // A big block above the RB24/26 wall. OK
303 pbox[0] = AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
304 pbox[1] = (AliCRTConstants::Instance()->Depth() - 220 - 1600)/2;
305 pbox[2] = 2987.7/2 - 1100/4 - concreteWidth/2;
306 gMC->Gsvolu("CMO4", "BOX", idtmed[1123], pbox, 3);
307 gMC->Gspos("CMO4", 1, "CMO1", 0, AliCRTConstants::Instance()->Depth()/2 - pbox[1], -1900 - pbox[2], 0, "MANY");
308 // Small blocks below the volume CMO4 on both sides of the wall RB24/26. OK
309 pbox[0] = (AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - ptubs[0])/2;
310 pbox[1] = AliCRTConstants::Instance()->Depth()/2 - pbox[1];
311 gMC->Gsvolu("CM17", "BOX", idtmed[1123], pbox, 3);
312 gMC->Gspos("CM17", 1, "CMO1", AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], -AliCRTConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
313 gMC->Gspos("CM17", 2, "CMO1", -AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad)+ pbox[0], -AliCRTConstants::Instance()->Depth()/2 + pbox[1], -1900 - pbox[2], 0, "MANY");
314
315 // And a big block of molasse above the hall up to the surface. OK
316 pbox[0] = pm25X - pm25radius;
317 pbox[1] = (AliCRTConstants::Instance()->Depth()-500-1170)/2;
318 pbox[2] = (1900 + 1150)/2;
319 gMC->Gsvolu("CMO5", "BOX", idtmed[1123], pbox, 3);
320 gMC->Gspos("CMO5", 1, "CMO1", 0,AliCRTConstants::Instance()->Depth()/2-pbox[1], pbox[2]-1900, 0, "MANY");
321 // Small blocks of molasse betwen the blocks CMO2, CMO5 and PM25. Ok
322 pbox[0] = (pm25X - pm25radius - 1170)/2;
323 pbox[1] = 1000;
324 gMC->Gsvolu("CM16", "BOX", idtmed[1123], pbox, 3);
325 gMC->Gspos("CM16", 1, "CMO1", 1170 + pbox[0], -AliCRTConstants::Instance()->Depth()/2+pbox[1], pbox[2] - 1900, 0, "MANY");
326
327 // Molasse around the shafts.
328 AliMatrix(idrotm[2003], 0, 0, 90, 0, 90, 90);
329 // Around the PX24, the open section. OK
330 ptubs[0] = px24radius + concreteWidth;
331 ptubs[1] = ptubs[0] + 1000;
332 ptubs[2] = (2300 - (5150 - AliCRTConstants::Instance()->Depth()))/2;
333 ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]);
334 ptubs[4] = 180 - kRaddeg*TMath::ASin(1070/ptubs[0]);
335 gMC->Gsvolu("CMO6", "TUBS", idtmed[1123], ptubs, 5);
336 gMC->Gspos("CMO6", 1, "CMO1", px24X, ptubs[2] - AliCRTConstants::Instance()->Depth()/2, px24Z, idrotm[2003], "MANY");
337
338 // Around the PX24, the closed section. OK
339 Float_t ptube[3];
340 ptube[0] = px24radius + concreteWidth;
341 ptube[1] = ptube[0] + 1000;
342 ptube[2] = (5150 - 2300)/2;
343 gMC->Gsvolu("CMO7", "TUBE", idtmed[1123], ptube, 3);
344 gMC->Gspos("CMO7", 1, "CMO1", px24X, AliCRTConstants::Instance()->Depth()/2 - ptube[2], px24Z, idrotm[2003], "MANY");
345
346 // Around PM25. OK
347 ptube[0] = pm25radius + concreteWidth;
348 ptube[1] = ptube[0] + 400;
349 ptube[2] = AliCRTConstants::Instance()->Depth()/2;
350 gMC->Gsvolu("CMO8", "TUBE", idtmed[1123], ptube, 3);
351 gMC->Gspos("CMO8", 1, "CMO1", pm25X, 0, pm25Z, idrotm[2003], "MANY");
352 // On both sides of the PM25 along the HALL.
353 pbox[0] = (2100 + pm25radius - 1170)/2;
354 pbox[1] = AliCRTConstants::Instance()->Depth()/2;
355 pbox[2] = (3*px24radius - pm25radius)/2;
356 gMC->Gsvolu("CM18", "BOX", idtmed[1123], pbox, 3);
357 gMC->Gspos("CM18", 1, "CMO1", 2100, 0, pbox[2] + pm25radius, 0, "MANY");
358
359 pbox[2] = (1900 - pm25radius)/2;
360 gMC->Gsvolu("CM19", "BOX", idtmed[1123], pbox, 3);
361 gMC->Gspos("CM19", 1, "CMO1", 2100, 0, -pbox[2] - pm25radius, 0, "MANY");
362
363 // Around the PGC2. OK
364 ptube[0] = pgc2radius + concreteWidth;
365 ptube[1] = 2987.7 - 740;
366 ptube[2] = AliCRTConstants::Instance()->Depth()/2;
367 gMC->Gsvolu("CMO9", "TUBE", idtmed[1123], ptube, 3);
368 gMC->Gspos("CMO9", 1, "CMO1", pgc2X, 0, pgc2Z, idrotm[2003], "MANY");
369
370 // On both sides of the PGC2.OK
371 pbox[0] = (AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - 1100 - 375)/2;
372 pbox[1] = AliCRTConstants::Instance()->Depth()/2;
373 pbox[2] = pgc2radius + concreteWidth;
374 gMC->Gsvolu("CM10", "BOX", idtmed[1123], pbox, 3);
375 gMC->Gspos("CM10", 1, "CMO1", AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - pbox[0], 0, pgc2Z, 0, "MANY");
376 gMC->Gspos("CM10", 2, "CMO1", -AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) + pbox[0], 0, pgc2Z, 0, "MANY");
377
378 // big block of molasse behind the PX24. OK
379 pbox[0] = AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
380 pbox[1] = AliCRTConstants::Instance()->Depth()/2;
381 pbox[2] = (pbox[0] - (2300 + 1150 + 100))/2;
382 gMC->Gsvolu("CM12", "BOX", idtmed[1123], pbox, 3);
383 gMC->Gspos("CM12", 1, "CMO1", px24X, 0, px24Z + px24radius + concreteWidth + pbox[2], 0, "MANY");
384
385 // big block of molasse in the opposite side of the PM25. OK
386 pbox[0] = (AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - 1150)/2;
387 pbox[1] = AliCRTConstants::Instance()->Depth()/2;
388 pbox[2] = (1900 + 2300 + 1150)/2;
389 gMC->Gsvolu("CM13", "BOX", idtmed[1123], pbox, 3);
390 gMC->Gspos("CM13", 1, "CMO1", -1150 - pbox[0], 0, pbox[2] - 1900, 0, "MANY");
391
392 // big block of molasse behind the PM25. OK
393 pbox[0] = (AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad) - (2100 + 910/2 + 100))/2;
394 pbox[1] = AliCRTConstants::Instance()->Depth()/2;
395 pbox[2] = (1900 + 2300 + 1150)/2;
396 gMC->Gsvolu("CM14", "BOX", idtmed[1123], pbox, 3);
397 gMC->Gspos("CM14", 1, "CMO1", pm25X + pm25radius + concreteWidth + pbox[0], 0, pbox[2] - 1900, 0, "MANY");
398
399 // big block of molasse behind the PGC2. OK
400 pbox[0] = AliCRTConstants::Instance()->Depth()*TMath::Tan(67.5*kDegrad);
401 pbox[1] = AliCRTConstants::Instance()->Depth()/2;
402 pbox[2] = (pbox[0] - (2987.7 + 1900 + 1100/2 + 100))/2;
403 gMC->Gsvolu("CM15", "BOX", idtmed[1123], pbox, 3);
404 gMC->Gspos("CM15", 1, "CMO1", 0, 0, -pbox[0] + pbox[2], 0, "MANY");
405
406 gMC->Gspos("CMO1",1,"CRT",0,AliCRTConstants::Instance()->Depth()/2,0,0,"MANY");
53d2a7cd 407
408}
409
410//_____________________________________________________________________________
411void AliCRTv1::CreateShafts()
412{
413 //
414 //
415 //
416 Int_t idrotm[2499]; // The rotation matrix.
0b61c88b 417 Int_t* idtmed = fIdtmed->GetArray() - 1099 ;
53d2a7cd 418
53d2a7cd 419 //
420 // Acces shafts
421 //
7b213e3c 422 AliMatrix(idrotm[2001], 0, 0, 90, 0, 90, 90);
0b61c88b 423
53d2a7cd 424
7b213e3c 425 // Create a bing cilinder to hold the main structures in the shaft.
426 // All the structures relative to the shaft will be put into
427 // this volume.
428 // This shaft is composed by an open tube down in the hall, and
429 // a cilinder avobe the level of the ceiling.
53d2a7cd 430 Float_t ptube[3];
7b213e3c 431 ptube[0] = 0; // inner radius
432 ptube[1] = 1250; // outer radius
433 ptube[2] = 5150/2; // Half lenght in Z
434 gMC->Gsvolu("CSF1", "TUBE", idtmed[1114], ptube, 3);
0b61c88b 435
7b213e3c 436 Float_t ptubs[5];
437 // The open section of the PX24
438 ptubs[0] = 1150; // Inner radius
439 ptubs[1] = 1250; // Outer radius
440 ptubs[2] = 1300; // Half length
441 ptubs[3] = 180 + kRaddeg*TMath::ASin(1070/ptubs[0]); // starting angle
442 ptubs[4] = 180 - kRaddeg*TMath::ASin(1070/ptubs[0]);
443 gMC->Gsvolu("CSF2", "TUBS", idtmed[1116], ptubs, 5);
444 gMC->Gspos("CSF2", 1, "CSF1", 0, 0, -ptube[2] + ptubs[2], 0, "MANY");
445
446 // The other part of the shaft.
447 ptube[0] = ptubs[0]; // Inner radius
448 ptube[1] = ptubs[1]; // Outer radius
449 ptube[2] = 5150/2 - ptubs[2]; // Half lenght
450 gMC->Gsvolu("CSF3", "TUBE", idtmed[1116], ptube, 3);
451 gMC->Gspos("CSF3", 1, "CSF1", 0, 0, 5150/2 - ptube[2], 0, "MANY");
0b61c88b 452
7b213e3c 453 Float_t pbox[3];
454 // Concrete walls along the shaft (next to the elevator.)
455 pbox[0] = 480/2; // Half length in X
456 pbox[1] = 120/2; // Half length in Y
457 pbox[2] = 5150/2; // Half length in Z
458 gMC->Gsvolu("CSW1", "BOX", idtmed[1116], pbox, 3);
459 gMC->Gspos("CSW1", 1, "CSF1", 820+pbox[0], 150+pbox[1], 0, 0, "MANY");
460 gMC->Gspos("CSW1", 2, "CSF1", 820+pbox[0], -300-pbox[1], 0, 0, "MANY");
0b61c88b 461
53d2a7cd 462 //
7b213e3c 463 pbox[0] = 120/2; // Half length in X
464 pbox[1] = 750/2; // Half length in Y
465 pbox[2] = 5150/2; // Half length in Z
466 gMC->Gsvolu("CSW2", "BOX", idtmed[1116], pbox, 3);
467 gMC->Gspos("CSW2", 1, "CSF1", 820-60, 150+pbox[1], 0, 0, "MANY");
0b61c88b 468
53d2a7cd 469 //
7b213e3c 470 pbox[0] = 120/2; // Half length in X
471 pbox[1] = 600/2; // Half lenght in Y
472 pbox[2] = 5150/2; // Half length in Z
473 gMC->Gsvolu("CSW3", "BOX", idtmed[1116], pbox, 3);
474 gMC->Gspos("CSW3", 1, "CSF1", 820-60, -300-pbox[1], 0, 0, "MANY");
475
476 // Material below the counting rooms.
477 pbox[0] = 400/2;
478 pbox[1] = 2300/2;
479 pbox[2] = 300/2;
480 gMC->Gsvolu("CSW4", "BOX", idtmed[1116], pbox, 3);
481 gMC->Gspos("CSW4",1,"CSF1",2300/2-pbox[0],0,3000-5150/2-pbox[2], 0, "MANY");
482
483 // Shielding plug.
484 pbox[0] = 1400/2;
485 pbox[1] = 2300/2;
486 pbox[2] = 170/2;
487 gMC->Gsvolu("CSW5", "BOX", idtmed[1116], pbox, 3);
488 gMC->Gspos("CSW5", 1, "CSF1", 0, 0, 3000-5150/2-130, 0, "MANY");
489
490 // The end of the support for the shielding plug.
491 pbox[0] = 170/2;
492 pbox[1] = 2300/2;
493 pbox[2] = 300/2;
494 gMC->Gsvolu("CSW6", "BOX", idtmed[1116], pbox, 3);
495 gMC->Gspos("CSW6",1,"CSF1",-1400/2-pbox[0],0,3000-5150/2-pbox[2],0,"MANY");
496
497 // ...
498 pbox[0] = 100/2;
499 pbox[1] = 2300/2;
500 pbox[2] = 450/2;
501 gMC->Gsvolu("CSW7", "BOX", idtmed[1116], pbox, 3);
502 gMC->Gspos("CSW7",1,"CSF1",-1400/2-170-pbox[0],0,3000-5150/2+pbox[2],0,"MANY");
503
504 // Material close to the pipe.
505 pbox[0] = 300/2;
506 pbox[1] = 2300/2;
507 pbox[2] = 170/2;
508 gMC->Gsvolu("CSW8", "BOX", idtmed[1116], pbox, 3);
509 gMC->Gspos("CSW8",1,"CSF1",-2300/2+pbox[0],0,2500-5150/2,0,"MANY");
510
511 // Now put the shaft into the mother volume.
512 gMC->Gspos("CSF1", 1, "CRT", 0, AliCRTConstants::Instance()->Depth() - 5150/2, 2300, idrotm[2001], "MANY");
513
514 // PM25 Access Shaft
0b61c88b 515 ptube[0] = 910/2;
516 ptube[1] = ptube[0] + 100;
517 ptube[2] = (5150 - 1166)/2;
7b213e3c 518 gMC->Gsvolu("CSF4", "TUBE", idtmed[1116], ptube, 3);
519 gMC->Gspos("CSF4", 1, "CRT", 2100, AliCRTConstants::Instance()->Depth()-ptube[2], 0, idrotm[2001], "MANY");
0b61c88b 520
53d2a7cd 521 // PGC2 Access Shaft
0b61c88b 522 ptube[0] = 1100/2;
523 ptube[1] = ptube[0] + 100;
524 ptube[2] = (5150 - 690)/2;
7b213e3c 525 gMC->Gsvolu("CSF5", "TUBE", idtmed[1116], ptube, 3);
526 gMC->Gspos("CSF5", 1, "CRT", -375, AliCRTConstants::Instance()->Depth()-ptube[2], -1900 - 2987.7, idrotm[2001], "MANY");
53d2a7cd 527
528}
529
530//_____________________________________________________________________________
fddb5247 531void AliCRTv1::DrawDetector() const
53d2a7cd 532{
533 //
534 // Draw a shaded view of the L3 magnet
535 //
7b213e3c 536 Info("DrawDetector", "Drawing CRT module");
537
53d2a7cd 538 gMC->Gsatt("*", "seen", -1);
7b213e3c 539 gMC->Gsatt("ALIC", "seen", 0);
540 /*
541 gMC->Gsatt("L3MO","seen",0); // L3 Magnet, Mother
542 gMC->Gsatt("L3CO","seen",1); // Coils
543 gMC->Gsatt("L3C1","seen",1); // Coils
544 gMC->Gsatt("L3YO","seen",1); // Yoke
545 gMC->Gsatt("L3DO","seen",0); // return Yoke (DOOR)
546 gMC->Gsatt("L3FR","seen",1); // DOOR
547 gMC->Gsatt("L3IR","seen",0); // Inner layer
548 gMC->Gsatt("L3O1","seen",1); // Door opening
549 gMC->Gsatt("L3O2","seen",1); // Door opening
550 */
551 gMC->Gsatt("CRT", "seen",0); // CRT mother volume.
552
553 gMC->Gsatt("CMO1","seen",0); // Molasse.
554
555 gMC->Gsatt("CSF1","seen",0); // PX24 access shaft.
556 gMC->Gsatt("CSF2", "seen", 1); // PX24 open section
557 gMC->Gsatt("CSF3", "seen", 1); // PX24, upper part.
558 gMC->Gsatt("CSW1", "seen", 1);
559 gMC->Gsatt("CSW2", "seen", 1);
560 gMC->Gsatt("CSW3", "seen", 1);
561 gMC->Gsatt("CSW4", "seen", 1);
562 gMC->Gsatt("CSW5", "seen", 1);
563 gMC->Gsatt("CSW6", "seen", 1);
564 gMC->Gsatt("CSW7", "seen", 1);
565 gMC->Gsatt("CSW8", "seen", 1);
566
567 gMC->Gsatt("CSF4","seen",1); // PM25 access shaft.
568 gMC->Gsatt("CSF5","seen",1); // PGC2 access shaft.
569
570 gMC->Gsatt("CRT", "seen", 0); // CRT Mother volume.
571 gMC->Gsatt("CRT1", "seen", 0); // ?
572 gMC->Gsatt("CRT2", "seen", 0); // Module air box
573 gMC->Gsatt("CRT3", "seen", 1); // Scintillators
574 gMC->Gsatt("CRT3", "colo", 2); // Scintillators
575 gMC->Gsatt("CRT4", "seen", 1); // Aluminium frame (long bars)
576 gMC->Gsatt("CRT4", "colo", 3); //
577 gMC->Gsatt("CRT5", "seen", 1); // Aluminium frame (short bars)
578 gMC->Gsatt("CRT5", "colo", 3); //
579 gMC->Gsatt("CRT6", "seen", 1); // Module support
580 gMC->Gsatt("CRT6", "colo", 3); //
581
53d2a7cd 582 gMC->Gdopt("hide", "on");
583 gMC->Gdopt("edge","off");
584 gMC->Gdopt("shad", "on");
585 gMC->Gsatt("*", "fill", 7);
586 gMC->SetClipBox("ALIC", 0, 3000, -3000, 3000, -6000, 6000);
587 gMC->DefaultRange();
7b213e3c 588 gMC->Gdraw("alic", 70, 30, 0, 10, 9.5, .001, .001);
53d2a7cd 589 gMC->Gdhead(1111, "View of CRT(ACORDE)");
590 gMC->Gdman(18, 4, "MAN");
7b213e3c 591
53d2a7cd 592}
593
594//_____________________________________________________________________________
595void AliCRTv1::Init()
596{
597 //
598 // Initialise L3 magnet after it has been built
599 Int_t i;
600 //
4951e003 601 if(AliLog::GetGlobalDebugLevel()>0) {
53d2a7cd 602 printf("\n%s: ",ClassName());
603 for(i=0;i<35;i++) printf("*");
604 printf(" CRTv1_INIT ");
605 for(i=0;i<35;i++) printf("*");
606 printf("\n%s: ",ClassName());
607 //
608 // Here the CRTv1 initialisation code (if any!)
609 for(i=0;i<80;i++) printf("*");
610 printf("\n");
611 }
612
613}
614
615//____________________________________________________________________________
616void AliCRTv1::StepManager()
617{
618 //
619 // Called for every step in the Cosmic Ray Trigger
620 //
0b61c88b 621 static Int_t vol[1];
53d2a7cd 622 Int_t ipart;
623 TLorentzVector pos;
624 TLorentzVector mom;
625
626 static Float_t hits[14];
627 static Float_t eloss;
53d2a7cd 628
0b61c88b 629 if ( gMC->TrackPid() != kMuonMinus ) return;
630
631 // Only charged tracks
632 if ( !(gMC->TrackCharge()) ) return;
53d2a7cd 633
634 if (gMC->IsNewTrack()) {
635 // Reset the deposited energy
0b61c88b 636 eloss = 0;
53d2a7cd 637 }
638
639 // Add th energy loss in each step.
640 eloss += gMC->Edep();
641
0b61c88b 642 if ( ( (strcmp(gMC->CurrentVolName(),"CRT4") == 0) || // Magnet
643 (strcmp(gMC->CurrentVolName(),"CRT5") == 0) || // CRT
644 (strcmp(gMC->CurrentVolName(),"CRT6") == 0) || // Magnet Doors
645 (strcmp(gMC->CurrentVolName(),"CSF2") == 0) || // PX24
646 (strcmp(gMC->CurrentVolName(),"CSF3") == 0) || // PM25
647 (strcmp(gMC->CurrentVolName(),"CSF4") == 0) ) // PGC2
648 && gMC->IsTrackEntering() ) {
53d2a7cd 649
7b213e3c 650 /*
651 if ( (strcmp(gMC->CurrentVolName(),"CRT3") == 0)
652 && gMC->IsTrackEntering() ) {
653 */
53d2a7cd 654 // Get current particle id(ipart),track position (pos) and momentum (mom)
655 gMC->TrackPosition(pos);
656 gMC->TrackMomentum(mom);
657 ipart = gMC->TrackPid();
53d2a7cd 658
659 ipart = gMC->TrackPid();
660 hits[0] = (Float_t)ipart; // (fId)
661
0b61c88b 662 hits[1] = pos[0]; // X coordinate (fX)
663 hits[2] = pos[1]; // Y coordinate (fY)
664 hits[3] = pos[2]; // Z coordinate (fZ)
665 hits[4] = mom[0]; // Px (fpxug)
666 hits[5] = mom[1]; // Py (fpyug)
667 hits[6] = mom[2]; // Pz (fpzug)
668 hits[7] = eloss; // Energy loss
669
7b213e3c 670 Info("StepManager", "X=%f", pos[0]);
671
0b61c88b 672 // Tag the volumes
673 if ( (strcmp(gMC->CurrentVolName(),"CRT4")==0) ) vol[0] = 1; // Magnet
674 else if ( (strcmp(gMC->CurrentVolName(),"CRT5")==0) ) vol[0] = 2; // CRT
675 else if ( (strcmp(gMC->CurrentVolName(),"CRT6")==0) ) vol[0] = 3; // Doors
676 else if ( (strcmp(gMC->CurrentVolName(),"CSF2")==0) ) vol[0] = 4; // PX24
677 else if ( (strcmp(gMC->CurrentVolName(),"CSF3")==0) ) vol[0] = 5; // PM25
678 else if ( (strcmp(gMC->CurrentVolName(),"CSF4")==0) ) vol[0] = 6; // PGC2
679 else vol[0] = -1;// ?
680 //vol[0] = gMC->GetMedium(); //layer(flay)
7b213e3c 681 Info("StepManager", "Adding hit");
5d12ce38 682 AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol, hits);
7b213e3c 683 Info("StepManager", "Hit added");
0b61c88b 684 // Reset the deposited energy only when you reach the Magnet
685 if ( (strcmp(gMC->CurrentVolName(),"CRT4")==0) ) eloss = 0;
53d2a7cd 686
687 } else {
688 return;
689 }
690
0b61c88b 691}
692
693//_____________________________________________________________________________
694void AliCRTv1::AddHit(Int_t track, Int_t *vol, Float_t *hits)
695{
696 //
697 // Add a CRT hit
698 //
699 TClonesArray &lhits = *fHits;
700 new(lhits[fNhits++]) AliCRThit(fIshunt,track,vol,hits);
701}