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.28 2001/05/16 14:57:27 alibrary
19 New files for folders and Stack
21 Revision 1.27 2001/05/08 07:05:02 hristov
22 Loop variable declared once (HP, Sun)
24 Revision 1.26 2001/05/07 08:03:22 cblume
25 Generate also hits in the amplification region
27 Revision 1.25 2001/03/13 09:30:35 cblume
28 Update of digitization. Moved digit branch definition to AliTRD
30 Revision 1.24 2001/01/26 19:56:49 hristov
31 Major upgrade of AliRoot code
33 Revision 1.23 2000/11/01 14:53:20 cblume
34 Merge with TRD-develop
36 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
37 Introduced more detailed geometry for the display
39 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
42 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
43 Replace include files by forward declarations
45 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
46 Included changes for the tracking
48 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
49 Included LoadPoints() method to display the TR photons
51 Revision 1.22 2000/10/02 21:28:19 fca
52 Removal of useless dependecies via forward declarations
54 Revision 1.21 2000/06/09 11:10:07 cblume
55 Compiler warnings and coding conventions, next round
57 Revision 1.20 2000/06/08 18:32:57 cblume
58 Make code compliant to coding conventions
60 Revision 1.19 2000/06/07 16:25:37 cblume
61 Try to remove compiler warnings on Sun and HP
63 Revision 1.18 2000/05/08 16:17:27 cblume
66 Revision 1.21 2000/06/09 11:10:07 cblume
67 Compiler warnings and coding conventions, next round
69 Revision 1.20 2000/06/08 18:32:57 cblume
70 Make code compliant to coding conventions
72 Revision 1.19 2000/06/07 16:25:37 cblume
73 Try to remove compiler warnings on Sun and HP
75 Revision 1.18 2000/05/08 16:17:27 cblume
78 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
79 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
81 Revision 1.17 2000/02/28 19:10:26 cblume
82 Include the new TRD classes
84 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
85 Introduce TRD geometry classes
87 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
88 Include functions and data members for AliTRDrecPoint
90 Revision 1.16 2000/01/19 17:17:35 fca
91 Introducing a list of lists of hits -- more hits allowed for detector now
93 Revision 1.15 1999/11/02 17:04:25 fca
94 Small syntax change for HP compiler
96 Revision 1.14 1999/11/02 16:57:02 fca
97 Avoid non ansi warnings on HP compilers
99 Revision 1.13 1999/11/02 16:35:56 fca
100 New version of TRD introduced
102 Revision 1.12 1999/11/01 20:41:51 fca
103 Added protections against using the wrong version of FRAME
105 Revision 1.11 1999/09/29 09:24:34 fca
106 Introduction of the Copyright and cvs Log
110 ///////////////////////////////////////////////////////////////////////////////
112 // Transition Radiation Detector //
113 // This class contains the basic functions for the Transition Radiation //
116 ///////////////////////////////////////////////////////////////////////////////
119 #include <iostream.h>
123 #include <TGeometry.h>
128 #include "AliConst.h"
129 #include "AliDigit.h"
134 #include "AliTRDhit.h"
135 #include "AliTRDpoints.h"
136 #include "AliTRDdigit.h"
137 #include "AliTRDdigitizer.h"
138 #include "AliTRDclusterizer.h"
139 #include "AliTRDgeometryHole.h"
140 #include "AliTRDgeometryFull.h"
141 #include "AliTRDrecPoint.h"
142 #include "AliTRDcluster.h"
143 #include "AliTRDdigitsManager.h"
144 #include "AliTRDdataArrayI.h"
145 #include "AliTRDsegmentArray.h"
149 //_____________________________________________________________________________
153 // Default constructor
173 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
174 fDictionaryArray[iDict] = 0;
179 //_____________________________________________________________________________
180 AliTRD::AliTRD(const char *name, const char *title)
181 : AliDetector(name,title)
184 // Standard constructor for the TRD
187 // Check that FRAME is there otherwise we have no place where to
189 AliModule* frame = gAlice->GetModule("FRAME");
191 Error("Ctor","TRD needs FRAME to be present\n");
195 // Define the TRD geometry according to the FRAME geometry
196 if (frame->IsVersion() == 0) {
197 // Geometry with hole
198 fGeometry = new AliTRDgeometryHole();
200 else if (frame->IsVersion() == 1) {
201 // Geometry without hole
202 fGeometry = new AliTRDgeometryFull();
205 Error("Ctor","Could not find valid FRAME version\n");
209 // Allocate the hit array
210 fHits = new TClonesArray("AliTRDhit" ,405);
211 gAlice->AddHitList(fHits);
213 // Allocate the digits array
216 // Allocate the rec point array
217 fRecPoints = new TObjArray(400);
230 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
231 fDictionaryArray[iDict] = 0;
234 SetMarkerColor(kWhite);
238 //_____________________________________________________________________________
239 AliTRD::AliTRD(const AliTRD &trd)
245 ((AliTRD &) trd).Copy(*this);
249 //_____________________________________________________________________________
261 if (fDigitsArray) delete fDigitsArray;
262 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
263 if (fDictionaryArray[iDict]) delete fDictionaryArray[iDict];
268 //_____________________________________________________________________________
269 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
270 , Int_t *tracks, Int_t iType)
273 // Add a cluster for the TRD
276 Int_t pla = fGeometry->GetPlane(det);
277 Int_t cha = fGeometry->GetChamber(det);
278 Int_t sec = fGeometry->GetSector(det);
280 Float_t padRow = pos[0];
281 Float_t padCol = pos[1];
282 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
283 Float_t col0 = fGeometry->GetCol0(pla);
284 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
285 Float_t colSize = fGeometry->GetColPadSize(pla);
287 AliTRDcluster *c = new AliTRDcluster();
290 c->AddTrackIndex(tracks);
294 c->SetLocalTimeBin(((Int_t) pos[2]));
295 c->SetY(- (col0 + padCol * colSize));
296 c->SetZ( row0 + padRow * rowSize);
298 c->SetSigmaY2(0.05 * 0.05);
299 c->SetSigmaZ2(rowSize * rowSize / 12.);
323 //_____________________________________________________________________________
324 void AliTRD::Hits2Digits()
330 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
331 ,"TRD digitizer class");
334 digitizer->SetDiffusion();
336 digitizer->SetEvent(gAlice->GetEvNumber());
338 digitizer->InitDetector();
341 digitizer->MakeDigits();
343 // Write the digits into the input file
344 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
346 digitizer->WriteDigits();
348 // Save the digitizer class in the AliROOT
355 //_____________________________________________________________________________
356 void AliTRD::Hits2SDigits()
359 // Create summable digits
362 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
363 ,"TRD digitizer class");
365 // For the summable digits
366 digitizer->SetSDigits(kTRUE);
369 digitizer->SetDiffusion();
371 digitizer->SetEvent(gAlice->GetEvNumber());
374 digitizer->InitDetector();
377 digitizer->MakeDigits();
379 // Write the digits into the input file
380 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
382 digitizer->WriteDigits();
384 // Save the digitizer class in the AliROOT
391 //_____________________________________________________________________________
392 void AliTRD::SDigits2Digits()
395 // Create final digits from summable digits
400 //_____________________________________________________________________________
401 void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
404 // Add a digit for the TRD
407 TClonesArray &ldigits = *fDigits;
408 new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
412 //_____________________________________________________________________________
413 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q)
416 // Add a hit for the TRD
419 TClonesArray &lhits = *fHits;
420 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
424 //_____________________________________________________________________________
425 void AliTRD::BuildGeometry()
428 // Create the ROOT TNode geometry for the TRD
435 Float_t zmax1, zmax2;
439 const Int_t kColorTRD = 46;
441 // Find the top node alice
442 top = gAlice->GetGeometry()->GetNode("alice");
444 if (fDisplayType == 0) {
446 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
447 rmin = AliTRDgeometry::Rmin();
448 rmax = AliTRDgeometry::Rmax();
449 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
450 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
451 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
452 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
454 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
455 node->SetLineColor(kColorTRD);
459 else if (fDisplayType == 1) {
463 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
464 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
466 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::Ccframe()/2.
467 + AliTRDgeometry::DrZpos()
468 - AliTRDgeometry::DrThick()/2.;
469 rmax = rmin + AliTRDgeometry::DrThick();
471 Float_t thickness = rmin - AliTRDgeometry::Rmin();
472 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
473 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
475 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
477 sprintf(name,"S_TR1%d",iPlan);
478 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
479 pgon->DefineSection(0,-zmax1,rmax,rmax);
480 pgon->DefineSection(1,-zmax2,rmin,rmax);
481 pgon->DefineSection(2, zmax2,rmin,rmax);
482 pgon->DefineSection(3, zmax1,rmax,rmax);
484 node = new TNode("TRD","TRD",name,0,0,0,"");
485 node->SetLineColor(kColorTRD);
488 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
489 rmin = rmin + height;
490 rmax = rmax + height;
491 zmax1 = zmax1 + slope * height;
492 zmax2 = zmax2 + slope * height;
496 thickness += AliTRDgeometry::DrThick();
497 rmin = AliTRDgeometry::Rmin() + thickness;
498 rmax = rmin + AliTRDgeometry::AmThick();
499 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
500 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
502 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
504 sprintf(name,"S_TR2%d",iPlan);
505 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
506 pgon->DefineSection(0,-zmax1,rmax,rmax);
507 pgon->DefineSection(1,-zmax2,rmin,rmax);
508 pgon->DefineSection(2, zmax2,rmin,rmax);
509 pgon->DefineSection(3, zmax1,rmax,rmax);
511 node = new TNode("TRD","TRD",name,0,0,0,"");
512 node->SetLineColor(kColorTRD);
515 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
516 rmin = rmin + height;
517 rmax = rmax + height;
518 zmax1 = zmax1 + slope * height;
519 zmax2 = zmax2 + slope * height;
527 //_____________________________________________________________________________
528 void AliTRD::Copy(TObject &trd)
534 ((AliTRD &) trd).fGasMix = fGasMix;
535 ((AliTRD &) trd).fGeometry = fGeometry;
536 ((AliTRD &) trd).fRecPoints = fRecPoints;
537 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
538 ((AliTRD &) trd).fGasDensity = fGasDensity;
539 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
540 ((AliTRD &) trd).fDrawTR = fDrawTR;
541 ((AliTRD &) trd).fDisplayType = fDisplayType;
543 //AliDetector::Copy(trd);
547 //_____________________________________________________________________________
548 void AliTRD::CreateGeometry()
551 // Creates the volumes for the TRD chambers
554 // Check that FRAME is there otherwise we have no place where to put the TRD
555 AliModule* frame = gAlice->GetModule("FRAME");
557 printf(" The TRD needs the FRAME to be defined first\n");
561 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
565 //_____________________________________________________________________________
566 void AliTRD::CreateMaterials()
569 // Create the materials for the TRD
573 Int_t isxfld = gAlice->Field()->Integ();
574 Float_t sxmgmx = gAlice->Field()->Max();
576 // For polyethilene (CH2)
577 Float_t ape[2] = { 12., 1. };
578 Float_t zpe[2] = { 6., 1. };
579 Float_t wpe[2] = { 1., 2. };
582 // For mylar (C5H4O2)
583 Float_t amy[3] = { 12., 1., 16. };
584 Float_t zmy[3] = { 6., 1., 8. };
585 Float_t wmy[3] = { 5., 4., 2. };
589 Float_t aco[2] = { 12., 16. };
590 Float_t zco[2] = { 6., 8. };
591 Float_t wco[2] = { 1., 2. };
592 Float_t dco = 0.001977;
595 Float_t awa[2] = { 1., 16. };
596 Float_t zwa[2] = { 1., 8. };
597 Float_t wwa[2] = { 2., 1. };
600 // For isobutane (C4H10)
601 Float_t ais[2] = { 12., 1. };
602 Float_t zis[2] = { 6., 1. };
603 Float_t wis[2] = { 4., 10. };
604 Float_t dis = 0.00267;
606 // For plexiglas (C5H8O2)
607 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
608 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
609 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
612 // For Xe/CO2-gas-mixture
613 // Xe-content of the Xe/CO2-mixture (85% / 15%)
615 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
617 Float_t dxe = .005858;
619 // General tracking parameter
620 Float_t tmaxfd = -10.;
621 Float_t stemax = -1e10;
622 Float_t deemax = -0.1;
623 Float_t epsil = 1e-4;
624 Float_t stmin = -0.001;
626 Float_t absl, radl, d, buf[1];
627 Float_t agm[2], zgm[2], wgm[2];
631 //////////////////////////////////////////////////////////////////////////
633 //////////////////////////////////////////////////////////////////////////
635 AliMaterial( 1, "Al ", 26.98, 13.0, 2.7 , 8.9 , 37.2);
636 AliMaterial( 2, "Air", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
637 AliMaterial( 4, "Xe ", 131.29, 54.0, dxe , 1447.59, 0.0);
638 AliMaterial( 5, "Cu ", 63.54, 29.0, 8.96 , 1.43, 14.8);
639 AliMaterial( 6, "C ", 12.01, 6.0, 2.265 , 18.8 , 74.4);
640 AliMaterial(12, "G10", 20.00, 10.0, 1.7 , 19.4 , 999.0);
643 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
644 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
645 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
646 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
647 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
648 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
653 // Get properties of Xe
654 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
655 // Get properties of CO2
656 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
657 // Create gas mixture
660 dgm1 = wgm[0] * dxe + wgm[1] * dco;
661 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
662 // Xe/Isobutane-mixture
663 // Get properties of Xe
664 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
665 // Get properties of Isobutane
666 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
667 // Create gas mixture
670 dgm2 = wgm[0] * dxe + wgm[1] * dis;
671 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
673 //////////////////////////////////////////////////////////////////////////
674 // Tracking Media Parameters
675 //////////////////////////////////////////////////////////////////////////
678 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
679 , tmaxfd, stemax, deemax, epsil, stmin);
681 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
682 , tmaxfd, stemax, deemax, epsil, stmin);
684 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
685 , tmaxfd, stemax, deemax, epsil, stmin);
687 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
688 , tmaxfd, stemax, deemax, epsil, stmin);
690 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
691 , tmaxfd, stemax, deemax, epsil, stmin);
693 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
694 , tmaxfd, stemax, deemax, epsil, stmin);
696 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
697 , tmaxfd, stemax, deemax, epsil, stmin);
699 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
700 , tmaxfd, stemax, deemax, epsil, stmin);
702 // Gas-mixture (Xe/CO2)
703 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
704 , tmaxfd, stemax, deemax, epsil, stmin);
707 // Gas-mixture (Xe/Isobutane)
708 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
709 , tmaxfd, stemax, deemax, epsil, stmin);
711 // Nomex-honeycomb (use carbon for the time being)
712 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
713 , tmaxfd, stemax, deemax, epsil, stmin);
714 // Kapton foils (use Mylar for the time being)
715 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
716 , tmaxfd, stemax, deemax, epsil, stmin);
717 // Gas-filling of the radiator
718 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
719 , tmaxfd, stemax, deemax, epsil, stmin);
721 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
722 , tmaxfd, stemax, deemax, epsil, stmin);
724 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
725 , tmaxfd, stemax, deemax, epsil, stmin);
726 // Rohacell (plexiglas) for the radiator
727 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
728 , tmaxfd, stemax, deemax, epsil, stmin);
730 // Save the density values for the TRD absorbtion
739 //_____________________________________________________________________________
740 void AliTRD::DrawModule()
743 // Draw a shaded view of the Transition Radiation Detector version 0
746 // Set everything unseen
747 gMC->Gsatt("*" ,"SEEN",-1);
749 // Set ALIC mother transparent
750 gMC->Gsatt("ALIC","SEEN", 0);
752 // Set the volumes visible
753 if (fGeometry->IsVersion() == 0) {
754 gMC->Gsatt("B071","SEEN", 0);
755 gMC->Gsatt("B074","SEEN", 0);
756 gMC->Gsatt("B075","SEEN", 0);
757 gMC->Gsatt("B077","SEEN", 0);
758 gMC->Gsatt("BTR1","SEEN", 0);
759 gMC->Gsatt("BTR2","SEEN", 0);
760 gMC->Gsatt("BTR3","SEEN", 0);
761 gMC->Gsatt("TRD1","SEEN", 0);
762 gMC->Gsatt("TRD2","SEEN", 0);
763 gMC->Gsatt("TRD3","SEEN", 0);
766 gMC->Gsatt("B071","SEEN", 0);
767 gMC->Gsatt("B074","SEEN", 0);
768 gMC->Gsatt("B075","SEEN", 0);
769 gMC->Gsatt("B077","SEEN", 0);
770 gMC->Gsatt("BTR1","SEEN", 0);
771 gMC->Gsatt("BTR2","SEEN", 0);
772 gMC->Gsatt("BTR3","SEEN", 0);
773 gMC->Gsatt("TRD1","SEEN", 0);
774 if (fGeometry->GetPHOShole())
775 gMC->Gsatt("TRD2","SEEN", 0);
776 if (fGeometry->GetRICHhole())
777 gMC->Gsatt("TRD3","SEEN", 0);
779 gMC->Gsatt("UCII","SEEN", 0);
780 gMC->Gsatt("UCIM","SEEN", 0);
781 gMC->Gsatt("UCIO","SEEN", 0);
782 gMC->Gsatt("UL02","SEEN", 1);
783 gMC->Gsatt("UL05","SEEN", 1);
784 gMC->Gsatt("UL06","SEEN", 1);
786 gMC->Gdopt("hide", "on");
787 gMC->Gdopt("shad", "on");
788 gMC->Gsatt("*", "fill", 7);
789 gMC->SetClipBox(".");
790 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
792 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
793 gMC->Gdhead(1111, "Transition Radiation Detector");
794 gMC->Gdman(18, 4, "MAN");
798 //_____________________________________________________________________________
799 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
802 // Distance between the mouse and the TRD detector on the screen
809 //_____________________________________________________________________________
813 // Initialize the TRD detector after the geometry has been created
819 printf("\n%s: ",ClassName());
820 for (i = 0; i < 35; i++) printf("*");
821 printf(" TRD_INIT ");
822 for (i = 0; i < 35; i++) printf("*");
826 if (fGeometry->IsVersion() == 0) {
827 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
829 else if (fGeometry->IsVersion() == 1) {
830 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
831 if (fGeometry->GetPHOShole())
832 printf("%s: Leave space in front of PHOS free\n",ClassName());
833 if (fGeometry->GetRICHhole())
834 printf("%s: Leave space in front of RICH free\n",ClassName());
838 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
840 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
844 //_____________________________________________________________________________
845 void AliTRD::LoadPoints(Int_t track)
848 // Store x, y, z of all hits in memory.
849 // Hit originating from TR photons are given a different color
853 AliDetector::LoadPoints(track);
857 if (fHits == 0) return;
859 Int_t nhits = fHits->GetEntriesFast();
860 if (nhits == 0) return;
862 Int_t tracks = gAlice->GetNtrack();
863 if (fPoints == 0) fPoints = new TObjArray(tracks);
867 Int_t *ntrkE = new Int_t[tracks];
868 Int_t *ntrkT = new Int_t[tracks];
869 Int_t *limiE = new Int_t[tracks];
870 Int_t *limiT = new Int_t[tracks];
871 Float_t **coorE = new Float_t*[tracks];
872 Float_t **coorT = new Float_t*[tracks];
873 for(Int_t i = 0; i < tracks; i++) {
882 AliTRDpoints *points = 0;
885 Int_t chunk = nhits / 4 + 1;
887 // Loop over all the hits and store their position
888 for (Int_t hit = 0; hit < nhits; hit++) {
890 ahit = (AliTRDhit *) fHits->UncheckedAt(hit);
893 if (ahit->FromDrift() || ahit->FromAmplification()) {
895 trk = ahit->GetTrack();
896 if (ntrkE[trk] == limiE[trk]) {
897 // Initialise a new track
898 fp = new Float_t[3*(limiE[trk]+chunk)];
900 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
901 delete [] coorE[trk];
909 fp[3*ntrkE[trk] ] = ahit->X();
910 fp[3*ntrkE[trk]+1] = ahit->Y();
911 fp[3*ntrkE[trk]+2] = ahit->Z();
916 else if (ahit->FromTRphoton()) {
918 trk = ahit->GetTrack();
919 if (ntrkT[trk] == limiT[trk]) {
920 // Initialise a new track
921 fp = new Float_t[3*(limiT[trk]+chunk)];
923 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
924 delete [] coorT[trk];
932 fp[3*ntrkT[trk] ] = ahit->X();
933 fp[3*ntrkT[trk]+1] = ahit->Y();
934 fp[3*ntrkT[trk]+2] = ahit->Z();
941 for (trk = 0; trk < tracks; ++trk) {
943 if (ntrkE[trk] || ntrkT[trk]) {
945 points = new AliTRDpoints();
946 points->SetDetector(this);
947 points->SetParticle(trk);
949 // Set the dEdx points
951 points->SetMarkerColor(GetMarkerColor());
952 points->SetMarkerSize(GetMarkerSize());
953 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
954 delete [] coorE[trk];
958 // Set the TR photon points
960 points->SetTRpoints(ntrkT[trk],coorT[trk]);
961 delete [] coorT[trk];
965 fPoints->AddAt(points,trk);
980 //_____________________________________________________________________________
981 void AliTRD::MakeBranch(Option_t* option, const char *file)
984 // Create Tree branches for the TRD digits and cluster.
987 //Int_t buffersize = 4000;
988 //Char_t branchname[15];
990 AliDetector::MakeBranch(option,file);
992 Int_t buffersize = 64000;
994 fDigitsArray = new AliTRDdataArrayI();
995 MakeBranchInTree(gAlice->TreeD()
996 ,"TRDdigits", fDigitsArray->IsA()->GetName()
997 ,&fDigitsArray,buffersize,1,file);
999 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
1000 Char_t branchname[15];
1001 sprintf(branchname,"TRDdictionary%d",iDict);
1002 fDictionaryArray[iDict] = new AliTRDdataArrayI();
1003 MakeBranchInTree(gAlice->TreeD()
1004 ,branchname,fDictionaryArray[iDict]->IsA()->GetName()
1005 ,&fDictionaryArray[iDict],buffersize,1,file);
1009 //_____________________________________________________________________________
1010 void AliTRD::ResetDigits()
1013 // Resets the digits
1016 if (gAlice->TreeD()) {
1018 branch = gAlice->TreeD()->GetBranch("TRDdigits");
1021 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
1022 Char_t branchname[15];
1023 sprintf(branchname,"TRDdictionary%d",iDict);
1024 branch = gAlice->TreeD()->GetBranch(branchname);
1032 //_____________________________________________________________________________
1033 void AliTRD::ResetRecPoints()
1036 // Reset number of reconstructed points and the point array
1041 Int_t nentr = fRecPoints->GetEntriesFast();
1042 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1047 //_____________________________________________________________________________
1048 void AliTRD::SetTreeAddress()
1051 // Set the branch addresses for the trees.
1054 Char_t branchname[15];
1056 AliDetector::SetTreeAddress();
1059 TTree *treeR = gAlice->TreeR();
1062 sprintf(branchname,"%scluster",GetName());
1064 branch = treeR->GetBranch(branchname);
1066 branch->SetAddress(&fRecPoints);
1073 //_____________________________________________________________________________
1074 void AliTRD::SetGasMix(Int_t imix)
1077 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1080 if ((imix < 0) || (imix > 1)) {
1081 printf("Wrong input value: %d\n",imix);
1082 printf("Use standard setting\n");
1091 //_____________________________________________________________________________
1092 void AliTRD::SetPHOShole()
1095 // Selects a geometry with a hole in front of the PHOS
1098 fGeometry->SetPHOShole();
1102 //_____________________________________________________________________________
1103 void AliTRD::SetRICHhole()
1106 // Selects a geometry with a hole in front of the RICH
1109 fGeometry->SetRICHhole();
1113 //_____________________________________________________________________________
1114 AliTRD &AliTRD::operator=(const AliTRD &trd)
1117 // Assignment operator
1120 if (this != &trd) ((AliTRD &) trd).Copy(*this);