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.34 2001/11/14 10:50:45 cblume
19 Changes in digits IO. Add merging of summable digits
21 Revision 1.33 2001/11/06 17:19:41 cblume
22 Add detailed geometry and simple simulator
24 Revision 1.32 2001/10/08 06:57:33 hristov
25 Branches for TRD digits are created only during the digitisation
27 Revision 1.31 2001/08/30 09:30:30 hristov
28 The split level of branches is set to 99
30 Revision 1.30 2001/05/28 17:07:58 hristov
31 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)
33 Revision 1.29 2001/05/21 16:45:47 hristov
34 Last minute changes (C.Blume)
36 Revision 1.28 2001/05/16 14:57:27 alibrary
37 New files for folders and Stack
39 Revision 1.27 2001/05/08 07:05:02 hristov
40 Loop variable declared once (HP, Sun)
42 Revision 1.26 2001/05/07 08:03:22 cblume
43 Generate also hits in the amplification region
45 Revision 1.25 2001/03/13 09:30:35 cblume
46 Update of digitization. Moved digit branch definition to AliTRD
48 Revision 1.24 2001/01/26 19:56:49 hristov
49 Major upgrade of AliRoot code
51 Revision 1.23 2000/11/01 14:53:20 cblume
52 Merge with TRD-develop
54 Revision 1.17.2.6 2000/10/15 23:29:08 cblume
55 Introduced more detailed geometry for the display
57 Revision 1.17.2.5 2000/10/06 16:49:46 cblume
60 Revision 1.17.2.4 2000/10/04 16:34:57 cblume
61 Replace include files by forward declarations
63 Revision 1.17.2.3 2000/09/22 14:45:17 cblume
64 Included changes for the tracking
66 Revision 1.17.2.2 2000/09/18 13:25:13 cblume
67 Included LoadPoints() method to display the TR photons
69 Revision 1.22 2000/10/02 21:28:19 fca
70 Removal of useless dependecies via forward declarations
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.21 2000/06/09 11:10:07 cblume
85 Compiler warnings and coding conventions, next round
87 Revision 1.20 2000/06/08 18:32:57 cblume
88 Make code compliant to coding conventions
90 Revision 1.19 2000/06/07 16:25:37 cblume
91 Try to remove compiler warnings on Sun and HP
93 Revision 1.18 2000/05/08 16:17:27 cblume
96 Revision 1.17.2.1 2000/05/08 14:28:59 cblume
97 Introduced SetPHOShole() and SetRICHhole(). AliTRDrecPoint container is now a TObjArray
99 Revision 1.17 2000/02/28 19:10:26 cblume
100 Include the new TRD classes
102 Revision 1.16.2.2 2000/02/28 17:53:24 cblume
103 Introduce TRD geometry classes
105 Revision 1.16.2.1 2000/02/28 17:04:19 cblume
106 Include functions and data members for AliTRDrecPoint
108 Revision 1.16 2000/01/19 17:17:35 fca
109 Introducing a list of lists of hits -- more hits allowed for detector now
111 Revision 1.15 1999/11/02 17:04:25 fca
112 Small syntax change for HP compiler
114 Revision 1.14 1999/11/02 16:57:02 fca
115 Avoid non ansi warnings on HP compilers
117 Revision 1.13 1999/11/02 16:35:56 fca
118 New version of TRD introduced
120 Revision 1.12 1999/11/01 20:41:51 fca
121 Added protections against using the wrong version of FRAME
123 Revision 1.11 1999/09/29 09:24:34 fca
124 Introduction of the Copyright and cvs Log
128 ///////////////////////////////////////////////////////////////////////////////
130 // Transition Radiation Detector //
131 // This class contains the basic functions for the Transition Radiation //
134 ///////////////////////////////////////////////////////////////////////////////
137 #include <iostream.h>
141 #include <TGeometry.h>
148 #include "AliConst.h"
149 #include "AliDigit.h"
154 #include "AliTRDhit.h"
155 #include "AliTRDpoints.h"
156 #include "AliTRDdigit.h"
157 #include "AliTRDdigitizer.h"
158 #include "AliTRDclusterizer.h"
159 #include "AliTRDgeometryHole.h"
160 #include "AliTRDgeometryFull.h"
161 #include "AliTRDrecPoint.h"
162 #include "AliTRDcluster.h"
163 #include "AliTRDdigitsManager.h"
167 //_____________________________________________________________________________
171 // Default constructor
192 //_____________________________________________________________________________
193 AliTRD::AliTRD(const char *name, const char *title)
194 : AliDetector(name,title)
197 // Standard constructor for the TRD
200 // Check that FRAME is there otherwise we have no place where to
202 AliModule* frame = gAlice->GetModule("FRAME");
204 Error("Ctor","TRD needs FRAME to be present\n");
208 // Define the TRD geometry according to the FRAME geometry
209 if (frame->IsVersion() == 0) {
210 // Geometry with hole
211 fGeometry = new AliTRDgeometryHole();
213 else if (frame->IsVersion() == 1) {
214 // Geometry without hole
215 fGeometry = new AliTRDgeometryFull();
218 Error("Ctor","Could not find valid FRAME version\n");
222 // Allocate the hit array
223 fHits = new TClonesArray("AliTRDhit" ,405);
224 gAlice->AddHitList(fHits);
226 // Allocate the digits array
229 // Allocate the rec point array
230 fRecPoints = new TObjArray(400);
242 SetMarkerColor(kWhite);
246 //_____________________________________________________________________________
247 AliTRD::AliTRD(const AliTRD &trd)
253 ((AliTRD &) trd).Copy(*this);
257 //_____________________________________________________________________________
278 //_____________________________________________________________________________
279 void AliTRD::AddCluster(Float_t *pos, Int_t *digits, Int_t det, Float_t amp
280 , Int_t *tracks, Float_t sigmaY2, Int_t iType)
283 // Add a cluster for the TRD
286 Int_t pla = fGeometry->GetPlane(det);
287 Int_t cha = fGeometry->GetChamber(det);
288 Int_t sec = fGeometry->GetSector(det);
290 Float_t padRow = pos[0];
291 Float_t padCol = pos[1];
292 Float_t row0 = fGeometry->GetRow0(pla,cha,sec);
293 Float_t col0 = fGeometry->GetCol0(pla);
294 Float_t rowSize = fGeometry->GetRowPadSize(pla,cha,sec);
295 Float_t colSize = fGeometry->GetColPadSize(pla);
297 AliTRDcluster *c = new AliTRDcluster();
300 c->AddTrackIndex(tracks);
304 c->SetLocalTimeBin(((Int_t) pos[2]));
305 c->SetY(- (col0 + padCol * colSize));
306 c->SetZ( row0 + padRow * rowSize);
308 c->SetSigmaY2((sigmaY2 + 1./12.) * colSize*colSize);
309 c->SetSigmaZ2(rowSize * rowSize / 12.);
333 //_____________________________________________________________________________
334 void AliTRD::Hits2Digits()
340 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
341 ,"TRD digitizer class");
342 digitizer->SetVerbose(GetDebug());
345 digitizer->SetDiffusion();
347 digitizer->SetEvent(gAlice->GetEvNumber());
350 digitizer->InitDetector();
353 digitizer->MakeDigits();
355 // Write the digits into the input file
356 if (digitizer->MakeBranch(fDigitsFile)) {
358 digitizer->WriteDigits();
360 // Save the digitizer class in the AliROOT
367 //_____________________________________________________________________________
368 void AliTRD::Hits2SDigits()
371 // Create summable digits
374 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
375 ,"TRD digitizer class");
376 digitizer->SetVerbose(GetDebug());
378 // For the summable digits
379 digitizer->SetSDigits(kTRUE);
382 digitizer->SetDiffusion();
384 digitizer->SetEvent(gAlice->GetEvNumber());
387 digitizer->InitDetector();
389 // Create the TRD s-digits branch
390 digitizer->MakeDigits();
392 // Write the digits into the input file
393 if (digitizer->MakeBranch(fDigitsFile)) {
395 digitizer->WriteDigits();
397 // Save the digitizer class in the AliROOT
404 //_____________________________________________________________________________
405 void AliTRD::SDigits2Digits()
408 // Create final digits from summable digits
411 // Create the TRD digitizer
412 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
413 ,"TRD digitizer class");
414 digitizer->SetVerbose(GetDebug());
417 digitizer->SetEvent(gAlice->GetEvNumber());
420 digitizer->InitDetector();
422 // Read the s-digits via digits manager
423 AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager();
424 sdigitsManager->SetVerbose(GetDebug());
425 sdigitsManager->SetSDigits(kTRUE);
427 sdigitsManager->Open(fDigitsFile);
429 sdigitsManager->CreateArrays();
430 sdigitsManager->ReadDigits();
432 // Add the s-digits to the input list
433 digitizer->AddSDigitsManager(sdigitsManager);
435 // Convert the s-digits to normal digits
436 digitizer->SDigits2Digits();
439 if (digitizer->MakeBranch(fDigitsFile)) {
441 digitizer->WriteDigits();
447 //_____________________________________________________________________________
448 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q)
451 // Add a hit for the TRD
454 TClonesArray &lhits = *fHits;
455 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
459 //_____________________________________________________________________________
460 void AliTRD::BuildGeometry()
463 // Create the ROOT TNode geometry for the TRD
470 Float_t zmax1, zmax2;
474 const Int_t kColorTRD = 46;
476 // Find the top node alice
477 top = gAlice->GetGeometry()->GetNode("alice");
479 if (fDisplayType == 0) {
481 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
482 rmin = AliTRDgeometry::Rmin();
483 rmax = AliTRDgeometry::Rmax();
484 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
485 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
486 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
487 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
489 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
490 node->SetLineColor(kColorTRD);
494 else if (fDisplayType == 1) {
498 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
499 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
501 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::Ccframe()/2.
502 + AliTRDgeometry::DrZpos()
503 - AliTRDgeometry::DrThick()/2.;
504 rmax = rmin + AliTRDgeometry::DrThick();
506 Float_t thickness = rmin - AliTRDgeometry::Rmin();
507 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
508 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
510 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
512 sprintf(name,"S_TR1%d",iPlan);
513 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
514 pgon->DefineSection(0,-zmax1,rmax,rmax);
515 pgon->DefineSection(1,-zmax2,rmin,rmax);
516 pgon->DefineSection(2, zmax2,rmin,rmax);
517 pgon->DefineSection(3, zmax1,rmax,rmax);
519 node = new TNode("TRD","TRD",name,0,0,0,"");
520 node->SetLineColor(kColorTRD);
523 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
524 rmin = rmin + height;
525 rmax = rmax + height;
526 zmax1 = zmax1 + slope * height;
527 zmax2 = zmax2 + slope * height;
531 thickness += AliTRDgeometry::DrThick();
532 rmin = AliTRDgeometry::Rmin() + thickness;
533 rmax = rmin + AliTRDgeometry::AmThick();
534 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
535 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
537 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
539 sprintf(name,"S_TR2%d",iPlan);
540 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
541 pgon->DefineSection(0,-zmax1,rmax,rmax);
542 pgon->DefineSection(1,-zmax2,rmin,rmax);
543 pgon->DefineSection(2, zmax2,rmin,rmax);
544 pgon->DefineSection(3, zmax1,rmax,rmax);
546 node = new TNode("TRD","TRD",name,0,0,0,"");
547 node->SetLineColor(kColorTRD);
550 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
551 rmin = rmin + height;
552 rmax = rmax + height;
553 zmax1 = zmax1 + slope * height;
554 zmax2 = zmax2 + slope * height;
562 //_____________________________________________________________________________
563 void AliTRD::Copy(TObject &trd)
569 ((AliTRD &) trd).fGasMix = fGasMix;
570 ((AliTRD &) trd).fGeometry = fGeometry;
571 ((AliTRD &) trd).fRecPoints = fRecPoints;
572 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
573 ((AliTRD &) trd).fGasDensity = fGasDensity;
574 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
575 ((AliTRD &) trd).fDrawTR = fDrawTR;
576 ((AliTRD &) trd).fDisplayType = fDisplayType;
578 //AliDetector::Copy(trd);
582 //_____________________________________________________________________________
583 void AliTRD::CreateGeometry()
586 // Creates the volumes for the TRD chambers
589 // Check that FRAME is there otherwise we have no place where to put the TRD
590 AliModule* frame = gAlice->GetModule("FRAME");
592 printf(" The TRD needs the FRAME to be defined first\n");
596 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
600 //_____________________________________________________________________________
601 void AliTRD::CreateMaterials()
604 // Create the materials for the TRD
608 Int_t isxfld = gAlice->Field()->Integ();
609 Float_t sxmgmx = gAlice->Field()->Max();
611 // For polyethilene (CH2)
612 Float_t ape[2] = { 12., 1. };
613 Float_t zpe[2] = { 6., 1. };
614 Float_t wpe[2] = { 1., 2. };
617 // For mylar (C5H4O2)
618 Float_t amy[3] = { 12., 1., 16. };
619 Float_t zmy[3] = { 6., 1., 8. };
620 Float_t wmy[3] = { 5., 4., 2. };
624 Float_t aco[2] = { 12., 16. };
625 Float_t zco[2] = { 6., 8. };
626 Float_t wco[2] = { 1., 2. };
627 Float_t dco = 0.001977;
630 Float_t awa[2] = { 1., 16. };
631 Float_t zwa[2] = { 1., 8. };
632 Float_t wwa[2] = { 2., 1. };
635 // For isobutane (C4H10)
636 Float_t ais[2] = { 12., 1. };
637 Float_t zis[2] = { 6., 1. };
638 Float_t wis[2] = { 4., 10. };
639 Float_t dis = 0.00267;
641 // For plexiglas (C5H8O2)
642 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
643 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
644 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
647 // For Xe/CO2-gas-mixture
648 // Xe-content of the Xe/CO2-mixture (85% / 15%)
650 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
652 Float_t dxe = .005858;
654 // General tracking parameter
655 Float_t tmaxfd = -10.;
656 Float_t stemax = -1e10;
657 Float_t deemax = -0.1;
658 Float_t epsil = 1e-4;
659 Float_t stmin = -0.001;
661 Float_t absl, radl, d, buf[1];
662 Float_t agm[2], zgm[2], wgm[2];
666 //////////////////////////////////////////////////////////////////////////
668 //////////////////////////////////////////////////////////////////////////
670 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
671 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
672 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
673 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
674 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
675 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
676 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
677 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
678 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
681 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
682 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
683 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
684 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
685 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
686 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
691 // Get properties of Xe
692 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
693 // Get properties of CO2
694 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
695 // Create gas mixture
698 dgm1 = wgm[0] * dxe + wgm[1] * dco;
699 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
700 // Xe/Isobutane-mixture
701 // Get properties of Xe
702 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
703 // Get properties of Isobutane
704 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
705 // Create gas mixture
708 dgm2 = wgm[0] * dxe + wgm[1] * dis;
709 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
711 //////////////////////////////////////////////////////////////////////////
712 // Tracking Media Parameters
713 //////////////////////////////////////////////////////////////////////////
716 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
717 , tmaxfd, stemax, deemax, epsil, stmin);
719 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
720 , tmaxfd, stemax, deemax, epsil, stmin);
722 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
723 , tmaxfd, stemax, deemax, epsil, stmin);
725 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
726 , tmaxfd, stemax, deemax, epsil, stmin);
728 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
729 , tmaxfd, stemax, deemax, epsil, stmin);
731 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
732 , tmaxfd, stemax, deemax, epsil, stmin);
734 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
735 , tmaxfd, stemax, deemax, epsil, stmin);
737 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
738 , tmaxfd, stemax, deemax, epsil, stmin);
740 // Gas-mixture (Xe/CO2)
741 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
742 , tmaxfd, stemax, deemax, epsil, stmin);
745 // Gas-mixture (Xe/Isobutane)
746 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
747 , tmaxfd, stemax, deemax, epsil, stmin);
749 // Nomex-honeycomb (use carbon for the time being)
750 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
751 , tmaxfd, stemax, deemax, epsil, stmin);
752 // Kapton foils (use Mylar for the time being)
753 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
754 , tmaxfd, stemax, deemax, epsil, stmin);
755 // Gas-filling of the radiator
756 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
757 , tmaxfd, stemax, deemax, epsil, stmin);
759 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
760 , tmaxfd, stemax, deemax, epsil, stmin);
762 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
763 , tmaxfd, stemax, deemax, epsil, stmin);
764 // Rohacell (plexiglas) for the radiator
765 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
766 , tmaxfd, stemax, deemax, epsil, stmin);
768 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
769 , tmaxfd, stemax, deemax, epsil, stmin);
771 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
772 , tmaxfd, stemax, deemax, epsil, stmin);
774 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
775 , tmaxfd, stemax, deemax, epsil, stmin);
777 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
778 , tmaxfd, stemax, deemax, epsil, stmin);
779 // Si in readout chips
780 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
781 , tmaxfd, stemax, deemax, epsil, stmin);
782 // Epoxy in readout chips
783 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
784 , tmaxfd, stemax, deemax, epsil, stmin);
786 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
787 , tmaxfd, stemax, deemax, epsil, stmin);
789 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
790 , tmaxfd, stemax, deemax, epsil, stmin);
791 // Al of cooling pipes
792 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
793 , tmaxfd, stemax, deemax, epsil, stmin);
795 // Save the density values for the TRD absorbtion
804 //_____________________________________________________________________________
805 void AliTRD::DrawModule()
808 // Draw a shaded view of the Transition Radiation Detector version 0
811 // Set everything unseen
812 gMC->Gsatt("*" ,"SEEN",-1);
814 // Set ALIC mother transparent
815 gMC->Gsatt("ALIC","SEEN", 0);
817 // Set the volumes visible
818 if (fGeometry->IsVersion() == 0) {
819 gMC->Gsatt("B071","SEEN", 0);
820 gMC->Gsatt("B074","SEEN", 0);
821 gMC->Gsatt("B075","SEEN", 0);
822 gMC->Gsatt("B077","SEEN", 0);
823 gMC->Gsatt("BTR1","SEEN", 0);
824 gMC->Gsatt("BTR2","SEEN", 0);
825 gMC->Gsatt("BTR3","SEEN", 0);
826 gMC->Gsatt("TRD1","SEEN", 0);
827 gMC->Gsatt("TRD2","SEEN", 0);
828 gMC->Gsatt("TRD3","SEEN", 0);
831 gMC->Gsatt("B071","SEEN", 0);
832 gMC->Gsatt("B074","SEEN", 0);
833 gMC->Gsatt("B075","SEEN", 0);
834 gMC->Gsatt("B077","SEEN", 0);
835 gMC->Gsatt("BTR1","SEEN", 0);
836 gMC->Gsatt("BTR2","SEEN", 0);
837 gMC->Gsatt("BTR3","SEEN", 0);
838 gMC->Gsatt("TRD1","SEEN", 0);
839 if (fGeometry->GetPHOShole())
840 gMC->Gsatt("TRD2","SEEN", 0);
841 if (fGeometry->GetRICHhole())
842 gMC->Gsatt("TRD3","SEEN", 0);
844 gMC->Gsatt("UCII","SEEN", 0);
845 gMC->Gsatt("UCIM","SEEN", 0);
846 gMC->Gsatt("UCIO","SEEN", 0);
847 gMC->Gsatt("UL02","SEEN", 1);
848 gMC->Gsatt("UL05","SEEN", 1);
849 gMC->Gsatt("UL06","SEEN", 1);
851 gMC->Gdopt("hide", "on");
852 gMC->Gdopt("shad", "on");
853 gMC->Gsatt("*", "fill", 7);
854 gMC->SetClipBox(".");
855 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
857 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
858 gMC->Gdhead(1111, "Transition Radiation Detector");
859 gMC->Gdman(18, 4, "MAN");
863 //_____________________________________________________________________________
864 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
867 // Distance between the mouse and the TRD detector on the screen
874 //_____________________________________________________________________________
878 // Initialize the TRD detector after the geometry has been created
884 printf("\n%s: ",ClassName());
885 for (i = 0; i < 35; i++) printf("*");
886 printf(" TRD_INIT ");
887 for (i = 0; i < 35; i++) printf("*");
891 if (fGeometry->IsVersion() == 0) {
892 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
894 else if (fGeometry->IsVersion() == 1) {
895 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
896 if (fGeometry->GetPHOShole())
897 printf("%s: Leave space in front of PHOS free\n",ClassName());
898 if (fGeometry->GetRICHhole())
899 printf("%s: Leave space in front of RICH free\n",ClassName());
903 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
906 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
911 //_____________________________________________________________________________
912 void AliTRD::LoadPoints(Int_t track)
915 // Store x, y, z of all hits in memory.
916 // Hit originating from TR photons are given a different color
920 AliDetector::LoadPoints(track);
924 if (fHits == 0) return;
926 Int_t nhits = fHits->GetEntriesFast();
927 if (nhits == 0) return;
929 Int_t tracks = gAlice->GetNtrack();
930 if (fPoints == 0) fPoints = new TObjArray(tracks);
934 Int_t *ntrkE = new Int_t[tracks];
935 Int_t *ntrkT = new Int_t[tracks];
936 Int_t *limiE = new Int_t[tracks];
937 Int_t *limiT = new Int_t[tracks];
938 Float_t **coorE = new Float_t*[tracks];
939 Float_t **coorT = new Float_t*[tracks];
940 for(Int_t i = 0; i < tracks; i++) {
949 AliTRDpoints *points = 0;
952 Int_t chunk = nhits / 4 + 1;
954 // Loop over all the hits and store their position
955 for (Int_t hit = 0; hit < nhits; hit++) {
957 ahit = (AliTRDhit *) fHits->UncheckedAt(hit);
960 if (ahit->FromDrift() || ahit->FromAmplification()) {
962 trk = ahit->GetTrack();
963 if (ntrkE[trk] == limiE[trk]) {
964 // Initialise a new track
965 fp = new Float_t[3*(limiE[trk]+chunk)];
967 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
968 delete [] coorE[trk];
976 fp[3*ntrkE[trk] ] = ahit->X();
977 fp[3*ntrkE[trk]+1] = ahit->Y();
978 fp[3*ntrkE[trk]+2] = ahit->Z();
983 else if (ahit->FromTRphoton()) {
985 trk = ahit->GetTrack();
986 if (ntrkT[trk] == limiT[trk]) {
987 // Initialise a new track
988 fp = new Float_t[3*(limiT[trk]+chunk)];
990 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
991 delete [] coorT[trk];
999 fp[3*ntrkT[trk] ] = ahit->X();
1000 fp[3*ntrkT[trk]+1] = ahit->Y();
1001 fp[3*ntrkT[trk]+2] = ahit->Z();
1008 for (trk = 0; trk < tracks; ++trk) {
1010 if (ntrkE[trk] || ntrkT[trk]) {
1012 points = new AliTRDpoints();
1013 points->SetDetector(this);
1014 points->SetParticle(trk);
1016 // Set the dEdx points
1018 points->SetMarkerColor(GetMarkerColor());
1019 points->SetMarkerSize(GetMarkerSize());
1020 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
1021 delete [] coorE[trk];
1025 // Set the TR photon points
1027 points->SetTRpoints(ntrkT[trk],coorT[trk]);
1028 delete [] coorT[trk];
1032 fPoints->AddAt(points,trk);
1047 //_____________________________________________________________________________
1048 void AliTRD::MakeBranch(Option_t* option, const char *file)
1051 // Create Tree branches for the TRD digits.
1054 Int_t buffersize = 4000;
1055 Char_t branchname[15];
1056 sprintf(branchname,"%s",GetName());
1058 const char *cD = strstr(option,"D");
1060 AliDetector::MakeBranch(option,file);
1062 if (fDigits && gAlice->TreeD() && cD) {
1063 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,file);
1068 //_____________________________________________________________________________
1069 void AliTRD::ResetDigits()
1072 // Reset number of digits and the digits array for this detector
1076 if (fDigits) fDigits->Clear();
1080 //_____________________________________________________________________________
1081 void AliTRD::ResetRecPoints()
1084 // Reset number of reconstructed points and the point array
1089 Int_t nentr = fRecPoints->GetEntriesFast();
1090 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1095 //_____________________________________________________________________________
1096 void AliTRD::SetTreeAddress()
1099 // Set the branch addresses for the trees.
1102 Char_t branchname[15];
1104 AliDetector::SetTreeAddress();
1107 TTree *treeR = gAlice->TreeR();
1110 sprintf(branchname,"%scluster",GetName());
1112 branch = treeR->GetBranch(branchname);
1114 branch->SetAddress(&fRecPoints);
1121 //_____________________________________________________________________________
1122 void AliTRD::SetGasMix(Int_t imix)
1125 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1128 if ((imix < 0) || (imix > 1)) {
1129 printf("Wrong input value: %d\n",imix);
1130 printf("Use standard setting\n");
1139 //_____________________________________________________________________________
1140 void AliTRD::SetPHOShole()
1143 // Selects a geometry with a hole in front of the PHOS
1146 fGeometry->SetPHOShole();
1150 //_____________________________________________________________________________
1151 void AliTRD::SetRICHhole()
1154 // Selects a geometry with a hole in front of the RICH
1157 fGeometry->SetRICHhole();
1161 //_____________________________________________________________________________
1162 AliTRD &AliTRD::operator=(const AliTRD &trd)
1165 // Assignment operator
1168 if (this != &trd) ((AliTRD &) trd).Copy(*this);