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.29 2001/05/21 16:45:47 hristov
19 Last minute changes (C.Blume)
21 Revision 1.28 2001/05/16 14:57:27 alibrary
22 New files for folders and Stack
24 Revision 1.27 2001/05/08 07:05:02 hristov
25 Loop variable declared once (HP, Sun)
27 Revision 1.26 2001/05/07 08:03:22 cblume
28 Generate also hits in the amplification region
30 Revision 1.25 2001/03/13 09:30:35 cblume
31 Update of digitization. Moved digit branch definition to AliTRD
33 Revision 1.24 2001/01/26 19:56:49 hristov
34 Major upgrade of AliRoot code
36 Revision 1.23 2000/11/01 14:53:20 cblume
37 Merge with TRD-develop
39 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
40 Introduced more detailed geometry for the display
42 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
45 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
46 Replace include files by forward declarations
48 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
49 Included changes for the tracking
51 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
52 Included LoadPoints() method to display the TR photons
54 Revision 1.22 2000/10/02 21:28:19 fca
55 Removal of useless dependecies via forward declarations
57 Revision 1.21 2000/06/09 11:10:07 cblume
58 Compiler warnings and coding conventions, next round
60 Revision 1.20 2000/06/08 18:32:57 cblume
61 Make code compliant to coding conventions
63 Revision 1.19 2000/06/07 16:25:37 cblume
64 Try to remove compiler warnings on Sun and HP
66 Revision 1.18 2000/05/08 16:17:27 cblume
69 Revision 1.21 2000/06/09 11:10:07 cblume
70 Compiler warnings and coding conventions, next round
72 Revision 1.20 2000/06/08 18:32:57 cblume
73 Make code compliant to coding conventions
75 Revision 1.19 2000/06/07 16:25:37 cblume
76 Try to remove compiler warnings on Sun and HP
78 Revision 1.18 2000/05/08 16:17:27 cblume
81 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
82 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
84 Revision 1.17 2000/02/28 19:10:26 cblume
85 Include the new TRD classes
87 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
88 Introduce TRD geometry classes
90 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
91 Include functions and data members for AliTRDrecPoint
93 Revision 1.16 2000/01/19 17:17:35 fca
94 Introducing a list of lists of hits -- more hits allowed for detector now
96 Revision 1.15 1999/11/02 17:04:25 fca
97 Small syntax change for HP compiler
99 Revision 1.14 1999/11/02 16:57:02 fca
100 Avoid non ansi warnings on HP compilers
102 Revision 1.13 1999/11/02 16:35:56 fca
103 New version of TRD introduced
105 Revision 1.12 1999/11/01 20:41:51 fca
106 Added protections against using the wrong version of FRAME
108 Revision 1.11 1999/09/29 09:24:34 fca
109 Introduction of the Copyright and cvs Log
113 ///////////////////////////////////////////////////////////////////////////////
115 // Transition Radiation Detector //
116 // This class contains the basic functions for the Transition Radiation //
119 ///////////////////////////////////////////////////////////////////////////////
122 #include <iostream.h>
126 #include <TGeometry.h>
131 #include "AliConst.h"
132 #include "AliDigit.h"
137 #include "AliTRDhit.h"
138 #include "AliTRDpoints.h"
139 #include "AliTRDdigit.h"
140 #include "AliTRDdigitizer.h"
141 #include "AliTRDclusterizer.h"
142 #include "AliTRDgeometryHole.h"
143 #include "AliTRDgeometryFull.h"
144 #include "AliTRDrecPoint.h"
145 #include "AliTRDcluster.h"
146 #include "AliTRDdigitsManager.h"
147 #include "AliTRDdataArrayI.h"
148 #include "AliTRDsegmentArray.h"
152 //_____________________________________________________________________________
156 // Default constructor
176 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
177 fDictionaryArray[iDict] = 0;
182 //_____________________________________________________________________________
183 AliTRD::AliTRD(const char *name, const char *title)
184 : AliDetector(name,title)
187 // Standard constructor for the TRD
190 // Check that FRAME is there otherwise we have no place where to
192 AliModule* frame = gAlice->GetModule("FRAME");
194 Error("Ctor","TRD needs FRAME to be present\n");
198 // Define the TRD geometry according to the FRAME geometry
199 if (frame->IsVersion() == 0) {
200 // Geometry with hole
201 fGeometry = new AliTRDgeometryHole();
203 else if (frame->IsVersion() == 1) {
204 // Geometry without hole
205 fGeometry = new AliTRDgeometryFull();
208 Error("Ctor","Could not find valid FRAME version\n");
212 // Allocate the hit array
213 fHits = new TClonesArray("AliTRDhit" ,405);
214 gAlice->AddHitList(fHits);
216 // Allocate the digits array
219 // Allocate the rec point array
220 fRecPoints = new TObjArray(400);
233 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
234 fDictionaryArray[iDict] = 0;
237 SetMarkerColor(kWhite);
241 //_____________________________________________________________________________
242 AliTRD::AliTRD(const AliTRD &trd)
248 ((AliTRD &) trd).Copy(*this);
252 //_____________________________________________________________________________
264 if (fDigitsArray) delete fDigitsArray;
265 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
266 if (fDictionaryArray[iDict]) delete fDictionaryArray[iDict];
271 //_____________________________________________________________________________
272 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
273 , Int_t *tracks, Float_t sigmaY2, Int_t iType)
276 // Add a cluster for the TRD
279 Int_t pla = fGeometry->GetPlane(det);
280 Int_t cha = fGeometry->GetChamber(det);
281 Int_t sec = fGeometry->GetSector(det);
283 Float_t padRow = pos[0];
284 Float_t padCol = pos[1];
285 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
286 Float_t col0 = fGeometry->GetCol0(pla);
287 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
288 Float_t colSize = fGeometry->GetColPadSize(pla);
290 AliTRDcluster *c = new AliTRDcluster();
293 c->AddTrackIndex(tracks);
297 c->SetLocalTimeBin(((Int_t) pos[2]));
298 c->SetY(- (col0 + padCol * colSize));
299 c->SetZ( row0 + padRow * rowSize);
301 c->SetSigmaY2((sigmaY2 + 1./12.) * colSize*colSize);
302 c->SetSigmaZ2(rowSize * rowSize / 12.);
326 //_____________________________________________________________________________
327 void AliTRD::Hits2Digits()
333 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
334 ,"TRD digitizer class");
337 digitizer->SetDiffusion();
339 digitizer->SetEvent(gAlice->GetEvNumber());
341 digitizer->InitDetector();
344 digitizer->MakeDigits();
346 // Write the digits into the input file
347 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
349 digitizer->WriteDigits();
351 // Save the digitizer class in the AliROOT
358 //_____________________________________________________________________________
359 void AliTRD::Hits2SDigits()
362 // Create summable digits
365 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
366 ,"TRD digitizer class");
368 // For the summable digits
369 digitizer->SetSDigits(kTRUE);
372 digitizer->SetDiffusion();
374 digitizer->SetEvent(gAlice->GetEvNumber());
377 digitizer->InitDetector();
380 digitizer->MakeDigits();
382 // Write the digits into the input file
383 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
385 digitizer->WriteDigits();
387 // Save the digitizer class in the AliROOT
394 //_____________________________________________________________________________
395 void AliTRD::SDigits2Digits()
398 // Create final digits from summable digits
403 //_____________________________________________________________________________
404 void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
407 // Add a digit for the TRD
410 TClonesArray &ldigits = *fDigits;
411 new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
415 //_____________________________________________________________________________
416 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q)
419 // Add a hit for the TRD
422 TClonesArray &lhits = *fHits;
423 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
427 //_____________________________________________________________________________
428 void AliTRD::BuildGeometry()
431 // Create the ROOT TNode geometry for the TRD
438 Float_t zmax1, zmax2;
442 const Int_t kColorTRD = 46;
444 // Find the top node alice
445 top = gAlice->GetGeometry()->GetNode("alice");
447 if (fDisplayType == 0) {
449 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
450 rmin = AliTRDgeometry::Rmin();
451 rmax = AliTRDgeometry::Rmax();
452 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
453 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
454 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
455 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
457 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
458 node->SetLineColor(kColorTRD);
462 else if (fDisplayType == 1) {
466 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
467 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
469 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::Ccframe()/2.
470 + AliTRDgeometry::DrZpos()
471 - AliTRDgeometry::DrThick()/2.;
472 rmax = rmin + AliTRDgeometry::DrThick();
474 Float_t thickness = rmin - AliTRDgeometry::Rmin();
475 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
476 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
478 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
480 sprintf(name,"S_TR1%d",iPlan);
481 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
482 pgon->DefineSection(0,-zmax1,rmax,rmax);
483 pgon->DefineSection(1,-zmax2,rmin,rmax);
484 pgon->DefineSection(2, zmax2,rmin,rmax);
485 pgon->DefineSection(3, zmax1,rmax,rmax);
487 node = new TNode("TRD","TRD",name,0,0,0,"");
488 node->SetLineColor(kColorTRD);
491 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
492 rmin = rmin + height;
493 rmax = rmax + height;
494 zmax1 = zmax1 + slope * height;
495 zmax2 = zmax2 + slope * height;
499 thickness += AliTRDgeometry::DrThick();
500 rmin = AliTRDgeometry::Rmin() + thickness;
501 rmax = rmin + AliTRDgeometry::AmThick();
502 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
503 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
505 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
507 sprintf(name,"S_TR2%d",iPlan);
508 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
509 pgon->DefineSection(0,-zmax1,rmax,rmax);
510 pgon->DefineSection(1,-zmax2,rmin,rmax);
511 pgon->DefineSection(2, zmax2,rmin,rmax);
512 pgon->DefineSection(3, zmax1,rmax,rmax);
514 node = new TNode("TRD","TRD",name,0,0,0,"");
515 node->SetLineColor(kColorTRD);
518 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
519 rmin = rmin + height;
520 rmax = rmax + height;
521 zmax1 = zmax1 + slope * height;
522 zmax2 = zmax2 + slope * height;
530 //_____________________________________________________________________________
531 void AliTRD::Copy(TObject &trd)
537 ((AliTRD &) trd).fGasMix = fGasMix;
538 ((AliTRD &) trd).fGeometry = fGeometry;
539 ((AliTRD &) trd).fRecPoints = fRecPoints;
540 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
541 ((AliTRD &) trd).fGasDensity = fGasDensity;
542 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
543 ((AliTRD &) trd).fDrawTR = fDrawTR;
544 ((AliTRD &) trd).fDisplayType = fDisplayType;
546 //AliDetector::Copy(trd);
550 //_____________________________________________________________________________
551 void AliTRD::CreateGeometry()
554 // Creates the volumes for the TRD chambers
557 // Check that FRAME is there otherwise we have no place where to put the TRD
558 AliModule* frame = gAlice->GetModule("FRAME");
560 printf(" The TRD needs the FRAME to be defined first\n");
564 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
568 //_____________________________________________________________________________
569 void AliTRD::CreateMaterials()
572 // Create the materials for the TRD
576 Int_t isxfld = gAlice->Field()->Integ();
577 Float_t sxmgmx = gAlice->Field()->Max();
579 // For polyethilene (CH2)
580 Float_t ape[2] = { 12., 1. };
581 Float_t zpe[2] = { 6., 1. };
582 Float_t wpe[2] = { 1., 2. };
585 // For mylar (C5H4O2)
586 Float_t amy[3] = { 12., 1., 16. };
587 Float_t zmy[3] = { 6., 1., 8. };
588 Float_t wmy[3] = { 5., 4., 2. };
592 Float_t aco[2] = { 12., 16. };
593 Float_t zco[2] = { 6., 8. };
594 Float_t wco[2] = { 1., 2. };
595 Float_t dco = 0.001977;
598 Float_t awa[2] = { 1., 16. };
599 Float_t zwa[2] = { 1., 8. };
600 Float_t wwa[2] = { 2., 1. };
603 // For isobutane (C4H10)
604 Float_t ais[2] = { 12., 1. };
605 Float_t zis[2] = { 6., 1. };
606 Float_t wis[2] = { 4., 10. };
607 Float_t dis = 0.00267;
609 // For plexiglas (C5H8O2)
610 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
611 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
612 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
615 // For Xe/CO2-gas-mixture
616 // Xe-content of the Xe/CO2-mixture (85% / 15%)
618 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
620 Float_t dxe = .005858;
622 // General tracking parameter
623 Float_t tmaxfd = -10.;
624 Float_t stemax = -1e10;
625 Float_t deemax = -0.1;
626 Float_t epsil = 1e-4;
627 Float_t stmin = -0.001;
629 Float_t absl, radl, d, buf[1];
630 Float_t agm[2], zgm[2], wgm[2];
634 //////////////////////////////////////////////////////////////////////////
636 //////////////////////////////////////////////////////////////////////////
638 AliMaterial( 1, "Al ", 26.98, 13.0, 2.7 , 8.9 , 37.2);
639 AliMaterial( 2, "Air", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
640 AliMaterial( 4, "Xe ", 131.29, 54.0, dxe , 1447.59, 0.0);
641 AliMaterial( 5, "Cu ", 63.54, 29.0, 8.96 , 1.43, 14.8);
642 AliMaterial( 6, "C ", 12.01, 6.0, 2.265 , 18.8 , 74.4);
643 AliMaterial(12, "G10", 20.00, 10.0, 1.7 , 19.4 , 999.0);
646 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
647 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
648 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
649 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
650 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
651 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
656 // Get properties of Xe
657 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
658 // Get properties of CO2
659 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
660 // Create gas mixture
663 dgm1 = wgm[0] * dxe + wgm[1] * dco;
664 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
665 // Xe/Isobutane-mixture
666 // Get properties of Xe
667 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
668 // Get properties of Isobutane
669 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
670 // Create gas mixture
673 dgm2 = wgm[0] * dxe + wgm[1] * dis;
674 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
676 //////////////////////////////////////////////////////////////////////////
677 // Tracking Media Parameters
678 //////////////////////////////////////////////////////////////////////////
681 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
682 , tmaxfd, stemax, deemax, epsil, stmin);
684 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
685 , tmaxfd, stemax, deemax, epsil, stmin);
687 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
688 , tmaxfd, stemax, deemax, epsil, stmin);
690 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
691 , tmaxfd, stemax, deemax, epsil, stmin);
693 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
694 , tmaxfd, stemax, deemax, epsil, stmin);
696 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
697 , tmaxfd, stemax, deemax, epsil, stmin);
699 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
700 , tmaxfd, stemax, deemax, epsil, stmin);
702 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
703 , tmaxfd, stemax, deemax, epsil, stmin);
705 // Gas-mixture (Xe/CO2)
706 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
707 , tmaxfd, stemax, deemax, epsil, stmin);
710 // Gas-mixture (Xe/Isobutane)
711 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
712 , tmaxfd, stemax, deemax, epsil, stmin);
714 // Nomex-honeycomb (use carbon for the time being)
715 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
716 , tmaxfd, stemax, deemax, epsil, stmin);
717 // Kapton foils (use Mylar for the time being)
718 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
719 , tmaxfd, stemax, deemax, epsil, stmin);
720 // Gas-filling of the radiator
721 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
722 , tmaxfd, stemax, deemax, epsil, stmin);
724 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
725 , tmaxfd, stemax, deemax, epsil, stmin);
727 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
728 , tmaxfd, stemax, deemax, epsil, stmin);
729 // Rohacell (plexiglas) for the radiator
730 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
731 , tmaxfd, stemax, deemax, epsil, stmin);
733 // Save the density values for the TRD absorbtion
742 //_____________________________________________________________________________
743 void AliTRD::DrawModule()
746 // Draw a shaded view of the Transition Radiation Detector version 0
749 // Set everything unseen
750 gMC->Gsatt("*" ,"SEEN",-1);
752 // Set ALIC mother transparent
753 gMC->Gsatt("ALIC","SEEN", 0);
755 // Set the volumes visible
756 if (fGeometry->IsVersion() == 0) {
757 gMC->Gsatt("B071","SEEN", 0);
758 gMC->Gsatt("B074","SEEN", 0);
759 gMC->Gsatt("B075","SEEN", 0);
760 gMC->Gsatt("B077","SEEN", 0);
761 gMC->Gsatt("BTR1","SEEN", 0);
762 gMC->Gsatt("BTR2","SEEN", 0);
763 gMC->Gsatt("BTR3","SEEN", 0);
764 gMC->Gsatt("TRD1","SEEN", 0);
765 gMC->Gsatt("TRD2","SEEN", 0);
766 gMC->Gsatt("TRD3","SEEN", 0);
769 gMC->Gsatt("B071","SEEN", 0);
770 gMC->Gsatt("B074","SEEN", 0);
771 gMC->Gsatt("B075","SEEN", 0);
772 gMC->Gsatt("B077","SEEN", 0);
773 gMC->Gsatt("BTR1","SEEN", 0);
774 gMC->Gsatt("BTR2","SEEN", 0);
775 gMC->Gsatt("BTR3","SEEN", 0);
776 gMC->Gsatt("TRD1","SEEN", 0);
777 if (fGeometry->GetPHOShole())
778 gMC->Gsatt("TRD2","SEEN", 0);
779 if (fGeometry->GetRICHhole())
780 gMC->Gsatt("TRD3","SEEN", 0);
782 gMC->Gsatt("UCII","SEEN", 0);
783 gMC->Gsatt("UCIM","SEEN", 0);
784 gMC->Gsatt("UCIO","SEEN", 0);
785 gMC->Gsatt("UL02","SEEN", 1);
786 gMC->Gsatt("UL05","SEEN", 1);
787 gMC->Gsatt("UL06","SEEN", 1);
789 gMC->Gdopt("hide", "on");
790 gMC->Gdopt("shad", "on");
791 gMC->Gsatt("*", "fill", 7);
792 gMC->SetClipBox(".");
793 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
795 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
796 gMC->Gdhead(1111, "Transition Radiation Detector");
797 gMC->Gdman(18, 4, "MAN");
801 //_____________________________________________________________________________
802 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
805 // Distance between the mouse and the TRD detector on the screen
812 //_____________________________________________________________________________
816 // Initialize the TRD detector after the geometry has been created
822 printf("\n%s: ",ClassName());
823 for (i = 0; i < 35; i++) printf("*");
824 printf(" TRD_INIT ");
825 for (i = 0; i < 35; i++) printf("*");
829 if (fGeometry->IsVersion() == 0) {
830 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
832 else if (fGeometry->IsVersion() == 1) {
833 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
834 if (fGeometry->GetPHOShole())
835 printf("%s: Leave space in front of PHOS free\n",ClassName());
836 if (fGeometry->GetRICHhole())
837 printf("%s: Leave space in front of RICH free\n",ClassName());
841 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
843 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
847 //_____________________________________________________________________________
848 void AliTRD::LoadPoints(Int_t track)
851 // Store x, y, z of all hits in memory.
852 // Hit originating from TR photons are given a different color
856 AliDetector::LoadPoints(track);
860 if (fHits == 0) return;
862 Int_t nhits = fHits->GetEntriesFast();
863 if (nhits == 0) return;
865 Int_t tracks = gAlice->GetNtrack();
866 if (fPoints == 0) fPoints = new TObjArray(tracks);
870 Int_t *ntrkE = new Int_t[tracks];
871 Int_t *ntrkT = new Int_t[tracks];
872 Int_t *limiE = new Int_t[tracks];
873 Int_t *limiT = new Int_t[tracks];
874 Float_t **coorE = new Float_t*[tracks];
875 Float_t **coorT = new Float_t*[tracks];
876 for(Int_t i = 0; i < tracks; i++) {
885 AliTRDpoints *points = 0;
888 Int_t chunk = nhits / 4 + 1;
890 // Loop over all the hits and store their position
891 for (Int_t hit = 0; hit < nhits; hit++) {
893 ahit = (AliTRDhit *) fHits->UncheckedAt(hit);
896 if (ahit->FromDrift() || ahit->FromAmplification()) {
898 trk = ahit->GetTrack();
899 if (ntrkE[trk] == limiE[trk]) {
900 // Initialise a new track
901 fp = new Float_t[3*(limiE[trk]+chunk)];
903 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
904 delete [] coorE[trk];
912 fp[3*ntrkE[trk] ] = ahit->X();
913 fp[3*ntrkE[trk]+1] = ahit->Y();
914 fp[3*ntrkE[trk]+2] = ahit->Z();
919 else if (ahit->FromTRphoton()) {
921 trk = ahit->GetTrack();
922 if (ntrkT[trk] == limiT[trk]) {
923 // Initialise a new track
924 fp = new Float_t[3*(limiT[trk]+chunk)];
926 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
927 delete [] coorT[trk];
935 fp[3*ntrkT[trk] ] = ahit->X();
936 fp[3*ntrkT[trk]+1] = ahit->Y();
937 fp[3*ntrkT[trk]+2] = ahit->Z();
944 for (trk = 0; trk < tracks; ++trk) {
946 if (ntrkE[trk] || ntrkT[trk]) {
948 points = new AliTRDpoints();
949 points->SetDetector(this);
950 points->SetParticle(trk);
952 // Set the dEdx points
954 points->SetMarkerColor(GetMarkerColor());
955 points->SetMarkerSize(GetMarkerSize());
956 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
957 delete [] coorE[trk];
961 // Set the TR photon points
963 points->SetTRpoints(ntrkT[trk],coorT[trk]);
964 delete [] coorT[trk];
968 fPoints->AddAt(points,trk);
983 //_____________________________________________________________________________
984 void AliTRD::MakeBranch(Option_t* option, const char *file)
987 // Create Tree branches for the TRD digits and cluster.
990 //Int_t buffersize = 4000;
991 //Char_t branchname[15];
993 AliDetector::MakeBranch(option,file);
995 Int_t buffersize = 64000;
997 fDigitsArray = new AliTRDdataArrayI();
998 MakeBranchInTree(gAlice->TreeD()
999 ,"TRDdigits", fDigitsArray->IsA()->GetName()
1000 ,&fDigitsArray,buffersize,1,file);
1002 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
1003 Char_t branchname[15];
1004 sprintf(branchname,"TRDdictionary%d",iDict);
1005 fDictionaryArray[iDict] = new AliTRDdataArrayI();
1006 MakeBranchInTree(gAlice->TreeD()
1007 ,branchname,fDictionaryArray[iDict]->IsA()->GetName()
1008 ,&fDictionaryArray[iDict],buffersize,1,file);
1012 //_____________________________________________________________________________
1013 void AliTRD::ResetDigits()
1016 // Resets the digits
1019 if (gAlice->TreeD()) {
1021 branch = gAlice->TreeD()->GetBranch("TRDdigits");
1024 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
1025 Char_t branchname[15];
1026 sprintf(branchname,"TRDdictionary%d",iDict);
1027 branch = gAlice->TreeD()->GetBranch(branchname);
1035 //_____________________________________________________________________________
1036 void AliTRD::ResetRecPoints()
1039 // Reset number of reconstructed points and the point array
1044 Int_t nentr = fRecPoints->GetEntriesFast();
1045 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1050 //_____________________________________________________________________________
1051 void AliTRD::SetTreeAddress()
1054 // Set the branch addresses for the trees.
1057 Char_t branchname[15];
1059 AliDetector::SetTreeAddress();
1062 TTree *treeR = gAlice->TreeR();
1065 sprintf(branchname,"%scluster",GetName());
1067 branch = treeR->GetBranch(branchname);
1069 branch->SetAddress(&fRecPoints);
1076 //_____________________________________________________________________________
1077 void AliTRD::SetGasMix(Int_t imix)
1080 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1083 if ((imix < 0) || (imix > 1)) {
1084 printf("Wrong input value: %d\n",imix);
1085 printf("Use standard setting\n");
1094 //_____________________________________________________________________________
1095 void AliTRD::SetPHOShole()
1098 // Selects a geometry with a hole in front of the PHOS
1101 fGeometry->SetPHOShole();
1105 //_____________________________________________________________________________
1106 void AliTRD::SetRICHhole()
1109 // Selects a geometry with a hole in front of the RICH
1112 fGeometry->SetRICHhole();
1116 //_____________________________________________________________________________
1117 AliTRD &AliTRD::operator=(const AliTRD &trd)
1120 // Assignment operator
1123 if (this != &trd) ((AliTRD &) trd).Copy(*this);