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.25 2001/03/13 09:30:35 cblume
19 Update of digitization. Moved digit branch definition to AliTRD
21 Revision 1.24 2001/01/26 19:56:49 hristov
22 Major upgrade of AliRoot code
24 Revision 1.23 2000/11/01 14:53:20 cblume
25 Merge with TRD-develop
28 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
29 Introduced more detailed geometry for the display
31 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
34 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
35 Replace include files by forward declarations
37 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
38 Included changes for the tracking
40 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
41 Included LoadPoints() method to display the TR photons
43 Revision 1.22 2000/10/02 21:28:19 fca
44 Removal of useless dependecies via forward declarations
46 Revision 1.21 2000/06/09 11:10:07 cblume
47 Compiler warnings and coding conventions, next round
49 Revision 1.20 2000/06/08 18:32:57 cblume
50 Make code compliant to coding conventions
52 Revision 1.19 2000/06/07 16:25:37 cblume
53 Try to remove compiler warnings on Sun and HP
55 Revision 1.18 2000/05/08 16:17:27 cblume
58 Revision 1.21 2000/06/09 11:10:07 cblume
59 Compiler warnings and coding conventions, next round
61 Revision 1.20 2000/06/08 18:32:57 cblume
62 Make code compliant to coding conventions
64 Revision 1.19 2000/06/07 16:25:37 cblume
65 Try to remove compiler warnings on Sun and HP
67 Revision 1.18 2000/05/08 16:17:27 cblume
70 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
71 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
73 Revision 1.17 2000/02/28 19:10:26 cblume
74 Include the new TRD classes
76 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
77 Introduce TRD geometry classes
79 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
80 Include functions and data members for AliTRDrecPoint
82 Revision 1.16 2000/01/19 17:17:35 fca
83 Introducing a list of lists of hits -- more hits allowed for detector now
85 Revision 1.15 1999/11/02 17:04:25 fca
86 Small syntax change for HP compiler
88 Revision 1.14 1999/11/02 16:57:02 fca
89 Avoid non ansi warnings on HP compilers
91 Revision 1.13 1999/11/02 16:35:56 fca
92 New version of TRD introduced
94 Revision 1.12 1999/11/01 20:41:51 fca
95 Added protections against using the wrong version of FRAME
97 Revision 1.11 1999/09/29 09:24:34 fca
98 Introduction of the Copyright and cvs Log
102 ///////////////////////////////////////////////////////////////////////////////
104 // Transition Radiation Detector //
105 // This class contains the basic functions for the Transition Radiation //
108 ///////////////////////////////////////////////////////////////////////////////
111 #include <iostream.h>
115 #include <TGeometry.h>
120 #include "AliConst.h"
121 #include "AliDigit.h"
126 #include "AliTRDhit.h"
127 #include "AliTRDpoints.h"
128 #include "AliTRDdigit.h"
129 #include "AliTRDdigitizer.h"
130 #include "AliTRDclusterizer.h"
131 #include "AliTRDgeometryHole.h"
132 #include "AliTRDgeometryFull.h"
133 #include "AliTRDrecPoint.h"
134 #include "AliTRDcluster.h"
135 #include "AliTRDdigitsManager.h"
136 #include "AliTRDdataArrayI.h"
137 #include "AliTRDsegmentArray.h"
141 //_____________________________________________________________________________
145 // Default constructor
165 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
166 fDictionaryArray[iDict] = 0;
171 //_____________________________________________________________________________
172 AliTRD::AliTRD(const char *name, const char *title)
173 : AliDetector(name,title)
176 // Standard constructor for the TRD
179 // Check that FRAME is there otherwise we have no place where to
181 AliModule* frame = gAlice->GetModule("FRAME");
183 Error("Ctor","TRD needs FRAME to be present\n");
187 // Define the TRD geometry according to the FRAME geometry
188 if (frame->IsVersion() == 0) {
189 // Geometry with hole
190 fGeometry = new AliTRDgeometryHole();
192 else if (frame->IsVersion() == 1) {
193 // Geometry without hole
194 fGeometry = new AliTRDgeometryFull();
197 Error("Ctor","Could not find valid FRAME version\n");
201 // Allocate the hit array
202 fHits = new TClonesArray("AliTRDhit" ,405);
203 gAlice->AddHitList(fHits);
205 // Allocate the digits array
208 // Allocate the rec point array
209 fRecPoints = new TObjArray(400);
222 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
223 fDictionaryArray[iDict] = 0;
226 SetMarkerColor(kWhite);
230 //_____________________________________________________________________________
231 AliTRD::AliTRD(const AliTRD &trd)
237 ((AliTRD &) trd).Copy(*this);
241 //_____________________________________________________________________________
253 if (fDigitsArray) delete fDigitsArray;
254 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
255 if (fDictionaryArray[iDict]) delete fDictionaryArray[iDict];
260 //_____________________________________________________________________________
261 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
262 , Int_t *tracks, Int_t iType)
265 // Add a cluster for the TRD
268 Int_t pla = fGeometry->GetPlane(det);
269 Int_t cha = fGeometry->GetChamber(det);
270 Int_t sec = fGeometry->GetSector(det);
272 Float_t padRow = pos[0];
273 Float_t padCol = pos[1];
274 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
275 Float_t col0 = fGeometry->GetCol0(pla);
276 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
277 Float_t colSize = fGeometry->GetColPadSize(pla);
279 AliTRDcluster *c = new AliTRDcluster();
282 c->AddTrackIndex(tracks);
286 c->SetLocalTimeBin(((Int_t) pos[2]));
287 c->SetY(- (col0 + padCol * colSize));
288 c->SetZ( row0 + padRow * rowSize);
290 c->SetSigmaY2(0.05 * 0.05);
291 c->SetSigmaZ2(rowSize * rowSize / 12.);
301 //_____________________________________________________________________________
302 void AliTRD::Hits2Digits()
308 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
309 ,"TRD digitizer class");
312 digitizer->SetDiffusion();
316 //digitizer->InitDetector();
319 digitizer->MakeDigits();
321 // Write the digits into the input file
322 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
324 digitizer->WriteDigits();
326 // Save the digitizer class in the AliROOT
333 //_____________________________________________________________________________
334 void AliTRD::Hits2SDigits()
337 // Create summable digits
340 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
341 ,"TRD digitizer class");
343 // For the summable digits
344 digitizer->SetSDigits(kTRUE);
347 digitizer->SetDiffusion();
351 //digitizer->InitDetector();
354 digitizer->MakeDigits();
356 // Write the digits into the input file
357 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
359 digitizer->WriteDigits();
361 // Save the digitizer class in the AliROOT
368 //_____________________________________________________________________________
369 void AliTRD::SDigits2Digits()
372 // Create final digits from summable digits
377 //_____________________________________________________________________________
378 void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
381 // Add a digit for the TRD
384 TClonesArray &ldigits = *fDigits;
385 new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
389 //_____________________________________________________________________________
390 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q)
393 // Add a hit for the TRD
396 TClonesArray &lhits = *fHits;
397 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
401 //_____________________________________________________________________________
402 void AliTRD::BuildGeometry()
405 // Create the ROOT TNode geometry for the TRD
412 Float_t zmax1, zmax2;
414 const Int_t kColorTRD = 46;
416 // Find the top node alice
417 top = gAlice->GetGeometry()->GetNode("alice");
419 switch (fDisplayType) {
423 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
424 rmin = AliTRDgeometry::Rmin();
425 rmax = AliTRDgeometry::Rmax();
426 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
427 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
428 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
429 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
431 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
432 node->SetLineColor(kColorTRD);
441 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
442 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
444 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::Ccframe()/2.
445 + AliTRDgeometry::DrZpos()
446 - AliTRDgeometry::DrThick()/2.;
447 rmax = rmin + AliTRDgeometry::DrThick();
449 Float_t thickness = rmin - AliTRDgeometry::Rmin();
450 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
451 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
453 for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
455 sprintf(name,"S_TR1%d",iPlan);
456 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
457 pgon->DefineSection(0,-zmax1,rmax,rmax);
458 pgon->DefineSection(1,-zmax2,rmin,rmax);
459 pgon->DefineSection(2, zmax2,rmin,rmax);
460 pgon->DefineSection(3, zmax1,rmax,rmax);
462 node = new TNode("TRD","TRD",name,0,0,0,"");
463 node->SetLineColor(kColorTRD);
466 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
467 rmin = rmin + height;
468 rmax = rmax + height;
469 zmax1 = zmax1 + slope * height;
470 zmax2 = zmax2 + slope * height;
474 thickness += AliTRDgeometry::DrThick();
475 rmin = AliTRDgeometry::Rmin() + thickness;
476 rmax = rmin + AliTRDgeometry::AmThick();
477 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
478 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
480 for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
482 sprintf(name,"S_TR2%d",iPlan);
483 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
484 pgon->DefineSection(0,-zmax1,rmax,rmax);
485 pgon->DefineSection(1,-zmax2,rmin,rmax);
486 pgon->DefineSection(2, zmax2,rmin,rmax);
487 pgon->DefineSection(3, zmax1,rmax,rmax);
489 node = new TNode("TRD","TRD",name,0,0,0,"");
490 node->SetLineColor(kColorTRD);
493 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
494 rmin = rmin + height;
495 rmax = rmax + height;
496 zmax1 = zmax1 + slope * height;
497 zmax2 = zmax2 + slope * height;
507 //_____________________________________________________________________________
508 void AliTRD::Copy(TObject &trd)
514 ((AliTRD &) trd).fGasMix = fGasMix;
515 ((AliTRD &) trd).fGeometry = fGeometry;
516 ((AliTRD &) trd).fRecPoints = fRecPoints;
517 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
518 ((AliTRD &) trd).fGasDensity = fGasDensity;
519 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
520 ((AliTRD &) trd).fDrawTR = fDrawTR;
521 ((AliTRD &) trd).fDisplayType = fDisplayType;
523 //AliDetector::Copy(trd);
527 //_____________________________________________________________________________
528 void AliTRD::CreateGeometry()
531 // Creates the volumes for the TRD chambers
534 // Check that FRAME is there otherwise we have no place where to put the TRD
535 AliModule* frame = gAlice->GetModule("FRAME");
537 printf(" The TRD needs the FRAME to be defined first\n");
541 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
545 //_____________________________________________________________________________
546 void AliTRD::CreateMaterials()
549 // Create the materials for the TRD
553 Int_t isxfld = gAlice->Field()->Integ();
554 Float_t sxmgmx = gAlice->Field()->Max();
556 // For polyethilene (CH2)
557 Float_t ape[2] = { 12., 1. };
558 Float_t zpe[2] = { 6., 1. };
559 Float_t wpe[2] = { 1., 2. };
562 // For mylar (C5H4O2)
563 Float_t amy[3] = { 12., 1., 16. };
564 Float_t zmy[3] = { 6., 1., 8. };
565 Float_t wmy[3] = { 5., 4., 2. };
569 Float_t aco[2] = { 12., 16. };
570 Float_t zco[2] = { 6., 8. };
571 Float_t wco[2] = { 1., 2. };
572 Float_t dco = 0.001977;
575 Float_t awa[2] = { 1., 16. };
576 Float_t zwa[2] = { 1., 8. };
577 Float_t wwa[2] = { 2., 1. };
580 // For isobutane (C4H10)
581 Float_t ais[2] = { 12., 1. };
582 Float_t zis[2] = { 6., 1. };
583 Float_t wis[2] = { 4., 10. };
584 Float_t dis = 0.00267;
586 // For Xe/CO2-gas-mixture
587 // Xe-content of the Xe/CO2-mixture (90% / 10%)
589 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
591 Float_t dxe = .005858;
593 // General tracking parameter
594 Float_t tmaxfd = -10.;
595 Float_t stemax = -1e10;
596 Float_t deemax = -0.1;
597 Float_t epsil = 1e-4;
598 Float_t stmin = -0.001;
600 Float_t absl, radl, d, buf[1];
601 Float_t agm[2], zgm[2], wgm[2];
605 //////////////////////////////////////////////////////////////////////////
607 //////////////////////////////////////////////////////////////////////////
609 AliMaterial( 1, "Al $", 26.98, 13.0, 2.7 , 8.9 , 37.2);
610 AliMaterial( 2, "Air$", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
611 AliMaterial( 4, "Xe $", 131.29, 54.0, dxe , 1447.59, 0.0);
612 AliMaterial( 5, "Cu $", 63.54, 29.0, 8.96 , 1.43, 14.8);
613 AliMaterial( 6, "C $", 12.01, 6.0, 2.265 , 18.8 , 74.4);
614 AliMaterial(12, "G10$", 20.00, 10.0, 1.7 , 19.4 , 999.0);
617 AliMixture(3, "Polyethilene$", ape, zpe, dpe, -2, wpe);
618 AliMixture(7, "Mylar$", amy, zmy, dmy, -3, wmy);
619 AliMixture(8, "CO2$", aco, zco, dco, -2, wco);
620 AliMixture(9, "Isobutane$", ais, zis, dis, -2, wis);
621 AliMixture(13,"Water$", awa, zwa, dwa, -2, wwa);
626 // Get properties of Xe
627 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
628 // Get properties of CO2
629 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
630 // Create gas mixture
633 dgm1 = wgm[0] * dxe + wgm[1] * dco;
634 AliMixture(10, "Gas mixture 1$", agm, zgm, dgm1, 2, wgm);
635 // Xe/Isobutane-mixture
636 // Get properties of Xe
637 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
638 // Get properties of Isobutane
639 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
640 // Create gas mixture
643 dgm2 = wgm[0] * dxe + wgm[1] * dis;
644 AliMixture(11, "Gas mixture 2$", agm, zgm, dgm2, 2, wgm);
646 //////////////////////////////////////////////////////////////////////////
647 // Tracking Media Parameters
648 //////////////////////////////////////////////////////////////////////////
651 AliMedium(1, "Al Frame$", 1, 0, isxfld, sxmgmx
652 , tmaxfd, stemax, deemax, epsil, stmin);
654 AliMedium(2, "Air$", 2, 0, isxfld, sxmgmx
655 , tmaxfd, stemax, deemax, epsil, stmin);
657 AliMedium(3, "Radiator$", 3, 0, isxfld, sxmgmx
658 , tmaxfd, stemax, deemax, epsil, stmin);
660 AliMedium(4, "Xe$", 4, 1, isxfld, sxmgmx
661 , tmaxfd, stemax, deemax, epsil, stmin);
663 AliMedium(5, "Padplane$", 5, 1, isxfld, sxmgmx
664 , tmaxfd, stemax, deemax, epsil, stmin);
666 AliMedium(6, "Readout$", 1, 0, isxfld, sxmgmx
667 , tmaxfd, stemax, deemax, epsil, stmin);
669 AliMedium(7, "C Frame$", 6, 0, isxfld, sxmgmx
670 , tmaxfd, stemax, deemax, epsil, stmin);
672 AliMedium(8, "Mylar$", 7, 0, isxfld, sxmgmx
673 , tmaxfd, stemax, deemax, epsil, stmin);
675 // Gas-mixture (Xe/CO2)
676 AliMedium(9, "Gas-mix$", 10, 1, isxfld, sxmgmx
677 , tmaxfd, stemax, deemax, epsil, stmin);
680 // Gas-mixture (Xe/Isobutane)
681 AliMedium(9, "Gas-mix$", 11, 1, isxfld, sxmgmx
682 , tmaxfd, stemax, deemax, epsil, stmin);
684 // Nomex-honeycomb (use carbon for the time being)
685 AliMedium(10, "Nomex$", 6, 0, isxfld, sxmgmx
686 , tmaxfd, stemax, deemax, epsil, stmin);
687 // Kapton foils (use Mylar for the time being)
688 AliMedium(11, "Kapton$", 7, 0, isxfld, sxmgmx
689 , tmaxfd, stemax, deemax, epsil, stmin);
690 // Gas-filling of the radiator
691 AliMedium(12, "CO2$", 8, 0, isxfld, sxmgmx
692 , tmaxfd, stemax, deemax, epsil, stmin);
694 AliMedium(13, "G10-plates$",12, 0, isxfld, sxmgmx
695 , tmaxfd, stemax, deemax, epsil, stmin);
697 AliMedium(14, "Water$", 13, 0, isxfld, sxmgmx
698 , tmaxfd, stemax, deemax, epsil, stmin);
700 // Save the density values for the TRD absorbtion
709 //_____________________________________________________________________________
710 void AliTRD::DrawModule()
713 // Draw a shaded view of the Transition Radiation Detector version 0
716 // Set everything unseen
717 gMC->Gsatt("*" ,"SEEN",-1);
719 // Set ALIC mother transparent
720 gMC->Gsatt("ALIC","SEEN", 0);
722 // Set the volumes visible
723 if (fGeometry->IsVersion() == 0) {
724 gMC->Gsatt("B071","SEEN", 0);
725 gMC->Gsatt("B074","SEEN", 0);
726 gMC->Gsatt("B075","SEEN", 0);
727 gMC->Gsatt("B077","SEEN", 0);
728 gMC->Gsatt("BTR1","SEEN", 0);
729 gMC->Gsatt("BTR2","SEEN", 0);
730 gMC->Gsatt("BTR3","SEEN", 0);
731 gMC->Gsatt("TRD1","SEEN", 0);
732 gMC->Gsatt("TRD2","SEEN", 0);
733 gMC->Gsatt("TRD3","SEEN", 0);
736 gMC->Gsatt("B071","SEEN", 0);
737 gMC->Gsatt("B074","SEEN", 0);
738 gMC->Gsatt("B075","SEEN", 0);
739 gMC->Gsatt("B077","SEEN", 0);
740 gMC->Gsatt("BTR1","SEEN", 0);
741 gMC->Gsatt("BTR2","SEEN", 0);
742 gMC->Gsatt("BTR3","SEEN", 0);
743 gMC->Gsatt("TRD1","SEEN", 0);
744 if (fGeometry->GetPHOShole())
745 gMC->Gsatt("TRD2","SEEN", 0);
746 if (fGeometry->GetRICHhole())
747 gMC->Gsatt("TRD3","SEEN", 0);
749 gMC->Gsatt("UCII","SEEN", 0);
750 gMC->Gsatt("UCIM","SEEN", 0);
751 gMC->Gsatt("UCIO","SEEN", 0);
752 gMC->Gsatt("UL02","SEEN", 1);
753 gMC->Gsatt("UL05","SEEN", 1);
754 gMC->Gsatt("UL06","SEEN", 1);
756 gMC->Gdopt("hide", "on");
757 gMC->Gdopt("shad", "on");
758 gMC->Gsatt("*", "fill", 7);
759 gMC->SetClipBox(".");
760 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
762 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
763 gMC->Gdhead(1111, "Transition Radiation Detector");
764 gMC->Gdman(18, 4, "MAN");
768 //_____________________________________________________________________________
769 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
772 // Distance between the mouse and the TRD detector on the screen
779 //_____________________________________________________________________________
783 // Initialize the TRD detector after the geometry has been created
789 for (i = 0; i < 35; i++) printf("*");
790 printf(" TRD_INIT ");
791 for (i = 0; i < 35; i++) printf("*");
795 if (fGeometry->IsVersion() == 0) {
796 printf(" Geometry for spaceframe with holes initialized.\n\n");
798 else if (fGeometry->IsVersion() == 1) {
799 printf(" Geometry for spaceframe without holes initialized.\n");
800 if (fGeometry->GetPHOShole())
801 printf(" Leave space in front of PHOS free.\n");
802 if (fGeometry->GetRICHhole())
803 printf(" Leave space in front of RICH free.\n");
808 printf(" Gas Mixture: 90%% Xe + 10%% CO2\n\n");
810 printf(" Gas Mixture: 97%% Xe + 3%% Isobutane\n\n");
814 //_____________________________________________________________________________
815 void AliTRD::LoadPoints(Int_t track)
818 // Store x, y, z of all hits in memory.
819 // Hit originating from TR photons are given a different color
823 AliDetector::LoadPoints(track);
827 if (fHits == 0) return;
829 Int_t nhits = fHits->GetEntriesFast();
830 if (nhits == 0) return;
832 Int_t tracks = gAlice->GetNtrack();
833 if (fPoints == 0) fPoints = new TObjArray(tracks);
837 Int_t *ntrkE = new Int_t[tracks];
838 Int_t *ntrkT = new Int_t[tracks];
839 Int_t *limiE = new Int_t[tracks];
840 Int_t *limiT = new Int_t[tracks];
841 Float_t **coorE = new Float_t*[tracks];
842 Float_t **coorT = new Float_t*[tracks];
843 for(Int_t i = 0; i < tracks; i++) {
852 AliTRDpoints *points = 0;
855 Int_t chunk = nhits / 4 + 1;
857 // Loop over all the hits and store their position
858 for (Int_t hit = 0; hit < nhits; hit++) {
860 ahit = (AliTRDhit *) fHits->UncheckedAt(hit);
863 if (ahit->FromDrift() || ahit->FromAmplification()) {
865 trk = ahit->GetTrack();
866 if (ntrkE[trk] == limiE[trk]) {
867 // Initialise a new track
868 fp = new Float_t[3*(limiE[trk]+chunk)];
870 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
871 delete [] coorE[trk];
879 fp[3*ntrkE[trk] ] = ahit->X();
880 fp[3*ntrkE[trk]+1] = ahit->Y();
881 fp[3*ntrkE[trk]+2] = ahit->Z();
886 else if (ahit->FromTRphoton()) {
888 trk = ahit->GetTrack();
889 if (ntrkT[trk] == limiT[trk]) {
890 // Initialise a new track
891 fp = new Float_t[3*(limiT[trk]+chunk)];
893 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
894 delete [] coorT[trk];
902 fp[3*ntrkT[trk] ] = ahit->X();
903 fp[3*ntrkT[trk]+1] = ahit->Y();
904 fp[3*ntrkT[trk]+2] = ahit->Z();
911 for (trk = 0; trk < tracks; ++trk) {
913 if (ntrkE[trk] || ntrkT[trk]) {
915 points = new AliTRDpoints();
916 points->SetDetector(this);
917 points->SetParticle(trk);
919 // Set the dEdx points
921 points->SetMarkerColor(GetMarkerColor());
922 points->SetMarkerSize(GetMarkerSize());
923 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
924 delete [] coorE[trk];
928 // Set the TR photon points
930 points->SetTRpoints(ntrkT[trk],coorT[trk]);
931 delete [] coorT[trk];
935 fPoints->AddAt(points,trk);
950 //_____________________________________________________________________________
951 void AliTRD::MakeBranch(Option_t* option, char *file)
954 // Create Tree branches for the TRD digits and cluster.
957 //Int_t buffersize = 4000;
958 //Char_t branchname[15];
960 AliDetector::MakeBranch(option,file);
962 Int_t buffersize = 64000;
964 fDigitsArray = new AliTRDdataArrayI();
965 gAlice->MakeBranchInTree(gAlice->TreeD()
966 ,"TRDdigits", fDigitsArray->IsA()->GetName()
967 ,&fDigitsArray,buffersize,1,file);
969 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
970 Char_t branchname[15];
971 sprintf(branchname,"TRDdictionary%d",iDict);
972 fDictionaryArray[iDict] = new AliTRDdataArrayI();
973 gAlice->MakeBranchInTree(gAlice->TreeD()
974 ,branchname,fDictionaryArray[iDict]->IsA()->GetName()
975 ,&fDictionaryArray[iDict],buffersize,1,file) ;
980 //_____________________________________________________________________________
981 void AliTRD::ResetDigits()
987 if (gAlice->TreeD()) {
989 branch = gAlice->TreeD()->GetBranch("TRDdigits");
992 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
993 Char_t branchname[15];
994 sprintf(branchname,"TRDdictionary%d",iDict);
995 branch = gAlice->TreeD()->GetBranch(branchname);
1003 //_____________________________________________________________________________
1004 void AliTRD::ResetRecPoints()
1007 // Reset number of reconstructed points and the point array
1012 Int_t nentr = fRecPoints->GetEntriesFast();
1013 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1018 //_____________________________________________________________________________
1019 void AliTRD::SetTreeAddress()
1022 // Set the branch addresses for the trees.
1025 Char_t branchname[15];
1027 AliDetector::SetTreeAddress();
1030 TTree *treeR = gAlice->TreeR();
1033 sprintf(branchname,"%scluster",GetName());
1035 branch = treeR->GetBranch(branchname);
1037 branch->SetAddress(&fRecPoints);
1044 //_____________________________________________________________________________
1045 void AliTRD::SetGasMix(Int_t imix)
1048 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1051 if ((imix < 0) || (imix > 1)) {
1052 printf("Wrong input value: %d\n",imix);
1053 printf("Use standard setting\n");
1062 //_____________________________________________________________________________
1063 void AliTRD::SetPHOShole()
1066 // Selects a geometry with a hole in front of the PHOS
1069 fGeometry->SetPHOShole();
1073 //_____________________________________________________________________________
1074 void AliTRD::SetRICHhole()
1077 // Selects a geometry with a hole in front of the RICH
1080 fGeometry->SetRICHhole();
1084 //_____________________________________________________________________________
1085 AliTRD &AliTRD::operator=(const AliTRD &trd)
1088 // Assignment operator
1091 if (this != &trd) ((AliTRD &) trd).Copy(*this);