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.38 2002/03/28 14:59:07 cblume
21 Revision 1.37 2002/03/25 20:01:49 cblume
22 Introduce parameter class
24 Revision 1.36 2002/02/11 14:25:27 cblume
25 Geometry update, compressed hit structure
27 Revision 1.35 2001/11/14 12:08:44 cblume
28 Remove unneccessary header files
30 Revision 1.34 2001/11/14 10:50:45 cblume
31 Changes in digits IO. Add merging of summable digits
33 Revision 1.33 2001/11/06 17:19:41 cblume
34 Add detailed geometry and simple simulator
36 Revision 1.32 2001/10/08 06:57:33 hristov
37 Branches for TRD digits are created only during the digitisation
39 Revision 1.31 2001/08/30 09:30:30 hristov
40 The split level of branches is set to 99
42 Revision 1.30 2001/05/28 17:07:58 hristov
43 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)
45 Revision 1.29 2001/05/21 16:45:47 hristov
46 Last minute changes (C.Blume)
48 Revision 1.28 2001/05/16 14:57:27 alibrary
49 New files for folders and Stack
51 Revision 1.27 2001/05/08 07:05:02 hristov
52 Loop variable declared once (HP, Sun)
54 Revision 1.26 2001/05/07 08:03:22 cblume
55 Generate also hits in the amplification region
57 Revision 1.25 2001/03/13 09:30:35 cblume
58 Update of digitization. Moved digit branch definition to AliTRD
60 Revision 1.24 2001/01/26 19:56:49 hristov
61 Major upgrade of AliRoot code
63 Revision 1.23 2000/11/01 14:53:20 cblume
64 Merge with TRD-develop
66 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
67 Introduced more detailed geometry for the display
69 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
72 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
73 Replace include files by forward declarations
75 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
76 Included changes for the tracking
78 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
79 Included LoadPoints() method to display the TR photons
81 Revision 1.22 2000/10/02 21:28:19 fca
82 Removal of useless dependecies via forward declarations
84 Revision 1.21 2000/06/09 11:10:07 cblume
85 Compiler warnings and coding conventions, next round
87 Revision 1.20 2000/06/08 18:32:57 cblume
88 Make code compliant to coding conventions
90 Revision 1.19 2000/06/07 16:25:37 cblume
91 Try to remove compiler warnings on Sun and HP
93 Revision 1.18 2000/05/08 16:17:27 cblume
96 Revision 1.21 2000/06/09 11:10:07 cblume
97 Compiler warnings and coding conventions, next round
99 Revision 1.20 2000/06/08 18:32:57 cblume
100 Make code compliant to coding conventions
102 Revision 1.19 2000/06/07 16:25:37 cblume
103 Try to remove compiler warnings on Sun and HP
105 Revision 1.18 2000/05/08 16:17:27 cblume
108 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
109 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
111 Revision 1.17 2000/02/28 19:10:26 cblume
112 Include the new TRD classes
114 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
115 Introduce TRD geometry classes
117 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
118 Include functions and data members for AliTRDrecPoint
120 Revision 1.16 2000/01/19 17:17:35 fca
121 Introducing a list of lists of hits -- more hits allowed for detector now
123 Revision 1.15 1999/11/02 17:04:25 fca
124 Small syntax change for HP compiler
126 Revision 1.14 1999/11/02 16:57:02 fca
127 Avoid non ansi warnings on HP compilers
129 Revision 1.13 1999/11/02 16:35:56 fca
130 New version of TRD introduced
132 Revision 1.12 1999/11/01 20:41:51 fca
133 Added protections against using the wrong version of FRAME
135 Revision 1.11 1999/09/29 09:24:34 fca
136 Introduction of the Copyright and cvs Log
140 ///////////////////////////////////////////////////////////////////////////////
142 // Transition Radiation Detector //
143 // This class contains the basic functions for the Transition Radiation //
146 ///////////////////////////////////////////////////////////////////////////////
149 #include <iostream.h>
153 #include <TGeometry.h>
158 #include <TParticle.h>
161 #include "AliConst.h"
162 #include "AliDigit.h"
167 #include "AliTRDhit.h"
168 #include "AliTRDpoints.h"
169 #include "AliTRDdigit.h"
170 #include "AliTRDdigitizer.h"
171 #include "AliTRDclusterizer.h"
172 #include "AliTRDgeometryHole.h"
173 #include "AliTRDgeometryFull.h"
174 #include "AliTRDrecPoint.h"
175 #include "AliTRDcluster.h"
176 #include "AliTRDdigitsManager.h"
177 #include "AliTRDtrackHits.h"
181 //_____________________________________________________________________________
185 // Default constructor
209 //_____________________________________________________________________________
210 AliTRD::AliTRD(const char *name, const char *title)
211 : AliDetector(name,title)
214 // Standard constructor for the TRD
217 // Check that FRAME is there otherwise we have no place where to
219 AliModule* frame = gAlice->GetModule("FRAME");
221 Error("Ctor","TRD needs FRAME to be present\n");
225 // Define the TRD geometry according to the FRAME geometry
226 if (frame->IsVersion() == 0) {
227 // Geometry with hole
228 fGeometry = new AliTRDgeometryHole();
230 else if (frame->IsVersion() == 1) {
231 // Geometry without hole
232 fGeometry = new AliTRDgeometryFull();
235 Error("Ctor","Could not find valid FRAME version\n");
239 // Allocate the hit array
240 fHits = new TClonesArray("AliTRDhit" ,405);
241 gAlice->AddHitList(fHits);
243 // Allocate the digits array
246 // Allocate the rec point array
247 fRecPoints = new TObjArray(400);
262 SetMarkerColor(kWhite);
266 //_____________________________________________________________________________
267 AliTRD::AliTRD(const AliTRD &trd)
273 ((AliTRD &) trd).Copy(*this);
277 //_____________________________________________________________________________
305 //_____________________________________________________________________________
306 void AliTRD::AddCluster(Float_t *pos, Int_t det, Float_t amp
307 , Int_t *tracks, Float_t *sig, Int_t iType)
310 // Add a cluster for the TRD
313 AliTRDcluster *c = new AliTRDcluster();
316 c->AddTrackIndex(tracks);
320 c->SetSigmaY2(sig[0]);
321 c->SetSigmaZ2(sig[1]);
322 c->SetLocalTimeBin(((Int_t) pos[2]));
346 //_____________________________________________________________________________
347 void AliTRD::Hits2Digits()
353 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
354 ,"TRD digitizer class");
355 digitizer->SetDebug(GetDebug());
356 digitizer->SetEvent(gAlice->GetEvNumber());
359 digitizer->InitDetector();
362 digitizer->MakeDigits();
364 // Write the digits into the input file
365 if (digitizer->MakeBranch(fDigitsFile)) {
367 digitizer->WriteDigits();
369 // Save the digitizer class in the AliROOT
376 //_____________________________________________________________________________
377 void AliTRD::Hits2SDigits()
380 // Create summable digits
383 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
384 ,"TRD digitizer class");
385 digitizer->SetDebug(GetDebug());
387 // For the summable digits
388 digitizer->SetSDigits(kTRUE);
389 digitizer->SetEvent(gAlice->GetEvNumber());
392 digitizer->InitDetector();
394 // Create the TRD s-digits branch
395 digitizer->MakeDigits();
397 // Write the digits into the input file
398 if (digitizer->MakeBranch(fDigitsFile)) {
400 digitizer->WriteDigits();
402 // Save the digitizer class in the AliROOT
409 //_____________________________________________________________________________
410 void AliTRD::SDigits2Digits()
413 // Create final digits from summable digits
416 // Create the TRD digitizer
417 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
418 ,"TRD digitizer class");
419 digitizer->SetDebug(GetDebug());
422 digitizer->SetEvent(gAlice->GetEvNumber());
425 digitizer->InitDetector();
427 // Read the s-digits via digits manager
428 AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager();
429 sdigitsManager->SetDebug(GetDebug());
430 sdigitsManager->SetSDigits(kTRUE);
432 sdigitsManager->Open(fDigitsFile);
434 sdigitsManager->CreateArrays();
435 sdigitsManager->ReadDigits();
437 // Add the s-digits to the input list
438 digitizer->AddSDigitsManager(sdigitsManager);
440 // Convert the s-digits to normal digits
441 digitizer->SDigits2Digits();
444 if (digitizer->MakeBranch(fDigitsFile)) {
446 digitizer->WriteDigits();
452 //_____________________________________________________________________________
453 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
457 // Add a hit for the TRD
459 // The data structure is set according to fHitType:
460 // bit0: standard TClonesArray
461 // bit1: compressed trackHits structure
465 TClonesArray &lhits = *fHits;
466 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
470 AddHit2(track,det,hits,q,inDrift);
475 //_____________________________________________________________________________
476 void AliTRD::BuildGeometry()
479 // Create the ROOT TNode geometry for the TRD
486 Float_t zmax1, zmax2;
490 const Int_t kColorTRD = 46;
492 // Find the top node alice
493 top = gAlice->GetGeometry()->GetNode("alice");
495 if (fDisplayType == 0) {
497 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
498 rmin = AliTRDgeometry::Rmin();
499 rmax = AliTRDgeometry::Rmax();
500 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
501 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
502 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
503 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
505 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
506 node->SetLineColor(kColorTRD);
510 else if (fDisplayType == 1) {
514 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
515 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
517 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght();
518 rmax = rmin + AliTRDgeometry::CdrHght();
520 Float_t thickness = rmin - AliTRDgeometry::Rmin();
521 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
522 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
524 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
526 sprintf(name,"S_TR1%d",iPlan);
527 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
528 pgon->DefineSection(0,-zmax1,rmax,rmax);
529 pgon->DefineSection(1,-zmax2,rmin,rmax);
530 pgon->DefineSection(2, zmax2,rmin,rmax);
531 pgon->DefineSection(3, zmax1,rmax,rmax);
533 node = new TNode("TRD","TRD",name,0,0,0,"");
534 node->SetLineColor(kColorTRD);
537 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
538 rmin = rmin + height;
539 rmax = rmax + height;
540 zmax1 = zmax1 + slope * height;
541 zmax2 = zmax2 + slope * height;
545 thickness += AliTRDgeometry::DrThick();
546 rmin = AliTRDgeometry::Rmin() + thickness;
547 rmax = rmin + AliTRDgeometry::AmThick();
548 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
549 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
551 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
553 sprintf(name,"S_TR2%d",iPlan);
554 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
555 pgon->DefineSection(0,-zmax1,rmax,rmax);
556 pgon->DefineSection(1,-zmax2,rmin,rmax);
557 pgon->DefineSection(2, zmax2,rmin,rmax);
558 pgon->DefineSection(3, zmax1,rmax,rmax);
560 node = new TNode("TRD","TRD",name,0,0,0,"");
561 node->SetLineColor(kColorTRD);
564 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
565 rmin = rmin + height;
566 rmax = rmax + height;
567 zmax1 = zmax1 + slope * height;
568 zmax2 = zmax2 + slope * height;
576 //_____________________________________________________________________________
577 void AliTRD::Copy(TObject &trd)
583 ((AliTRD &) trd).fGasMix = fGasMix;
584 ((AliTRD &) trd).fGeometry = fGeometry;
585 ((AliTRD &) trd).fRecPoints = fRecPoints;
586 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
587 ((AliTRD &) trd).fGasDensity = fGasDensity;
588 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
589 ((AliTRD &) trd).fDrawTR = fDrawTR;
590 ((AliTRD &) trd).fDisplayType = fDisplayType;
591 ((AliTRD &) trd).fHitType = fHitType;
593 //AliDetector::Copy(trd);
597 //_____________________________________________________________________________
598 void AliTRD::CreateGeometry()
601 // Creates the volumes for the TRD chambers
604 // Check that FRAME is there otherwise we have no place where to put the TRD
605 AliModule* frame = gAlice->GetModule("FRAME");
607 printf(" The TRD needs the FRAME to be defined first\n");
611 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
615 //_____________________________________________________________________________
616 void AliTRD::CreateMaterials()
619 // Create the materials for the TRD
623 Int_t isxfld = gAlice->Field()->Integ();
624 Float_t sxmgmx = gAlice->Field()->Max();
626 // For polyethilene (CH2)
627 Float_t ape[2] = { 12., 1. };
628 Float_t zpe[2] = { 6., 1. };
629 Float_t wpe[2] = { 1., 2. };
632 // For mylar (C5H4O2)
633 Float_t amy[3] = { 12., 1., 16. };
634 Float_t zmy[3] = { 6., 1., 8. };
635 Float_t wmy[3] = { 5., 4., 2. };
639 Float_t aco[2] = { 12., 16. };
640 Float_t zco[2] = { 6., 8. };
641 Float_t wco[2] = { 1., 2. };
642 Float_t dco = 0.001977;
645 Float_t awa[2] = { 1., 16. };
646 Float_t zwa[2] = { 1., 8. };
647 Float_t wwa[2] = { 2., 1. };
650 // For isobutane (C4H10)
651 Float_t ais[2] = { 12., 1. };
652 Float_t zis[2] = { 6., 1. };
653 Float_t wis[2] = { 4., 10. };
654 Float_t dis = 0.00267;
656 // For plexiglas (C5H8O2)
657 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
658 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
659 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
662 // For Xe/CO2-gas-mixture
663 // Xe-content of the Xe/CO2-mixture (85% / 15%)
665 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
667 Float_t dxe = .005858;
669 // General tracking parameter
670 Float_t tmaxfd = -10.;
671 Float_t stemax = -1e10;
672 Float_t deemax = -0.1;
673 Float_t epsil = 1e-4;
674 Float_t stmin = -0.001;
676 Float_t absl, radl, d, buf[1];
677 Float_t agm[2], zgm[2], wgm[2];
681 //////////////////////////////////////////////////////////////////////////
683 //////////////////////////////////////////////////////////////////////////
685 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
686 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
687 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
688 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
689 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
690 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
691 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
692 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
693 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
696 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
697 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
698 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
699 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
700 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
701 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
706 // Get properties of Xe
707 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
708 // Get properties of CO2
709 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
710 // Create gas mixture
713 dgm1 = wgm[0] * dxe + wgm[1] * dco;
714 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
715 // Xe/Isobutane-mixture
716 // Get properties of Xe
717 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
718 // Get properties of Isobutane
719 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
720 // Create gas mixture
723 dgm2 = wgm[0] * dxe + wgm[1] * dis;
724 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
726 //////////////////////////////////////////////////////////////////////////
727 // Tracking Media Parameters
728 //////////////////////////////////////////////////////////////////////////
731 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
732 , tmaxfd, stemax, deemax, epsil, stmin);
734 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
735 , tmaxfd, stemax, deemax, epsil, stmin);
737 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
738 , tmaxfd, stemax, deemax, epsil, stmin);
740 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
741 , tmaxfd, stemax, deemax, epsil, stmin);
743 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
744 , tmaxfd, stemax, deemax, epsil, stmin);
746 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
747 , tmaxfd, stemax, deemax, epsil, stmin);
749 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
750 , tmaxfd, stemax, deemax, epsil, stmin);
752 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
753 , tmaxfd, stemax, deemax, epsil, stmin);
755 // Gas-mixture (Xe/CO2)
756 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
757 , tmaxfd, stemax, deemax, epsil, stmin);
760 // Gas-mixture (Xe/Isobutane)
761 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
762 , tmaxfd, stemax, deemax, epsil, stmin);
764 // Nomex-honeycomb (use carbon for the time being)
765 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
766 , tmaxfd, stemax, deemax, epsil, stmin);
767 // Kapton foils (use Mylar for the time being)
768 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
769 , tmaxfd, stemax, deemax, epsil, stmin);
770 // Gas-filling of the radiator
771 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
772 , tmaxfd, stemax, deemax, epsil, stmin);
774 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
775 , tmaxfd, stemax, deemax, epsil, stmin);
777 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
778 , tmaxfd, stemax, deemax, epsil, stmin);
779 // Rohacell (plexiglas) for the radiator
780 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
781 , tmaxfd, stemax, deemax, epsil, stmin);
783 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
784 , tmaxfd, stemax, deemax, epsil, stmin);
786 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
787 , tmaxfd, stemax, deemax, epsil, stmin);
789 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
790 , tmaxfd, stemax, deemax, epsil, stmin);
792 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
793 , tmaxfd, stemax, deemax, epsil, stmin);
794 // Si in readout chips
795 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
796 , tmaxfd, stemax, deemax, epsil, stmin);
797 // Epoxy in readout chips
798 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
799 , tmaxfd, stemax, deemax, epsil, stmin);
801 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
802 , tmaxfd, stemax, deemax, epsil, stmin);
804 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
805 , tmaxfd, stemax, deemax, epsil, stmin);
806 // Al of cooling pipes
807 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
808 , tmaxfd, stemax, deemax, epsil, stmin);
810 // Save the density values for the TRD absorbtion
819 //_____________________________________________________________________________
820 void AliTRD::DrawModule() const
823 // Draw a shaded view of the Transition Radiation Detector version 0
826 // Set everything unseen
827 gMC->Gsatt("*" ,"SEEN",-1);
829 // Set ALIC mother transparent
830 gMC->Gsatt("ALIC","SEEN", 0);
832 // Set the volumes visible
833 if (fGeometry->IsVersion() == 0) {
834 gMC->Gsatt("B071","SEEN", 0);
835 gMC->Gsatt("B074","SEEN", 0);
836 gMC->Gsatt("B075","SEEN", 0);
837 gMC->Gsatt("B077","SEEN", 0);
838 gMC->Gsatt("BTR1","SEEN", 0);
839 gMC->Gsatt("BTR2","SEEN", 0);
840 gMC->Gsatt("BTR3","SEEN", 0);
841 gMC->Gsatt("UTR1","SEEN", 0);
842 gMC->Gsatt("UTR2","SEEN", 0);
843 gMC->Gsatt("UTR3","SEEN", 0);
846 gMC->Gsatt("B071","SEEN", 0);
847 gMC->Gsatt("B074","SEEN", 0);
848 gMC->Gsatt("B075","SEEN", 0);
849 gMC->Gsatt("B077","SEEN", 0);
850 gMC->Gsatt("BTR1","SEEN", 0);
851 gMC->Gsatt("BTR2","SEEN", 0);
852 gMC->Gsatt("BTR3","SEEN", 0);
853 gMC->Gsatt("UTR1","SEEN", 0);
854 if (fGeometry->GetPHOShole())
855 gMC->Gsatt("UTR2","SEEN", 0);
856 if (fGeometry->GetRICHhole())
857 gMC->Gsatt("UTR3","SEEN", 0);
859 // gMC->Gsatt("UCII","SEEN", 0);
860 // gMC->Gsatt("UCIM","SEEN", 0);
861 // gMC->Gsatt("UCIO","SEEN", 0);
862 // gMC->Gsatt("UL02","SEEN", 1);
863 // gMC->Gsatt("UL05","SEEN", 1);
864 // gMC->Gsatt("UL06","SEEN", 1);
866 gMC->Gdopt("hide", "on");
867 gMC->Gdopt("shad", "on");
868 gMC->Gsatt("*", "fill", 7);
869 gMC->SetClipBox(".");
870 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
872 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
873 gMC->Gdhead(1111, "Transition Radiation Detector");
874 gMC->Gdman(18, 4, "MAN");
878 //_____________________________________________________________________________
879 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t ) const
882 // Distance between the mouse and the TRD detector on the screen
889 //_____________________________________________________________________________
893 // Initialize the TRD detector after the geometry has been created
899 printf("\n%s: ",ClassName());
900 for (i = 0; i < 35; i++) printf("*");
901 printf(" TRD_INIT ");
902 for (i = 0; i < 35; i++) printf("*");
906 if (fGeometry->IsVersion() == 0) {
907 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
909 else if (fGeometry->IsVersion() == 1) {
910 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
911 if (fGeometry->GetPHOShole())
912 printf("%s: Leave space in front of PHOS free\n",ClassName());
913 if (fGeometry->GetRICHhole())
914 printf("%s: Leave space in front of RICH free\n",ClassName());
918 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
921 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
926 //_____________________________________________________________________________
927 void AliTRD::LoadPoints(Int_t track)
930 // Store x, y, z of all hits in memory.
931 // Hit originating from TR photons are given a different color
935 // AliDetector::LoadPoints(track);
939 if ((fHits == 0) && (fTrackHits == 0)) return;
943 nhits = fHits->GetEntriesFast();
946 nhits = fTrackHits->GetEntriesFast();
948 if (nhits == 0) return;
950 Int_t tracks = gAlice->GetNtrack();
951 if (fPoints == 0) fPoints = new TObjArray(tracks);
955 Int_t *ntrkE = new Int_t[tracks];
956 Int_t *ntrkT = new Int_t[tracks];
957 Int_t *limiE = new Int_t[tracks];
958 Int_t *limiT = new Int_t[tracks];
959 Float_t **coorE = new Float_t*[tracks];
960 Float_t **coorT = new Float_t*[tracks];
961 for(Int_t i = 0; i < tracks; i++) {
970 AliTRDpoints *points = 0;
973 Int_t chunk = nhits / 4 + 1;
975 // Loop over all the hits and store their position
976 ahit = (AliTRDhit *) FirstHit(-1);
980 if (ahit->GetCharge() >= 0) {
982 trk = ahit->GetTrack();
983 if (ntrkE[trk] == limiE[trk]) {
984 // Initialise a new track
985 fp = new Float_t[3*(limiE[trk]+chunk)];
987 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
988 delete [] coorE[trk];
996 fp[3*ntrkE[trk] ] = ahit->X();
997 fp[3*ntrkE[trk]+1] = ahit->Y();
998 fp[3*ntrkE[trk]+2] = ahit->Z();
1003 else if ((ahit->GetCharge() < 0) && (fDrawTR)) {
1005 trk = ahit->GetTrack();
1006 if (ntrkT[trk] == limiT[trk]) {
1007 // Initialise a new track
1008 fp = new Float_t[3*(limiT[trk]+chunk)];
1010 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
1011 delete [] coorT[trk];
1013 limiT[trk] += chunk;
1019 fp[3*ntrkT[trk] ] = ahit->X();
1020 fp[3*ntrkT[trk]+1] = ahit->Y();
1021 fp[3*ntrkT[trk]+2] = ahit->Z();
1026 ahit = (AliTRDhit *) NextHit();
1030 for (trk = 0; trk < tracks; ++trk) {
1032 if (ntrkE[trk] || ntrkT[trk]) {
1034 points = new AliTRDpoints();
1035 points->SetDetector(this);
1036 points->SetParticle(trk);
1038 // Set the dEdx points
1040 points->SetMarkerColor(GetMarkerColor());
1041 points->SetMarkerSize(GetMarkerSize());
1042 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
1043 delete [] coorE[trk];
1047 // Set the TR photon points
1049 points->SetTRpoints(ntrkT[trk],coorT[trk]);
1050 delete [] coorT[trk];
1054 fPoints->AddAt(points,trk);
1069 //_____________________________________________________________________________
1070 void AliTRD::MakeBranch(Option_t* option, const char *file)
1073 // Create Tree branches for the TRD digits.
1076 Int_t buffersize = 4000;
1077 Char_t branchname[15];
1078 sprintf(branchname,"%s",GetName());
1080 const char *cD = strstr(option,"D");
1082 AliDetector::MakeBranch(option,file);
1084 if (fDigits && gAlice->TreeD() && cD) {
1085 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file);
1089 MakeBranch2(option,file);
1094 //_____________________________________________________________________________
1095 void AliTRD::ResetDigits()
1098 // Reset number of digits and the digits array for this detector
1102 if (fDigits) fDigits->Clear();
1106 //_____________________________________________________________________________
1107 void AliTRD::ResetRecPoints()
1110 // Reset number of reconstructed points and the point array
1115 Int_t nentr = fRecPoints->GetEntriesFast();
1116 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1121 //_____________________________________________________________________________
1122 void AliTRD::SetTreeAddress()
1125 // Set the branch addresses for the trees.
1128 Char_t branchname[15];
1130 AliDetector::SetTreeAddress();
1133 TTree *treeR = gAlice->TreeR();
1136 sprintf(branchname,"%scluster",GetName());
1138 branch = treeR->GetBranch(branchname);
1140 branch->SetAddress(&fRecPoints);
1151 //_____________________________________________________________________________
1152 void AliTRD::SetGasMix(Int_t imix)
1155 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1158 if ((imix < 0) || (imix > 1)) {
1159 printf("Wrong input value: %d\n",imix);
1160 printf("Use standard setting\n");
1169 //_____________________________________________________________________________
1170 void AliTRD::SetPHOShole()
1173 // Selects a geometry with a hole in front of the PHOS
1176 fGeometry->SetPHOShole();
1180 //_____________________________________________________________________________
1181 void AliTRD::SetRICHhole()
1184 // Selects a geometry with a hole in front of the RICH
1187 fGeometry->SetRICHhole();
1191 //_____________________________________________________________________________
1192 AliTRD &AliTRD::operator=(const AliTRD &trd)
1195 // Assignment operator
1198 if (this != &trd) ((AliTRD &) trd).Copy(*this);
1203 //_____________________________________________________________________________
1204 void AliTRD::FinishPrimary()
1207 // Store the hits in the containers after all primaries are finished
1211 fTrackHits->FlushHitStack();
1216 //_____________________________________________________________________________
1217 void AliTRD::RemapTrackHitIDs(Int_t *map)
1220 // Remap the track IDs
1228 TClonesArray *arr = fTrackHits->GetArray();;
1229 for (Int_t i = 0; i < arr->GetEntriesFast(); i++){
1230 AliTrackHitsParamV2 *info = (AliTrackHitsParamV2 *) (arr->At(i));
1231 info->fTrackID = map[info->fTrackID];
1237 //_____________________________________________________________________________
1238 void AliTRD::ResetHits()
1244 AliDetector::ResetHits();
1246 fTrackHits->Clear();
1251 //_____________________________________________________________________________
1252 AliHit* AliTRD::FirstHit(Int_t track)
1255 // Return the first hit of a track
1259 return FirstHit2(track);
1262 return AliDetector::FirstHit(track);
1266 //_____________________________________________________________________________
1267 AliHit* AliTRD::NextHit()
1270 // Returns the next hit of a track
1277 return AliDetector::NextHit();
1281 //_____________________________________________________________________________
1282 AliHit* AliTRD::FirstHit2(Int_t track)
1285 // Initializes the hit iterator.
1286 // Returns the address of the first hit of a track.
1287 // If <track> >= 0 the track is read from disk,
1288 // while if <track> < 0 the first hit of the current
1289 // track is returned.
1293 gAlice->ResetHits();
1294 gAlice->TreeH()->GetEvent(track);
1298 fTrackHits->First();
1299 return (AliHit*) fTrackHits->GetHit();
1307 //_____________________________________________________________________________
1308 AliHit* AliTRD::NextHit2()
1311 // Returns the next hit of the current track
1316 return (AliHit *) fTrackHits->GetHit();
1324 //_____________________________________________________________________________
1325 void AliTRD::MakeBranch2(Option_t *option, const char *file)
1328 // Create a new branch in the current Root tree.
1329 // The branch of fHits is automatically split.
1336 char branchname[10];
1337 sprintf(branchname,"%s2",GetName());
1339 // Get the pointer to the header
1340 const char *cH = strstr(option,"H");
1343 fTrackHits = new AliTRDtrackHits();
1346 if (fTrackHits && gAlice->TreeH() && cH) {
1348 gAlice->TreeH()->Branch(branchname,"AliTRDtrackHits"
1352 if (GetDebug() > 1) {
1353 printf("<AliTRD::MakeBranch2> Making Branch %s for trackhits\n"
1357 const char kFolder[] = "RunMC/Event/Data";
1360 printf("<AliTRD::MakeBranch2> %15s: Publishing %s to %s\n"
1361 ,ClassName(),branchname,kFolder);
1364 Publish(kFolder,&fTrackHits,branchname);
1367 TBranch *b = gAlice->TreeH()->GetBranch(branchname);
1368 TDirectory *wd = gDirectory;
1370 TIter next(b->GetListOfBranches());
1371 while ((b = (TBranch*) next())) {
1375 if (GetDebug() > 1) {
1376 printf("<AliTRD::MakeBranch2> Diverting branch %s to file %s\n"
1385 //_____________________________________________________________________________
1386 void AliTRD::SetTreeAddress2()
1389 // Set the branch address for the trackHits tree
1394 char branchname[20];
1396 sprintf(branchname,"%s2",GetName());
1398 // Branch address for hit tree
1399 TTree *treeH = gAlice->TreeH();
1400 if ((treeH) && (fHitType > 0)) {
1401 branch = treeH->GetBranch(branchname);
1403 branch->SetAddress(&fTrackHits);
1409 //_____________________________________________________________________________
1410 void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q
1414 // Add a hit to the list
1420 Int_t primary = gAlice->GetPrimary(track);
1421 gAlice->Particle(primary)->SetBit(kKeepBit);
1426 gAlice->FlagTrack(track);
1429 if ((fTrackHits) && (fHitType > 0)) {
1430 fTrackHits->AddHitTRD(det,rtrack,hits[0],hits[1],hits[2],q,inDrift);