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.30 2001/05/28 17:07:58 hristov
19 Last minute changes; ExB correction in AliTRDclusterizerV1; taking into account of material in G10 TEC frames and material between TEC planes (C.Blume,S.Sedykh)
21 Revision 1.29 2001/05/21 16:45:47 hristov
22 Last minute changes (C.Blume)
24 Revision 1.28 2001/05/16 14:57:27 alibrary
25 New files for folders and Stack
27 Revision 1.27 2001/05/08 07:05:02 hristov
28 Loop variable declared once (HP, Sun)
30 Revision 1.26 2001/05/07 08:03:22 cblume
31 Generate also hits in the amplification region
33 Revision 1.25 2001/03/13 09:30:35 cblume
34 Update of digitization. Moved digit branch definition to AliTRD
36 Revision 1.24 2001/01/26 19:56:49 hristov
37 Major upgrade of AliRoot code
39 Revision 1.23 2000/11/01 14:53:20 cblume
40 Merge with TRD-develop
42 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
43 Introduced more detailed geometry for the display
45 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
48 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
49 Replace include files by forward declarations
51 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
52 Included changes for the tracking
54 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
55 Included LoadPoints() method to display the TR photons
57 Revision 1.22 2000/10/02 21:28:19 fca
58 Removal of useless dependecies via forward declarations
60 Revision 1.21 2000/06/09 11:10:07 cblume
61 Compiler warnings and coding conventions, next round
63 Revision 1.20 2000/06/08 18:32:57 cblume
64 Make code compliant to coding conventions
66 Revision 1.19 2000/06/07 16:25:37 cblume
67 Try to remove compiler warnings on Sun and HP
69 Revision 1.18 2000/05/08 16:17:27 cblume
72 Revision 1.21 2000/06/09 11:10:07 cblume
73 Compiler warnings and coding conventions, next round
75 Revision 1.20 2000/06/08 18:32:57 cblume
76 Make code compliant to coding conventions
78 Revision 1.19 2000/06/07 16:25:37 cblume
79 Try to remove compiler warnings on Sun and HP
81 Revision 1.18 2000/05/08 16:17:27 cblume
84 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
85 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
87 Revision 1.17 2000/02/28 19:10:26 cblume
88 Include the new TRD classes
90 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
91 Introduce TRD geometry classes
93 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
94 Include functions and data members for AliTRDrecPoint
96 Revision 1.16 2000/01/19 17:17:35 fca
97 Introducing a list of lists of hits -- more hits allowed for detector now
99 Revision 1.15 1999/11/02 17:04:25 fca
100 Small syntax change for HP compiler
102 Revision 1.14 1999/11/02 16:57:02 fca
103 Avoid non ansi warnings on HP compilers
105 Revision 1.13 1999/11/02 16:35:56 fca
106 New version of TRD introduced
108 Revision 1.12 1999/11/01 20:41:51 fca
109 Added protections against using the wrong version of FRAME
111 Revision 1.11 1999/09/29 09:24:34 fca
112 Introduction of the Copyright and cvs Log
116 ///////////////////////////////////////////////////////////////////////////////
118 // Transition Radiation Detector //
119 // This class contains the basic functions for the Transition Radiation //
122 ///////////////////////////////////////////////////////////////////////////////
125 #include <iostream.h>
129 #include <TGeometry.h>
134 #include "AliConst.h"
135 #include "AliDigit.h"
140 #include "AliTRDhit.h"
141 #include "AliTRDpoints.h"
142 #include "AliTRDdigit.h"
143 #include "AliTRDdigitizer.h"
144 #include "AliTRDclusterizer.h"
145 #include "AliTRDgeometryHole.h"
146 #include "AliTRDgeometryFull.h"
147 #include "AliTRDrecPoint.h"
148 #include "AliTRDcluster.h"
149 #include "AliTRDdigitsManager.h"
150 #include "AliTRDdataArrayI.h"
151 #include "AliTRDsegmentArray.h"
155 //_____________________________________________________________________________
159 // Default constructor
179 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
180 fDictionaryArray[iDict] = 0;
185 //_____________________________________________________________________________
186 AliTRD::AliTRD(const char *name, const char *title)
187 : AliDetector(name,title)
190 // Standard constructor for the TRD
193 // Check that FRAME is there otherwise we have no place where to
195 AliModule* frame = gAlice->GetModule("FRAME");
197 Error("Ctor","TRD needs FRAME to be present\n");
201 // Define the TRD geometry according to the FRAME geometry
202 if (frame->IsVersion() == 0) {
203 // Geometry with hole
204 fGeometry = new AliTRDgeometryHole();
206 else if (frame->IsVersion() == 1) {
207 // Geometry without hole
208 fGeometry = new AliTRDgeometryFull();
211 Error("Ctor","Could not find valid FRAME version\n");
215 // Allocate the hit array
216 fHits = new TClonesArray("AliTRDhit" ,405);
217 gAlice->AddHitList(fHits);
219 // Allocate the digits array
222 // Allocate the rec point array
223 fRecPoints = new TObjArray(400);
236 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
237 fDictionaryArray[iDict] = 0;
240 SetMarkerColor(kWhite);
244 //_____________________________________________________________________________
245 AliTRD::AliTRD(const AliTRD &trd)
251 ((AliTRD &) trd).Copy(*this);
255 //_____________________________________________________________________________
267 if (fDigitsArray) delete fDigitsArray;
268 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
269 if (fDictionaryArray[iDict]) delete fDictionaryArray[iDict];
274 //_____________________________________________________________________________
275 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
276 , Int_t *tracks, Float_t sigmaY2, Int_t iType)
279 // Add a cluster for the TRD
282 Int_t pla = fGeometry->GetPlane(det);
283 Int_t cha = fGeometry->GetChamber(det);
284 Int_t sec = fGeometry->GetSector(det);
286 Float_t padRow = pos[0];
287 Float_t padCol = pos[1];
288 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
289 Float_t col0 = fGeometry->GetCol0(pla);
290 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
291 Float_t colSize = fGeometry->GetColPadSize(pla);
293 AliTRDcluster *c = new AliTRDcluster();
296 c->AddTrackIndex(tracks);
300 c->SetLocalTimeBin(((Int_t) pos[2]));
301 c->SetY(- (col0 + padCol * colSize));
302 c->SetZ( row0 + padRow * rowSize);
304 c->SetSigmaY2((sigmaY2 + 1./12.) * colSize*colSize);
305 c->SetSigmaZ2(rowSize * rowSize / 12.);
329 //_____________________________________________________________________________
330 void AliTRD::Hits2Digits()
336 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
337 ,"TRD digitizer class");
340 digitizer->SetDiffusion();
342 digitizer->SetEvent(gAlice->GetEvNumber());
344 digitizer->InitDetector();
347 digitizer->MakeDigits();
349 // Write the digits into the input file
350 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
352 digitizer->WriteDigits();
354 // Save the digitizer class in the AliROOT
361 //_____________________________________________________________________________
362 void AliTRD::Hits2SDigits()
365 // Create summable digits
368 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
369 ,"TRD digitizer class");
371 // For the summable digits
372 digitizer->SetSDigits(kTRUE);
375 digitizer->SetDiffusion();
377 digitizer->SetEvent(gAlice->GetEvNumber());
380 digitizer->InitDetector();
383 digitizer->MakeDigits();
385 // Write the digits into the input file
386 if (digitizer->Digits()->MakeBranch(fDigitsFile)) {
388 digitizer->WriteDigits();
390 // Save the digitizer class in the AliROOT
397 //_____________________________________________________________________________
398 void AliTRD::SDigits2Digits()
401 // Create final digits from summable digits
406 //_____________________________________________________________________________
407 void AliTRD::AddDigit(Int_t *digits, Int_t *amp)
410 // Add a digit for the TRD
413 TClonesArray &ldigits = *fDigits;
414 new(ldigits[fNdigits++]) AliTRDdigit(kFALSE,digits,amp);
418 //_____________________________________________________________________________
419 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q)
422 // Add a hit for the TRD
425 TClonesArray &lhits = *fHits;
426 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
430 //_____________________________________________________________________________
431 void AliTRD::BuildGeometry()
434 // Create the ROOT TNode geometry for the TRD
441 Float_t zmax1, zmax2;
445 const Int_t kColorTRD = 46;
447 // Find the top node alice
448 top = gAlice->GetGeometry()->GetNode("alice");
450 if (fDisplayType == 0) {
452 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
453 rmin = AliTRDgeometry::Rmin();
454 rmax = AliTRDgeometry::Rmax();
455 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
456 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
457 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
458 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
460 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
461 node->SetLineColor(kColorTRD);
465 else if (fDisplayType == 1) {
469 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
470 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
472 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::Ccframe()/2.
473 + AliTRDgeometry::DrZpos()
474 - AliTRDgeometry::DrThick()/2.;
475 rmax = rmin + AliTRDgeometry::DrThick();
477 Float_t thickness = rmin - AliTRDgeometry::Rmin();
478 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
479 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
481 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
483 sprintf(name,"S_TR1%d",iPlan);
484 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
485 pgon->DefineSection(0,-zmax1,rmax,rmax);
486 pgon->DefineSection(1,-zmax2,rmin,rmax);
487 pgon->DefineSection(2, zmax2,rmin,rmax);
488 pgon->DefineSection(3, zmax1,rmax,rmax);
490 node = new TNode("TRD","TRD",name,0,0,0,"");
491 node->SetLineColor(kColorTRD);
494 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
495 rmin = rmin + height;
496 rmax = rmax + height;
497 zmax1 = zmax1 + slope * height;
498 zmax2 = zmax2 + slope * height;
502 thickness += AliTRDgeometry::DrThick();
503 rmin = AliTRDgeometry::Rmin() + thickness;
504 rmax = rmin + AliTRDgeometry::AmThick();
505 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
506 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
508 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
510 sprintf(name,"S_TR2%d",iPlan);
511 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
512 pgon->DefineSection(0,-zmax1,rmax,rmax);
513 pgon->DefineSection(1,-zmax2,rmin,rmax);
514 pgon->DefineSection(2, zmax2,rmin,rmax);
515 pgon->DefineSection(3, zmax1,rmax,rmax);
517 node = new TNode("TRD","TRD",name,0,0,0,"");
518 node->SetLineColor(kColorTRD);
521 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
522 rmin = rmin + height;
523 rmax = rmax + height;
524 zmax1 = zmax1 + slope * height;
525 zmax2 = zmax2 + slope * height;
533 //_____________________________________________________________________________
534 void AliTRD::Copy(TObject &trd)
540 ((AliTRD &) trd).fGasMix = fGasMix;
541 ((AliTRD &) trd).fGeometry = fGeometry;
542 ((AliTRD &) trd).fRecPoints = fRecPoints;
543 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
544 ((AliTRD &) trd).fGasDensity = fGasDensity;
545 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
546 ((AliTRD &) trd).fDrawTR = fDrawTR;
547 ((AliTRD &) trd).fDisplayType = fDisplayType;
549 //AliDetector::Copy(trd);
553 //_____________________________________________________________________________
554 void AliTRD::CreateGeometry()
557 // Creates the volumes for the TRD chambers
560 // Check that FRAME is there otherwise we have no place where to put the TRD
561 AliModule* frame = gAlice->GetModule("FRAME");
563 printf(" The TRD needs the FRAME to be defined first\n");
567 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
571 //_____________________________________________________________________________
572 void AliTRD::CreateMaterials()
575 // Create the materials for the TRD
579 Int_t isxfld = gAlice->Field()->Integ();
580 Float_t sxmgmx = gAlice->Field()->Max();
582 // For polyethilene (CH2)
583 Float_t ape[2] = { 12., 1. };
584 Float_t zpe[2] = { 6., 1. };
585 Float_t wpe[2] = { 1., 2. };
588 // For mylar (C5H4O2)
589 Float_t amy[3] = { 12., 1., 16. };
590 Float_t zmy[3] = { 6., 1., 8. };
591 Float_t wmy[3] = { 5., 4., 2. };
595 Float_t aco[2] = { 12., 16. };
596 Float_t zco[2] = { 6., 8. };
597 Float_t wco[2] = { 1., 2. };
598 Float_t dco = 0.001977;
601 Float_t awa[2] = { 1., 16. };
602 Float_t zwa[2] = { 1., 8. };
603 Float_t wwa[2] = { 2., 1. };
606 // For isobutane (C4H10)
607 Float_t ais[2] = { 12., 1. };
608 Float_t zis[2] = { 6., 1. };
609 Float_t wis[2] = { 4., 10. };
610 Float_t dis = 0.00267;
612 // For plexiglas (C5H8O2)
613 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
614 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
615 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
618 // For Xe/CO2-gas-mixture
619 // Xe-content of the Xe/CO2-mixture (85% / 15%)
621 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
623 Float_t dxe = .005858;
625 // General tracking parameter
626 Float_t tmaxfd = -10.;
627 Float_t stemax = -1e10;
628 Float_t deemax = -0.1;
629 Float_t epsil = 1e-4;
630 Float_t stmin = -0.001;
632 Float_t absl, radl, d, buf[1];
633 Float_t agm[2], zgm[2], wgm[2];
637 //////////////////////////////////////////////////////////////////////////
639 //////////////////////////////////////////////////////////////////////////
641 AliMaterial( 1, "Al ", 26.98, 13.0, 2.7 , 8.9 , 37.2);
642 AliMaterial( 2, "Air", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
643 AliMaterial( 4, "Xe ", 131.29, 54.0, dxe , 1447.59, 0.0);
644 AliMaterial( 5, "Cu ", 63.54, 29.0, 8.96 , 1.43, 14.8);
645 AliMaterial( 6, "C ", 12.01, 6.0, 2.265 , 18.8 , 74.4);
646 AliMaterial(12, "G10", 20.00, 10.0, 1.7 , 19.4 , 999.0);
649 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
650 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
651 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
652 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
653 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
654 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
659 // Get properties of Xe
660 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
661 // Get properties of CO2
662 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
663 // Create gas mixture
666 dgm1 = wgm[0] * dxe + wgm[1] * dco;
667 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
668 // Xe/Isobutane-mixture
669 // Get properties of Xe
670 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
671 // Get properties of Isobutane
672 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
673 // Create gas mixture
676 dgm2 = wgm[0] * dxe + wgm[1] * dis;
677 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
679 //////////////////////////////////////////////////////////////////////////
680 // Tracking Media Parameters
681 //////////////////////////////////////////////////////////////////////////
684 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
685 , tmaxfd, stemax, deemax, epsil, stmin);
687 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
688 , tmaxfd, stemax, deemax, epsil, stmin);
690 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
691 , tmaxfd, stemax, deemax, epsil, stmin);
693 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
694 , tmaxfd, stemax, deemax, epsil, stmin);
696 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
697 , tmaxfd, stemax, deemax, epsil, stmin);
699 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
700 , tmaxfd, stemax, deemax, epsil, stmin);
702 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
703 , tmaxfd, stemax, deemax, epsil, stmin);
705 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
706 , tmaxfd, stemax, deemax, epsil, stmin);
708 // Gas-mixture (Xe/CO2)
709 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
710 , tmaxfd, stemax, deemax, epsil, stmin);
713 // Gas-mixture (Xe/Isobutane)
714 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
715 , tmaxfd, stemax, deemax, epsil, stmin);
717 // Nomex-honeycomb (use carbon for the time being)
718 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
719 , tmaxfd, stemax, deemax, epsil, stmin);
720 // Kapton foils (use Mylar for the time being)
721 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
722 , tmaxfd, stemax, deemax, epsil, stmin);
723 // Gas-filling of the radiator
724 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
725 , tmaxfd, stemax, deemax, epsil, stmin);
727 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
728 , tmaxfd, stemax, deemax, epsil, stmin);
730 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
731 , tmaxfd, stemax, deemax, epsil, stmin);
732 // Rohacell (plexiglas) for the radiator
733 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
734 , tmaxfd, stemax, deemax, epsil, stmin);
736 // Save the density values for the TRD absorbtion
745 //_____________________________________________________________________________
746 void AliTRD::DrawModule()
749 // Draw a shaded view of the Transition Radiation Detector version 0
752 // Set everything unseen
753 gMC->Gsatt("*" ,"SEEN",-1);
755 // Set ALIC mother transparent
756 gMC->Gsatt("ALIC","SEEN", 0);
758 // Set the volumes visible
759 if (fGeometry->IsVersion() == 0) {
760 gMC->Gsatt("B071","SEEN", 0);
761 gMC->Gsatt("B074","SEEN", 0);
762 gMC->Gsatt("B075","SEEN", 0);
763 gMC->Gsatt("B077","SEEN", 0);
764 gMC->Gsatt("BTR1","SEEN", 0);
765 gMC->Gsatt("BTR2","SEEN", 0);
766 gMC->Gsatt("BTR3","SEEN", 0);
767 gMC->Gsatt("TRD1","SEEN", 0);
768 gMC->Gsatt("TRD2","SEEN", 0);
769 gMC->Gsatt("TRD3","SEEN", 0);
772 gMC->Gsatt("B071","SEEN", 0);
773 gMC->Gsatt("B074","SEEN", 0);
774 gMC->Gsatt("B075","SEEN", 0);
775 gMC->Gsatt("B077","SEEN", 0);
776 gMC->Gsatt("BTR1","SEEN", 0);
777 gMC->Gsatt("BTR2","SEEN", 0);
778 gMC->Gsatt("BTR3","SEEN", 0);
779 gMC->Gsatt("TRD1","SEEN", 0);
780 if (fGeometry->GetPHOShole())
781 gMC->Gsatt("TRD2","SEEN", 0);
782 if (fGeometry->GetRICHhole())
783 gMC->Gsatt("TRD3","SEEN", 0);
785 gMC->Gsatt("UCII","SEEN", 0);
786 gMC->Gsatt("UCIM","SEEN", 0);
787 gMC->Gsatt("UCIO","SEEN", 0);
788 gMC->Gsatt("UL02","SEEN", 1);
789 gMC->Gsatt("UL05","SEEN", 1);
790 gMC->Gsatt("UL06","SEEN", 1);
792 gMC->Gdopt("hide", "on");
793 gMC->Gdopt("shad", "on");
794 gMC->Gsatt("*", "fill", 7);
795 gMC->SetClipBox(".");
796 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
798 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
799 gMC->Gdhead(1111, "Transition Radiation Detector");
800 gMC->Gdman(18, 4, "MAN");
804 //_____________________________________________________________________________
805 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
808 // Distance between the mouse and the TRD detector on the screen
815 //_____________________________________________________________________________
819 // Initialize the TRD detector after the geometry has been created
825 printf("\n%s: ",ClassName());
826 for (i = 0; i < 35; i++) printf("*");
827 printf(" TRD_INIT ");
828 for (i = 0; i < 35; i++) printf("*");
832 if (fGeometry->IsVersion() == 0) {
833 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
835 else if (fGeometry->IsVersion() == 1) {
836 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
837 if (fGeometry->GetPHOShole())
838 printf("%s: Leave space in front of PHOS free\n",ClassName());
839 if (fGeometry->GetRICHhole())
840 printf("%s: Leave space in front of RICH free\n",ClassName());
844 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
846 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
850 //_____________________________________________________________________________
851 void AliTRD::LoadPoints(Int_t track)
854 // Store x, y, z of all hits in memory.
855 // Hit originating from TR photons are given a different color
859 AliDetector::LoadPoints(track);
863 if (fHits == 0) return;
865 Int_t nhits = fHits->GetEntriesFast();
866 if (nhits == 0) return;
868 Int_t tracks = gAlice->GetNtrack();
869 if (fPoints == 0) fPoints = new TObjArray(tracks);
873 Int_t *ntrkE = new Int_t[tracks];
874 Int_t *ntrkT = new Int_t[tracks];
875 Int_t *limiE = new Int_t[tracks];
876 Int_t *limiT = new Int_t[tracks];
877 Float_t **coorE = new Float_t*[tracks];
878 Float_t **coorT = new Float_t*[tracks];
879 for(Int_t i = 0; i < tracks; i++) {
888 AliTRDpoints *points = 0;
891 Int_t chunk = nhits / 4 + 1;
893 // Loop over all the hits and store their position
894 for (Int_t hit = 0; hit < nhits; hit++) {
896 ahit = (AliTRDhit *) fHits->UncheckedAt(hit);
899 if (ahit->FromDrift() || ahit->FromAmplification()) {
901 trk = ahit->GetTrack();
902 if (ntrkE[trk] == limiE[trk]) {
903 // Initialise a new track
904 fp = new Float_t[3*(limiE[trk]+chunk)];
906 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
907 delete [] coorE[trk];
915 fp[3*ntrkE[trk] ] = ahit->X();
916 fp[3*ntrkE[trk]+1] = ahit->Y();
917 fp[3*ntrkE[trk]+2] = ahit->Z();
922 else if (ahit->FromTRphoton()) {
924 trk = ahit->GetTrack();
925 if (ntrkT[trk] == limiT[trk]) {
926 // Initialise a new track
927 fp = new Float_t[3*(limiT[trk]+chunk)];
929 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
930 delete [] coorT[trk];
938 fp[3*ntrkT[trk] ] = ahit->X();
939 fp[3*ntrkT[trk]+1] = ahit->Y();
940 fp[3*ntrkT[trk]+2] = ahit->Z();
947 for (trk = 0; trk < tracks; ++trk) {
949 if (ntrkE[trk] || ntrkT[trk]) {
951 points = new AliTRDpoints();
952 points->SetDetector(this);
953 points->SetParticle(trk);
955 // Set the dEdx points
957 points->SetMarkerColor(GetMarkerColor());
958 points->SetMarkerSize(GetMarkerSize());
959 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
960 delete [] coorE[trk];
964 // Set the TR photon points
966 points->SetTRpoints(ntrkT[trk],coorT[trk]);
967 delete [] coorT[trk];
971 fPoints->AddAt(points,trk);
986 //_____________________________________________________________________________
987 void AliTRD::MakeBranch(Option_t* option, const char *file)
990 // Create Tree branches for the TRD digits and cluster.
993 //Int_t buffersize = 4000;
994 //Char_t branchname[15];
996 AliDetector::MakeBranch(option,file);
998 Int_t buffersize = 64000;
1000 fDigitsArray = new AliTRDdataArrayI();
1001 MakeBranchInTree(gAlice->TreeD()
1002 ,"TRDdigits", fDigitsArray->IsA()->GetName()
1003 ,&fDigitsArray,buffersize,99,file);
1005 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
1006 Char_t branchname[15];
1007 sprintf(branchname,"TRDdictionary%d",iDict);
1008 fDictionaryArray[iDict] = new AliTRDdataArrayI();
1009 MakeBranchInTree(gAlice->TreeD()
1010 ,branchname,fDictionaryArray[iDict]->IsA()->GetName()
1011 ,&fDictionaryArray[iDict],buffersize,99,file);
1015 //_____________________________________________________________________________
1016 void AliTRD::ResetDigits()
1019 // Resets the digits
1022 if (gAlice->TreeD()) {
1024 branch = gAlice->TreeD()->GetBranch("TRDdigits");
1027 for (Int_t iDict = 0; iDict < AliTRDdigitsManager::NDict(); iDict++) {
1028 Char_t branchname[15];
1029 sprintf(branchname,"TRDdictionary%d",iDict);
1030 branch = gAlice->TreeD()->GetBranch(branchname);
1038 //_____________________________________________________________________________
1039 void AliTRD::ResetRecPoints()
1042 // Reset number of reconstructed points and the point array
1047 Int_t nentr = fRecPoints->GetEntriesFast();
1048 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1053 //_____________________________________________________________________________
1054 void AliTRD::SetTreeAddress()
1057 // Set the branch addresses for the trees.
1060 Char_t branchname[15];
1062 AliDetector::SetTreeAddress();
1065 TTree *treeR = gAlice->TreeR();
1068 sprintf(branchname,"%scluster",GetName());
1070 branch = treeR->GetBranch(branchname);
1072 branch->SetAddress(&fRecPoints);
1079 //_____________________________________________________________________________
1080 void AliTRD::SetGasMix(Int_t imix)
1083 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1086 if ((imix < 0) || (imix > 1)) {
1087 printf("Wrong input value: %d\n",imix);
1088 printf("Use standard setting\n");
1097 //_____________________________________________________________________________
1098 void AliTRD::SetPHOShole()
1101 // Selects a geometry with a hole in front of the PHOS
1104 fGeometry->SetPHOShole();
1108 //_____________________________________________________________________________
1109 void AliTRD::SetRICHhole()
1112 // Selects a geometry with a hole in front of the RICH
1115 fGeometry->SetRICHhole();
1119 //_____________________________________________________________________________
1120 AliTRD &AliTRD::operator=(const AliTRD &trd)
1123 // Assignment operator
1126 if (this != &trd) ((AliTRD &) trd).Copy(*this);