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.36 2002/02/11 14:25:27 cblume
19 Geometry update, compressed hit structure
21 Revision 1.35 2001/11/14 12:08:44 cblume
22 Remove unneccessary header files
24 Revision 1.34 2001/11/14 10:50:45 cblume
25 Changes in digits IO. Add merging of summable digits
27 Revision 1.33 2001/11/06 17:19:41 cblume
28 Add detailed geometry and simple simulator
30 Revision 1.32 2001/10/08 06:57:33 hristov
31 Branches for TRD digits are created only during the digitisation
33 Revision 1.31 2001/08/30 09:30:30 hristov
34 The split level of branches is set to 99
36 Revision 1.30 2001/05/28 17:07:58 hristov
37 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)
39 Revision 1.29 2001/05/21 16:45:47 hristov
40 Last minute changes (C.Blume)
42 Revision 1.28 2001/05/16 14:57:27 alibrary
43 New files for folders and Stack
45 Revision 1.27 2001/05/08 07:05:02 hristov
46 Loop variable declared once (HP, Sun)
48 Revision 1.26 2001/05/07 08:03:22 cblume
49 Generate also hits in the amplification region
51 Revision 1.25 2001/03/13 09:30:35 cblume
52 Update of digitization. Moved digit branch definition to AliTRD
54 Revision 1.24 2001/01/26 19:56:49 hristov
55 Major upgrade of AliRoot code
57 Revision 1.23 2000/11/01 14:53:20 cblume
58 Merge with TRD-develop
60 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
61 Introduced more detailed geometry for the display
63 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
66 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
67 Replace include files by forward declarations
69 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
70 Included changes for the tracking
72 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
73 Included LoadPoints() method to display the TR photons
75 Revision 1.22 2000/10/02 21:28:19 fca
76 Removal of useless dependecies via forward declarations
78 Revision 1.21 2000/06/09 11:10:07 cblume
79 Compiler warnings and coding conventions, next round
81 Revision 1.20 2000/06/08 18:32:57 cblume
82 Make code compliant to coding conventions
84 Revision 1.19 2000/06/07 16:25:37 cblume
85 Try to remove compiler warnings on Sun and HP
87 Revision 1.18 2000/05/08 16:17:27 cblume
90 Revision 1.21 2000/06/09 11:10:07 cblume
91 Compiler warnings and coding conventions, next round
93 Revision 1.20 2000/06/08 18:32:57 cblume
94 Make code compliant to coding conventions
96 Revision 1.19 2000/06/07 16:25:37 cblume
97 Try to remove compiler warnings on Sun and HP
99 Revision 1.18 2000/05/08 16:17:27 cblume
102 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
103 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
105 Revision 1.17 2000/02/28 19:10:26 cblume
106 Include the new TRD classes
108 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
109 Introduce TRD geometry classes
111 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
112 Include functions and data members for AliTRDrecPoint
114 Revision 1.16 2000/01/19 17:17:35 fca
115 Introducing a list of lists of hits -- more hits allowed for detector now
117 Revision 1.15 1999/11/02 17:04:25 fca
118 Small syntax change for HP compiler
120 Revision 1.14 1999/11/02 16:57:02 fca
121 Avoid non ansi warnings on HP compilers
123 Revision 1.13 1999/11/02 16:35:56 fca
124 New version of TRD introduced
126 Revision 1.12 1999/11/01 20:41:51 fca
127 Added protections against using the wrong version of FRAME
129 Revision 1.11 1999/09/29 09:24:34 fca
130 Introduction of the Copyright and cvs Log
134 ///////////////////////////////////////////////////////////////////////////////
136 // Transition Radiation Detector //
137 // This class contains the basic functions for the Transition Radiation //
140 ///////////////////////////////////////////////////////////////////////////////
143 #include <iostream.h>
147 #include <TGeometry.h>
152 #include <TParticle.h>
155 #include "AliConst.h"
156 #include "AliDigit.h"
161 #include "AliTRDhit.h"
162 #include "AliTRDpoints.h"
163 #include "AliTRDdigit.h"
164 #include "AliTRDdigitizer.h"
165 #include "AliTRDclusterizer.h"
166 #include "AliTRDgeometryHole.h"
167 #include "AliTRDgeometryFull.h"
168 #include "AliTRDrecPoint.h"
169 #include "AliTRDcluster.h"
170 #include "AliTRDdigitsManager.h"
171 #include "AliTRDtrackHits.h"
175 //_____________________________________________________________________________
179 // Default constructor
203 //_____________________________________________________________________________
204 AliTRD::AliTRD(const char *name, const char *title)
205 : AliDetector(name,title)
208 // Standard constructor for the TRD
211 // Check that FRAME is there otherwise we have no place where to
213 AliModule* frame = gAlice->GetModule("FRAME");
215 Error("Ctor","TRD needs FRAME to be present\n");
219 // Define the TRD geometry according to the FRAME geometry
220 if (frame->IsVersion() == 0) {
221 // Geometry with hole
222 fGeometry = new AliTRDgeometryHole();
224 else if (frame->IsVersion() == 1) {
225 // Geometry without hole
226 fGeometry = new AliTRDgeometryFull();
229 Error("Ctor","Could not find valid FRAME version\n");
233 // Allocate the hit array
234 fHits = new TClonesArray("AliTRDhit" ,405);
235 gAlice->AddHitList(fHits);
237 // Allocate the digits array
240 // Allocate the rec point array
241 fRecPoints = new TObjArray(400);
256 SetMarkerColor(kWhite);
260 //_____________________________________________________________________________
261 AliTRD::AliTRD(const AliTRD &trd)
267 ((AliTRD &) trd).Copy(*this);
271 //_____________________________________________________________________________
299 //_____________________________________________________________________________
300 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
301 , Int_t *tracks, Float_t sigmaY2, Int_t iType)
304 // Add a cluster for the TRD
307 Int_t pla = fGeometry->GetPlane(det);
308 Int_t cha = fGeometry->GetChamber(det);
309 Int_t sec = fGeometry->GetSector(det);
311 Float_t padRow = pos[0];
312 Float_t padCol = pos[1];
313 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
314 Float_t col0 = fGeometry->GetCol0(pla);
315 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
316 Float_t colSize = fGeometry->GetColPadSize(pla);
318 AliTRDcluster *c = new AliTRDcluster();
321 c->AddTrackIndex(tracks);
325 c->SetLocalTimeBin(((Int_t) pos[2]));
326 c->SetY(col0 + padCol * colSize);
327 c->SetZ(row0 + padRow * rowSize);
329 c->SetSigmaY2((sigmaY2 + 1./12.) * colSize*colSize);
330 c->SetSigmaZ2(rowSize * rowSize / 12.);
354 //_____________________________________________________________________________
355 void AliTRD::Hits2Digits()
361 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
362 ,"TRD digitizer class");
363 digitizer->SetDebug(GetDebug());
364 digitizer->SetEvent(gAlice->GetEvNumber());
367 digitizer->InitDetector();
370 digitizer->MakeDigits();
372 // Write the digits into the input file
373 if (digitizer->MakeBranch(fDigitsFile)) {
375 digitizer->WriteDigits();
377 // Save the digitizer class in the AliROOT
384 //_____________________________________________________________________________
385 void AliTRD::Hits2SDigits()
388 // Create summable digits
391 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
392 ,"TRD digitizer class");
393 digitizer->SetDebug(GetDebug());
395 // For the summable digits
396 digitizer->SetSDigits(kTRUE);
397 digitizer->SetEvent(gAlice->GetEvNumber());
400 digitizer->InitDetector();
402 // Create the TRD s-digits branch
403 digitizer->MakeDigits();
405 // Write the digits into the input file
406 if (digitizer->MakeBranch(fDigitsFile)) {
408 digitizer->WriteDigits();
410 // Save the digitizer class in the AliROOT
417 //_____________________________________________________________________________
418 void AliTRD::SDigits2Digits()
421 // Create final digits from summable digits
424 // Create the TRD digitizer
425 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
426 ,"TRD digitizer class");
427 digitizer->SetDebug(GetDebug());
430 digitizer->SetEvent(gAlice->GetEvNumber());
433 digitizer->InitDetector();
435 // Read the s-digits via digits manager
436 AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager();
437 sdigitsManager->SetDebug(GetDebug());
438 sdigitsManager->SetSDigits(kTRUE);
440 sdigitsManager->Open(fDigitsFile);
442 sdigitsManager->CreateArrays();
443 sdigitsManager->ReadDigits();
445 // Add the s-digits to the input list
446 digitizer->AddSDigitsManager(sdigitsManager);
448 // Convert the s-digits to normal digits
449 digitizer->SDigits2Digits();
452 if (digitizer->MakeBranch(fDigitsFile)) {
454 digitizer->WriteDigits();
460 //_____________________________________________________________________________
461 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
465 // Add a hit for the TRD
467 // The data structure is set according to fHitType:
468 // bit0: standard TClonesArray
469 // bit1: compressed trackHits structure
473 TClonesArray &lhits = *fHits;
474 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
478 AddHit2(track,det,hits,q,inDrift);
483 //_____________________________________________________________________________
484 void AliTRD::BuildGeometry()
487 // Create the ROOT TNode geometry for the TRD
494 Float_t zmax1, zmax2;
498 const Int_t kColorTRD = 46;
500 // Find the top node alice
501 top = gAlice->GetGeometry()->GetNode("alice");
503 if (fDisplayType == 0) {
505 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
506 rmin = AliTRDgeometry::Rmin();
507 rmax = AliTRDgeometry::Rmax();
508 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
509 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
510 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
511 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
513 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
514 node->SetLineColor(kColorTRD);
518 else if (fDisplayType == 1) {
522 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
523 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
525 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght();
526 rmax = rmin + AliTRDgeometry::CdrHght();
528 Float_t thickness = rmin - AliTRDgeometry::Rmin();
529 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
530 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
532 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
534 sprintf(name,"S_TR1%d",iPlan);
535 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
536 pgon->DefineSection(0,-zmax1,rmax,rmax);
537 pgon->DefineSection(1,-zmax2,rmin,rmax);
538 pgon->DefineSection(2, zmax2,rmin,rmax);
539 pgon->DefineSection(3, zmax1,rmax,rmax);
541 node = new TNode("TRD","TRD",name,0,0,0,"");
542 node->SetLineColor(kColorTRD);
545 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
546 rmin = rmin + height;
547 rmax = rmax + height;
548 zmax1 = zmax1 + slope * height;
549 zmax2 = zmax2 + slope * height;
553 thickness += AliTRDgeometry::DrThick();
554 rmin = AliTRDgeometry::Rmin() + thickness;
555 rmax = rmin + AliTRDgeometry::AmThick();
556 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
557 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
559 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
561 sprintf(name,"S_TR2%d",iPlan);
562 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
563 pgon->DefineSection(0,-zmax1,rmax,rmax);
564 pgon->DefineSection(1,-zmax2,rmin,rmax);
565 pgon->DefineSection(2, zmax2,rmin,rmax);
566 pgon->DefineSection(3, zmax1,rmax,rmax);
568 node = new TNode("TRD","TRD",name,0,0,0,"");
569 node->SetLineColor(kColorTRD);
572 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
573 rmin = rmin + height;
574 rmax = rmax + height;
575 zmax1 = zmax1 + slope * height;
576 zmax2 = zmax2 + slope * height;
584 //_____________________________________________________________________________
585 void AliTRD::Copy(TObject &trd)
591 ((AliTRD &) trd).fGasMix = fGasMix;
592 ((AliTRD &) trd).fGeometry = fGeometry;
593 ((AliTRD &) trd).fRecPoints = fRecPoints;
594 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
595 ((AliTRD &) trd).fGasDensity = fGasDensity;
596 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
597 ((AliTRD &) trd).fDrawTR = fDrawTR;
598 ((AliTRD &) trd).fDisplayType = fDisplayType;
599 ((AliTRD &) trd).fHitType = fHitType;
601 //AliDetector::Copy(trd);
605 //_____________________________________________________________________________
606 void AliTRD::CreateGeometry()
609 // Creates the volumes for the TRD chambers
612 // Check that FRAME is there otherwise we have no place where to put the TRD
613 AliModule* frame = gAlice->GetModule("FRAME");
615 printf(" The TRD needs the FRAME to be defined first\n");
619 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
623 //_____________________________________________________________________________
624 void AliTRD::CreateMaterials()
627 // Create the materials for the TRD
631 Int_t isxfld = gAlice->Field()->Integ();
632 Float_t sxmgmx = gAlice->Field()->Max();
634 // For polyethilene (CH2)
635 Float_t ape[2] = { 12., 1. };
636 Float_t zpe[2] = { 6., 1. };
637 Float_t wpe[2] = { 1., 2. };
640 // For mylar (C5H4O2)
641 Float_t amy[3] = { 12., 1., 16. };
642 Float_t zmy[3] = { 6., 1., 8. };
643 Float_t wmy[3] = { 5., 4., 2. };
647 Float_t aco[2] = { 12., 16. };
648 Float_t zco[2] = { 6., 8. };
649 Float_t wco[2] = { 1., 2. };
650 Float_t dco = 0.001977;
653 Float_t awa[2] = { 1., 16. };
654 Float_t zwa[2] = { 1., 8. };
655 Float_t wwa[2] = { 2., 1. };
658 // For isobutane (C4H10)
659 Float_t ais[2] = { 12., 1. };
660 Float_t zis[2] = { 6., 1. };
661 Float_t wis[2] = { 4., 10. };
662 Float_t dis = 0.00267;
664 // For plexiglas (C5H8O2)
665 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
666 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
667 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
670 // For Xe/CO2-gas-mixture
671 // Xe-content of the Xe/CO2-mixture (85% / 15%)
673 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
675 Float_t dxe = .005858;
677 // General tracking parameter
678 Float_t tmaxfd = -10.;
679 Float_t stemax = -1e10;
680 Float_t deemax = -0.1;
681 Float_t epsil = 1e-4;
682 Float_t stmin = -0.001;
684 Float_t absl, radl, d, buf[1];
685 Float_t agm[2], zgm[2], wgm[2];
689 //////////////////////////////////////////////////////////////////////////
691 //////////////////////////////////////////////////////////////////////////
693 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
694 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
695 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
696 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
697 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
698 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
699 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
700 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
701 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
704 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
705 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
706 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
707 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
708 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
709 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
714 // Get properties of Xe
715 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
716 // Get properties of CO2
717 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
718 // Create gas mixture
721 dgm1 = wgm[0] * dxe + wgm[1] * dco;
722 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
723 // Xe/Isobutane-mixture
724 // Get properties of Xe
725 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
726 // Get properties of Isobutane
727 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
728 // Create gas mixture
731 dgm2 = wgm[0] * dxe + wgm[1] * dis;
732 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
734 //////////////////////////////////////////////////////////////////////////
735 // Tracking Media Parameters
736 //////////////////////////////////////////////////////////////////////////
739 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
740 , tmaxfd, stemax, deemax, epsil, stmin);
742 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
743 , tmaxfd, stemax, deemax, epsil, stmin);
745 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
746 , tmaxfd, stemax, deemax, epsil, stmin);
748 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
749 , tmaxfd, stemax, deemax, epsil, stmin);
751 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
752 , tmaxfd, stemax, deemax, epsil, stmin);
754 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
755 , tmaxfd, stemax, deemax, epsil, stmin);
757 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
758 , tmaxfd, stemax, deemax, epsil, stmin);
760 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
761 , tmaxfd, stemax, deemax, epsil, stmin);
763 // Gas-mixture (Xe/CO2)
764 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
765 , tmaxfd, stemax, deemax, epsil, stmin);
768 // Gas-mixture (Xe/Isobutane)
769 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
770 , tmaxfd, stemax, deemax, epsil, stmin);
772 // Nomex-honeycomb (use carbon for the time being)
773 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
774 , tmaxfd, stemax, deemax, epsil, stmin);
775 // Kapton foils (use Mylar for the time being)
776 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
777 , tmaxfd, stemax, deemax, epsil, stmin);
778 // Gas-filling of the radiator
779 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
780 , tmaxfd, stemax, deemax, epsil, stmin);
782 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
783 , tmaxfd, stemax, deemax, epsil, stmin);
785 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
786 , tmaxfd, stemax, deemax, epsil, stmin);
787 // Rohacell (plexiglas) for the radiator
788 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
789 , tmaxfd, stemax, deemax, epsil, stmin);
791 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
792 , tmaxfd, stemax, deemax, epsil, stmin);
794 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
795 , tmaxfd, stemax, deemax, epsil, stmin);
797 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
798 , tmaxfd, stemax, deemax, epsil, stmin);
800 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
801 , tmaxfd, stemax, deemax, epsil, stmin);
802 // Si in readout chips
803 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
804 , tmaxfd, stemax, deemax, epsil, stmin);
805 // Epoxy in readout chips
806 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
807 , tmaxfd, stemax, deemax, epsil, stmin);
809 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
810 , tmaxfd, stemax, deemax, epsil, stmin);
812 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
813 , tmaxfd, stemax, deemax, epsil, stmin);
814 // Al of cooling pipes
815 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
816 , tmaxfd, stemax, deemax, epsil, stmin);
818 // Save the density values for the TRD absorbtion
827 //_____________________________________________________________________________
828 void AliTRD::DrawModule()
831 // Draw a shaded view of the Transition Radiation Detector version 0
834 // Set everything unseen
835 gMC->Gsatt("*" ,"SEEN",-1);
837 // Set ALIC mother transparent
838 gMC->Gsatt("ALIC","SEEN", 0);
840 // Set the volumes visible
841 if (fGeometry->IsVersion() == 0) {
842 gMC->Gsatt("B071","SEEN", 0);
843 gMC->Gsatt("B074","SEEN", 0);
844 gMC->Gsatt("B075","SEEN", 0);
845 gMC->Gsatt("B077","SEEN", 0);
846 gMC->Gsatt("BTR1","SEEN", 0);
847 gMC->Gsatt("BTR2","SEEN", 0);
848 gMC->Gsatt("BTR3","SEEN", 0);
849 gMC->Gsatt("UTR1","SEEN", 0);
850 gMC->Gsatt("UTR2","SEEN", 0);
851 gMC->Gsatt("UTR3","SEEN", 0);
854 gMC->Gsatt("B071","SEEN", 0);
855 gMC->Gsatt("B074","SEEN", 0);
856 gMC->Gsatt("B075","SEEN", 0);
857 gMC->Gsatt("B077","SEEN", 0);
858 gMC->Gsatt("BTR1","SEEN", 0);
859 gMC->Gsatt("BTR2","SEEN", 0);
860 gMC->Gsatt("BTR3","SEEN", 0);
861 gMC->Gsatt("UTR1","SEEN", 0);
862 if (fGeometry->GetPHOShole())
863 gMC->Gsatt("UTR2","SEEN", 0);
864 if (fGeometry->GetRICHhole())
865 gMC->Gsatt("UTR3","SEEN", 0);
867 // gMC->Gsatt("UCII","SEEN", 0);
868 // gMC->Gsatt("UCIM","SEEN", 0);
869 // gMC->Gsatt("UCIO","SEEN", 0);
870 // gMC->Gsatt("UL02","SEEN", 1);
871 // gMC->Gsatt("UL05","SEEN", 1);
872 // gMC->Gsatt("UL06","SEEN", 1);
874 gMC->Gdopt("hide", "on");
875 gMC->Gdopt("shad", "on");
876 gMC->Gsatt("*", "fill", 7);
877 gMC->SetClipBox(".");
878 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
880 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
881 gMC->Gdhead(1111, "Transition Radiation Detector");
882 gMC->Gdman(18, 4, "MAN");
886 //_____________________________________________________________________________
887 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
890 // Distance between the mouse and the TRD detector on the screen
897 //_____________________________________________________________________________
901 // Initialize the TRD detector after the geometry has been created
907 printf("\n%s: ",ClassName());
908 for (i = 0; i < 35; i++) printf("*");
909 printf(" TRD_INIT ");
910 for (i = 0; i < 35; i++) printf("*");
914 if (fGeometry->IsVersion() == 0) {
915 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
917 else if (fGeometry->IsVersion() == 1) {
918 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
919 if (fGeometry->GetPHOShole())
920 printf("%s: Leave space in front of PHOS free\n",ClassName());
921 if (fGeometry->GetRICHhole())
922 printf("%s: Leave space in front of RICH free\n",ClassName());
926 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
929 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
934 //_____________________________________________________________________________
935 void AliTRD::LoadPoints(Int_t track)
938 // Store x, y, z of all hits in memory.
939 // Hit originating from TR photons are given a different color
943 // AliDetector::LoadPoints(track);
947 if ((fHits == 0) && (fTrackHits == 0)) return;
951 nhits = fHits->GetEntriesFast();
954 nhits = fTrackHits->GetEntriesFast();
956 if (nhits == 0) return;
958 Int_t tracks = gAlice->GetNtrack();
959 if (fPoints == 0) fPoints = new TObjArray(tracks);
963 Int_t *ntrkE = new Int_t[tracks];
964 Int_t *ntrkT = new Int_t[tracks];
965 Int_t *limiE = new Int_t[tracks];
966 Int_t *limiT = new Int_t[tracks];
967 Float_t **coorE = new Float_t*[tracks];
968 Float_t **coorT = new Float_t*[tracks];
969 for(Int_t i = 0; i < tracks; i++) {
978 AliTRDpoints *points = 0;
981 Int_t chunk = nhits / 4 + 1;
983 // Loop over all the hits and store their position
984 ahit = (AliTRDhit *) FirstHit(-1);
988 if (ahit->GetCharge() >= 0) {
990 trk = ahit->GetTrack();
991 if (ntrkE[trk] == limiE[trk]) {
992 // Initialise a new track
993 fp = new Float_t[3*(limiE[trk]+chunk)];
995 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
996 delete [] coorE[trk];
1004 fp[3*ntrkE[trk] ] = ahit->X();
1005 fp[3*ntrkE[trk]+1] = ahit->Y();
1006 fp[3*ntrkE[trk]+2] = ahit->Z();
1011 else if ((ahit->GetCharge() < 0) && (fDrawTR)) {
1013 trk = ahit->GetTrack();
1014 if (ntrkT[trk] == limiT[trk]) {
1015 // Initialise a new track
1016 fp = new Float_t[3*(limiT[trk]+chunk)];
1018 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
1019 delete [] coorT[trk];
1021 limiT[trk] += chunk;
1027 fp[3*ntrkT[trk] ] = ahit->X();
1028 fp[3*ntrkT[trk]+1] = ahit->Y();
1029 fp[3*ntrkT[trk]+2] = ahit->Z();
1034 ahit = (AliTRDhit *) NextHit();
1038 for (trk = 0; trk < tracks; ++trk) {
1040 if (ntrkE[trk] || ntrkT[trk]) {
1042 points = new AliTRDpoints();
1043 points->SetDetector(this);
1044 points->SetParticle(trk);
1046 // Set the dEdx points
1048 points->SetMarkerColor(GetMarkerColor());
1049 points->SetMarkerSize(GetMarkerSize());
1050 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
1051 delete [] coorE[trk];
1055 // Set the TR photon points
1057 points->SetTRpoints(ntrkT[trk],coorT[trk]);
1058 delete [] coorT[trk];
1062 fPoints->AddAt(points,trk);
1077 //_____________________________________________________________________________
1078 void AliTRD::MakeBranch(Option_t* option, const char *file)
1081 // Create Tree branches for the TRD digits.
1084 Int_t buffersize = 4000;
1085 Char_t branchname[15];
1086 sprintf(branchname,"%s",GetName());
1088 const char *cD = strstr(option,"D");
1090 AliDetector::MakeBranch(option,file);
1092 if (fDigits && gAlice->TreeD() && cD) {
1093 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file);
1097 MakeBranch2(option,file);
1102 //_____________________________________________________________________________
1103 void AliTRD::ResetDigits()
1106 // Reset number of digits and the digits array for this detector
1110 if (fDigits) fDigits->Clear();
1114 //_____________________________________________________________________________
1115 void AliTRD::ResetRecPoints()
1118 // Reset number of reconstructed points and the point array
1123 Int_t nentr = fRecPoints->GetEntriesFast();
1124 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1129 //_____________________________________________________________________________
1130 void AliTRD::SetTreeAddress()
1133 // Set the branch addresses for the trees.
1136 Char_t branchname[15];
1138 AliDetector::SetTreeAddress();
1141 TTree *treeR = gAlice->TreeR();
1144 sprintf(branchname,"%scluster",GetName());
1146 branch = treeR->GetBranch(branchname);
1148 branch->SetAddress(&fRecPoints);
1159 //_____________________________________________________________________________
1160 void AliTRD::SetGasMix(Int_t imix)
1163 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1166 if ((imix < 0) || (imix > 1)) {
1167 printf("Wrong input value: %d\n",imix);
1168 printf("Use standard setting\n");
1177 //_____________________________________________________________________________
1178 void AliTRD::SetPHOShole()
1181 // Selects a geometry with a hole in front of the PHOS
1184 fGeometry->SetPHOShole();
1188 //_____________________________________________________________________________
1189 void AliTRD::SetRICHhole()
1192 // Selects a geometry with a hole in front of the RICH
1195 fGeometry->SetRICHhole();
1199 //_____________________________________________________________________________
1200 AliTRD &AliTRD::operator=(const AliTRD &trd)
1203 // Assignment operator
1206 if (this != &trd) ((AliTRD &) trd).Copy(*this);
1211 //_____________________________________________________________________________
1212 void AliTRD::FinishPrimary()
1215 // Store the hits in the containers after all primaries are finished
1219 fTrackHits->FlushHitStack();
1224 //_____________________________________________________________________________
1225 void AliTRD::RemapTrackHitIDs(Int_t *map)
1228 // Remap the track IDs
1236 TClonesArray *arr = fTrackHits->GetArray();;
1237 for (Int_t i = 0; i < arr->GetEntriesFast(); i++){
1238 AliTrackHitsParamV2 *info = (AliTrackHitsParamV2 *) (arr->At(i));
1239 info->fTrackID = map[info->fTrackID];
1245 //_____________________________________________________________________________
1246 void AliTRD::ResetHits()
1252 AliDetector::ResetHits();
1254 fTrackHits->Clear();
1259 //_____________________________________________________________________________
1260 AliHit* AliTRD::FirstHit(Int_t track)
1263 // Return the first hit of a track
1267 return FirstHit2(track);
1270 return AliDetector::FirstHit(track);
1274 //_____________________________________________________________________________
1275 AliHit* AliTRD::NextHit()
1278 // Returns the next hit of a track
1285 return AliDetector::NextHit();
1289 //_____________________________________________________________________________
1290 AliHit* AliTRD::FirstHit2(Int_t track)
1293 // Initializes the hit iterator.
1294 // Returns the address of the first hit of a track.
1295 // If <track> >= 0 the track is read from disk,
1296 // while if <track> < 0 the first hit of the current
1297 // track is returned.
1301 gAlice->ResetHits();
1302 gAlice->TreeH()->GetEvent(track);
1306 fTrackHits->First();
1307 return (AliHit*) fTrackHits->GetHit();
1315 //_____________________________________________________________________________
1316 AliHit* AliTRD::NextHit2()
1319 // Returns the next hit of the current track
1324 return (AliHit *) fTrackHits->GetHit();
1332 //_____________________________________________________________________________
1333 void AliTRD::MakeBranch2(Option_t *option, const char *file)
1336 // Create a new branch in the current Root tree.
1337 // The branch of fHits is automatically split.
1344 char branchname[10];
1345 sprintf(branchname,"%s2",GetName());
1347 // Get the pointer to the header
1348 const char *cH = strstr(option,"H");
1351 fTrackHits = new AliTRDtrackHits();
1354 if (fTrackHits && gAlice->TreeH() && cH) {
1356 gAlice->TreeH()->Branch(branchname,"AliTRDtrackHits"
1360 if (GetDebug() > 1) {
1361 printf("<AliTRD::MakeBranch2> Making Branch %s for trackhits\n"
1365 const char folder[] = "RunMC/Event/Data";
1368 printf("<AliTRD::MakeBranch2> %15s: Publishing %s to %s\n"
1369 ,ClassName(),branchname,folder);
1372 Publish(folder,&fTrackHits,branchname);
1375 TBranch *b = gAlice->TreeH()->GetBranch(branchname);
1376 TDirectory *wd = gDirectory;
1378 TIter next(b->GetListOfBranches());
1379 while ((b = (TBranch*) next())) {
1383 if (GetDebug() > 1) {
1384 printf("<AliTRD::MakeBranch2> Diverting branch %s to file %s\n"
1393 //_____________________________________________________________________________
1394 void AliTRD::SetTreeAddress2()
1397 // Set the branch address for the trackHits tree
1402 char branchname[20];
1404 sprintf(branchname,"%s2",GetName());
1406 // Branch address for hit tree
1407 TTree *treeH = gAlice->TreeH();
1408 if ((treeH) && (fHitType > 0)) {
1409 branch = treeH->GetBranch(branchname);
1411 branch->SetAddress(&fTrackHits);
1417 //_____________________________________________________________________________
1418 void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q
1422 // Add a hit to the list
1428 Int_t primary = gAlice->GetPrimary(track);
1429 gAlice->Particle(primary)->SetBit(kKeepBit);
1434 gAlice->FlagTrack(track);
1437 if ((fTrackHits) && (fHitType > 0)) {
1438 fTrackHits->AddHitTRD(det,rtrack,hits[0],hits[1],hits[2],q,inDrift);