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.32 2001/10/08 06:57:33 hristov
19 Branches for TRD digits are created only during the digitisation
21 Revision 1.31 2001/08/30 09:30:30 hristov
22 The split level of branches is set to 99
24 Revision 1.30 2001/05/28 17:07:58 hristov
25 Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh)
27 Revision 1.29 2001/05/21 16:45:47 hristov
28 Last minute changes (C.Blume)
30 Revision 1.28 2001/05/16 14:57:27 alibrary
31 New files for folders and Stack
33 Revision 1.27 2001/05/08 07:05:02 hristov
34 Loop variable declared once (HP, Sun)
36 Revision 1.26 2001/05/07 08:03:22 cblume
37 Generate also hits in the amplification region
39 Revision 1.25 2001/03/13 09:30:35 cblume
40 Update of digitization. Moved digit branch definition to AliTRD
42 Revision 1.24 2001/01/26 19:56:49 hristov
43 Major upgrade of AliRoot code
45 Revision 1.23 2000/11/01 14:53:20 cblume
46 Merge with TRD-develop
48 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
49 Introduced more detailed geometry for the display
51 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
54 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
55 Replace include files by forward declarations
57 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
58 Included changes for the tracking
60 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
61 Included LoadPoints() method to display the TR photons
63 Revision 1.22 2000/10/02 21:28:19 fca
64 Removal of useless dependecies via forward declarations
66 Revision 1.21 2000/06/09 11:10:07 cblume
67 Compiler warnings and coding conventions, next round
69 Revision 1.20 2000/06/08 18:32:57 cblume
70 Make code compliant to coding conventions
72 Revision 1.19 2000/06/07 16:25:37 cblume
73 Try to remove compiler warnings on Sun and HP
75 Revision 1.18 2000/05/08 16:17:27 cblume
78 Revision 1.21 2000/06/09 11:10:07 cblume
79 Compiler warnings and coding conventions, next round
81 Revision 1.20 2000/06/08 18:32:57 cblume
82 Make code compliant to coding conventions
84 Revision 1.19 2000/06/07 16:25:37 cblume
85 Try to remove compiler warnings on Sun and HP
87 Revision 1.18 2000/05/08 16:17:27 cblume
90 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
91 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
93 Revision 1.17 2000/02/28 19:10:26 cblume
94 Include the new TRD classes
96 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
97 Introduce TRD geometry classes
99 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
100 Include functions and data members for AliTRDrecPoint
102 Revision 1.16 2000/01/19 17:17:35 fca
103 Introducing a list of lists of hits -- more hits allowed for detector now
105 Revision 1.15 1999/11/02 17:04:25 fca
106 Small syntax change for HP compiler
108 Revision 1.14 1999/11/02 16:57:02 fca
109 Avoid non ansi warnings on HP compilers
111 Revision 1.13 1999/11/02 16:35:56 fca
112 New version of TRD introduced
114 Revision 1.12 1999/11/01 20:41:51 fca
115 Added protections against using the wrong version of FRAME
117 Revision 1.11 1999/09/29 09:24:34 fca
118 Introduction of the Copyright and cvs Log
122 ///////////////////////////////////////////////////////////////////////////////
124 // Transition Radiation Detector //
125 // This class contains the basic functions for the Transition Radiation //
128 ///////////////////////////////////////////////////////////////////////////////
131 #include <iostream.h>
135 #include <TGeometry.h>
140 #include "AliConst.h"
141 #include "AliDigit.h"
146 #include "AliTRDhit.h"
147 #include "AliTRDpoints.h"
148 #include "AliTRDdigit.h"
149 #include "AliTRDdigitizer.h"
150 #include "AliTRDclusterizer.h"
151 #include "AliTRDgeometryHole.h"
152 #include "AliTRDgeometryFull.h"
153 #include "AliTRDrecPoint.h"
154 #include "AliTRDcluster.h"
155 #include "AliTRDdigitsManager.h"
156 #include "AliTRDdataArrayI.h"
157 #include "AliTRDsegmentArray.h"
161 //_____________________________________________________________________________
165 // Default constructor
185 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
186 fDictionaryArray[iDict] = 0;
191 //_____________________________________________________________________________
192 AliTRD::AliTRD(const char *name, const char *title)
193 : AliDetector(name,title)
196 // Standard constructor for the TRD
199 // Check that FRAME is there otherwise we have no place where to
201 AliModule* frame = gAlice->GetModule("FRAME");
203 Error("Ctor","TRD needs FRAME to be present\n");
207 // Define the TRD geometry according to the FRAME geometry
208 if (frame->IsVersion() == 0) {
209 // Geometry with hole
210 fGeometry = new AliTRDgeometryHole();
212 else if (frame->IsVersion() == 1) {
213 // Geometry without hole
214 fGeometry = new AliTRDgeometryFull();
217 Error("Ctor","Could not find valid FRAME version\n");
221 // Allocate the hit array
222 fHits = new TClonesArray("AliTRDhit" ,405);
223 gAlice->AddHitList(fHits);
225 // Allocate the digits array
228 // Allocate the rec point array
229 fRecPoints = new TObjArray(400);
242 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
243 fDictionaryArray[iDict] = 0;
246 SetMarkerColor(kWhite);
250 //_____________________________________________________________________________
251 AliTRD::AliTRD(const AliTRD &trd)
257 ((AliTRD &) trd).Copy(*this);
261 //_____________________________________________________________________________
273 if (fDigitsArray) delete fDigitsArray;
274 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
275 if (fDictionaryArray[iDict]) delete fDictionaryArray[iDict];
280 //_____________________________________________________________________________
281 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
282 , Int_t *tracks, Float_t sigmaY2, Int_t iType)
285 // Add a cluster for the TRD
288 Int_t pla = fGeometry->GetPlane(det);
289 Int_t cha = fGeometry->GetChamber(det);
290 Int_t sec = fGeometry->GetSector(det);
292 Float_t padRow = pos[0];
293 Float_t padCol = pos[1];
294 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
295 Float_t col0 = fGeometry->GetCol0(pla);
296 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
297 Float_t colSize = fGeometry->GetColPadSize(pla);
299 AliTRDcluster *c = new AliTRDcluster();
302 c->AddTrackIndex(tracks);
306 c->SetLocalTimeBin(((Int_t) pos[2]));
307 c->SetY(- (col0 + padCol * colSize));
308 c->SetZ( row0 + padRow * rowSize);
310 c->SetSigmaY2((sigmaY2 + 1./12.) * colSize*colSize);
311 c->SetSigmaZ2(rowSize * rowSize / 12.);
335 //_____________________________________________________________________________
336 void AliTRD::Hits2Digits()
342 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
343 ,"TRD digitizer class");
346 digitizer->SetDiffusion();
348 digitizer->SetEvent(gAlice->GetEvNumber());
350 digitizer->InitDetector();
353 digitizer->MakeDigits();
355 // Write the digits into the input file
356 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
358 digitizer->WriteDigits();
360 // Save the digitizer class in the AliROOT
367 //_____________________________________________________________________________
368 void AliTRD::Hits2SDigits()
371 // Create summable digits
374 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
375 ,"TRD digitizer class");
377 // For the summable digits
378 digitizer->SetSDigits(kTRUE);
381 digitizer->SetDiffusion();
383 digitizer->SetEvent(gAlice->GetEvNumber());
386 digitizer->InitDetector();
389 digitizer->MakeDigits();
391 // Write the digits into the input file
392 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
394 digitizer->WriteDigits();
396 // Save the digitizer class in the AliROOT
403 //_____________________________________________________________________________
404 void AliTRD::SDigits2Digits()
407 // Create final digits from summable digits
412 //_____________________________________________________________________________
413 void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
416 // Add a digit for the TRD
419 TClonesArray &ldigits = *fDigits;
420 new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
424 //_____________________________________________________________________________
425 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q)
428 // Add a hit for the TRD
431 TClonesArray &lhits = *fHits;
432 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
436 //_____________________________________________________________________________
437 void AliTRD::BuildGeometry()
440 // Create the ROOT TNode geometry for the TRD
447 Float_t zmax1, zmax2;
451 const Int_t kColorTRD = 46;
453 // Find the top node alice
454 top = gAlice->GetGeometry()->GetNode("alice");
456 if (fDisplayType == 0) {
458 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
459 rmin = AliTRDgeometry::Rmin();
460 rmax = AliTRDgeometry::Rmax();
461 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
462 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
463 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
464 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
466 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
467 node->SetLineColor(kColorTRD);
471 else if (fDisplayType == 1) {
475 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
476 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
478 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::Ccframe()/2.
479 + AliTRDgeometry::DrZpos()
480 - AliTRDgeometry::DrThick()/2.;
481 rmax = rmin + AliTRDgeometry::DrThick();
483 Float_t thickness = rmin - AliTRDgeometry::Rmin();
484 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
485 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
487 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
489 sprintf(name,"S_TR1%d",iPlan);
490 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
491 pgon->DefineSection(0,-zmax1,rmax,rmax);
492 pgon->DefineSection(1,-zmax2,rmin,rmax);
493 pgon->DefineSection(2, zmax2,rmin,rmax);
494 pgon->DefineSection(3, zmax1,rmax,rmax);
496 node = new TNode("TRD","TRD",name,0,0,0,"");
497 node->SetLineColor(kColorTRD);
500 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
501 rmin = rmin + height;
502 rmax = rmax + height;
503 zmax1 = zmax1 + slope * height;
504 zmax2 = zmax2 + slope * height;
508 thickness += AliTRDgeometry::DrThick();
509 rmin = AliTRDgeometry::Rmin() + thickness;
510 rmax = rmin + AliTRDgeometry::AmThick();
511 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
512 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
514 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
516 sprintf(name,"S_TR2%d",iPlan);
517 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
518 pgon->DefineSection(0,-zmax1,rmax,rmax);
519 pgon->DefineSection(1,-zmax2,rmin,rmax);
520 pgon->DefineSection(2, zmax2,rmin,rmax);
521 pgon->DefineSection(3, zmax1,rmax,rmax);
523 node = new TNode("TRD","TRD",name,0,0,0,"");
524 node->SetLineColor(kColorTRD);
527 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
528 rmin = rmin + height;
529 rmax = rmax + height;
530 zmax1 = zmax1 + slope * height;
531 zmax2 = zmax2 + slope * height;
539 //_____________________________________________________________________________
540 void AliTRD::Copy(TObject &trd)
546 ((AliTRD &) trd).fGasMix = fGasMix;
547 ((AliTRD &) trd).fGeometry = fGeometry;
548 ((AliTRD &) trd).fRecPoints = fRecPoints;
549 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
550 ((AliTRD &) trd).fGasDensity = fGasDensity;
551 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
552 ((AliTRD &) trd).fDrawTR = fDrawTR;
553 ((AliTRD &) trd).fDisplayType = fDisplayType;
555 //AliDetector::Copy(trd);
559 //_____________________________________________________________________________
560 void AliTRD::CreateGeometry()
563 // Creates the volumes for the TRD chambers
566 // Check that FRAME is there otherwise we have no place where to put the TRD
567 AliModule* frame = gAlice->GetModule("FRAME");
569 printf(" The TRD needs the FRAME to be defined first\n");
573 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
577 //_____________________________________________________________________________
578 void AliTRD::CreateMaterials()
581 // Create the materials for the TRD
585 Int_t isxfld = gAlice->Field()->Integ();
586 Float_t sxmgmx = gAlice->Field()->Max();
588 // For polyethilene (CH2)
589 Float_t ape[2] = { 12., 1. };
590 Float_t zpe[2] = { 6., 1. };
591 Float_t wpe[2] = { 1., 2. };
594 // For mylar (C5H4O2)
595 Float_t amy[3] = { 12., 1., 16. };
596 Float_t zmy[3] = { 6., 1., 8. };
597 Float_t wmy[3] = { 5., 4., 2. };
601 Float_t aco[2] = { 12., 16. };
602 Float_t zco[2] = { 6., 8. };
603 Float_t wco[2] = { 1., 2. };
604 Float_t dco = 0.001977;
607 Float_t awa[2] = { 1., 16. };
608 Float_t zwa[2] = { 1., 8. };
609 Float_t wwa[2] = { 2., 1. };
612 // For isobutane (C4H10)
613 Float_t ais[2] = { 12., 1. };
614 Float_t zis[2] = { 6., 1. };
615 Float_t wis[2] = { 4., 10. };
616 Float_t dis = 0.00267;
618 // For plexiglas (C5H8O2)
619 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
620 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
621 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
624 // For Xe/CO2-gas-mixture
625 // Xe-content of the Xe/CO2-mixture (85% / 15%)
627 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
629 Float_t dxe = .005858;
631 // General tracking parameter
632 Float_t tmaxfd = -10.;
633 Float_t stemax = -1e10;
634 Float_t deemax = -0.1;
635 Float_t epsil = 1e-4;
636 Float_t stmin = -0.001;
638 Float_t absl, radl, d, buf[1];
639 Float_t agm[2], zgm[2], wgm[2];
643 //////////////////////////////////////////////////////////////////////////
645 //////////////////////////////////////////////////////////////////////////
647 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
648 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
649 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
650 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
651 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
652 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
653 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
654 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
655 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
658 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
659 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
660 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
661 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
662 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
663 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
668 // Get properties of Xe
669 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
670 // Get properties of CO2
671 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
672 // Create gas mixture
675 dgm1 = wgm[0] * dxe + wgm[1] * dco;
676 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
677 // Xe/Isobutane-mixture
678 // Get properties of Xe
679 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
680 // Get properties of Isobutane
681 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
682 // Create gas mixture
685 dgm2 = wgm[0] * dxe + wgm[1] * dis;
686 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
688 //////////////////////////////////////////////////////////////////////////
689 // Tracking Media Parameters
690 //////////////////////////////////////////////////////////////////////////
693 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
694 , tmaxfd, stemax, deemax, epsil, stmin);
696 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
697 , tmaxfd, stemax, deemax, epsil, stmin);
699 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
700 , tmaxfd, stemax, deemax, epsil, stmin);
702 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
703 , tmaxfd, stemax, deemax, epsil, stmin);
705 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
706 , tmaxfd, stemax, deemax, epsil, stmin);
708 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
709 , tmaxfd, stemax, deemax, epsil, stmin);
711 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
712 , tmaxfd, stemax, deemax, epsil, stmin);
714 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
715 , tmaxfd, stemax, deemax, epsil, stmin);
717 // Gas-mixture (Xe/CO2)
718 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
719 , tmaxfd, stemax, deemax, epsil, stmin);
722 // Gas-mixture (Xe/Isobutane)
723 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
724 , tmaxfd, stemax, deemax, epsil, stmin);
726 // Nomex-honeycomb (use carbon for the time being)
727 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
728 , tmaxfd, stemax, deemax, epsil, stmin);
729 // Kapton foils (use Mylar for the time being)
730 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
731 , tmaxfd, stemax, deemax, epsil, stmin);
732 // Gas-filling of the radiator
733 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
734 , tmaxfd, stemax, deemax, epsil, stmin);
736 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
737 , tmaxfd, stemax, deemax, epsil, stmin);
739 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
740 , tmaxfd, stemax, deemax, epsil, stmin);
741 // Rohacell (plexiglas) for the radiator
742 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
743 , tmaxfd, stemax, deemax, epsil, stmin);
745 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
746 , tmaxfd, stemax, deemax, epsil, stmin);
748 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
749 , tmaxfd, stemax, deemax, epsil, stmin);
751 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
752 , tmaxfd, stemax, deemax, epsil, stmin);
754 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
755 , tmaxfd, stemax, deemax, epsil, stmin);
756 // Si in readout chips
757 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
758 , tmaxfd, stemax, deemax, epsil, stmin);
759 // Epoxy in readout chips
760 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
761 , tmaxfd, stemax, deemax, epsil, stmin);
763 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
764 , tmaxfd, stemax, deemax, epsil, stmin);
766 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
767 , tmaxfd, stemax, deemax, epsil, stmin);
768 // Al of cooling pipes
769 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
770 , tmaxfd, stemax, deemax, epsil, stmin);
772 // Save the density values for the TRD absorbtion
781 //_____________________________________________________________________________
782 void AliTRD::DrawModule()
785 // Draw a shaded view of the Transition Radiation Detector version 0
788 // Set everything unseen
789 gMC->Gsatt("*" ,"SEEN",-1);
791 // Set ALIC mother transparent
792 gMC->Gsatt("ALIC","SEEN", 0);
794 // Set the volumes visible
795 if (fGeometry->IsVersion() == 0) {
796 gMC->Gsatt("B071","SEEN", 0);
797 gMC->Gsatt("B074","SEEN", 0);
798 gMC->Gsatt("B075","SEEN", 0);
799 gMC->Gsatt("B077","SEEN", 0);
800 gMC->Gsatt("BTR1","SEEN", 0);
801 gMC->Gsatt("BTR2","SEEN", 0);
802 gMC->Gsatt("BTR3","SEEN", 0);
803 gMC->Gsatt("TRD1","SEEN", 0);
804 gMC->Gsatt("TRD2","SEEN", 0);
805 gMC->Gsatt("TRD3","SEEN", 0);
808 gMC->Gsatt("B071","SEEN", 0);
809 gMC->Gsatt("B074","SEEN", 0);
810 gMC->Gsatt("B075","SEEN", 0);
811 gMC->Gsatt("B077","SEEN", 0);
812 gMC->Gsatt("BTR1","SEEN", 0);
813 gMC->Gsatt("BTR2","SEEN", 0);
814 gMC->Gsatt("BTR3","SEEN", 0);
815 gMC->Gsatt("TRD1","SEEN", 0);
816 if (fGeometry->GetPHOShole())
817 gMC->Gsatt("TRD2","SEEN", 0);
818 if (fGeometry->GetRICHhole())
819 gMC->Gsatt("TRD3","SEEN", 0);
821 gMC->Gsatt("UCII","SEEN", 0);
822 gMC->Gsatt("UCIM","SEEN", 0);
823 gMC->Gsatt("UCIO","SEEN", 0);
824 gMC->Gsatt("UL02","SEEN", 1);
825 gMC->Gsatt("UL05","SEEN", 1);
826 gMC->Gsatt("UL06","SEEN", 1);
828 gMC->Gdopt("hide", "on");
829 gMC->Gdopt("shad", "on");
830 gMC->Gsatt("*", "fill", 7);
831 gMC->SetClipBox(".");
832 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
834 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
835 gMC->Gdhead(1111, "Transition Radiation Detector");
836 gMC->Gdman(18, 4, "MAN");
840 //_____________________________________________________________________________
841 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
844 // Distance between the mouse and the TRD detector on the screen
851 //_____________________________________________________________________________
855 // Initialize the TRD detector after the geometry has been created
861 printf("\n%s: ",ClassName());
862 for (i = 0; i < 35; i++) printf("*");
863 printf(" TRD_INIT ");
864 for (i = 0; i < 35; i++) printf("*");
868 if (fGeometry->IsVersion() == 0) {
869 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
871 else if (fGeometry->IsVersion() == 1) {
872 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
873 if (fGeometry->GetPHOShole())
874 printf("%s: Leave space in front of PHOS free\n",ClassName());
875 if (fGeometry->GetRICHhole())
876 printf("%s: Leave space in front of RICH free\n",ClassName());
880 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
882 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
886 //_____________________________________________________________________________
887 void AliTRD::LoadPoints(Int_t track)
890 // Store x, y, z of all hits in memory.
891 // Hit originating from TR photons are given a different color
895 AliDetector::LoadPoints(track);
899 if (fHits == 0) return;
901 Int_t nhits = fHits->GetEntriesFast();
902 if (nhits == 0) return;
904 Int_t tracks = gAlice->GetNtrack();
905 if (fPoints == 0) fPoints = new TObjArray(tracks);
909 Int_t *ntrkE = new Int_t[tracks];
910 Int_t *ntrkT = new Int_t[tracks];
911 Int_t *limiE = new Int_t[tracks];
912 Int_t *limiT = new Int_t[tracks];
913 Float_t **coorE = new Float_t*[tracks];
914 Float_t **coorT = new Float_t*[tracks];
915 for(Int_t i = 0; i < tracks; i++) {
924 AliTRDpoints *points = 0;
927 Int_t chunk = nhits / 4 + 1;
929 // Loop over all the hits and store their position
930 for (Int_t hit = 0; hit < nhits; hit++) {
932 ahit = (AliTRDhit *) fHits->UncheckedAt(hit);
935 if (ahit->FromDrift() || ahit->FromAmplification()) {
937 trk = ahit->GetTrack();
938 if (ntrkE[trk] == limiE[trk]) {
939 // Initialise a new track
940 fp = new Float_t[3*(limiE[trk]+chunk)];
942 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
943 delete [] coorE[trk];
951 fp[3*ntrkE[trk] ] = ahit->X();
952 fp[3*ntrkE[trk]+1] = ahit->Y();
953 fp[3*ntrkE[trk]+2] = ahit->Z();
958 else if (ahit->FromTRphoton()) {
960 trk = ahit->GetTrack();
961 if (ntrkT[trk] == limiT[trk]) {
962 // Initialise a new track
963 fp = new Float_t[3*(limiT[trk]+chunk)];
965 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
966 delete [] coorT[trk];
974 fp[3*ntrkT[trk] ] = ahit->X();
975 fp[3*ntrkT[trk]+1] = ahit->Y();
976 fp[3*ntrkT[trk]+2] = ahit->Z();
983 for (trk = 0; trk < tracks; ++trk) {
985 if (ntrkE[trk] || ntrkT[trk]) {
987 points = new AliTRDpoints();
988 points->SetDetector(this);
989 points->SetParticle(trk);
991 // Set the dEdx points
993 points->SetMarkerColor(GetMarkerColor());
994 points->SetMarkerSize(GetMarkerSize());
995 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
996 delete [] coorE[trk];
1000 // Set the TR photon points
1002 points->SetTRpoints(ntrkT[trk],coorT[trk]);
1003 delete [] coorT[trk];
1007 fPoints->AddAt(points,trk);
1022 //_____________________________________________________________________________
1023 void AliTRD::MakeBranch(Option_t* option, const char *file)
1026 // Create Tree branches for the TRD digits and cluster.
1029 //Int_t buffersize = 4000;
1030 //Char_t branchname[15];
1032 const char *cD = strstr(option,"D");
1034 AliDetector::MakeBranch(option,file);
1036 Int_t buffersize = 64000;
1039 fDigitsArray = new AliTRDdataArrayI();
1040 MakeBranchInTree(gAlice->TreeD()
1041 ,"TRDdigits", fDigitsArray->IsA()->GetName()
1042 ,&fDigitsArray,buffersize,99,file);
1044 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
1045 Char_t branchname[15];
1046 sprintf(branchname,"TRDdictionary%d",iDict);
1047 fDictionaryArray[iDict] = new AliTRDdataArrayI();
1048 MakeBranchInTree(gAlice->TreeD()
1049 ,branchname,fDictionaryArray[iDict]->IsA()->GetName()
1050 ,&fDictionaryArray[iDict],buffersize,99,file);
1055 //_____________________________________________________________________________
1056 void AliTRD::ResetDigits()
1059 // Resets the digits
1062 if (gAlice->TreeD()) {
1064 branch = gAlice->TreeD()->GetBranch("TRDdigits");
1067 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
1068 Char_t branchname[15];
1069 sprintf(branchname,"TRDdictionary%d",iDict);
1070 branch = gAlice->TreeD()->GetBranch(branchname);
1078 //_____________________________________________________________________________
1079 void AliTRD::ResetRecPoints()
1082 // Reset number of reconstructed points and the point array
1087 Int_t nentr = fRecPoints->GetEntriesFast();
1088 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1093 //_____________________________________________________________________________
1094 void AliTRD::SetTreeAddress()
1097 // Set the branch addresses for the trees.
1100 Char_t branchname[15];
1102 AliDetector::SetTreeAddress();
1105 TTree *treeR = gAlice->TreeR();
1108 sprintf(branchname,"%scluster",GetName());
1110 branch = treeR->GetBranch(branchname);
1112 branch->SetAddress(&fRecPoints);
1119 //_____________________________________________________________________________
1120 void AliTRD::SetGasMix(Int_t imix)
1123 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1126 if ((imix < 0) || (imix > 1)) {
1127 printf("Wrong input value: %d\n",imix);
1128 printf("Use standard setting\n");
1137 //_____________________________________________________________________________
1138 void AliTRD::SetPHOShole()
1141 // Selects a geometry with a hole in front of the PHOS
1144 fGeometry->SetPHOShole();
1148 //_____________________________________________________________________________
1149 void AliTRD::SetRICHhole()
1152 // Selects a geometry with a hole in front of the RICH
1155 fGeometry->SetRICHhole();
1159 //_____________________________________________________________________________
1160 AliTRD &AliTRD::operator=(const AliTRD &trd)
1163 // Assignment operator
1166 if (this != &trd) ((AliTRD &) trd).Copy(*this);