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.20 2000/06/08 18:32:57 cblume
19 Make code compliant to coding conventions
21 Revision 1.19 2000/06/07 16:25:37 cblume
22 Try to remove compiler warnings on Sun and HP
24 Revision 1.18 2000/05/08 16:17:27 cblume
27 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
28 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
30 Revision 1.17 2000/02/28 19:10:26 cblume
31 Include the new TRD classes
33 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
34 Introduce TRD geometry classes
36 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
37 Include functions and data members for AliTRDrecPoint
39 Revision 1.16 2000/01/19 17:17:35 fca
40 Introducing a list of lists of hits -- more hits allowed for detector now
42 Revision 1.15 1999/11/02 17:04:25 fca
43 Small syntax change for HP compiler
45 Revision 1.14 1999/11/02 16:57:02 fca
46 Avoid non ansi warnings on HP compilers
48 Revision 1.13 1999/11/02 16:35:56 fca
49 New version of TRD introduced
51 Revision 1.12 1999/11/01 20:41:51 fca
52 Added protections against using the wrong version of FRAME
54 Revision 1.11 1999/09/29 09:24:34 fca
55 Introduction of the Copyright and cvs Log
59 ///////////////////////////////////////////////////////////////////////////////
61 // Transition Radiation Detector //
62 // This class contains the basic functions for the Transition Radiation //
65 ///////////////////////////////////////////////////////////////////////////////
76 #include "AliTRDdigitizer.h"
77 #include "AliTRDclusterizer.h"
78 #include "AliTRDgeometryHole.h"
79 #include "AliTRDgeometryFull.h"
80 #include "AliTRDrecPoint.h"
84 //_____________________________________________________________________________
88 // Default constructor
103 //_____________________________________________________________________________
104 AliTRD::AliTRD(const char *name, const char *title)
105 : AliDetector(name,title)
108 // Standard constructor for the TRD
111 // Check that FRAME is there otherwise we have no place where to
113 AliModule* frame = gAlice->GetModule("FRAME");
115 Error("Ctor","TRD needs FRAME to be present\n");
119 // Define the TRD geometry according to the FRAME geometry
120 if (frame->IsVersion() == 0) {
121 // Geometry with hole
122 fGeometry = new AliTRDgeometryHole();
124 else if (frame->IsVersion() == 1) {
125 // Geometry without hole
126 fGeometry = new AliTRDgeometryFull();
129 Error("Ctor","Could not find valid FRAME version\n");
133 // Allocate the hit array
134 fHits = new TClonesArray("AliTRDhit" ,405);
135 gAlice->AddHitList(fHits);
137 // Allocate the digits array
140 // Allocate the rec point array
141 fRecPoints = new TObjArray(400);
147 SetMarkerColor(kWhite);
151 //_____________________________________________________________________________
152 AliTRD::AliTRD(const AliTRD &trd)
158 ((AliTRD &) trd).Copy(*this);
162 //_____________________________________________________________________________
177 //_____________________________________________________________________________
178 void AliTRD::AddRecPoint(Float_t *pos, Int_t *digits, Int_t det, Float_t amp)
181 // Add a reconstructed point for the TRD
184 AliTRDrecPoint *recPoint = new AliTRDrecPoint();
185 TVector3 posVec(pos[0],pos[1],pos[2]);
186 recPoint->SetLocalPosition(posVec);
187 recPoint->SetDetector(det);
188 recPoint->SetEnergy(amp);
189 for (Int_t iDigit = 0; iDigit < 3; iDigit++) {
190 recPoint->AddDigit(digits[iDigit]);
193 fRecPoints->Add(recPoint);
197 //_____________________________________________________________________________
198 void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
201 // Add a digit for the TRD
204 TClonesArray &ldigits = *fDigits;
205 new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
209 //_____________________________________________________________________________
210 void AliTRD::AddHit(Int_t track, Int_t *det, Float_t *hits)
213 // Add a hit for the TRD
216 TClonesArray &lhits = *fHits;
217 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits);
221 //_____________________________________________________________________________
222 void AliTRD::BuildGeometry()
225 // Create the ROOT TNode geometry for the TRD
230 const Int_t kColorTRD = 46;
232 // Find the top node alice
233 top = gAlice->GetGeometry()->GetNode("alice");
235 pgon = new TPGON("S_TRD","TRD","void",0,360,kNsect,4);
236 Float_t ff = TMath::Cos(kDegrad * 180 / kNsect);
237 Float_t rrmin = kRmin / ff;
238 Float_t rrmax = kRmax / ff;
239 pgon->DefineSection(0,-kZmax1,rrmax,rrmax);
240 pgon->DefineSection(1,-kZmax2,rrmin,rrmax);
241 pgon->DefineSection(2, kZmax2,rrmin,rrmax);
242 pgon->DefineSection(3, kZmax1,rrmax,rrmax);
244 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
245 node->SetLineColor(kColorTRD);
250 //_____________________________________________________________________________
251 void AliTRD::Copy(TObject &trd)
257 ((AliTRD &) trd).fGasMix = fGasMix;
258 ((AliTRD &) trd).fGeometry = fGeometry;
259 ((AliTRD &) trd).fRecPoints = fRecPoints;
260 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
262 //AliDetector::Copy(trd);
266 //_____________________________________________________________________________
267 void AliTRD::CreateGeometry()
270 // Creates the volumes for the TRD chambers
273 // Check that FRAME is there otherwise we have no place where to put the TRD
274 AliModule* frame = gAlice->GetModule("FRAME");
276 printf(" The TRD needs the FRAME to be defined first\n");
280 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
284 //_____________________________________________________________________________
285 void AliTRD::CreateMaterials()
288 // Create the materials for the TRD
292 Int_t isxfld = gAlice->Field()->Integ();
293 Float_t sxmgmx = gAlice->Field()->Max();
295 // For polyethilene (CH2)
296 Float_t ape[2] = { 12., 1. };
297 Float_t zpe[2] = { 6., 1. };
298 Float_t wpe[2] = { 1., 2. };
301 // For mylar (C5H4O2)
302 Float_t amy[3] = { 12., 1., 16. };
303 Float_t zmy[3] = { 6., 1., 8. };
304 Float_t wmy[3] = { 5., 4., 2. };
308 Float_t aco[2] = { 12., 16. };
309 Float_t zco[2] = { 6., 8. };
310 Float_t wco[2] = { 1., 2. };
311 Float_t dco = 0.001977;
314 Float_t awa[2] = { 1., 16. };
315 Float_t zwa[2] = { 1., 8. };
316 Float_t wwa[2] = { 2., 1. };
319 // For isobutane (C4H10)
320 Float_t ais[2] = { 12., 1. };
321 Float_t zis[2] = { 6., 1. };
322 Float_t wis[2] = { 4., 10. };
323 Float_t dis = 0.00267;
325 // For Xe/CO2-gas-mixture
326 // Xe-content of the Xe/CO2-mixture (90% / 10%)
328 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
330 Float_t dxe = .005858;
332 // General tracking parameter
333 Float_t tmaxfd = -10.;
334 Float_t stemax = -1e10;
335 Float_t deemax = -0.1;
336 Float_t epsil = 1e-4;
337 Float_t stmin = -0.001;
339 Float_t absl, radl, d, buf[1];
340 Float_t agm[2], dgm, zgm[2], wgm[2];
343 //////////////////////////////////////////////////////////////////////////
345 //////////////////////////////////////////////////////////////////////////
347 AliMaterial( 1, "Al $", 26.98, 13.0, 2.7 , 8.9 , 37.2);
348 AliMaterial( 2, "Air$", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
349 AliMaterial( 4, "Xe $", 131.29, 54.0, dxe , 1447.59, 0.0);
350 AliMaterial( 5, "Cu $", 63.54, 29.0, 8.96 , 1.43, 14.8);
351 AliMaterial( 6, "C $", 12.01, 6.0, 2.265 , 18.8 , 74.4);
352 AliMaterial(12, "G10$", 20.00, 10.0, 1.7 , 19.4 , 999.0);
355 AliMixture(3, "Polyethilene$", ape, zpe, dpe, -2, wpe);
356 AliMixture(7, "Mylar$", amy, zmy, dmy, -3, wmy);
357 AliMixture(8, "CO2$", aco, zco, dco, -2, wco);
358 AliMixture(9, "Isobutane$", ais, zis, dis, -2, wis);
359 AliMixture(13,"Water$", awa, zwa, dwa, -2, wwa);
364 // Get properties of Xe
365 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
366 // Get properties of CO2
367 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
368 // Create gas mixture
371 dgm = wgm[0] * dxe + wgm[1] * dco;
372 AliMixture(10, "Gas mixture 1$", agm, zgm, dgm, 2, wgm);
373 // Xe/Isobutane-mixture
374 // Get properties of Xe
375 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
376 // Get properties of Isobutane
377 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
378 // Create gas mixture
381 dgm = wgm[0] * dxe + wgm[1] * dis;
382 AliMixture(11, "Gas mixture 2$", agm, zgm, dgm, 2, wgm);
384 //////////////////////////////////////////////////////////////////////////
385 // Tracking Media Parameters
386 //////////////////////////////////////////////////////////////////////////
389 AliMedium(1, "Al Frame$", 1, 0, isxfld, sxmgmx
390 , tmaxfd, stemax, deemax, epsil, stmin);
392 AliMedium(2, "Air$", 2, 0, isxfld, sxmgmx
393 , tmaxfd, stemax, deemax, epsil, stmin);
395 AliMedium(3, "Radiator$", 3, 0, isxfld, sxmgmx
396 , tmaxfd, stemax, deemax, epsil, stmin);
398 AliMedium(4, "Xe$", 4, 1, isxfld, sxmgmx
399 , tmaxfd, stemax, deemax, epsil, stmin);
401 AliMedium(5, "Padplane$", 5, 1, isxfld, sxmgmx
402 , tmaxfd, stemax, deemax, epsil, stmin);
404 AliMedium(6, "Readout$", 1, 0, isxfld, sxmgmx
405 , tmaxfd, stemax, deemax, epsil, stmin);
407 AliMedium(7, "C Frame$", 6, 0, isxfld, sxmgmx
408 , tmaxfd, stemax, deemax, epsil, stmin);
410 AliMedium(8, "Mylar$", 7, 0, isxfld, sxmgmx
411 , tmaxfd, stemax, deemax, epsil, stmin);
413 // Gas-mixture (Xe/CO2)
414 AliMedium(9, "Gas-mix$", 10, 1, isxfld, sxmgmx
415 , tmaxfd, stemax, deemax, epsil, stmin);
418 // Gas-mixture (Xe/Isobutane)
419 AliMedium(9, "Gas-mix$", 11, 1, isxfld, sxmgmx
420 , tmaxfd, stemax, deemax, epsil, stmin);
422 // Nomex-honeycomb (use carbon for the time being)
423 AliMedium(10, "Nomex$", 6, 0, isxfld, sxmgmx
424 , tmaxfd, stemax, deemax, epsil, stmin);
425 // Kapton foils (use Mylar for the time being)
426 AliMedium(11, "Kapton$", 7, 0, isxfld, sxmgmx
427 , tmaxfd, stemax, deemax, epsil, stmin);
428 // Gas-filling of the radiator
429 AliMedium(12, "CO2$", 8, 0, isxfld, sxmgmx
430 , tmaxfd, stemax, deemax, epsil, stmin);
432 AliMedium(13, "G10-plates$",12, 0, isxfld, sxmgmx
433 , tmaxfd, stemax, deemax, epsil, stmin);
435 AliMedium(14, "Water$", 13, 0, isxfld, sxmgmx
436 , tmaxfd, stemax, deemax, epsil, stmin);
440 //_____________________________________________________________________________
441 void AliTRD::DrawModule()
444 // Draw a shaded view of the Transition Radiation Detector version 0
447 // Set everything unseen
448 gMC->Gsatt("*" ,"SEEN",-1);
450 // Set ALIC mother transparent
451 gMC->Gsatt("ALIC","SEEN", 0);
453 // Set the volumes visible
454 if (fGeometry->IsVersion() == 0) {
455 gMC->Gsatt("B071","SEEN", 0);
456 gMC->Gsatt("B074","SEEN", 0);
457 gMC->Gsatt("B075","SEEN", 0);
458 gMC->Gsatt("B077","SEEN", 0);
459 gMC->Gsatt("BTR1","SEEN", 0);
460 gMC->Gsatt("BTR2","SEEN", 0);
461 gMC->Gsatt("BTR3","SEEN", 0);
462 gMC->Gsatt("TRD1","SEEN", 0);
463 gMC->Gsatt("TRD2","SEEN", 0);
464 gMC->Gsatt("TRD3","SEEN", 0);
467 gMC->Gsatt("B071","SEEN", 0);
468 gMC->Gsatt("B074","SEEN", 0);
469 gMC->Gsatt("B075","SEEN", 0);
470 gMC->Gsatt("B077","SEEN", 0);
471 gMC->Gsatt("BTR1","SEEN", 0);
472 gMC->Gsatt("BTR2","SEEN", 0);
473 gMC->Gsatt("BTR3","SEEN", 0);
474 gMC->Gsatt("TRD1","SEEN", 0);
475 if (fGeometry->GetPHOShole())
476 gMC->Gsatt("TRD2","SEEN", 0);
477 if (fGeometry->GetRICHhole())
478 gMC->Gsatt("TRD3","SEEN", 0);
480 gMC->Gsatt("UCII","SEEN", 0);
481 gMC->Gsatt("UCIM","SEEN", 0);
482 gMC->Gsatt("UCIO","SEEN", 0);
483 gMC->Gsatt("UL02","SEEN", 1);
484 gMC->Gsatt("UL05","SEEN", 1);
485 gMC->Gsatt("UL06","SEEN", 1);
487 gMC->Gdopt("hide", "on");
488 gMC->Gdopt("shad", "on");
489 gMC->Gsatt("*", "fill", 7);
490 gMC->SetClipBox(".");
491 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
493 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
494 gMC->Gdhead(1111, "Transition Radiation Detector");
495 gMC->Gdman(18, 4, "MAN");
499 //_____________________________________________________________________________
500 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
503 // Distance between the mouse and the TRD detector on the screen
510 //_____________________________________________________________________________
514 // Initialize the TRD detector after the geometry has been created
520 for (i = 0; i < 35; i++) printf("*");
521 printf(" TRD_INIT ");
522 for (i = 0; i < 35; i++) printf("*");
526 if (fGeometry->IsVersion() == 0) {
527 printf(" Geometry for spaceframe with holes initialized.\n\n");
529 else if (fGeometry->IsVersion() == 1) {
530 printf(" Geometry for spaceframe without holes initialized.\n");
531 if (fGeometry->GetPHOShole())
532 printf(" Leave space in front of PHOS free.\n");
533 if (fGeometry->GetRICHhole())
534 printf(" Leave space in front of RICH free.\n");
539 printf(" Gas Mixture: 90%% Xe + 10%% CO2\n\n");
541 printf(" Gas Mixture: 97%% Xe + 3%% Isobutane\n\n");
545 //_____________________________________________________________________________
546 void AliTRD::MakeBranch(Option_t* option)
549 // Create Tree branches for the TRD digits and cluster.
552 Int_t buffersize = 4000;
553 Char_t branchname[15];
555 AliDetector::MakeBranch(option);
557 Char_t *r = strstr(option,"R");
558 sprintf(branchname,"%srecPoints",GetName());
559 if (fRecPoints && gAlice->TreeR() && r) {
560 gAlice->TreeR()->Branch(branchname,fRecPoints->IsA()->GetName()
561 ,&fRecPoints,buffersize,0);
562 printf("* AliTRD::MakeBranch * Making Branch %s for points in TreeR\n",branchname);
567 //_____________________________________________________________________________
568 void AliTRD::ResetRecPoints()
571 // Reset number of reconstructed points and the point array
575 if (fRecPoints) fRecPoints->Delete();
579 //_____________________________________________________________________________
580 void AliTRD::SetTreeAddress()
583 // Set the branch addresses for the trees.
586 Char_t branchname[15];
588 AliDetector::SetTreeAddress();
591 TTree *treeR = gAlice->TreeR();
594 sprintf(branchname,"%srecPoints",GetName());
596 branch = treeR->GetBranch(branchname);
598 branch->SetAddress(&fRecPoints);
605 //_____________________________________________________________________________
606 void AliTRD::SetGasMix(Int_t imix)
609 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
612 if ((imix < 0) || (imix > 1)) {
613 printf("Wrong input value: %d\n",imix);
614 printf("Use standard setting\n");
623 //_____________________________________________________________________________
624 AliTRD &AliTRD::operator=(const AliTRD &trd)
627 // Assignment operator
630 if (this != &trd) ((AliTRD &) trd).Copy(*this);