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