1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.19 2000/06/07 16:25:37 cblume
19 Try to remove compiler warnings on Sun and HP
21 Revision 1.18 2000/05/08 16:17:27 cblume
24 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
25 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
27 Revision 1.17 2000/02/28 19:10:26 cblume
28 Include the new TRD classes
30 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
31 Introduce TRD geometry classes
33 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
34 Include functions and data members for AliTRDrecPoint
36 Revision 1.16 2000/01/19 17:17:35 fca
37 Introducing a list of lists of hits -- more hits allowed for detector now
39 Revision 1.15 1999/11/02 17:04:25 fca
40 Small syntax change for HP compiler
42 Revision 1.14 1999/11/02 16:57:02 fca
43 Avoid non ansi warnings on HP compilers
45 Revision 1.13 1999/11/02 16:35:56 fca
46 New version of TRD introduced
48 Revision 1.12 1999/11/01 20:41:51 fca
49 Added protections against using the wrong version of FRAME
51 Revision 1.11 1999/09/29 09:24:34 fca
52 Introduction of the Copyright and cvs Log
56 ///////////////////////////////////////////////////////////////////////////////
58 // Transition Radiation Detector //
59 // This class contains the basic functions for the Transition Radiation //
62 ///////////////////////////////////////////////////////////////////////////////
73 #include "AliTRDdigitizer.h"
74 #include "AliTRDclusterizer.h"
75 #include "AliTRDgeometryHole.h"
76 #include "AliTRDgeometryFull.h"
77 #include "AliTRDrecPoint.h"
81 //_____________________________________________________________________________
85 // Default constructor
100 //_____________________________________________________________________________
101 AliTRD::AliTRD(const char *name, const char *title)
102 : AliDetector(name,title)
105 // Standard constructor for the TRD
108 // Check that FRAME is there otherwise we have no place where to
110 AliModule* frame = gAlice->GetModule("FRAME");
112 Error("Ctor","TRD needs FRAME to be present\n");
116 // Define the TRD geometry according to the FRAME geometry
117 if (frame->IsVersion() == 0) {
118 // Geometry with hole
119 fGeometry = new AliTRDgeometryHole();
121 else if (frame->IsVersion() == 1) {
122 // Geometry without hole
123 fGeometry = new AliTRDgeometryFull();
126 Error("Ctor","Could not find valid FRAME version\n");
130 // Allocate the hit array
131 fHits = new TClonesArray("AliTRDhit" ,405);
132 gAlice->AddHitList(fHits);
134 // Allocate the digits array
137 // Allocate the rec point array
138 fRecPoints = new TObjArray(400);
144 SetMarkerColor(kWhite);
148 //_____________________________________________________________________________
149 AliTRD::AliTRD(AliTRD &trd)
159 //_____________________________________________________________________________
174 //_____________________________________________________________________________
175 void AliTRD::AddRecPoint(Float_t *pos, Int_t *digits, Int_t det, Float_t amp)
178 // Add a reconstructed point for the TRD
181 AliTRDrecPoint *recPoint = new AliTRDrecPoint();
182 TVector3 posVec(pos[0],pos[1],pos[2]);
183 recPoint->SetLocalPosition(posVec);
184 recPoint->SetDetector(det);
185 recPoint->SetEnergy(amp);
186 for (Int_t iDigit = 0; iDigit < 3; iDigit++) {
187 recPoint->AddDigit(digits[iDigit]);
190 fRecPoints->Add(recPoint);
194 //_____________________________________________________________________________
195 void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
198 // Add a digit for the TRD
201 TClonesArray &ldigits = *fDigits;
202 new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
206 //_____________________________________________________________________________
207 void AliTRD::AddHit(Int_t track, Int_t *det, Float_t *hits)
210 // Add a hit for the TRD
213 TClonesArray &lhits = *fHits;
214 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits);
218 //_____________________________________________________________________________
219 void AliTRD::BuildGeometry()
222 // Create the ROOT TNode geometry for the TRD
227 const Int_t kColorTRD = 46;
229 // Find the top node alice
230 top = gAlice->GetGeometry()->GetNode("alice");
232 pgon = new TPGON("S_TRD","TRD","void",0,360,kNsect,4);
233 Float_t ff = TMath::Cos(kDegrad * 180 / kNsect);
234 Float_t rrmin = kRmin / ff;
235 Float_t rrmax = kRmax / ff;
236 pgon->DefineSection(0,-kZmax1,rrmax,rrmax);
237 pgon->DefineSection(1,-kZmax2,rrmin,rrmax);
238 pgon->DefineSection(2, kZmax2,rrmin,rrmax);
239 pgon->DefineSection(3, kZmax1,rrmax,rrmax);
241 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
242 node->SetLineColor(kColorTRD);
247 //_____________________________________________________________________________
248 void AliTRD::Copy(AliTRD &trd)
254 trd.fGasMix = fGasMix;
255 trd.fGeometry = fGeometry;
256 trd.fRecPoints = fRecPoints;
257 trd.fNRecPoints = fNRecPoints;
259 //AliDetector::Copy(trd);
263 //_____________________________________________________________________________
264 void AliTRD::CreateGeometry()
267 // Creates the volumes for the TRD chambers
270 // Check that FRAME is there otherwise we have no place where to put the TRD
271 AliModule* frame = gAlice->GetModule("FRAME");
273 printf(" The TRD needs the FRAME to be defined first\n");
277 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
281 //_____________________________________________________________________________
282 void AliTRD::CreateMaterials()
285 // Create the materials for the TRD
289 Int_t isxfld = gAlice->Field()->Integ();
290 Float_t sxmgmx = gAlice->Field()->Max();
292 // For polyethilene (CH2)
293 Float_t ape[2] = { 12., 1. };
294 Float_t zpe[2] = { 6., 1. };
295 Float_t wpe[2] = { 1., 2. };
298 // For mylar (C5H4O2)
299 Float_t amy[3] = { 12., 1., 16. };
300 Float_t zmy[3] = { 6., 1., 8. };
301 Float_t wmy[3] = { 5., 4., 2. };
305 Float_t aco[2] = { 12., 16. };
306 Float_t zco[2] = { 6., 8. };
307 Float_t wco[2] = { 1., 2. };
308 Float_t dco = 0.001977;
311 Float_t awa[2] = { 1., 16. };
312 Float_t zwa[2] = { 1., 8. };
313 Float_t wwa[2] = { 2., 1. };
316 // For isobutane (C4H10)
317 Float_t ais[2] = { 12., 1. };
318 Float_t zis[2] = { 6., 1. };
319 Float_t wis[2] = { 4., 10. };
320 Float_t dis = 0.00267;
322 // For Xe/CO2-gas-mixture
323 // Xe-content of the Xe/CO2-mixture (90% / 10%)
325 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
327 Float_t dxe = .005858;
329 // General tracking parameter
330 Float_t tmaxfd = -10.;
331 Float_t stemax = -1e10;
332 Float_t deemax = -0.1;
333 Float_t epsil = 1e-4;
334 Float_t stmin = -0.001;
336 Float_t absl, radl, d, buf[1];
337 Float_t agm[2], dgm, zgm[2], wgm[2];
340 //////////////////////////////////////////////////////////////////////////
342 //////////////////////////////////////////////////////////////////////////
344 AliMaterial( 1, "Al $", 26.98, 13.0, 2.7 , 8.9 , 37.2);
345 AliMaterial( 2, "Air$", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
346 AliMaterial( 4, "Xe $", 131.29, 54.0, dxe , 1447.59, 0.0);
347 AliMaterial( 5, "Cu $", 63.54, 29.0, 8.96 , 1.43, 14.8);
348 AliMaterial( 6, "C $", 12.01, 6.0, 2.265 , 18.8 , 74.4);
349 AliMaterial(12, "G10$", 20.00, 10.0, 1.7 , 19.4 , 999.0);
352 AliMixture(3, "Polyethilene$", ape, zpe, dpe, -2, wpe);
353 AliMixture(7, "Mylar$", amy, zmy, dmy, -3, wmy);
354 AliMixture(8, "CO2$", aco, zco, dco, -2, wco);
355 AliMixture(9, "Isobutane$", ais, zis, dis, -2, wis);
356 AliMixture(13,"Water$", awa, zwa, dwa, -2, wwa);
361 // Get properties of Xe
362 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
363 // Get properties of CO2
364 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
365 // Create gas mixture
368 dgm = wgm[0] * dxe + wgm[1] * dco;
369 AliMixture(10, "Gas mixture 1$", agm, zgm, dgm, 2, wgm);
370 // Xe/Isobutane-mixture
371 // Get properties of Xe
372 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
373 // Get properties of Isobutane
374 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
375 // Create gas mixture
378 dgm = wgm[0] * dxe + wgm[1] * dis;
379 AliMixture(11, "Gas mixture 2$", agm, zgm, dgm, 2, wgm);
381 //////////////////////////////////////////////////////////////////////////
382 // Tracking Media Parameters
383 //////////////////////////////////////////////////////////////////////////
386 AliMedium(1, "Al Frame$", 1, 0, isxfld, sxmgmx
387 , tmaxfd, stemax, deemax, epsil, stmin);
389 AliMedium(2, "Air$", 2, 0, isxfld, sxmgmx
390 , tmaxfd, stemax, deemax, epsil, stmin);
392 AliMedium(3, "Radiator$", 3, 0, isxfld, sxmgmx
393 , tmaxfd, stemax, deemax, epsil, stmin);
395 AliMedium(4, "Xe$", 4, 1, isxfld, sxmgmx
396 , tmaxfd, stemax, deemax, epsil, stmin);
398 AliMedium(5, "Padplane$", 5, 1, isxfld, sxmgmx
399 , tmaxfd, stemax, deemax, epsil, stmin);
401 AliMedium(6, "Readout$", 1, 0, isxfld, sxmgmx
402 , tmaxfd, stemax, deemax, epsil, stmin);
404 AliMedium(7, "C Frame$", 6, 0, isxfld, sxmgmx
405 , tmaxfd, stemax, deemax, epsil, stmin);
407 AliMedium(8, "Mylar$", 7, 0, isxfld, sxmgmx
408 , tmaxfd, stemax, deemax, epsil, stmin);
410 // Gas-mixture (Xe/CO2)
411 AliMedium(9, "Gas-mix$", 10, 1, isxfld, sxmgmx
412 , tmaxfd, stemax, deemax, epsil, stmin);
415 // Gas-mixture (Xe/Isobutane)
416 AliMedium(9, "Gas-mix$", 11, 1, isxfld, sxmgmx
417 , tmaxfd, stemax, deemax, epsil, stmin);
419 // Nomex-honeycomb (use carbon for the time being)
420 AliMedium(10, "Nomex$", 6, 0, isxfld, sxmgmx
421 , tmaxfd, stemax, deemax, epsil, stmin);
422 // Kapton foils (use Mylar for the time being)
423 AliMedium(11, "Kapton$", 7, 0, isxfld, sxmgmx
424 , tmaxfd, stemax, deemax, epsil, stmin);
425 // Gas-filling of the radiator
426 AliMedium(12, "CO2$", 8, 0, isxfld, sxmgmx
427 , tmaxfd, stemax, deemax, epsil, stmin);
429 AliMedium(13, "G10-plates$",12, 0, isxfld, sxmgmx
430 , tmaxfd, stemax, deemax, epsil, stmin);
432 AliMedium(14, "Water$", 13, 0, isxfld, sxmgmx
433 , tmaxfd, stemax, deemax, epsil, stmin);
437 //_____________________________________________________________________________
438 void AliTRD::DrawModule()
441 // Draw a shaded view of the Transition Radiation Detector version 0
444 // Set everything unseen
445 gMC->Gsatt("*" ,"SEEN",-1);
447 // Set ALIC mother transparent
448 gMC->Gsatt("ALIC","SEEN", 0);
450 // Set the volumes visible
451 if (fGeometry->IsVersion() == 0) {
452 gMC->Gsatt("B071","SEEN", 0);
453 gMC->Gsatt("B074","SEEN", 0);
454 gMC->Gsatt("B075","SEEN", 0);
455 gMC->Gsatt("B077","SEEN", 0);
456 gMC->Gsatt("BTR1","SEEN", 0);
457 gMC->Gsatt("BTR2","SEEN", 0);
458 gMC->Gsatt("BTR3","SEEN", 0);
459 gMC->Gsatt("TRD1","SEEN", 0);
460 gMC->Gsatt("TRD2","SEEN", 0);
461 gMC->Gsatt("TRD3","SEEN", 0);
464 gMC->Gsatt("B071","SEEN", 0);
465 gMC->Gsatt("B074","SEEN", 0);
466 gMC->Gsatt("B075","SEEN", 0);
467 gMC->Gsatt("B077","SEEN", 0);
468 gMC->Gsatt("BTR1","SEEN", 0);
469 gMC->Gsatt("BTR2","SEEN", 0);
470 gMC->Gsatt("BTR3","SEEN", 0);
471 gMC->Gsatt("TRD1","SEEN", 0);
472 if (fGeometry->GetPHOShole())
473 gMC->Gsatt("TRD2","SEEN", 0);
474 if (fGeometry->GetRICHhole())
475 gMC->Gsatt("TRD3","SEEN", 0);
477 gMC->Gsatt("UCII","SEEN", 0);
478 gMC->Gsatt("UCIM","SEEN", 0);
479 gMC->Gsatt("UCIO","SEEN", 0);
480 gMC->Gsatt("UL02","SEEN", 1);
481 gMC->Gsatt("UL05","SEEN", 1);
482 gMC->Gsatt("UL06","SEEN", 1);
484 gMC->Gdopt("hide", "on");
485 gMC->Gdopt("shad", "on");
486 gMC->Gsatt("*", "fill", 7);
487 gMC->SetClipBox(".");
488 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
490 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
491 gMC->Gdhead(1111, "Transition Radiation Detector");
492 gMC->Gdman(18, 4, "MAN");
496 //_____________________________________________________________________________
497 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
500 // Distance between the mouse and the TRD detector on the screen
507 //_____________________________________________________________________________
511 // Initialize the TRD detector after the geometry has been created
517 for (i = 0; i < 35; i++) printf("*");
518 printf(" TRD_INIT ");
519 for (i = 0; i < 35; i++) printf("*");
523 if (fGeometry->IsVersion() == 0) {
524 printf(" Geometry for spaceframe with holes initialized.\n\n");
526 else if (fGeometry->IsVersion() == 1) {
527 printf(" Geometry for spaceframe without holes initialized.\n");
528 if (fGeometry->GetPHOShole())
529 printf(" Leave space in front of PHOS free.\n");
530 if (fGeometry->GetRICHhole())
531 printf(" Leave space in front of RICH free.\n");
536 printf(" Gas Mixture: 90%% Xe + 10%% CO2\n\n");
538 printf(" Gas Mixture: 97%% Xe + 3%% Isobutane\n\n");
542 //_____________________________________________________________________________
543 void AliTRD::MakeBranch(Option_t* option)
546 // Create Tree branches for the TRD digits and cluster.
549 Int_t buffersize = 4000;
550 Char_t branchname[15];
552 AliDetector::MakeBranch(option);
554 Char_t *r = strstr(option,"R");
555 sprintf(branchname,"%srecPoints",GetName());
556 if (fRecPoints && gAlice->TreeR() && r) {
557 gAlice->TreeR()->Branch(branchname,fRecPoints->IsA()->GetName()
558 ,&fRecPoints,buffersize,0);
559 printf("* AliTRD::MakeBranch * Making Branch %s for points in TreeR\n",branchname);
564 //_____________________________________________________________________________
565 void AliTRD::ResetRecPoints()
568 // Reset number of reconstructed points and the point array
572 if (fRecPoints) fRecPoints->Delete();
576 //_____________________________________________________________________________
577 void AliTRD::SetTreeAddress()
580 // Set the branch addresses for the trees.
583 Char_t branchname[15];
585 AliDetector::SetTreeAddress();
588 TTree *treeR = gAlice->TreeR();
591 sprintf(branchname,"%srecPoints",GetName());
593 branch = treeR->GetBranch(branchname);
595 branch->SetAddress(&fRecPoints);
602 //_____________________________________________________________________________
603 void AliTRD::SetGasMix(Int_t imix)
606 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
609 if ((imix < 0) || (imix > 1)) {
610 printf("Wrong input value: %d\n",imix);
611 printf("Use standard setting\n");