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.33 2001/11/06 17:19:41 cblume
19 Add detailed geometry and simple simulator
21 Revision 1.32 2001/10/08 06:57:33 hristov
22 Branches for TRD digits are created only during the digitisation
24 Revision 1.31 2001/08/30 09:30:30 hristov
25 The split level of branches is set to 99
27 Revision 1.30 2001/05/28 17:07:58 hristov
28 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)
30 Revision 1.29 2001/05/21 16:45:47 hristov
31 Last minute changes (C.Blume)
33 Revision 1.28 2001/05/16 14:57:27 alibrary
34 New files for folders and Stack
36 Revision 1.27 2001/05/08 07:05:02 hristov
37 Loop variable declared once (HP, Sun)
39 Revision 1.26 2001/05/07 08:03:22 cblume
40 Generate also hits in the amplification region
42 Revision 1.25 2001/03/13 09:30:35 cblume
43 Update of digitization. Moved digit branch definition to AliTRD
45 Revision 1.24 2001/01/26 19:56:49 hristov
46 Major upgrade of AliRoot code
48 Revision 1.23 2000/11/01 14:53:20 cblume
49 Merge with TRD-develop
51 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
52 Introduced more detailed geometry for the display
54 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
57 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
58 Replace include files by forward declarations
60 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
61 Included changes for the tracking
63 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
64 Included LoadPoints() method to display the TR photons
66 Revision 1.22 2000/10/02 21:28:19 fca
67 Removal of useless dependecies via forward declarations
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.21 2000/06/09 11:10:07 cblume
82 Compiler warnings and coding conventions, next round
84 Revision 1.20 2000/06/08 18:32:57 cblume
85 Make code compliant to coding conventions
87 Revision 1.19 2000/06/07 16:25:37 cblume
88 Try to remove compiler warnings on Sun and HP
90 Revision 1.18 2000/05/08 16:17:27 cblume
93 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
94 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
96 Revision 1.17 2000/02/28 19:10:26 cblume
97 Include the new TRD classes
99 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
100 Introduce TRD geometry classes
102 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
103 Include functions and data members for AliTRDrecPoint
105 Revision 1.16 2000/01/19 17:17:35 fca
106 Introducing a list of lists of hits -- more hits allowed for detector now
108 Revision 1.15 1999/11/02 17:04:25 fca
109 Small syntax change for HP compiler
111 Revision 1.14 1999/11/02 16:57:02 fca
112 Avoid non ansi warnings on HP compilers
114 Revision 1.13 1999/11/02 16:35:56 fca
115 New version of TRD introduced
117 Revision 1.12 1999/11/01 20:41:51 fca
118 Added protections against using the wrong version of FRAME
120 Revision 1.11 1999/09/29 09:24:34 fca
121 Introduction of the Copyright and cvs Log
125 ///////////////////////////////////////////////////////////////////////////////
127 // Transition Radiation Detector //
128 // This class contains the basic functions for the Transition Radiation //
131 ///////////////////////////////////////////////////////////////////////////////
134 #include <iostream.h>
138 #include <TGeometry.h>
145 #include "AliConst.h"
146 #include "AliDigit.h"
151 #include "AliTRDhit.h"
152 #include "AliTRDpoints.h"
153 #include "AliTRDdigit.h"
154 #include "AliTRDdigitizer.h"
155 #include "AliTRDclusterizer.h"
156 #include "AliTRDgeometryHole.h"
157 #include "AliTRDgeometryFull.h"
158 #include "AliTRDrecPoint.h"
159 #include "AliTRDcluster.h"
160 #include "AliTRDdigitsManager.h"
161 #include "AliTRDdigitsMerger.h"
165 //_____________________________________________________________________________
169 // Default constructor
190 //_____________________________________________________________________________
191 AliTRD::AliTRD(const char *name, const char *title)
192 : AliDetector(name,title)
195 // Standard constructor for the TRD
198 // Check that FRAME is there otherwise we have no place where to
200 AliModule* frame = gAlice->GetModule("FRAME");
202 Error("Ctor","TRD needs FRAME to be present\n");
206 // Define the TRD geometry according to the FRAME geometry
207 if (frame->IsVersion() == 0) {
208 // Geometry with hole
209 fGeometry = new AliTRDgeometryHole();
211 else if (frame->IsVersion() == 1) {
212 // Geometry without hole
213 fGeometry = new AliTRDgeometryFull();
216 Error("Ctor","Could not find valid FRAME version\n");
220 // Allocate the hit array
221 fHits = new TClonesArray("AliTRDhit" ,405);
222 gAlice->AddHitList(fHits);
224 // Allocate the digits array
227 // Allocate the rec point array
228 fRecPoints = new TObjArray(400);
240 SetMarkerColor(kWhite);
244 //_____________________________________________________________________________
245 AliTRD::AliTRD(const AliTRD &trd)
251 ((AliTRD &) trd).Copy(*this);
255 //_____________________________________________________________________________
276 //_____________________________________________________________________________
277 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
278 , Int_t *tracks, Float_t sigmaY2, Int_t iType)
281 // Add a cluster for the TRD
284 Int_t pla = fGeometry->GetPlane(det);
285 Int_t cha = fGeometry->GetChamber(det);
286 Int_t sec = fGeometry->GetSector(det);
288 Float_t padRow = pos[0];
289 Float_t padCol = pos[1];
290 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
291 Float_t col0 = fGeometry->GetCol0(pla);
292 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
293 Float_t colSize = fGeometry->GetColPadSize(pla);
295 AliTRDcluster *c = new AliTRDcluster();
298 c->AddTrackIndex(tracks);
302 c->SetLocalTimeBin(((Int_t) pos[2]));
303 c->SetY(- (col0 + padCol * colSize));
304 c->SetZ( row0 + padRow * rowSize);
306 c->SetSigmaY2((sigmaY2 + 1./12.) * colSize*colSize);
307 c->SetSigmaZ2(rowSize * rowSize / 12.);
331 //_____________________________________________________________________________
332 void AliTRD::Hits2Digits()
338 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
339 ,"TRD digitizer class");
340 digitizer->SetVerbose(GetDebug());
343 digitizer->SetDiffusion();
345 digitizer->SetEvent(gAlice->GetEvNumber());
348 digitizer->InitDetector();
351 digitizer->MakeDigits();
353 // Write the digits into the input file
354 if (digitizer->MakeBranch(fDigitsFile)) {
356 digitizer->WriteDigits();
358 // Save the digitizer class in the AliROOT
365 //_____________________________________________________________________________
366 void AliTRD::Hits2SDigits()
369 // Create summable digits
372 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
373 ,"TRD digitizer class");
374 digitizer->SetVerbose(GetDebug());
376 // For the summable digits
377 digitizer->SetSDigits(kTRUE);
380 digitizer->SetDiffusion();
382 digitizer->SetEvent(gAlice->GetEvNumber());
385 digitizer->InitDetector();
387 // Create the TRD s-digits branch
388 digitizer->MakeDigits();
390 // Write the digits into the input file
391 if (digitizer->MakeBranch(fDigitsFile)) {
393 digitizer->WriteDigits();
395 // Save the digitizer class in the AliROOT
402 //_____________________________________________________________________________
403 void AliTRD::SDigits2Digits()
406 // Create final digits from summable digits
409 // Create the TRD digitizer
410 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
411 ,"TRD digitizer class");
412 digitizer->SetVerbose(GetDebug());
415 digitizer->SetEvent(gAlice->GetEvNumber());
418 digitizer->InitDetector();
420 // Read the s-digits via digits manager
421 AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager();
422 sdigitsManager->SetVerbose(GetDebug());
423 sdigitsManager->SetSDigits(kTRUE);
425 sdigitsManager->Open(fDigitsFile);
427 sdigitsManager->CreateArrays();
428 sdigitsManager->ReadDigits();
430 // Add the s-digits to the input list
431 digitizer->AddSDigitsManager(sdigitsManager);
433 // Convert the s-digits to normal digits
434 digitizer->SDigits2Digits();
437 if (digitizer->MakeBranch(fDigitsFile)) {
439 digitizer->WriteDigits();
445 //_____________________________________________________________________________
446 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q)
449 // Add a hit for the TRD
452 TClonesArray &lhits = *fHits;
453 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
457 //_____________________________________________________________________________
458 void AliTRD::BuildGeometry()
461 // Create the ROOT TNode geometry for the TRD
468 Float_t zmax1, zmax2;
472 const Int_t kColorTRD = 46;
474 // Find the top node alice
475 top = gAlice->GetGeometry()->GetNode("alice");
477 if (fDisplayType == 0) {
479 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
480 rmin = AliTRDgeometry::Rmin();
481 rmax = AliTRDgeometry::Rmax();
482 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
483 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
484 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
485 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
487 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
488 node->SetLineColor(kColorTRD);
492 else if (fDisplayType == 1) {
496 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
497 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
499 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::Ccframe()/2.
500 + AliTRDgeometry::DrZpos()
501 - AliTRDgeometry::DrThick()/2.;
502 rmax = rmin + AliTRDgeometry::DrThick();
504 Float_t thickness = rmin - AliTRDgeometry::Rmin();
505 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
506 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
508 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
510 sprintf(name,"S_TR1%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;
529 thickness += AliTRDgeometry::DrThick();
530 rmin = AliTRDgeometry::Rmin() + thickness;
531 rmax = rmin + AliTRDgeometry::AmThick();
532 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
533 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
535 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
537 sprintf(name,"S_TR2%d",iPlan);
538 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
539 pgon->DefineSection(0,-zmax1,rmax,rmax);
540 pgon->DefineSection(1,-zmax2,rmin,rmax);
541 pgon->DefineSection(2, zmax2,rmin,rmax);
542 pgon->DefineSection(3, zmax1,rmax,rmax);
544 node = new TNode("TRD","TRD",name,0,0,0,"");
545 node->SetLineColor(kColorTRD);
548 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
549 rmin = rmin + height;
550 rmax = rmax + height;
551 zmax1 = zmax1 + slope * height;
552 zmax2 = zmax2 + slope * height;
560 //_____________________________________________________________________________
561 void AliTRD::Copy(TObject &trd)
567 ((AliTRD &) trd).fGasMix = fGasMix;
568 ((AliTRD &) trd).fGeometry = fGeometry;
569 ((AliTRD &) trd).fRecPoints = fRecPoints;
570 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
571 ((AliTRD &) trd).fGasDensity = fGasDensity;
572 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
573 ((AliTRD &) trd).fDrawTR = fDrawTR;
574 ((AliTRD &) trd).fDisplayType = fDisplayType;
576 //AliDetector::Copy(trd);
580 //_____________________________________________________________________________
581 void AliTRD::CreateGeometry()
584 // Creates the volumes for the TRD chambers
587 // Check that FRAME is there otherwise we have no place where to put the TRD
588 AliModule* frame = gAlice->GetModule("FRAME");
590 printf(" The TRD needs the FRAME to be defined first\n");
594 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
598 //_____________________________________________________________________________
599 void AliTRD::CreateMaterials()
602 // Create the materials for the TRD
606 Int_t isxfld = gAlice->Field()->Integ();
607 Float_t sxmgmx = gAlice->Field()->Max();
609 // For polyethilene (CH2)
610 Float_t ape[2] = { 12., 1. };
611 Float_t zpe[2] = { 6., 1. };
612 Float_t wpe[2] = { 1., 2. };
615 // For mylar (C5H4O2)
616 Float_t amy[3] = { 12., 1., 16. };
617 Float_t zmy[3] = { 6., 1., 8. };
618 Float_t wmy[3] = { 5., 4., 2. };
622 Float_t aco[2] = { 12., 16. };
623 Float_t zco[2] = { 6., 8. };
624 Float_t wco[2] = { 1., 2. };
625 Float_t dco = 0.001977;
628 Float_t awa[2] = { 1., 16. };
629 Float_t zwa[2] = { 1., 8. };
630 Float_t wwa[2] = { 2., 1. };
633 // For isobutane (C4H10)
634 Float_t ais[2] = { 12., 1. };
635 Float_t zis[2] = { 6., 1. };
636 Float_t wis[2] = { 4., 10. };
637 Float_t dis = 0.00267;
639 // For plexiglas (C5H8O2)
640 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
641 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
642 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
645 // For Xe/CO2-gas-mixture
646 // Xe-content of the Xe/CO2-mixture (85% / 15%)
648 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
650 Float_t dxe = .005858;
652 // General tracking parameter
653 Float_t tmaxfd = -10.;
654 Float_t stemax = -1e10;
655 Float_t deemax = -0.1;
656 Float_t epsil = 1e-4;
657 Float_t stmin = -0.001;
659 Float_t absl, radl, d, buf[1];
660 Float_t agm[2], zgm[2], wgm[2];
664 //////////////////////////////////////////////////////////////////////////
666 //////////////////////////////////////////////////////////////////////////
668 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
669 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
670 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
671 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
672 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
673 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
674 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
675 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
676 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
679 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
680 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
681 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
682 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
683 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
684 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
689 // Get properties of Xe
690 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
691 // Get properties of CO2
692 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
693 // Create gas mixture
696 dgm1 = wgm[0] * dxe + wgm[1] * dco;
697 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
698 // Xe/Isobutane-mixture
699 // Get properties of Xe
700 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
701 // Get properties of Isobutane
702 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
703 // Create gas mixture
706 dgm2 = wgm[0] * dxe + wgm[1] * dis;
707 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
709 //////////////////////////////////////////////////////////////////////////
710 // Tracking Media Parameters
711 //////////////////////////////////////////////////////////////////////////
714 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
715 , tmaxfd, stemax, deemax, epsil, stmin);
717 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
718 , tmaxfd, stemax, deemax, epsil, stmin);
720 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
721 , tmaxfd, stemax, deemax, epsil, stmin);
723 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
724 , tmaxfd, stemax, deemax, epsil, stmin);
726 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
727 , tmaxfd, stemax, deemax, epsil, stmin);
729 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
730 , tmaxfd, stemax, deemax, epsil, stmin);
732 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
733 , tmaxfd, stemax, deemax, epsil, stmin);
735 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
736 , tmaxfd, stemax, deemax, epsil, stmin);
738 // Gas-mixture (Xe/CO2)
739 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
740 , tmaxfd, stemax, deemax, epsil, stmin);
743 // Gas-mixture (Xe/Isobutane)
744 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
745 , tmaxfd, stemax, deemax, epsil, stmin);
747 // Nomex-honeycomb (use carbon for the time being)
748 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
749 , tmaxfd, stemax, deemax, epsil, stmin);
750 // Kapton foils (use Mylar for the time being)
751 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
752 , tmaxfd, stemax, deemax, epsil, stmin);
753 // Gas-filling of the radiator
754 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
755 , tmaxfd, stemax, deemax, epsil, stmin);
757 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
758 , tmaxfd, stemax, deemax, epsil, stmin);
760 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
761 , tmaxfd, stemax, deemax, epsil, stmin);
762 // Rohacell (plexiglas) for the radiator
763 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
764 , tmaxfd, stemax, deemax, epsil, stmin);
766 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
767 , tmaxfd, stemax, deemax, epsil, stmin);
769 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
770 , tmaxfd, stemax, deemax, epsil, stmin);
772 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
773 , tmaxfd, stemax, deemax, epsil, stmin);
775 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
776 , tmaxfd, stemax, deemax, epsil, stmin);
777 // Si in readout chips
778 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
779 , tmaxfd, stemax, deemax, epsil, stmin);
780 // Epoxy in readout chips
781 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
782 , tmaxfd, stemax, deemax, epsil, stmin);
784 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
785 , tmaxfd, stemax, deemax, epsil, stmin);
787 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
788 , tmaxfd, stemax, deemax, epsil, stmin);
789 // Al of cooling pipes
790 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
791 , tmaxfd, stemax, deemax, epsil, stmin);
793 // Save the density values for the TRD absorbtion
802 //_____________________________________________________________________________
803 void AliTRD::DrawModule()
806 // Draw a shaded view of the Transition Radiation Detector version 0
809 // Set everything unseen
810 gMC->Gsatt("*" ,"SEEN",-1);
812 // Set ALIC mother transparent
813 gMC->Gsatt("ALIC","SEEN", 0);
815 // Set the volumes visible
816 if (fGeometry->IsVersion() == 0) {
817 gMC->Gsatt("B071","SEEN", 0);
818 gMC->Gsatt("B074","SEEN", 0);
819 gMC->Gsatt("B075","SEEN", 0);
820 gMC->Gsatt("B077","SEEN", 0);
821 gMC->Gsatt("BTR1","SEEN", 0);
822 gMC->Gsatt("BTR2","SEEN", 0);
823 gMC->Gsatt("BTR3","SEEN", 0);
824 gMC->Gsatt("TRD1","SEEN", 0);
825 gMC->Gsatt("TRD2","SEEN", 0);
826 gMC->Gsatt("TRD3","SEEN", 0);
829 gMC->Gsatt("B071","SEEN", 0);
830 gMC->Gsatt("B074","SEEN", 0);
831 gMC->Gsatt("B075","SEEN", 0);
832 gMC->Gsatt("B077","SEEN", 0);
833 gMC->Gsatt("BTR1","SEEN", 0);
834 gMC->Gsatt("BTR2","SEEN", 0);
835 gMC->Gsatt("BTR3","SEEN", 0);
836 gMC->Gsatt("TRD1","SEEN", 0);
837 if (fGeometry->GetPHOShole())
838 gMC->Gsatt("TRD2","SEEN", 0);
839 if (fGeometry->GetRICHhole())
840 gMC->Gsatt("TRD3","SEEN", 0);
842 gMC->Gsatt("UCII","SEEN", 0);
843 gMC->Gsatt("UCIM","SEEN", 0);
844 gMC->Gsatt("UCIO","SEEN", 0);
845 gMC->Gsatt("UL02","SEEN", 1);
846 gMC->Gsatt("UL05","SEEN", 1);
847 gMC->Gsatt("UL06","SEEN", 1);
849 gMC->Gdopt("hide", "on");
850 gMC->Gdopt("shad", "on");
851 gMC->Gsatt("*", "fill", 7);
852 gMC->SetClipBox(".");
853 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
855 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
856 gMC->Gdhead(1111, "Transition Radiation Detector");
857 gMC->Gdman(18, 4, "MAN");
861 //_____________________________________________________________________________
862 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
865 // Distance between the mouse and the TRD detector on the screen
872 //_____________________________________________________________________________
876 // Initialize the TRD detector after the geometry has been created
882 printf("\n%s: ",ClassName());
883 for (i = 0; i < 35; i++) printf("*");
884 printf(" TRD_INIT ");
885 for (i = 0; i < 35; i++) printf("*");
889 if (fGeometry->IsVersion() == 0) {
890 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
892 else if (fGeometry->IsVersion() == 1) {
893 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
894 if (fGeometry->GetPHOShole())
895 printf("%s: Leave space in front of PHOS free\n",ClassName());
896 if (fGeometry->GetRICHhole())
897 printf("%s: Leave space in front of RICH free\n",ClassName());
901 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
904 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
909 //_____________________________________________________________________________
910 void AliTRD::LoadPoints(Int_t track)
913 // Store x, y, z of all hits in memory.
914 // Hit originating from TR photons are given a different color
918 AliDetector::LoadPoints(track);
922 if (fHits == 0) return;
924 Int_t nhits = fHits->GetEntriesFast();
925 if (nhits == 0) return;
927 Int_t tracks = gAlice->GetNtrack();
928 if (fPoints == 0) fPoints = new TObjArray(tracks);
932 Int_t *ntrkE = new Int_t[tracks];
933 Int_t *ntrkT = new Int_t[tracks];
934 Int_t *limiE = new Int_t[tracks];
935 Int_t *limiT = new Int_t[tracks];
936 Float_t **coorE = new Float_t*[tracks];
937 Float_t **coorT = new Float_t*[tracks];
938 for(Int_t i = 0; i < tracks; i++) {
947 AliTRDpoints *points = 0;
950 Int_t chunk = nhits / 4 + 1;
952 // Loop over all the hits and store their position
953 for (Int_t hit = 0; hit < nhits; hit++) {
955 ahit = (AliTRDhit *) fHits->UncheckedAt(hit);
958 if (ahit->FromDrift() || ahit->FromAmplification()) {
960 trk = ahit->GetTrack();
961 if (ntrkE[trk] == limiE[trk]) {
962 // Initialise a new track
963 fp = new Float_t[3*(limiE[trk]+chunk)];
965 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
966 delete [] coorE[trk];
974 fp[3*ntrkE[trk] ] = ahit->X();
975 fp[3*ntrkE[trk]+1] = ahit->Y();
976 fp[3*ntrkE[trk]+2] = ahit->Z();
981 else if (ahit->FromTRphoton()) {
983 trk = ahit->GetTrack();
984 if (ntrkT[trk] == limiT[trk]) {
985 // Initialise a new track
986 fp = new Float_t[3*(limiT[trk]+chunk)];
988 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
989 delete [] coorT[trk];
997 fp[3*ntrkT[trk] ] = ahit->X();
998 fp[3*ntrkT[trk]+1] = ahit->Y();
999 fp[3*ntrkT[trk]+2] = ahit->Z();
1006 for (trk = 0; trk < tracks; ++trk) {
1008 if (ntrkE[trk] || ntrkT[trk]) {
1010 points = new AliTRDpoints();
1011 points->SetDetector(this);
1012 points->SetParticle(trk);
1014 // Set the dEdx points
1016 points->SetMarkerColor(GetMarkerColor());
1017 points->SetMarkerSize(GetMarkerSize());
1018 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
1019 delete [] coorE[trk];
1023 // Set the TR photon points
1025 points->SetTRpoints(ntrkT[trk],coorT[trk]);
1026 delete [] coorT[trk];
1030 fPoints->AddAt(points,trk);
1045 //_____________________________________________________________________________
1046 void AliTRD::MakeBranch(Option_t* option, const char *file)
1049 // Create Tree branches for the TRD digits.
1052 Int_t buffersize = 4000;
1053 Char_t branchname[15];
1054 sprintf(branchname,"%s",GetName());
1056 const char *cD = strstr(option,"D");
1058 AliDetector::MakeBranch(option,file);
1060 if (fDigits && gAlice->TreeD() && cD) {
1061 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file);
1066 //_____________________________________________________________________________
1067 void AliTRD::ResetDigits()
1070 // Reset number of digits and the digits array for this detector
1074 if (fDigits) fDigits->Clear();
1078 //_____________________________________________________________________________
1079 void AliTRD::ResetRecPoints()
1082 // Reset number of reconstructed points and the point array
1087 Int_t nentr = fRecPoints->GetEntriesFast();
1088 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1093 //_____________________________________________________________________________
1094 void AliTRD::SetTreeAddress()
1097 // Set the branch addresses for the trees.
1100 Char_t branchname[15];
1102 AliDetector::SetTreeAddress();
1105 TTree *treeR = gAlice->TreeR();
1108 sprintf(branchname,"%scluster",GetName());
1110 branch = treeR->GetBranch(branchname);
1112 branch->SetAddress(&fRecPoints);
1119 //_____________________________________________________________________________
1120 void AliTRD::SetGasMix(Int_t imix)
1123 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1126 if ((imix < 0) || (imix > 1)) {
1127 printf("Wrong input value: %d\n",imix);
1128 printf("Use standard setting\n");
1137 //_____________________________________________________________________________
1138 void AliTRD::SetPHOShole()
1141 // Selects a geometry with a hole in front of the PHOS
1144 fGeometry->SetPHOShole();
1148 //_____________________________________________________________________________
1149 void AliTRD::SetRICHhole()
1152 // Selects a geometry with a hole in front of the RICH
1155 fGeometry->SetRICHhole();
1159 //_____________________________________________________________________________
1160 AliTRD &AliTRD::operator=(const AliTRD &trd)
1163 // Assignment operator
1166 if (this != &trd) ((AliTRD &) trd).Copy(*this);