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.26 2001/05/07 08:03:22 cblume
19 Generate also hits in the amplification region
21 Revision 1.25 2001/03/13 09:30:35 cblume
22 Update of digitization. Moved digit branch definition to AliTRD
24 Revision 1.24 2001/01/26 19:56:49 hristov
25 Major upgrade of AliRoot code
27 Revision 1.23 2000/11/01 14:53:20 cblume
28 Merge with TRD-develop
31 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
32 Introduced more detailed geometry for the display
34 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
37 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
38 Replace include files by forward declarations
40 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
41 Included changes for the tracking
43 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
44 Included LoadPoints() method to display the TR photons
46 Revision 1.22 2000/10/02 21:28:19 fca
47 Removal of useless dependecies via forward declarations
49 Revision 1.21 2000/06/09 11:10:07 cblume
50 Compiler warnings and coding conventions, next round
52 Revision 1.20 2000/06/08 18:32:57 cblume
53 Make code compliant to coding conventions
55 Revision 1.19 2000/06/07 16:25:37 cblume
56 Try to remove compiler warnings on Sun and HP
58 Revision 1.18 2000/05/08 16:17:27 cblume
61 Revision 1.21 2000/06/09 11:10:07 cblume
62 Compiler warnings and coding conventions, next round
64 Revision 1.20 2000/06/08 18:32:57 cblume
65 Make code compliant to coding conventions
67 Revision 1.19 2000/06/07 16:25:37 cblume
68 Try to remove compiler warnings on Sun and HP
70 Revision 1.18 2000/05/08 16:17:27 cblume
73 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
74 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
76 Revision 1.17 2000/02/28 19:10:26 cblume
77 Include the new TRD classes
79 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
80 Introduce TRD geometry classes
82 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
83 Include functions and data members for AliTRDrecPoint
85 Revision 1.16 2000/01/19 17:17:35 fca
86 Introducing a list of lists of hits -- more hits allowed for detector now
88 Revision 1.15 1999/11/02 17:04:25 fca
89 Small syntax change for HP compiler
91 Revision 1.14 1999/11/02 16:57:02 fca
92 Avoid non ansi warnings on HP compilers
94 Revision 1.13 1999/11/02 16:35:56 fca
95 New version of TRD introduced
97 Revision 1.12 1999/11/01 20:41:51 fca
98 Added protections against using the wrong version of FRAME
100 Revision 1.11 1999/09/29 09:24:34 fca
101 Introduction of the Copyright and cvs Log
105 ///////////////////////////////////////////////////////////////////////////////
107 // Transition Radiation Detector //
108 // This class contains the basic functions for the Transition Radiation //
111 ///////////////////////////////////////////////////////////////////////////////
114 #include <iostream.h>
118 #include <TGeometry.h>
123 #include "AliConst.h"
124 #include "AliDigit.h"
129 #include "AliTRDhit.h"
130 #include "AliTRDpoints.h"
131 #include "AliTRDdigit.h"
132 #include "AliTRDdigitizer.h"
133 #include "AliTRDclusterizer.h"
134 #include "AliTRDgeometryHole.h"
135 #include "AliTRDgeometryFull.h"
136 #include "AliTRDrecPoint.h"
137 #include "AliTRDcluster.h"
138 #include "AliTRDdigitsManager.h"
139 #include "AliTRDdataArrayI.h"
140 #include "AliTRDsegmentArray.h"
144 //_____________________________________________________________________________
148 // Default constructor
168 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
169 fDictionaryArray[iDict] = 0;
174 //_____________________________________________________________________________
175 AliTRD::AliTRD(const char *name, const char *title)
176 : AliDetector(name,title)
179 // Standard constructor for the TRD
182 // Check that FRAME is there otherwise we have no place where to
184 AliModule* frame = gAlice->GetModule("FRAME");
186 Error("Ctor","TRD needs FRAME to be present\n");
190 // Define the TRD geometry according to the FRAME geometry
191 if (frame->IsVersion() == 0) {
192 // Geometry with hole
193 fGeometry = new AliTRDgeometryHole();
195 else if (frame->IsVersion() == 1) {
196 // Geometry without hole
197 fGeometry = new AliTRDgeometryFull();
200 Error("Ctor","Could not find valid FRAME version\n");
204 // Allocate the hit array
205 fHits = new TClonesArray("AliTRDhit" ,405);
206 gAlice->AddHitList(fHits);
208 // Allocate the digits array
211 // Allocate the rec point array
212 fRecPoints = new TObjArray(400);
225 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
226 fDictionaryArray[iDict] = 0;
229 SetMarkerColor(kWhite);
233 //_____________________________________________________________________________
234 AliTRD::AliTRD(const AliTRD &trd)
240 ((AliTRD &) trd).Copy(*this);
244 //_____________________________________________________________________________
256 if (fDigitsArray) delete fDigitsArray;
257 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
258 if (fDictionaryArray[iDict]) delete fDictionaryArray[iDict];
263 //_____________________________________________________________________________
264 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
265 , Int_t *tracks, Int_t iType)
268 // Add a cluster for the TRD
271 Int_t pla = fGeometry->GetPlane(det);
272 Int_t cha = fGeometry->GetChamber(det);
273 Int_t sec = fGeometry->GetSector(det);
275 Float_t padRow = pos[0];
276 Float_t padCol = pos[1];
277 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
278 Float_t col0 = fGeometry->GetCol0(pla);
279 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
280 Float_t colSize = fGeometry->GetColPadSize(pla);
282 AliTRDcluster *c = new AliTRDcluster();
285 c->AddTrackIndex(tracks);
289 c->SetLocalTimeBin(((Int_t) pos[2]));
290 c->SetY(- (col0 + padCol * colSize));
291 c->SetZ( row0 + padRow * rowSize);
293 c->SetSigmaY2(0.05 * 0.05);
294 c->SetSigmaZ2(rowSize * rowSize / 12.);
304 //_____________________________________________________________________________
305 void AliTRD::Hits2Digits()
311 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
312 ,"TRD digitizer class");
315 digitizer->SetDiffusion();
317 digitizer->SetEvent(gAlice->GetEvNumber());
319 //digitizer->InitDetector();
322 digitizer->MakeDigits();
324 // Write the digits into the input file
325 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
327 digitizer->WriteDigits();
329 // Save the digitizer class in the AliROOT
336 //_____________________________________________________________________________
337 void AliTRD::Hits2SDigits()
340 // Create summable digits
343 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
344 ,"TRD digitizer class");
346 // For the summable digits
347 digitizer->SetSDigits(kTRUE);
350 digitizer->SetDiffusion();
352 digitizer->SetEvent(gAlice->GetEvNumber());
355 //digitizer->InitDetector();
358 digitizer->MakeDigits();
360 // Write the digits into the input file
361 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
363 digitizer->WriteDigits();
365 // Save the digitizer class in the AliROOT
372 //_____________________________________________________________________________
373 void AliTRD::SDigits2Digits()
376 // Create final digits from summable digits
381 //_____________________________________________________________________________
382 void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
385 // Add a digit for the TRD
388 TClonesArray &ldigits = *fDigits;
389 new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
393 //_____________________________________________________________________________
394 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q)
397 // Add a hit for the TRD
400 TClonesArray &lhits = *fHits;
401 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
405 //_____________________________________________________________________________
406 void AliTRD::BuildGeometry()
409 // Create the ROOT TNode geometry for the TRD
416 Float_t zmax1, zmax2;
418 const Int_t kColorTRD = 46;
420 // Find the top node alice
421 top = gAlice->GetGeometry()->GetNode("alice");
423 switch (fDisplayType) {
427 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
428 rmin = AliTRDgeometry::Rmin();
429 rmax = AliTRDgeometry::Rmax();
430 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
431 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
432 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
433 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
435 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
436 node->SetLineColor(kColorTRD);
445 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
446 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
448 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::Ccframe()/2.
449 + AliTRDgeometry::DrZpos()
450 - AliTRDgeometry::DrThick()/2.;
451 rmax = rmin + AliTRDgeometry::DrThick();
453 Float_t thickness = rmin - AliTRDgeometry::Rmin();
454 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
455 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
457 for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
459 sprintf(name,"S_TR1%d",iPlan);
460 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
461 pgon->DefineSection(0,-zmax1,rmax,rmax);
462 pgon->DefineSection(1,-zmax2,rmin,rmax);
463 pgon->DefineSection(2, zmax2,rmin,rmax);
464 pgon->DefineSection(3, zmax1,rmax,rmax);
466 node = new TNode("TRD","TRD",name,0,0,0,"");
467 node->SetLineColor(kColorTRD);
470 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
471 rmin = rmin + height;
472 rmax = rmax + height;
473 zmax1 = zmax1 + slope * height;
474 zmax2 = zmax2 + slope * height;
478 thickness += AliTRDgeometry::DrThick();
479 rmin = AliTRDgeometry::Rmin() + thickness;
480 rmax = rmin + AliTRDgeometry::AmThick();
481 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
482 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
484 for (Int_t iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
486 sprintf(name,"S_TR2%d",iPlan);
487 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
488 pgon->DefineSection(0,-zmax1,rmax,rmax);
489 pgon->DefineSection(1,-zmax2,rmin,rmax);
490 pgon->DefineSection(2, zmax2,rmin,rmax);
491 pgon->DefineSection(3, zmax1,rmax,rmax);
493 node = new TNode("TRD","TRD",name,0,0,0,"");
494 node->SetLineColor(kColorTRD);
497 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
498 rmin = rmin + height;
499 rmax = rmax + height;
500 zmax1 = zmax1 + slope * height;
501 zmax2 = zmax2 + slope * height;
511 //_____________________________________________________________________________
512 void AliTRD::Copy(TObject &trd)
518 ((AliTRD &) trd).fGasMix = fGasMix;
519 ((AliTRD &) trd).fGeometry = fGeometry;
520 ((AliTRD &) trd).fRecPoints = fRecPoints;
521 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
522 ((AliTRD &) trd).fGasDensity = fGasDensity;
523 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
524 ((AliTRD &) trd).fDrawTR = fDrawTR;
525 ((AliTRD &) trd).fDisplayType = fDisplayType;
527 //AliDetector::Copy(trd);
531 //_____________________________________________________________________________
532 void AliTRD::CreateGeometry()
535 // Creates the volumes for the TRD chambers
538 // Check that FRAME is there otherwise we have no place where to put the TRD
539 AliModule* frame = gAlice->GetModule("FRAME");
541 printf(" The TRD needs the FRAME to be defined first\n");
545 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
549 //_____________________________________________________________________________
550 void AliTRD::CreateMaterials()
553 // Create the materials for the TRD
557 Int_t isxfld = gAlice->Field()->Integ();
558 Float_t sxmgmx = gAlice->Field()->Max();
560 // For polyethilene (CH2)
561 Float_t ape[2] = { 12., 1. };
562 Float_t zpe[2] = { 6., 1. };
563 Float_t wpe[2] = { 1., 2. };
566 // For mylar (C5H4O2)
567 Float_t amy[3] = { 12., 1., 16. };
568 Float_t zmy[3] = { 6., 1., 8. };
569 Float_t wmy[3] = { 5., 4., 2. };
573 Float_t aco[2] = { 12., 16. };
574 Float_t zco[2] = { 6., 8. };
575 Float_t wco[2] = { 1., 2. };
576 Float_t dco = 0.001977;
579 Float_t awa[2] = { 1., 16. };
580 Float_t zwa[2] = { 1., 8. };
581 Float_t wwa[2] = { 2., 1. };
584 // For isobutane (C4H10)
585 Float_t ais[2] = { 12., 1. };
586 Float_t zis[2] = { 6., 1. };
587 Float_t wis[2] = { 4., 10. };
588 Float_t dis = 0.00267;
590 // For Xe/CO2-gas-mixture
591 // Xe-content of the Xe/CO2-mixture (90% / 10%)
593 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
595 Float_t dxe = .005858;
597 // General tracking parameter
598 Float_t tmaxfd = -10.;
599 Float_t stemax = -1e10;
600 Float_t deemax = -0.1;
601 Float_t epsil = 1e-4;
602 Float_t stmin = -0.001;
604 Float_t absl, radl, d, buf[1];
605 Float_t agm[2], zgm[2], wgm[2];
609 //////////////////////////////////////////////////////////////////////////
611 //////////////////////////////////////////////////////////////////////////
613 AliMaterial( 1, "Al $", 26.98, 13.0, 2.7 , 8.9 , 37.2);
614 AliMaterial( 2, "Air$", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
615 AliMaterial( 4, "Xe $", 131.29, 54.0, dxe , 1447.59, 0.0);
616 AliMaterial( 5, "Cu $", 63.54, 29.0, 8.96 , 1.43, 14.8);
617 AliMaterial( 6, "C $", 12.01, 6.0, 2.265 , 18.8 , 74.4);
618 AliMaterial(12, "G10$", 20.00, 10.0, 1.7 , 19.4 , 999.0);
621 AliMixture(3, "Polyethilene$", ape, zpe, dpe, -2, wpe);
622 AliMixture(7, "Mylar$", amy, zmy, dmy, -3, wmy);
623 AliMixture(8, "CO2$", aco, zco, dco, -2, wco);
624 AliMixture(9, "Isobutane$", ais, zis, dis, -2, wis);
625 AliMixture(13,"Water$", awa, zwa, dwa, -2, wwa);
630 // Get properties of Xe
631 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
632 // Get properties of CO2
633 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
634 // Create gas mixture
637 dgm1 = wgm[0] * dxe + wgm[1] * dco;
638 AliMixture(10, "Gas mixture 1$", agm, zgm, dgm1, 2, wgm);
639 // Xe/Isobutane-mixture
640 // Get properties of Xe
641 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
642 // Get properties of Isobutane
643 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
644 // Create gas mixture
647 dgm2 = wgm[0] * dxe + wgm[1] * dis;
648 AliMixture(11, "Gas mixture 2$", agm, zgm, dgm2, 2, wgm);
650 //////////////////////////////////////////////////////////////////////////
651 // Tracking Media Parameters
652 //////////////////////////////////////////////////////////////////////////
655 AliMedium(1, "Al Frame$", 1, 0, isxfld, sxmgmx
656 , tmaxfd, stemax, deemax, epsil, stmin);
658 AliMedium(2, "Air$", 2, 0, isxfld, sxmgmx
659 , tmaxfd, stemax, deemax, epsil, stmin);
661 AliMedium(3, "Radiator$", 3, 0, isxfld, sxmgmx
662 , tmaxfd, stemax, deemax, epsil, stmin);
664 AliMedium(4, "Xe$", 4, 1, isxfld, sxmgmx
665 , tmaxfd, stemax, deemax, epsil, stmin);
667 AliMedium(5, "Padplane$", 5, 1, isxfld, sxmgmx
668 , tmaxfd, stemax, deemax, epsil, stmin);
670 AliMedium(6, "Readout$", 1, 0, isxfld, sxmgmx
671 , tmaxfd, stemax, deemax, epsil, stmin);
673 AliMedium(7, "C Frame$", 6, 0, isxfld, sxmgmx
674 , tmaxfd, stemax, deemax, epsil, stmin);
676 AliMedium(8, "Mylar$", 7, 0, isxfld, sxmgmx
677 , tmaxfd, stemax, deemax, epsil, stmin);
679 // Gas-mixture (Xe/CO2)
680 AliMedium(9, "Gas-mix$", 10, 1, isxfld, sxmgmx
681 , tmaxfd, stemax, deemax, epsil, stmin);
684 // Gas-mixture (Xe/Isobutane)
685 AliMedium(9, "Gas-mix$", 11, 1, isxfld, sxmgmx
686 , tmaxfd, stemax, deemax, epsil, stmin);
688 // Nomex-honeycomb (use carbon for the time being)
689 AliMedium(10, "Nomex$", 6, 0, isxfld, sxmgmx
690 , tmaxfd, stemax, deemax, epsil, stmin);
691 // Kapton foils (use Mylar for the time being)
692 AliMedium(11, "Kapton$", 7, 0, isxfld, sxmgmx
693 , tmaxfd, stemax, deemax, epsil, stmin);
694 // Gas-filling of the radiator
695 AliMedium(12, "CO2$", 8, 0, isxfld, sxmgmx
696 , tmaxfd, stemax, deemax, epsil, stmin);
698 AliMedium(13, "G10-plates$",12, 0, isxfld, sxmgmx
699 , tmaxfd, stemax, deemax, epsil, stmin);
701 AliMedium(14, "Water$", 13, 0, isxfld, sxmgmx
702 , tmaxfd, stemax, deemax, epsil, stmin);
704 // Save the density values for the TRD absorbtion
713 //_____________________________________________________________________________
714 void AliTRD::DrawModule()
717 // Draw a shaded view of the Transition Radiation Detector version 0
720 // Set everything unseen
721 gMC->Gsatt("*" ,"SEEN",-1);
723 // Set ALIC mother transparent
724 gMC->Gsatt("ALIC","SEEN", 0);
726 // Set the volumes visible
727 if (fGeometry->IsVersion() == 0) {
728 gMC->Gsatt("B071","SEEN", 0);
729 gMC->Gsatt("B074","SEEN", 0);
730 gMC->Gsatt("B075","SEEN", 0);
731 gMC->Gsatt("B077","SEEN", 0);
732 gMC->Gsatt("BTR1","SEEN", 0);
733 gMC->Gsatt("BTR2","SEEN", 0);
734 gMC->Gsatt("BTR3","SEEN", 0);
735 gMC->Gsatt("TRD1","SEEN", 0);
736 gMC->Gsatt("TRD2","SEEN", 0);
737 gMC->Gsatt("TRD3","SEEN", 0);
740 gMC->Gsatt("B071","SEEN", 0);
741 gMC->Gsatt("B074","SEEN", 0);
742 gMC->Gsatt("B075","SEEN", 0);
743 gMC->Gsatt("B077","SEEN", 0);
744 gMC->Gsatt("BTR1","SEEN", 0);
745 gMC->Gsatt("BTR2","SEEN", 0);
746 gMC->Gsatt("BTR3","SEEN", 0);
747 gMC->Gsatt("TRD1","SEEN", 0);
748 if (fGeometry->GetPHOShole())
749 gMC->Gsatt("TRD2","SEEN", 0);
750 if (fGeometry->GetRICHhole())
751 gMC->Gsatt("TRD3","SEEN", 0);
753 gMC->Gsatt("UCII","SEEN", 0);
754 gMC->Gsatt("UCIM","SEEN", 0);
755 gMC->Gsatt("UCIO","SEEN", 0);
756 gMC->Gsatt("UL02","SEEN", 1);
757 gMC->Gsatt("UL05","SEEN", 1);
758 gMC->Gsatt("UL06","SEEN", 1);
760 gMC->Gdopt("hide", "on");
761 gMC->Gdopt("shad", "on");
762 gMC->Gsatt("*", "fill", 7);
763 gMC->SetClipBox(".");
764 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
766 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
767 gMC->Gdhead(1111, "Transition Radiation Detector");
768 gMC->Gdman(18, 4, "MAN");
772 //_____________________________________________________________________________
773 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
776 // Distance between the mouse and the TRD detector on the screen
783 //_____________________________________________________________________________
787 // Initialize the TRD detector after the geometry has been created
793 printf("\n%s: ",ClassName());
794 for (i = 0; i < 35; i++) printf("*");
795 printf(" TRD_INIT ");
796 for (i = 0; i < 35; i++) printf("*");
800 if (fGeometry->IsVersion() == 0) {
801 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
803 else if (fGeometry->IsVersion() == 1) {
804 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
805 if (fGeometry->GetPHOShole())
806 printf("%s: Leave space in front of PHOS free\n",ClassName());
807 if (fGeometry->GetRICHhole())
808 printf("%s: Leave space in front of RICH free\n",ClassName());
812 printf("%s: Gas Mixture: 90%% Xe + 10%% CO2\n",ClassName());
814 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
818 //_____________________________________________________________________________
819 void AliTRD::LoadPoints(Int_t track)
822 // Store x, y, z of all hits in memory.
823 // Hit originating from TR photons are given a different color
827 AliDetector::LoadPoints(track);
831 if (fHits == 0) return;
833 Int_t nhits = fHits->GetEntriesFast();
834 if (nhits == 0) return;
836 Int_t tracks = gAlice->GetNtrack();
837 if (fPoints == 0) fPoints = new TObjArray(tracks);
841 Int_t *ntrkE = new Int_t[tracks];
842 Int_t *ntrkT = new Int_t[tracks];
843 Int_t *limiE = new Int_t[tracks];
844 Int_t *limiT = new Int_t[tracks];
845 Float_t **coorE = new Float_t*[tracks];
846 Float_t **coorT = new Float_t*[tracks];
847 for(Int_t i = 0; i < tracks; i++) {
856 AliTRDpoints *points = 0;
859 Int_t chunk = nhits / 4 + 1;
861 // Loop over all the hits and store their position
862 for (Int_t hit = 0; hit < nhits; hit++) {
864 ahit = (AliTRDhit *) fHits->UncheckedAt(hit);
867 if (ahit->FromDrift() || ahit->FromAmplification()) {
869 trk = ahit->GetTrack();
870 if (ntrkE[trk] == limiE[trk]) {
871 // Initialise a new track
872 fp = new Float_t[3*(limiE[trk]+chunk)];
874 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
875 delete [] coorE[trk];
883 fp[3*ntrkE[trk] ] = ahit->X();
884 fp[3*ntrkE[trk]+1] = ahit->Y();
885 fp[3*ntrkE[trk]+2] = ahit->Z();
890 else if (ahit->FromTRphoton()) {
892 trk = ahit->GetTrack();
893 if (ntrkT[trk] == limiT[trk]) {
894 // Initialise a new track
895 fp = new Float_t[3*(limiT[trk]+chunk)];
897 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
898 delete [] coorT[trk];
906 fp[3*ntrkT[trk] ] = ahit->X();
907 fp[3*ntrkT[trk]+1] = ahit->Y();
908 fp[3*ntrkT[trk]+2] = ahit->Z();
915 for (trk = 0; trk < tracks; ++trk) {
917 if (ntrkE[trk] || ntrkT[trk]) {
919 points = new AliTRDpoints();
920 points->SetDetector(this);
921 points->SetParticle(trk);
923 // Set the dEdx points
925 points->SetMarkerColor(GetMarkerColor());
926 points->SetMarkerSize(GetMarkerSize());
927 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
928 delete [] coorE[trk];
932 // Set the TR photon points
934 points->SetTRpoints(ntrkT[trk],coorT[trk]);
935 delete [] coorT[trk];
939 fPoints->AddAt(points,trk);
954 //_____________________________________________________________________________
955 void AliTRD::MakeBranch(Option_t* option, const char *file)
958 // Create Tree branches for the TRD digits and cluster.
961 //Int_t buffersize = 4000;
962 //Char_t branchname[15];
964 AliDetector::MakeBranch(option,file);
966 Int_t buffersize = 64000;
968 fDigitsArray = new AliTRDdataArrayI();
969 MakeBranchInTree(gAlice->TreeD()
970 ,"TRDdigits", fDigitsArray->IsA()->GetName()
971 ,&fDigitsArray,buffersize,1,file);
973 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
974 Char_t branchname[15];
975 sprintf(branchname,"TRDdictionary%d",iDict);
976 fDictionaryArray[iDict] = new AliTRDdataArrayI();
977 MakeBranchInTree(gAlice->TreeD()
978 ,branchname,fDictionaryArray[iDict]->IsA()->GetName()
979 ,&fDictionaryArray[iDict],buffersize,1,file);
983 //_____________________________________________________________________________
984 void AliTRD::ResetDigits()
990 if (gAlice->TreeD()) {
992 branch = gAlice->TreeD()->GetBranch("TRDdigits");
995 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
996 Char_t branchname[15];
997 sprintf(branchname,"TRDdictionary%d",iDict);
998 branch = gAlice->TreeD()->GetBranch(branchname);
1006 //_____________________________________________________________________________
1007 void AliTRD::ResetRecPoints()
1010 // Reset number of reconstructed points and the point array
1015 Int_t nentr = fRecPoints->GetEntriesFast();
1016 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1021 //_____________________________________________________________________________
1022 void AliTRD::SetTreeAddress()
1025 // Set the branch addresses for the trees.
1028 Char_t branchname[15];
1030 AliDetector::SetTreeAddress();
1033 TTree *treeR = gAlice->TreeR();
1036 sprintf(branchname,"%scluster",GetName());
1038 branch = treeR->GetBranch(branchname);
1040 branch->SetAddress(&fRecPoints);
1047 //_____________________________________________________________________________
1048 void AliTRD::SetGasMix(Int_t imix)
1051 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1054 if ((imix < 0) || (imix > 1)) {
1055 printf("Wrong input value: %d\n",imix);
1056 printf("Use standard setting\n");
1065 //_____________________________________________________________________________
1066 void AliTRD::SetPHOShole()
1069 // Selects a geometry with a hole in front of the PHOS
1072 fGeometry->SetPHOShole();
1076 //_____________________________________________________________________________
1077 void AliTRD::SetRICHhole()
1080 // Selects a geometry with a hole in front of the RICH
1083 fGeometry->SetRICHhole();
1087 //_____________________________________________________________________________
1088 AliTRD &AliTRD::operator=(const AliTRD &trd)
1091 // Assignment operator
1094 if (this != &trd) ((AliTRD &) trd).Copy(*this);