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.45 2003/02/11 16:54:07 hristov
19 Updated AliTrackReference class (S.Radomski)
21 Revision 1.44 2003/01/28 14:38:18 cblume
22 Add track length to track references
24 Revision 1.43 2002/11/21 22:38:47 alibrary
25 Removing AliMC and AliMCProcess
27 Revision 1.42 2002/10/22 15:53:08 alibrary
28 Introducing Riostream.h
30 Revision 1.41 2002/10/14 14:57:43 hristov
31 Merging the VirtualMC branch to the main development branch (HEAD)
33 Revision 1.36.6.2 2002/07/24 10:09:30 alibrary
36 Revision 1.40 2002/06/13 08:11:56 cblume
37 Add the track references
39 Revision 1.39 2002/06/12 09:54:35 cblume
40 Update of tracking code provided by Sergei
42 Revision 1.38 2002/03/28 14:59:07 cblume
45 Revision 1.37 2002/03/25 20:01:49 cblume
46 Introduce parameter class
48 Revision 1.36 2002/02/11 14:25:27 cblume
49 Geometry update, compressed hit structure
51 Revision 1.35 2001/11/14 12:08:44 cblume
52 Remove unneccessary header files
54 Revision 1.34 2001/11/14 10:50:45 cblume
55 Changes in digits IO. Add merging of summable digits
57 Revision 1.33 2001/11/06 17:19:41 cblume
58 Add detailed geometry and simple simulator
60 Revision 1.32 2001/10/08 06:57:33 hristov
61 Branches for TRD digits are created only during the digitisation
63 Revision 1.31 2001/08/30 09:30:30 hristov
64 The split level of branches is set to 99
66 Revision 1.30 2001/05/28 17:07:58 hristov
67 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)
69 Revision 1.29 2001/05/21 16:45:47 hristov
70 Last minute changes (C.Blume)
72 Revision 1.28 2001/05/16 14:57:27 alibrary
73 New files for folders and Stack
75 Revision 1.27 2001/05/08 07:05:02 hristov
76 Loop variable declared once (HP, Sun)
78 Revision 1.26 2001/05/07 08:03:22 cblume
79 Generate also hits in the amplification region
81 Revision 1.25 2001/03/13 09:30:35 cblume
82 Update of digitization. Moved digit branch definition to AliTRD
84 Revision 1.24 2001/01/26 19:56:49 hristov
85 Major upgrade of AliRoot code
87 Revision 1.23 2000/11/01 14:53:20 cblume
88 Merge with TRD-develop
90 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
91 Introduced more detailed geometry for the display
93 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
96 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
97 Replace include files by forward declarations
99 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
100 Included changes for the tracking
102 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
103 Included LoadPoints() method to display the TR photons
105 Revision 1.22 2000/10/02 21:28:19 fca
106 Removal of useless dependecies via forward declarations
108 Revision 1.21 2000/06/09 11:10:07 cblume
109 Compiler warnings and coding conventions, next round
111 Revision 1.20 2000/06/08 18:32:57 cblume
112 Make code compliant to coding conventions
114 Revision 1.19 2000/06/07 16:25:37 cblume
115 Try to remove compiler warnings on Sun and HP
117 Revision 1.18 2000/05/08 16:17:27 cblume
120 Revision 1.21 2000/06/09 11:10:07 cblume
121 Compiler warnings and coding conventions, next round
123 Revision 1.20 2000/06/08 18:32:57 cblume
124 Make code compliant to coding conventions
126 Revision 1.19 2000/06/07 16:25:37 cblume
127 Try to remove compiler warnings on Sun and HP
129 Revision 1.18 2000/05/08 16:17:27 cblume
132 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
133 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
135 Revision 1.17 2000/02/28 19:10:26 cblume
136 Include the new TRD classes
138 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
139 Introduce TRD geometry classes
141 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
142 Include functions and data members for AliTRDrecPoint
144 Revision 1.16 2000/01/19 17:17:35 fca
145 Introducing a list of lists of hits -- more hits allowed for detector now
147 Revision 1.15 1999/11/02 17:04:25 fca
148 Small syntax change for HP compiler
150 Revision 1.14 1999/11/02 16:57:02 fca
151 Avoid non ansi warnings on HP compilers
153 Revision 1.13 1999/11/02 16:35:56 fca
154 New version of TRD introduced
156 Revision 1.12 1999/11/01 20:41:51 fca
157 Added protections against using the wrong version of FRAME
159 Revision 1.11 1999/09/29 09:24:34 fca
160 Introduction of the Copyright and cvs Log
164 ///////////////////////////////////////////////////////////////////////////////
166 // Transition Radiation Detector //
167 // This class contains the basic functions for the Transition Radiation //
170 ///////////////////////////////////////////////////////////////////////////////
173 #include <Riostream.h>
177 #include <TGeometry.h>
182 #include <TParticle.h>
183 #include <TLorentzVector.h>
186 #include "AliConst.h"
187 #include "AliDigit.h"
190 #include "AliTrackReference.h"
193 #include "AliTRDhit.h"
194 #include "AliTRDpoints.h"
195 #include "AliTRDdigit.h"
196 #include "AliTRDdigitizer.h"
197 #include "AliTRDclusterizer.h"
198 #include "AliTRDgeometryHole.h"
199 #include "AliTRDgeometryFull.h"
200 #include "AliTRDrecPoint.h"
201 #include "AliTRDcluster.h"
202 #include "AliTRDdigitsManager.h"
203 #include "AliTRDtrackHits.h"
207 //_____________________________________________________________________________
211 // Default constructor
235 //_____________________________________________________________________________
236 AliTRD::AliTRD(const char *name, const char *title)
237 : AliDetector(name,title)
240 // Standard constructor for the TRD
243 // Check that FRAME is there otherwise we have no place where to
245 AliModule* frame = gAlice->GetModule("FRAME");
247 Error("Ctor","TRD needs FRAME to be present\n");
251 // Define the TRD geometry according to the FRAME geometry
252 if (frame->IsVersion() == 0) {
253 // Geometry with hole
254 fGeometry = new AliTRDgeometryHole();
256 else if (frame->IsVersion() == 1) {
257 // Geometry without hole
258 fGeometry = new AliTRDgeometryFull();
261 Error("Ctor","Could not find valid FRAME version\n");
265 // Allocate the hit array
266 fHits = new TClonesArray("AliTRDhit" ,405);
267 gAlice->AddHitList(fHits);
269 // Allocate the digits array
272 // Allocate the rec point array
273 fRecPoints = new TObjArray(400);
288 SetMarkerColor(kWhite);
292 //_____________________________________________________________________________
293 AliTRD::AliTRD(const AliTRD &trd)
299 ((AliTRD &) trd).Copy(*this);
303 //_____________________________________________________________________________
331 //_____________________________________________________________________________
332 void AliTRD::AddCluster(Float_t *pos, Int_t det, Float_t amp
333 , Int_t *tracks, Float_t *sig, Int_t iType)
336 // Add a cluster for the TRD
339 AliTRDcluster *c = new AliTRDcluster();
342 c->AddTrackIndex(tracks);
346 c->SetSigmaY2(sig[0]);
347 c->SetSigmaZ2(sig[1]);
348 c->SetLocalTimeBin(((Int_t) pos[2]));
372 //_____________________________________________________________________________
373 void AliTRD::Hits2Digits()
379 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
380 ,"TRD digitizer class");
381 digitizer->SetDebug(GetDebug());
382 digitizer->SetEvent(gAlice->GetEvNumber());
385 digitizer->InitDetector();
388 digitizer->MakeDigits();
390 // Write the digits into the input file
391 if (digitizer->MakeBranch(fDigitsFile)) {
393 digitizer->WriteDigits();
395 // Save the digitizer class in the AliROOT
402 //_____________________________________________________________________________
403 void AliTRD::Hits2SDigits()
406 // Create summable digits
409 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
410 ,"TRD digitizer class");
411 digitizer->SetDebug(GetDebug());
413 // For the summable digits
414 digitizer->SetSDigits(kTRUE);
415 digitizer->SetEvent(gAlice->GetEvNumber());
418 digitizer->InitDetector();
420 // Create the TRD s-digits branch
421 digitizer->MakeDigits();
423 // Write the digits into the input file
424 if (digitizer->MakeBranch(fDigitsFile)) {
426 digitizer->WriteDigits();
428 // Save the digitizer class in the AliROOT
435 //_____________________________________________________________________________
436 void AliTRD::SDigits2Digits()
439 // Create final digits from summable digits
442 // Create the TRD digitizer
443 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
444 ,"TRD digitizer class");
445 digitizer->SetDebug(GetDebug());
448 digitizer->SetEvent(gAlice->GetEvNumber());
451 digitizer->InitDetector();
453 // Read the s-digits via digits manager
454 AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager();
455 sdigitsManager->SetDebug(GetDebug());
456 sdigitsManager->SetSDigits(kTRUE);
458 sdigitsManager->Open(fDigitsFile);
460 sdigitsManager->CreateArrays();
461 sdigitsManager->ReadDigits();
463 // Add the s-digits to the input list
464 digitizer->AddSDigitsManager(sdigitsManager);
466 // Convert the s-digits to normal digits
467 digitizer->SDigits2Digits();
470 if (digitizer->MakeBranch(fDigitsFile)) {
472 digitizer->WriteDigits();
478 //_____________________________________________________________________________
479 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
483 // Add a hit for the TRD
485 // The data structure is set according to fHitType:
486 // bit0: standard TClonesArray
487 // bit1: compressed trackHits structure
491 TClonesArray &lhits = *fHits;
492 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
496 AddHit2(track,det,hits,q,inDrift);
501 //_____________________________________________________________________________
502 void AliTRD::BuildGeometry()
505 // Create the ROOT TNode geometry for the TRD
512 Float_t zmax1, zmax2;
516 const Int_t kColorTRD = 46;
518 // Find the top node alice
519 top = gAlice->GetGeometry()->GetNode("alice");
521 if (fDisplayType == 0) {
523 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
524 rmin = AliTRDgeometry::Rmin();
525 rmax = AliTRDgeometry::Rmax();
526 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
527 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
528 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
529 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
531 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
532 node->SetLineColor(kColorTRD);
536 else if (fDisplayType == 1) {
540 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
541 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
543 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght();
544 rmax = rmin + AliTRDgeometry::CdrHght();
546 Float_t thickness = rmin - AliTRDgeometry::Rmin();
547 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
548 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
550 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
552 sprintf(name,"S_TR1%d",iPlan);
553 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
554 pgon->DefineSection(0,-zmax1,rmax,rmax);
555 pgon->DefineSection(1,-zmax2,rmin,rmax);
556 pgon->DefineSection(2, zmax2,rmin,rmax);
557 pgon->DefineSection(3, zmax1,rmax,rmax);
559 node = new TNode("TRD","TRD",name,0,0,0,"");
560 node->SetLineColor(kColorTRD);
563 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
564 rmin = rmin + height;
565 rmax = rmax + height;
566 zmax1 = zmax1 + slope * height;
567 zmax2 = zmax2 + slope * height;
571 thickness += AliTRDgeometry::DrThick();
572 rmin = AliTRDgeometry::Rmin() + thickness;
573 rmax = rmin + AliTRDgeometry::AmThick();
574 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
575 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
577 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
579 sprintf(name,"S_TR2%d",iPlan);
580 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
581 pgon->DefineSection(0,-zmax1,rmax,rmax);
582 pgon->DefineSection(1,-zmax2,rmin,rmax);
583 pgon->DefineSection(2, zmax2,rmin,rmax);
584 pgon->DefineSection(3, zmax1,rmax,rmax);
586 node = new TNode("TRD","TRD",name,0,0,0,"");
587 node->SetLineColor(kColorTRD);
590 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
591 rmin = rmin + height;
592 rmax = rmax + height;
593 zmax1 = zmax1 + slope * height;
594 zmax2 = zmax2 + slope * height;
602 //_____________________________________________________________________________
603 void AliTRD::Copy(TObject &trd)
609 ((AliTRD &) trd).fGasMix = fGasMix;
610 ((AliTRD &) trd).fGeometry = fGeometry;
611 ((AliTRD &) trd).fRecPoints = fRecPoints;
612 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
613 ((AliTRD &) trd).fGasDensity = fGasDensity;
614 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
615 ((AliTRD &) trd).fDrawTR = fDrawTR;
616 ((AliTRD &) trd).fDisplayType = fDisplayType;
617 ((AliTRD &) trd).fHitType = fHitType;
619 //AliDetector::Copy(trd);
623 //_____________________________________________________________________________
624 void AliTRD::CreateGeometry()
627 // Creates the volumes for the TRD chambers
630 // Check that FRAME is there otherwise we have no place where to put the TRD
631 AliModule* frame = gAlice->GetModule("FRAME");
633 printf(" The TRD needs the FRAME to be defined first\n");
637 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
641 //_____________________________________________________________________________
642 void AliTRD::CreateMaterials()
645 // Create the materials for the TRD
649 Int_t isxfld = gAlice->Field()->Integ();
650 Float_t sxmgmx = gAlice->Field()->Max();
652 // For polyethilene (CH2)
653 Float_t ape[2] = { 12., 1. };
654 Float_t zpe[2] = { 6., 1. };
655 Float_t wpe[2] = { 1., 2. };
658 // For mylar (C5H4O2)
659 Float_t amy[3] = { 12., 1., 16. };
660 Float_t zmy[3] = { 6., 1., 8. };
661 Float_t wmy[3] = { 5., 4., 2. };
665 Float_t aco[2] = { 12., 16. };
666 Float_t zco[2] = { 6., 8. };
667 Float_t wco[2] = { 1., 2. };
668 Float_t dco = 0.001977;
671 Float_t awa[2] = { 1., 16. };
672 Float_t zwa[2] = { 1., 8. };
673 Float_t wwa[2] = { 2., 1. };
676 // For isobutane (C4H10)
677 Float_t ais[2] = { 12., 1. };
678 Float_t zis[2] = { 6., 1. };
679 Float_t wis[2] = { 4., 10. };
680 Float_t dis = 0.00267;
682 // For plexiglas (C5H8O2)
683 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
684 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
685 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
688 // For Xe/CO2-gas-mixture
689 // Xe-content of the Xe/CO2-mixture (85% / 15%)
691 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
693 Float_t dxe = .005858;
695 // General tracking parameter
696 Float_t tmaxfd = -10.;
697 Float_t stemax = -1e10;
698 Float_t deemax = -0.1;
699 Float_t epsil = 1e-4;
700 Float_t stmin = -0.001;
702 Float_t absl, radl, d, buf[1];
703 Float_t agm[2], zgm[2], wgm[2];
707 //////////////////////////////////////////////////////////////////////////
709 //////////////////////////////////////////////////////////////////////////
711 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
712 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
713 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
714 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
715 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
716 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
717 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
718 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
719 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
722 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
723 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
724 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
725 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
726 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
727 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
732 // Get properties of Xe
733 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
734 // Get properties of CO2
735 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
736 // Create gas mixture
739 dgm1 = wgm[0] * dxe + wgm[1] * dco;
740 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
741 // Xe/Isobutane-mixture
742 // Get properties of Xe
743 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
744 // Get properties of Isobutane
745 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
746 // Create gas mixture
749 dgm2 = wgm[0] * dxe + wgm[1] * dis;
750 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
752 //////////////////////////////////////////////////////////////////////////
753 // Tracking Media Parameters
754 //////////////////////////////////////////////////////////////////////////
757 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
758 , tmaxfd, stemax, deemax, epsil, stmin);
760 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
761 , tmaxfd, stemax, deemax, epsil, stmin);
763 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
764 , tmaxfd, stemax, deemax, epsil, stmin);
766 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
767 , tmaxfd, stemax, deemax, epsil, stmin);
769 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
770 , tmaxfd, stemax, deemax, epsil, stmin);
772 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
773 , tmaxfd, stemax, deemax, epsil, stmin);
775 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
776 , tmaxfd, stemax, deemax, epsil, stmin);
778 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
779 , tmaxfd, stemax, deemax, epsil, stmin);
781 // Gas-mixture (Xe/CO2)
782 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
783 , tmaxfd, stemax, deemax, epsil, stmin);
786 // Gas-mixture (Xe/Isobutane)
787 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
788 , tmaxfd, stemax, deemax, epsil, stmin);
790 // Nomex-honeycomb (use carbon for the time being)
791 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
792 , tmaxfd, stemax, deemax, epsil, stmin);
793 // Kapton foils (use Mylar for the time being)
794 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
795 , tmaxfd, stemax, deemax, epsil, stmin);
796 // Gas-filling of the radiator
797 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
798 , tmaxfd, stemax, deemax, epsil, stmin);
800 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
801 , tmaxfd, stemax, deemax, epsil, stmin);
803 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
804 , tmaxfd, stemax, deemax, epsil, stmin);
805 // Rohacell (plexiglas) for the radiator
806 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
807 , tmaxfd, stemax, deemax, epsil, stmin);
809 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
810 , tmaxfd, stemax, deemax, epsil, stmin);
812 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
813 , tmaxfd, stemax, deemax, epsil, stmin);
815 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
816 , tmaxfd, stemax, deemax, epsil, stmin);
818 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
819 , tmaxfd, stemax, deemax, epsil, stmin);
820 // Si in readout chips
821 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
822 , tmaxfd, stemax, deemax, epsil, stmin);
823 // Epoxy in readout chips
824 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
825 , tmaxfd, stemax, deemax, epsil, stmin);
827 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
828 , tmaxfd, stemax, deemax, epsil, stmin);
830 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
831 , tmaxfd, stemax, deemax, epsil, stmin);
832 // Al of cooling pipes
833 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
834 , tmaxfd, stemax, deemax, epsil, stmin);
836 // Save the density values for the TRD absorbtion
845 //_____________________________________________________________________________
846 void AliTRD::DrawModule() const
849 // Draw a shaded view of the Transition Radiation Detector version 0
852 // Set everything unseen
853 gMC->Gsatt("*" ,"SEEN",-1);
855 // Set ALIC mother transparent
856 gMC->Gsatt("ALIC","SEEN", 0);
858 // Set the volumes visible
859 if (fGeometry->IsVersion() == 0) {
860 gMC->Gsatt("B071","SEEN", 0);
861 gMC->Gsatt("B074","SEEN", 0);
862 gMC->Gsatt("B075","SEEN", 0);
863 gMC->Gsatt("B077","SEEN", 0);
864 gMC->Gsatt("BTR1","SEEN", 0);
865 gMC->Gsatt("BTR2","SEEN", 0);
866 gMC->Gsatt("BTR3","SEEN", 0);
867 gMC->Gsatt("UTR1","SEEN", 0);
868 gMC->Gsatt("UTR2","SEEN", 0);
869 gMC->Gsatt("UTR3","SEEN", 0);
872 gMC->Gsatt("B071","SEEN", 0);
873 gMC->Gsatt("B074","SEEN", 0);
874 gMC->Gsatt("B075","SEEN", 0);
875 gMC->Gsatt("B077","SEEN", 0);
876 gMC->Gsatt("BTR1","SEEN", 0);
877 gMC->Gsatt("BTR2","SEEN", 0);
878 gMC->Gsatt("BTR3","SEEN", 0);
879 gMC->Gsatt("UTR1","SEEN", 0);
880 if (fGeometry->GetPHOShole())
881 gMC->Gsatt("UTR2","SEEN", 0);
882 if (fGeometry->GetRICHhole())
883 gMC->Gsatt("UTR3","SEEN", 0);
885 // gMC->Gsatt("UCII","SEEN", 0);
886 // gMC->Gsatt("UCIM","SEEN", 0);
887 // gMC->Gsatt("UCIO","SEEN", 0);
888 // gMC->Gsatt("UL02","SEEN", 1);
889 // gMC->Gsatt("UL05","SEEN", 1);
890 // gMC->Gsatt("UL06","SEEN", 1);
892 gMC->Gdopt("hide", "on");
893 gMC->Gdopt("shad", "on");
894 gMC->Gsatt("*", "fill", 7);
895 gMC->SetClipBox(".");
896 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
898 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
899 gMC->Gdhead(1111, "Transition Radiation Detector");
900 gMC->Gdman(18, 4, "MAN");
904 //_____________________________________________________________________________
905 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t ) const
908 // Distance between the mouse and the TRD detector on the screen
915 //_____________________________________________________________________________
919 // Initialize the TRD detector after the geometry has been created
925 printf("\n%s: ",ClassName());
926 for (i = 0; i < 35; i++) printf("*");
927 printf(" TRD_INIT ");
928 for (i = 0; i < 35; i++) printf("*");
932 if (fGeometry->IsVersion() == 0) {
933 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
935 else if (fGeometry->IsVersion() == 1) {
936 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
937 if (fGeometry->GetPHOShole())
938 printf("%s: Leave space in front of PHOS free\n",ClassName());
939 if (fGeometry->GetRICHhole())
940 printf("%s: Leave space in front of RICH free\n",ClassName());
944 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
947 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
952 //_____________________________________________________________________________
953 void AliTRD::LoadPoints(Int_t track)
956 // Store x, y, z of all hits in memory.
957 // Hit originating from TR photons are given a different color
961 // AliDetector::LoadPoints(track);
965 if ((fHits == 0) && (fTrackHits == 0)) return;
969 nhits = fHits->GetEntriesFast();
972 nhits = fTrackHits->GetEntriesFast();
974 if (nhits == 0) return;
976 Int_t tracks = gAlice->GetNtrack();
977 if (fPoints == 0) fPoints = new TObjArray(tracks);
981 Int_t *ntrkE = new Int_t[tracks];
982 Int_t *ntrkT = new Int_t[tracks];
983 Int_t *limiE = new Int_t[tracks];
984 Int_t *limiT = new Int_t[tracks];
985 Float_t **coorE = new Float_t*[tracks];
986 Float_t **coorT = new Float_t*[tracks];
987 for(Int_t i = 0; i < tracks; i++) {
996 AliTRDpoints *points = 0;
999 Int_t chunk = nhits / 4 + 1;
1001 // Loop over all the hits and store their position
1002 ahit = (AliTRDhit *) FirstHit(-1);
1006 if (ahit->GetCharge() >= 0) {
1008 trk = ahit->GetTrack();
1009 if (ntrkE[trk] == limiE[trk]) {
1010 // Initialise a new track
1011 fp = new Float_t[3*(limiE[trk]+chunk)];
1013 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
1014 delete [] coorE[trk];
1016 limiE[trk] += chunk;
1022 fp[3*ntrkE[trk] ] = ahit->X();
1023 fp[3*ntrkE[trk]+1] = ahit->Y();
1024 fp[3*ntrkE[trk]+2] = ahit->Z();
1029 else if ((ahit->GetCharge() < 0) && (fDrawTR)) {
1031 trk = ahit->GetTrack();
1032 if (ntrkT[trk] == limiT[trk]) {
1033 // Initialise a new track
1034 fp = new Float_t[3*(limiT[trk]+chunk)];
1036 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
1037 delete [] coorT[trk];
1039 limiT[trk] += chunk;
1045 fp[3*ntrkT[trk] ] = ahit->X();
1046 fp[3*ntrkT[trk]+1] = ahit->Y();
1047 fp[3*ntrkT[trk]+2] = ahit->Z();
1052 ahit = (AliTRDhit *) NextHit();
1056 for (trk = 0; trk < tracks; ++trk) {
1058 if (ntrkE[trk] || ntrkT[trk]) {
1060 points = new AliTRDpoints();
1061 points->SetDetector(this);
1062 points->SetParticle(trk);
1064 // Set the dEdx points
1066 points->SetMarkerColor(GetMarkerColor());
1067 points->SetMarkerSize(GetMarkerSize());
1068 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
1069 delete [] coorE[trk];
1073 // Set the TR photon points
1075 points->SetTRpoints(ntrkT[trk],coorT[trk]);
1076 delete [] coorT[trk];
1080 fPoints->AddAt(points,trk);
1095 //_____________________________________________________________________________
1096 void AliTRD::MakeBranch(Option_t* option, const char *file)
1099 // Create Tree branches for the TRD digits.
1102 Int_t buffersize = 4000;
1103 Char_t branchname[15];
1104 sprintf(branchname,"%s",GetName());
1106 const char *cD = strstr(option,"D");
1108 AliDetector::MakeBranch(option,file);
1110 if (fDigits && gAlice->TreeD() && cD) {
1111 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file);
1115 MakeBranch2(option,file);
1120 //_____________________________________________________________________________
1121 void AliTRD::ResetDigits()
1124 // Reset number of digits and the digits array for this detector
1128 if (fDigits) fDigits->Clear();
1132 //_____________________________________________________________________________
1133 void AliTRD::ResetRecPoints()
1136 // Reset number of reconstructed points and the point array
1141 Int_t nentr = fRecPoints->GetEntriesFast();
1142 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1147 //_____________________________________________________________________________
1148 void AliTRD::SetTreeAddress()
1151 // Set the branch addresses for the trees.
1154 Char_t branchname[15];
1156 AliDetector::SetTreeAddress();
1159 TTree *treeR = gAlice->TreeR();
1162 sprintf(branchname,"%scluster",GetName());
1164 branch = treeR->GetBranch(branchname);
1166 branch->SetAddress(&fRecPoints);
1177 //_____________________________________________________________________________
1178 void AliTRD::SetGasMix(Int_t imix)
1181 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1184 if ((imix < 0) || (imix > 1)) {
1185 printf("Wrong input value: %d\n",imix);
1186 printf("Use standard setting\n");
1195 //_____________________________________________________________________________
1196 void AliTRD::SetPHOShole()
1199 // Selects a geometry with a hole in front of the PHOS
1202 fGeometry->SetPHOShole();
1206 //_____________________________________________________________________________
1207 void AliTRD::SetRICHhole()
1210 // Selects a geometry with a hole in front of the RICH
1213 fGeometry->SetRICHhole();
1217 //_____________________________________________________________________________
1218 AliTRD &AliTRD::operator=(const AliTRD &trd)
1221 // Assignment operator
1224 if (this != &trd) ((AliTRD &) trd).Copy(*this);
1229 //_____________________________________________________________________________
1230 void AliTRD::FinishPrimary()
1233 // Store the hits in the containers after all primaries are finished
1237 fTrackHits->FlushHitStack();
1242 //_____________________________________________________________________________
1243 void AliTRD::RemapTrackHitIDs(Int_t *map)
1246 // Remap the track IDs
1254 TClonesArray *arr = fTrackHits->GetArray();;
1255 for (Int_t i = 0; i < arr->GetEntriesFast(); i++){
1256 AliTrackHitsParamV2 *info = (AliTrackHitsParamV2 *) (arr->At(i));
1257 info->fTrackID = map[info->fTrackID];
1263 //_____________________________________________________________________________
1264 void AliTRD::ResetHits()
1270 AliDetector::ResetHits();
1272 fTrackHits->Clear();
1277 //_____________________________________________________________________________
1278 AliHit* AliTRD::FirstHit(Int_t track)
1281 // Return the first hit of a track
1285 return FirstHit2(track);
1288 return AliDetector::FirstHit(track);
1292 //_____________________________________________________________________________
1293 AliHit* AliTRD::NextHit()
1296 // Returns the next hit of a track
1303 return AliDetector::NextHit();
1307 //_____________________________________________________________________________
1308 AliHit* AliTRD::FirstHit2(Int_t track)
1311 // Initializes the hit iterator.
1312 // Returns the address of the first hit of a track.
1313 // If <track> >= 0 the track is read from disk,
1314 // while if <track> < 0 the first hit of the current
1315 // track is returned.
1319 gAlice->ResetHits();
1320 gAlice->TreeH()->GetEvent(track);
1324 fTrackHits->First();
1325 return (AliHit*) fTrackHits->GetHit();
1333 //_____________________________________________________________________________
1334 AliHit* AliTRD::NextHit2()
1337 // Returns the next hit of the current track
1342 return (AliHit *) fTrackHits->GetHit();
1350 //_____________________________________________________________________________
1351 void AliTRD::MakeBranch2(Option_t *option, const char *file)
1354 // Create a new branch in the current Root tree.
1355 // The branch of fHits is automatically split.
1362 char branchname[10];
1363 sprintf(branchname,"%s2",GetName());
1365 // Get the pointer to the header
1366 const char *cH = strstr(option,"H");
1369 fTrackHits = new AliTRDtrackHits();
1372 if (fTrackHits && gAlice->TreeH() && cH) {
1374 gAlice->TreeH()->Branch(branchname,"AliTRDtrackHits"
1378 if (GetDebug() > 1) {
1379 printf("<AliTRD::MakeBranch2> Making Branch %s for trackhits\n"
1383 const char kFolder[] = "RunMC/Event/Data";
1386 printf("<AliTRD::MakeBranch2> %15s: Publishing %s to %s\n"
1387 ,ClassName(),branchname,kFolder);
1390 Publish(kFolder,&fTrackHits,branchname);
1393 TBranch *b = gAlice->TreeH()->GetBranch(branchname);
1394 TDirectory *wd = gDirectory;
1396 TIter next(b->GetListOfBranches());
1397 while ((b = (TBranch*) next())) {
1401 if (GetDebug() > 1) {
1402 printf("<AliTRD::MakeBranch2> Diverting branch %s to file %s\n"
1411 //_____________________________________________________________________________
1412 void AliTRD::SetTreeAddress2()
1415 // Set the branch address for the trackHits tree
1420 char branchname[20];
1422 sprintf(branchname,"%s2",GetName());
1424 // Branch address for hit tree
1425 TTree *treeH = gAlice->TreeH();
1426 if ((treeH) && (fHitType > 0)) {
1427 branch = treeH->GetBranch(branchname);
1429 branch->SetAddress(&fTrackHits);
1435 //_____________________________________________________________________________
1436 void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q
1440 // Add a hit to the list
1446 Int_t primary = gAlice->GetPrimary(track);
1447 gAlice->Particle(primary)->SetBit(kKeepBit);
1452 gAlice->FlagTrack(track);
1455 if ((fTrackHits) && (fHitType > 0)) {
1456 fTrackHits->AddHitTRD(det,rtrack,hits[0],hits[1],hits[2],q,inDrift);