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.35 2001/11/14 12:08:44 cblume
19 Remove unneccessary header files
21 Revision 1.34 2001/11/14 10:50:45 cblume
22 Changes in digits IO. Add merging of summable digits
24 Revision 1.33 2001/11/06 17:19:41 cblume
25 Add detailed geometry and simple simulator
27 Revision 1.32 2001/10/08 06:57:33 hristov
28 Branches for TRD digits are created only during the digitisation
30 Revision 1.31 2001/08/30 09:30:30 hristov
31 The split level of branches is set to 99
33 Revision 1.30 2001/05/28 17:07:58 hristov
34 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)
36 Revision 1.29 2001/05/21 16:45:47 hristov
37 Last minute changes (C.Blume)
39 Revision 1.28 2001/05/16 14:57:27 alibrary
40 New files for folders and Stack
42 Revision 1.27 2001/05/08 07:05:02 hristov
43 Loop variable declared once (HP, Sun)
45 Revision 1.26 2001/05/07 08:03:22 cblume
46 Generate also hits in the amplification region
48 Revision 1.25 2001/03/13 09:30:35 cblume
49 Update of digitization. Moved digit branch definition to AliTRD
51 Revision 1.24 2001/01/26 19:56:49 hristov
52 Major upgrade of AliRoot code
54 Revision 1.23 2000/11/01 14:53:20 cblume
55 Merge with TRD-develop
57 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
58 Introduced more detailed geometry for the display
60 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
63 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
64 Replace include files by forward declarations
66 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
67 Included changes for the tracking
69 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
70 Included LoadPoints() method to display the TR photons
72 Revision 1.22 2000/10/02 21:28:19 fca
73 Removal of useless dependecies via forward declarations
75 Revision 1.21 2000/06/09 11:10:07 cblume
76 Compiler warnings and coding conventions, next round
78 Revision 1.20 2000/06/08 18:32:57 cblume
79 Make code compliant to coding conventions
81 Revision 1.19 2000/06/07 16:25:37 cblume
82 Try to remove compiler warnings on Sun and HP
84 Revision 1.18 2000/05/08 16:17:27 cblume
87 Revision 1.21 2000/06/09 11:10:07 cblume
88 Compiler warnings and coding conventions, next round
90 Revision 1.20 2000/06/08 18:32:57 cblume
91 Make code compliant to coding conventions
93 Revision 1.19 2000/06/07 16:25:37 cblume
94 Try to remove compiler warnings on Sun and HP
96 Revision 1.18 2000/05/08 16:17:27 cblume
99 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
100 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
102 Revision 1.17 2000/02/28 19:10:26 cblume
103 Include the new TRD classes
105 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
106 Introduce TRD geometry classes
108 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
109 Include functions and data members for AliTRDrecPoint
111 Revision 1.16 2000/01/19 17:17:35 fca
112 Introducing a list of lists of hits -- more hits allowed for detector now
114 Revision 1.15 1999/11/02 17:04:25 fca
115 Small syntax change for HP compiler
117 Revision 1.14 1999/11/02 16:57:02 fca
118 Avoid non ansi warnings on HP compilers
120 Revision 1.13 1999/11/02 16:35:56 fca
121 New version of TRD introduced
123 Revision 1.12 1999/11/01 20:41:51 fca
124 Added protections against using the wrong version of FRAME
126 Revision 1.11 1999/09/29 09:24:34 fca
127 Introduction of the Copyright and cvs Log
131 ///////////////////////////////////////////////////////////////////////////////
133 // Transition Radiation Detector //
134 // This class contains the basic functions for the Transition Radiation //
137 ///////////////////////////////////////////////////////////////////////////////
140 #include <iostream.h>
144 #include <TGeometry.h>
149 #include <TParticle.h>
152 #include "AliConst.h"
153 #include "AliDigit.h"
158 #include "AliTRDhit.h"
159 #include "AliTRDpoints.h"
160 #include "AliTRDdigit.h"
161 #include "AliTRDdigitizer.h"
162 #include "AliTRDclusterizer.h"
163 #include "AliTRDgeometryHole.h"
164 #include "AliTRDgeometryFull.h"
165 #include "AliTRDrecPoint.h"
166 #include "AliTRDcluster.h"
167 #include "AliTRDdigitsManager.h"
168 #include "AliTRDtrackHits.h"
172 //_____________________________________________________________________________
176 // Default constructor
200 //_____________________________________________________________________________
201 AliTRD::AliTRD(const char *name, const char *title)
202 : AliDetector(name,title)
205 // Standard constructor for the TRD
208 // Check that FRAME is there otherwise we have no place where to
210 AliModule* frame = gAlice->GetModule("FRAME");
212 Error("Ctor","TRD needs FRAME to be present\n");
216 // Define the TRD geometry according to the FRAME geometry
217 if (frame->IsVersion() == 0) {
218 // Geometry with hole
219 fGeometry = new AliTRDgeometryHole();
221 else if (frame->IsVersion() == 1) {
222 // Geometry without hole
223 fGeometry = new AliTRDgeometryFull();
226 Error("Ctor","Could not find valid FRAME version\n");
230 // Allocate the hit array
231 fHits = new TClonesArray("AliTRDhit" ,405);
232 gAlice->AddHitList(fHits);
234 // Allocate the digits array
237 // Allocate the rec point array
238 fRecPoints = new TObjArray(400);
253 SetMarkerColor(kWhite);
257 //_____________________________________________________________________________
258 AliTRD::AliTRD(const AliTRD &trd)
264 ((AliTRD &) trd).Copy(*this);
268 //_____________________________________________________________________________
296 //_____________________________________________________________________________
297 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
298 , Int_t *tracks, Float_t sigmaY2, Int_t iType)
301 // Add a cluster for the TRD
304 Int_t pla = fGeometry->GetPlane(det);
305 Int_t cha = fGeometry->GetChamber(det);
306 Int_t sec = fGeometry->GetSector(det);
308 Float_t padRow = pos[0];
309 Float_t padCol = pos[1];
310 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
311 Float_t col0 = fGeometry->GetCol0(pla);
312 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
313 Float_t colSize = fGeometry->GetColPadSize(pla);
315 AliTRDcluster *c = new AliTRDcluster();
318 c->AddTrackIndex(tracks);
322 c->SetLocalTimeBin(((Int_t) pos[2]));
323 c->SetY(- (col0 + padCol * colSize));
324 c->SetZ( row0 + padRow * rowSize);
326 c->SetSigmaY2((sigmaY2 + 1./12.) * colSize*colSize);
327 c->SetSigmaZ2(rowSize * rowSize / 12.);
351 //_____________________________________________________________________________
352 void AliTRD::Hits2Digits()
358 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
359 ,"TRD digitizer class");
360 digitizer->SetDebug(GetDebug());
363 digitizer->SetDiffusion();
365 digitizer->SetEvent(gAlice->GetEvNumber());
368 digitizer->InitDetector();
371 digitizer->MakeDigits();
373 // Write the digits into the input file
374 if (digitizer->MakeBranch(fDigitsFile)) {
376 digitizer->WriteDigits();
378 // Save the digitizer class in the AliROOT
385 //_____________________________________________________________________________
386 void AliTRD::Hits2SDigits()
389 // Create summable digits
392 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
393 ,"TRD digitizer class");
394 digitizer->SetDebug(GetDebug());
396 // For the summable digits
397 digitizer->SetSDigits(kTRUE);
400 digitizer->SetDiffusion();
402 digitizer->SetEvent(gAlice->GetEvNumber());
405 digitizer->InitDetector();
407 // Create the TRD s-digits branch
408 digitizer->MakeDigits();
410 // Write the digits into the input file
411 if (digitizer->MakeBranch(fDigitsFile)) {
413 digitizer->WriteDigits();
415 // Save the digitizer class in the AliROOT
422 //_____________________________________________________________________________
423 void AliTRD::SDigits2Digits()
426 // Create final digits from summable digits
429 // Create the TRD digitizer
430 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
431 ,"TRD digitizer class");
432 digitizer->SetDebug(GetDebug());
435 digitizer->SetEvent(gAlice->GetEvNumber());
438 digitizer->InitDetector();
440 // Read the s-digits via digits manager
441 AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager();
442 sdigitsManager->SetDebug(GetDebug());
443 sdigitsManager->SetSDigits(kTRUE);
445 sdigitsManager->Open(fDigitsFile);
447 sdigitsManager->CreateArrays();
448 sdigitsManager->ReadDigits();
450 // Add the s-digits to the input list
451 digitizer->AddSDigitsManager(sdigitsManager);
453 // Convert the s-digits to normal digits
454 digitizer->SDigits2Digits();
457 if (digitizer->MakeBranch(fDigitsFile)) {
459 digitizer->WriteDigits();
465 //_____________________________________________________________________________
466 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
470 // Add a hit for the TRD
472 // The data structure is set according to fHitType:
473 // bit0: standard TClonesArray
474 // bit1: compressed trackHits structure
478 TClonesArray &lhits = *fHits;
479 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
483 AddHit2(track,det,hits,q,inDrift);
488 //_____________________________________________________________________________
489 void AliTRD::BuildGeometry()
492 // Create the ROOT TNode geometry for the TRD
499 Float_t zmax1, zmax2;
503 const Int_t kColorTRD = 46;
505 // Find the top node alice
506 top = gAlice->GetGeometry()->GetNode("alice");
508 if (fDisplayType == 0) {
510 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
511 rmin = AliTRDgeometry::Rmin();
512 rmax = AliTRDgeometry::Rmax();
513 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
514 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
515 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
516 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
518 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
519 node->SetLineColor(kColorTRD);
523 else if (fDisplayType == 1) {
527 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
528 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
530 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght();
531 rmax = rmin + AliTRDgeometry::CdrHght();
533 Float_t thickness = rmin - AliTRDgeometry::Rmin();
534 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
535 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
537 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
539 sprintf(name,"S_TR1%d",iPlan);
540 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
541 pgon->DefineSection(0,-zmax1,rmax,rmax);
542 pgon->DefineSection(1,-zmax2,rmin,rmax);
543 pgon->DefineSection(2, zmax2,rmin,rmax);
544 pgon->DefineSection(3, zmax1,rmax,rmax);
546 node = new TNode("TRD","TRD",name,0,0,0,"");
547 node->SetLineColor(kColorTRD);
550 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
551 rmin = rmin + height;
552 rmax = rmax + height;
553 zmax1 = zmax1 + slope * height;
554 zmax2 = zmax2 + slope * height;
558 thickness += AliTRDgeometry::DrThick();
559 rmin = AliTRDgeometry::Rmin() + thickness;
560 rmax = rmin + AliTRDgeometry::AmThick();
561 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
562 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
564 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
566 sprintf(name,"S_TR2%d",iPlan);
567 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
568 pgon->DefineSection(0,-zmax1,rmax,rmax);
569 pgon->DefineSection(1,-zmax2,rmin,rmax);
570 pgon->DefineSection(2, zmax2,rmin,rmax);
571 pgon->DefineSection(3, zmax1,rmax,rmax);
573 node = new TNode("TRD","TRD",name,0,0,0,"");
574 node->SetLineColor(kColorTRD);
577 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
578 rmin = rmin + height;
579 rmax = rmax + height;
580 zmax1 = zmax1 + slope * height;
581 zmax2 = zmax2 + slope * height;
589 //_____________________________________________________________________________
590 void AliTRD::Copy(TObject &trd)
596 ((AliTRD &) trd).fGasMix = fGasMix;
597 ((AliTRD &) trd).fGeometry = fGeometry;
598 ((AliTRD &) trd).fRecPoints = fRecPoints;
599 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
600 ((AliTRD &) trd).fGasDensity = fGasDensity;
601 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
602 ((AliTRD &) trd).fDrawTR = fDrawTR;
603 ((AliTRD &) trd).fDisplayType = fDisplayType;
604 ((AliTRD &) trd).fHitType = fHitType;
606 //AliDetector::Copy(trd);
610 //_____________________________________________________________________________
611 void AliTRD::CreateGeometry()
614 // Creates the volumes for the TRD chambers
617 // Check that FRAME is there otherwise we have no place where to put the TRD
618 AliModule* frame = gAlice->GetModule("FRAME");
620 printf(" The TRD needs the FRAME to be defined first\n");
624 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
628 //_____________________________________________________________________________
629 void AliTRD::CreateMaterials()
632 // Create the materials for the TRD
636 Int_t isxfld = gAlice->Field()->Integ();
637 Float_t sxmgmx = gAlice->Field()->Max();
639 // For polyethilene (CH2)
640 Float_t ape[2] = { 12., 1. };
641 Float_t zpe[2] = { 6., 1. };
642 Float_t wpe[2] = { 1., 2. };
645 // For mylar (C5H4O2)
646 Float_t amy[3] = { 12., 1., 16. };
647 Float_t zmy[3] = { 6., 1., 8. };
648 Float_t wmy[3] = { 5., 4., 2. };
652 Float_t aco[2] = { 12., 16. };
653 Float_t zco[2] = { 6., 8. };
654 Float_t wco[2] = { 1., 2. };
655 Float_t dco = 0.001977;
658 Float_t awa[2] = { 1., 16. };
659 Float_t zwa[2] = { 1., 8. };
660 Float_t wwa[2] = { 2., 1. };
663 // For isobutane (C4H10)
664 Float_t ais[2] = { 12., 1. };
665 Float_t zis[2] = { 6., 1. };
666 Float_t wis[2] = { 4., 10. };
667 Float_t dis = 0.00267;
669 // For plexiglas (C5H8O2)
670 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
671 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
672 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
675 // For Xe/CO2-gas-mixture
676 // Xe-content of the Xe/CO2-mixture (85% / 15%)
678 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
680 Float_t dxe = .005858;
682 // General tracking parameter
683 Float_t tmaxfd = -10.;
684 Float_t stemax = -1e10;
685 Float_t deemax = -0.1;
686 Float_t epsil = 1e-4;
687 Float_t stmin = -0.001;
689 Float_t absl, radl, d, buf[1];
690 Float_t agm[2], zgm[2], wgm[2];
694 //////////////////////////////////////////////////////////////////////////
696 //////////////////////////////////////////////////////////////////////////
698 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
699 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
700 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
701 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
702 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
703 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
704 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
705 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
706 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
709 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
710 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
711 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
712 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
713 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
714 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
719 // Get properties of Xe
720 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
721 // Get properties of CO2
722 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
723 // Create gas mixture
726 dgm1 = wgm[0] * dxe + wgm[1] * dco;
727 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
728 // Xe/Isobutane-mixture
729 // Get properties of Xe
730 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
731 // Get properties of Isobutane
732 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
733 // Create gas mixture
736 dgm2 = wgm[0] * dxe + wgm[1] * dis;
737 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
739 //////////////////////////////////////////////////////////////////////////
740 // Tracking Media Parameters
741 //////////////////////////////////////////////////////////////////////////
744 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
745 , tmaxfd, stemax, deemax, epsil, stmin);
747 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
748 , tmaxfd, stemax, deemax, epsil, stmin);
750 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
751 , tmaxfd, stemax, deemax, epsil, stmin);
753 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
754 , tmaxfd, stemax, deemax, epsil, stmin);
756 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
757 , tmaxfd, stemax, deemax, epsil, stmin);
759 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
760 , tmaxfd, stemax, deemax, epsil, stmin);
762 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
763 , tmaxfd, stemax, deemax, epsil, stmin);
765 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
766 , tmaxfd, stemax, deemax, epsil, stmin);
768 // Gas-mixture (Xe/CO2)
769 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
770 , tmaxfd, stemax, deemax, epsil, stmin);
773 // Gas-mixture (Xe/Isobutane)
774 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
775 , tmaxfd, stemax, deemax, epsil, stmin);
777 // Nomex-honeycomb (use carbon for the time being)
778 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
779 , tmaxfd, stemax, deemax, epsil, stmin);
780 // Kapton foils (use Mylar for the time being)
781 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
782 , tmaxfd, stemax, deemax, epsil, stmin);
783 // Gas-filling of the radiator
784 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
785 , tmaxfd, stemax, deemax, epsil, stmin);
787 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
788 , tmaxfd, stemax, deemax, epsil, stmin);
790 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
791 , tmaxfd, stemax, deemax, epsil, stmin);
792 // Rohacell (plexiglas) for the radiator
793 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
794 , tmaxfd, stemax, deemax, epsil, stmin);
796 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
797 , tmaxfd, stemax, deemax, epsil, stmin);
799 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
800 , tmaxfd, stemax, deemax, epsil, stmin);
802 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
803 , tmaxfd, stemax, deemax, epsil, stmin);
805 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
806 , tmaxfd, stemax, deemax, epsil, stmin);
807 // Si in readout chips
808 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
809 , tmaxfd, stemax, deemax, epsil, stmin);
810 // Epoxy in readout chips
811 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
812 , tmaxfd, stemax, deemax, epsil, stmin);
814 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
815 , tmaxfd, stemax, deemax, epsil, stmin);
817 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
818 , tmaxfd, stemax, deemax, epsil, stmin);
819 // Al of cooling pipes
820 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
821 , tmaxfd, stemax, deemax, epsil, stmin);
823 // Save the density values for the TRD absorbtion
832 //_____________________________________________________________________________
833 void AliTRD::DrawModule()
836 // Draw a shaded view of the Transition Radiation Detector version 0
839 // Set everything unseen
840 gMC->Gsatt("*" ,"SEEN",-1);
842 // Set ALIC mother transparent
843 gMC->Gsatt("ALIC","SEEN", 0);
845 // Set the volumes visible
846 if (fGeometry->IsVersion() == 0) {
847 gMC->Gsatt("B071","SEEN", 0);
848 gMC->Gsatt("B074","SEEN", 0);
849 gMC->Gsatt("B075","SEEN", 0);
850 gMC->Gsatt("B077","SEEN", 0);
851 gMC->Gsatt("BTR1","SEEN", 0);
852 gMC->Gsatt("BTR2","SEEN", 0);
853 gMC->Gsatt("BTR3","SEEN", 0);
854 gMC->Gsatt("UTR1","SEEN", 0);
855 gMC->Gsatt("UTR2","SEEN", 0);
856 gMC->Gsatt("UTR3","SEEN", 0);
859 gMC->Gsatt("B071","SEEN", 0);
860 gMC->Gsatt("B074","SEEN", 0);
861 gMC->Gsatt("B075","SEEN", 0);
862 gMC->Gsatt("B077","SEEN", 0);
863 gMC->Gsatt("BTR1","SEEN", 0);
864 gMC->Gsatt("BTR2","SEEN", 0);
865 gMC->Gsatt("BTR3","SEEN", 0);
866 gMC->Gsatt("UTR1","SEEN", 0);
867 if (fGeometry->GetPHOShole())
868 gMC->Gsatt("UTR2","SEEN", 0);
869 if (fGeometry->GetRICHhole())
870 gMC->Gsatt("UTR3","SEEN", 0);
872 // gMC->Gsatt("UCII","SEEN", 0);
873 // gMC->Gsatt("UCIM","SEEN", 0);
874 // gMC->Gsatt("UCIO","SEEN", 0);
875 // gMC->Gsatt("UL02","SEEN", 1);
876 // gMC->Gsatt("UL05","SEEN", 1);
877 // gMC->Gsatt("UL06","SEEN", 1);
879 gMC->Gdopt("hide", "on");
880 gMC->Gdopt("shad", "on");
881 gMC->Gsatt("*", "fill", 7);
882 gMC->SetClipBox(".");
883 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
885 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
886 gMC->Gdhead(1111, "Transition Radiation Detector");
887 gMC->Gdman(18, 4, "MAN");
891 //_____________________________________________________________________________
892 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
895 // Distance between the mouse and the TRD detector on the screen
902 //_____________________________________________________________________________
906 // Initialize the TRD detector after the geometry has been created
912 printf("\n%s: ",ClassName());
913 for (i = 0; i < 35; i++) printf("*");
914 printf(" TRD_INIT ");
915 for (i = 0; i < 35; i++) printf("*");
919 if (fGeometry->IsVersion() == 0) {
920 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
922 else if (fGeometry->IsVersion() == 1) {
923 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
924 if (fGeometry->GetPHOShole())
925 printf("%s: Leave space in front of PHOS free\n",ClassName());
926 if (fGeometry->GetRICHhole())
927 printf("%s: Leave space in front of RICH free\n",ClassName());
931 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
934 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
939 //_____________________________________________________________________________
940 void AliTRD::LoadPoints(Int_t track)
943 // Store x, y, z of all hits in memory.
944 // Hit originating from TR photons are given a different color
948 // AliDetector::LoadPoints(track);
952 if ((fHits == 0) && (fTrackHits == 0)) return;
956 nhits = fHits->GetEntriesFast();
959 nhits = fTrackHits->GetEntriesFast();
961 if (nhits == 0) return;
963 Int_t tracks = gAlice->GetNtrack();
964 if (fPoints == 0) fPoints = new TObjArray(tracks);
968 Int_t *ntrkE = new Int_t[tracks];
969 Int_t *ntrkT = new Int_t[tracks];
970 Int_t *limiE = new Int_t[tracks];
971 Int_t *limiT = new Int_t[tracks];
972 Float_t **coorE = new Float_t*[tracks];
973 Float_t **coorT = new Float_t*[tracks];
974 for(Int_t i = 0; i < tracks; i++) {
983 AliTRDpoints *points = 0;
986 Int_t chunk = nhits / 4 + 1;
988 // Loop over all the hits and store their position
989 ahit = (AliTRDhit *) FirstHit(-1);
993 if (ahit->GetCharge() >= 0) {
995 trk = ahit->GetTrack();
996 if (ntrkE[trk] == limiE[trk]) {
997 // Initialise a new track
998 fp = new Float_t[3*(limiE[trk]+chunk)];
1000 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
1001 delete [] coorE[trk];
1003 limiE[trk] += chunk;
1009 fp[3*ntrkE[trk] ] = ahit->X();
1010 fp[3*ntrkE[trk]+1] = ahit->Y();
1011 fp[3*ntrkE[trk]+2] = ahit->Z();
1016 else if ((ahit->GetCharge() < 0) && (fDrawTR)) {
1018 trk = ahit->GetTrack();
1019 if (ntrkT[trk] == limiT[trk]) {
1020 // Initialise a new track
1021 fp = new Float_t[3*(limiT[trk]+chunk)];
1023 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
1024 delete [] coorT[trk];
1026 limiT[trk] += chunk;
1032 fp[3*ntrkT[trk] ] = ahit->X();
1033 fp[3*ntrkT[trk]+1] = ahit->Y();
1034 fp[3*ntrkT[trk]+2] = ahit->Z();
1039 ahit = (AliTRDhit *) NextHit();
1043 for (trk = 0; trk < tracks; ++trk) {
1045 if (ntrkE[trk] || ntrkT[trk]) {
1047 points = new AliTRDpoints();
1048 points->SetDetector(this);
1049 points->SetParticle(trk);
1051 // Set the dEdx points
1053 points->SetMarkerColor(GetMarkerColor());
1054 points->SetMarkerSize(GetMarkerSize());
1055 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
1056 delete [] coorE[trk];
1060 // Set the TR photon points
1062 points->SetTRpoints(ntrkT[trk],coorT[trk]);
1063 delete [] coorT[trk];
1067 fPoints->AddAt(points,trk);
1082 //_____________________________________________________________________________
1083 void AliTRD::MakeBranch(Option_t* option, const char *file)
1086 // Create Tree branches for the TRD digits.
1089 Int_t buffersize = 4000;
1090 Char_t branchname[15];
1091 sprintf(branchname,"%s",GetName());
1093 const char *cD = strstr(option,"D");
1095 AliDetector::MakeBranch(option,file);
1097 if (fDigits && gAlice->TreeD() && cD) {
1098 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file);
1102 MakeBranch2(option,file);
1107 //_____________________________________________________________________________
1108 void AliTRD::ResetDigits()
1111 // Reset number of digits and the digits array for this detector
1115 if (fDigits) fDigits->Clear();
1119 //_____________________________________________________________________________
1120 void AliTRD::ResetRecPoints()
1123 // Reset number of reconstructed points and the point array
1128 Int_t nentr = fRecPoints->GetEntriesFast();
1129 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1134 //_____________________________________________________________________________
1135 void AliTRD::SetTreeAddress()
1138 // Set the branch addresses for the trees.
1141 Char_t branchname[15];
1143 AliDetector::SetTreeAddress();
1146 TTree *treeR = gAlice->TreeR();
1149 sprintf(branchname,"%scluster",GetName());
1151 branch = treeR->GetBranch(branchname);
1153 branch->SetAddress(&fRecPoints);
1164 //_____________________________________________________________________________
1165 void AliTRD::SetGasMix(Int_t imix)
1168 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1171 if ((imix < 0) || (imix > 1)) {
1172 printf("Wrong input value: %d\n",imix);
1173 printf("Use standard setting\n");
1182 //_____________________________________________________________________________
1183 void AliTRD::SetPHOShole()
1186 // Selects a geometry with a hole in front of the PHOS
1189 fGeometry->SetPHOShole();
1193 //_____________________________________________________________________________
1194 void AliTRD::SetRICHhole()
1197 // Selects a geometry with a hole in front of the RICH
1200 fGeometry->SetRICHhole();
1204 //_____________________________________________________________________________
1205 AliTRD &AliTRD::operator=(const AliTRD &trd)
1208 // Assignment operator
1211 if (this != &trd) ((AliTRD &) trd).Copy(*this);
1216 //_____________________________________________________________________________
1217 void AliTRD::FinishPrimary()
1220 // Store the hits in the containers after all primaries are finished
1224 fTrackHits->FlushHitStack();
1229 //_____________________________________________________________________________
1230 void AliTRD::RemapTrackHitIDs(Int_t *map)
1233 // Remap the track IDs
1241 TClonesArray *arr = fTrackHits->GetArray();;
1242 for (Int_t i = 0; i < arr->GetEntriesFast(); i++){
1243 AliTrackHitsParamV2 *info = (AliTrackHitsParamV2 *) (arr->At(i));
1244 info->fTrackID = map[info->fTrackID];
1250 //_____________________________________________________________________________
1251 void AliTRD::ResetHits()
1257 AliDetector::ResetHits();
1259 fTrackHits->Clear();
1264 //_____________________________________________________________________________
1265 AliHit* AliTRD::FirstHit(Int_t track)
1268 // Return the first hit of a track
1272 return FirstHit2(track);
1275 return AliDetector::FirstHit(track);
1279 //_____________________________________________________________________________
1280 AliHit* AliTRD::NextHit()
1283 // Returns the next hit of a track
1290 return AliDetector::NextHit();
1294 //_____________________________________________________________________________
1295 AliHit* AliTRD::FirstHit2(Int_t track)
1298 // Initializes the hit iterator.
1299 // Returns the address of the first hit of a track.
1300 // If <track> >= 0 the track is read from disk,
1301 // while if <track> < 0 the first hit of the current
1302 // track is returned.
1306 gAlice->ResetHits();
1307 gAlice->TreeH()->GetEvent(track);
1311 fTrackHits->First();
1312 return (AliHit*) fTrackHits->GetHit();
1320 //_____________________________________________________________________________
1321 AliHit* AliTRD::NextHit2()
1324 // Returns the next hit of the current track
1329 return (AliHit *) fTrackHits->GetHit();
1337 //_____________________________________________________________________________
1338 void AliTRD::MakeBranch2(Option_t *option, const char *file)
1341 // Create a new branch in the current Root tree.
1342 // The branch of fHits is automatically split.
1349 char branchname[10];
1350 sprintf(branchname,"%s2",GetName());
1352 // Get the pointer to the header
1353 const char *cH = strstr(option,"H");
1356 fTrackHits = new AliTRDtrackHits();
1359 if (fTrackHits && gAlice->TreeH() && cH) {
1361 gAlice->TreeH()->Branch(branchname,"AliTRDtrackHits"
1365 if (GetDebug() > 1) {
1366 printf("<AliTRD::MakeBranch2> Making Branch %s for trackhits\n"
1370 const char folder[] = "RunMC/Event/Data";
1373 printf("<AliTRD::MakeBranch2> %15s: Publishing %s to %s\n"
1374 ,ClassName(),branchname,folder);
1377 Publish(folder,&fTrackHits,branchname);
1380 TBranch *b = gAlice->TreeH()->GetBranch(branchname);
1381 TDirectory *wd = gDirectory;
1383 TIter next(b->GetListOfBranches());
1384 while ((b = (TBranch*) next())) {
1388 if (GetDebug() > 1) {
1389 printf("<AliTRD::MakeBranch2> Diverting branch %s to file %s\n"
1398 //_____________________________________________________________________________
1399 void AliTRD::SetTreeAddress2()
1402 // Set the branch address for the trackHits tree
1407 char branchname[20];
1409 sprintf(branchname,"%s2",GetName());
1411 // Branch address for hit tree
1412 TTree *treeH = gAlice->TreeH();
1413 if ((treeH) && (fHitType > 0)) {
1414 branch = treeH->GetBranch(branchname);
1416 branch->SetAddress(&fTrackHits);
1422 //_____________________________________________________________________________
1423 void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q
1427 // Add a hit to the list
1433 Int_t primary = gAlice->GetPrimary(track);
1434 gAlice->Particle(primary)->SetBit(kKeepBit);
1439 gAlice->FlagTrack(track);
1442 if ((fTrackHits) && (fHitType > 0)) {
1443 fTrackHits->AddHitTRD(det,rtrack,hits[0],hits[1],hits[2],q,inDrift);