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 ///////////////////////////////////////////////////////////////////////////////
20 // Transition Radiation Detector //
21 // This class contains the basic functions for the Transition Radiation //
24 ///////////////////////////////////////////////////////////////////////////////
27 #include <Riostream.h>
30 #include <TGeometry.h>
31 #include <TLorentzVector.h>
35 #include <TParticle.h>
38 #include <TVirtualMC.h>
42 #include "AliLoader.h"
46 #include "AliTRDdigit.h"
47 #include "AliTRDdigitizer.h"
48 #include "AliTRDdigitsManager.h"
49 #include "AliTRDgeometryFull.h"
50 #include "AliTRDgeometryHole.h"
51 #include "AliTRDhit.h"
52 #include "AliTRDpoints.h"
53 #include "AliTRDrawData.h"
54 #include "AliTrackReference.h"
59 //_____________________________________________________________________________
63 // Default constructor
81 //_____________________________________________________________________________
82 AliTRD::AliTRD(const char *name, const char *title)
83 : AliDetector(name,title)
86 // Standard constructor for the TRD
89 // Check that FRAME is there otherwise we have no place where to
91 AliModule* frame = gAlice->GetModule("FRAME");
93 Error("Ctor","TRD needs FRAME to be present\n");
97 // Define the TRD geometry
98 if ((frame->IsVersion() == 0) ||
99 (frame->IsVersion() == 1)) {
100 fGeometry = new AliTRDgeometryFull();
103 Error("Ctor","Could not find valid FRAME version\n");
108 TDirectory* saveDir = gDirectory;
109 gAlice->GetRunLoader()->CdGAFile();
110 fGeometry->Write("TRDgeometry");
113 // Allocate the hit array
114 fHits = new TClonesArray("AliTRDhit" ,405);
115 gAlice->GetMCApp()->AddHitList(fHits);
117 // Allocate the digits array
129 SetMarkerColor(kWhite);
133 //_____________________________________________________________________________
134 AliTRD::AliTRD(const AliTRD &trd):AliDetector(trd)
140 ((AliTRD &) trd).Copy(*this);
144 //_____________________________________________________________________________
164 //_____________________________________________________________________________
165 void AliTRD::Hits2Digits()
170 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
171 digitizer.SetDebug(GetDebug());
174 digitizer.InitDetector();
176 if (!fLoader->TreeH()) fLoader->LoadHits("read");
177 fLoader->LoadDigits("recreate");
178 AliRunLoader* runLoader = fLoader->GetRunLoader();
180 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
181 digitizer.Open(runLoader->GetFileName().Data(), iEvent);
182 digitizer.MakeDigits();
183 digitizer.WriteDigits();
186 fLoader->UnloadHits();
187 fLoader->UnloadDigits();
191 //_____________________________________________________________________________
192 void AliTRD::Hits2SDigits()
195 // Create summable digits
198 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
199 // For the summable digits
200 digitizer.SetSDigits(kTRUE);
201 digitizer.SetDebug(GetDebug());
204 digitizer.InitDetector();
206 if (!fLoader->TreeH()) fLoader->LoadHits("read");
207 fLoader->LoadSDigits("recreate");
208 AliRunLoader* runLoader = fLoader->GetRunLoader();
210 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
211 digitizer.Open(runLoader->GetFileName().Data(), iEvent);
212 digitizer.MakeDigits();
213 digitizer.WriteDigits();
216 fLoader->UnloadHits();
217 fLoader->UnloadSDigits();
221 //_____________________________________________________________________________
222 AliDigitizer* AliTRD::CreateDigitizer(AliRunDigitizer* manager) const
225 // Creates a new digitizer object
228 return new AliTRDdigitizer(manager);
232 //_____________________________________________________________________________
233 void AliTRD::SDigits2Digits()
236 // Create final digits from summable digits
239 // Create the TRD digitizer
240 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
241 digitizer.SetDebug(GetDebug());
244 digitizer.SetEvent(gAlice->GetEvNumber());
247 digitizer.InitDetector();
249 // Read the s-digits via digits manager
250 AliTRDdigitsManager sdigitsManager;
252 sdigitsManager.SetDebug(GetDebug());
253 sdigitsManager.SetSDigits(kTRUE);
254 sdigitsManager.CreateArrays();
256 if (!fLoader->TreeS())
257 if (fLoader->LoadSDigits("read"))
259 Error("SDigits2Digits","Error while reading SDigits for event %d",gAlice->GetEvNumber());
262 if (!fLoader->TreeS()) return;
264 sdigitsManager.ReadDigits(fLoader->TreeS());
266 // Add the s-digits to the input list
267 digitizer.AddSDigitsManager(&sdigitsManager);
269 // Convert the s-digits to normal digits
270 digitizer.SDigits2Digits();
273 if (!fLoader->TreeD()) fLoader->MakeTree("D");
274 if (digitizer.MakeBranch(fLoader->TreeD())){
275 digitizer.WriteDigits();
280 //_____________________________________________________________________________
281 void AliTRD::Digits2Raw()
284 // convert digits of the current event to raw data
287 fLoader->LoadDigits();
288 TTree* digits = fLoader->TreeD();
290 Error("Digits2Raw", "no digits tree");
294 AliTRDrawData rawWriter;
295 // rawWriter.SetDebug(2);
296 if (!rawWriter.Digits2Raw(digits)) {
297 Error("AliTRD::Digits2Raw","The raw writer could not load the digits tree");
300 fLoader->UnloadDigits();
304 //_____________________________________________________________________________
305 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
309 // Add a hit for the TRD
312 TClonesArray &lhits = *fHits;
313 AliTRDhit *hit = new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
318 hit->SetAmplification();
326 //_____________________________________________________________________________
327 void AliTRD::BuildGeometry()
330 // Create the ROOT TNode geometry for the TRD
337 Float_t zmax1, zmax2;
341 const Int_t kColorTRD = 46;
343 // Find the top node alice
344 top = gAlice->GetGeometry()->GetNode("alice");
346 if (fDisplayType == 0) {
348 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
349 rmin = AliTRDgeometry::Rmin();
350 rmax = AliTRDgeometry::Rmax();
351 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
352 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
353 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
354 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
356 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
357 node->SetLineColor(kColorTRD);
361 else if (fDisplayType == 1) {
365 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
366 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
368 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght();
369 rmax = rmin + AliTRDgeometry::CdrHght();
371 Float_t thickness = rmin - AliTRDgeometry::Rmin();
372 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
373 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
375 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
377 sprintf(name,"S_TR1%d",iPlan);
378 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
379 pgon->DefineSection(0,-zmax1,rmax,rmax);
380 pgon->DefineSection(1,-zmax2,rmin,rmax);
381 pgon->DefineSection(2, zmax2,rmin,rmax);
382 pgon->DefineSection(3, zmax1,rmax,rmax);
384 node = new TNode("TRD","TRD",name,0,0,0,"");
385 node->SetLineColor(kColorTRD);
388 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
389 rmin = rmin + height;
390 rmax = rmax + height;
391 zmax1 = zmax1 + slope * height;
392 zmax2 = zmax2 + slope * height;
396 thickness += AliTRDgeometry::DrThick();
397 rmin = AliTRDgeometry::Rmin() + thickness;
398 rmax = rmin + AliTRDgeometry::AmThick();
399 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
400 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
402 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
404 sprintf(name,"S_TR2%d",iPlan);
405 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
406 pgon->DefineSection(0,-zmax1,rmax,rmax);
407 pgon->DefineSection(1,-zmax2,rmin,rmax);
408 pgon->DefineSection(2, zmax2,rmin,rmax);
409 pgon->DefineSection(3, zmax1,rmax,rmax);
411 node = new TNode("TRD","TRD",name,0,0,0,"");
412 node->SetLineColor(kColorTRD);
415 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
416 rmin = rmin + height;
417 rmax = rmax + height;
418 zmax1 = zmax1 + slope * height;
419 zmax2 = zmax2 + slope * height;
427 //_____________________________________________________________________________
428 void AliTRD::Copy(TObject &trd)
434 ((AliTRD &) trd).fGasMix = fGasMix;
435 ((AliTRD &) trd).fGeometry = fGeometry;
436 ((AliTRD &) trd).fGasDensity = fGasDensity;
437 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
438 ((AliTRD &) trd).fDrawTR = fDrawTR;
439 ((AliTRD &) trd).fDisplayType = fDisplayType;
441 //AliDetector::Copy(trd);
445 //_____________________________________________________________________________
446 void AliTRD::CreateGeometry()
449 // Creates the volumes for the TRD chambers
452 // Check that FRAME is there otherwise we have no place where to put the TRD
453 AliModule* frame = gAlice->GetModule("FRAME");
455 printf(" The TRD needs the FRAME to be defined first\n");
459 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
463 //_____________________________________________________________________________
464 void AliTRD::CreateMaterials()
467 // Create the materials for the TRD
471 Int_t isxfld = gAlice->Field()->Integ();
472 Float_t sxmgmx = gAlice->Field()->Max();
474 // For polyethilene (CH2)
475 Float_t ape[2] = { 12., 1. };
476 Float_t zpe[2] = { 6., 1. };
477 Float_t wpe[2] = { 1., 2. };
480 // For mylar (C5H4O2)
481 Float_t amy[3] = { 12., 1., 16. };
482 Float_t zmy[3] = { 6., 1., 8. };
483 Float_t wmy[3] = { 5., 4., 2. };
487 Float_t aco[2] = { 12., 16. };
488 Float_t zco[2] = { 6., 8. };
489 Float_t wco[2] = { 1., 2. };
490 Float_t dco = 0.001977;
493 Float_t awa[2] = { 1., 16. };
494 Float_t zwa[2] = { 1., 8. };
495 Float_t wwa[2] = { 2., 1. };
498 // For isobutane (C4H10)
499 Float_t ais[2] = { 12., 1. };
500 Float_t zis[2] = { 6., 1. };
501 Float_t wis[2] = { 4., 10. };
502 Float_t dis = 0.00267;
504 // For plexiglas (C5H8O2)
505 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
506 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
507 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
510 // For epoxy (C18H19O3)
511 Float_t aEpoxy[3] = { 15.9994 , 1.00794 , 12.0107 };
512 Float_t zEpoxy[3] = { 8.0 , 1.0 , 6.0 };
513 Float_t wEpoxy[3] = { 3.0 , 19.0 , 18.0 };
514 Float_t dEpoxy = 1.8 ;
517 Float_t aAir[4] = { 12.0 , 14.0 , 16.0 , 36.0 };
518 Float_t zAir[4] = { 6.0 , 7.0 , 8.0 , 18.0 };
519 Float_t wAir[4] = { 0.000124 , 0.755267 , 0.231781 , 0.012827};
520 Float_t dAir = 1.20479E-3;
523 Float_t aG10[4] = { 1.0 , 12.011 , 15.9994 , 28.086 };
524 Float_t zG10[4] = { 1.0 , 6.0 , 8.0 , 14.0 };
525 //PH Float_t wG10[4] = { 0.148648649 , 0.104054054 , 0.483499056 , 0.241666667 };
526 Float_t wG10[4]={0.15201,0.10641,0.49444,0.24714};
529 // For Xe/CO2-gas-mixture
530 Float_t aXeCO2[3] = { 39.948, 12.0107, 15.9994 };
531 Float_t zXeCO2[3] = { 18.0, 6.0, 8.0 };
532 Float_t wXeCO2[3] = { 0.85, 0.0375, 0.1125 };
533 // Xe-content of the Xe/CO2-mixture (85% / 15%)
535 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
537 Float_t dxe = .005858;
539 // General tracking parameter
540 Float_t tmaxfd = -10.;
541 Float_t stemax = -1e10;
542 Float_t deemax = -0.1;
543 Float_t epsil = 1e-4;
544 Float_t stmin = -0.001;
546 Float_t absl, radl, d, buf[1];
547 Float_t agm[2], zgm[2], wgm[2];
551 //////////////////////////////////////////////////////////////////////////
553 //////////////////////////////////////////////////////////////////////////
555 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
556 //AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
557 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
558 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
559 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
560 //AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
561 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
562 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
563 //AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
566 AliMixture(2, "Air" , aAir, zAir, dAir, 4, wAir);
567 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
568 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
569 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
570 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
571 AliMixture(12,"G10", aG10, zG10, dG10, 4, wG10);
572 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
573 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
574 AliMixture(17,"Epoxy", aEpoxy,zEpoxy,dEpoxy, -3, wEpoxy);
577 Char_t namate[21]="";
579 // Get properties of Xe
580 //gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
581 // Get properties of CO2
582 //gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
583 // Create gas mixture
586 dgm1 = wgm[0] * dxe + wgm[1] * dco;
587 AliMixture(10, "Gas mixture 1", aXeCO2, zXeCO2, dgm1, 3, wXeCO2);
589 // Xe/Isobutane-mixture
590 // Get properties of Xe
591 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
592 // Get properties of Isobutane
593 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
594 // Create gas mixture
597 dgm2 = wgm[0] * dxe + wgm[1] * dis;
598 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
600 //////////////////////////////////////////////////////////////////////////
601 // Tracking Media Parameters
602 //////////////////////////////////////////////////////////////////////////
605 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
606 , tmaxfd, stemax, deemax, epsil, stmin);
608 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
609 , tmaxfd, stemax, deemax, epsil, stmin);
611 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
612 , tmaxfd, stemax, deemax, epsil, stmin);
614 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
615 , tmaxfd, stemax, deemax, epsil, stmin);
617 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
618 , tmaxfd, stemax, deemax, epsil, stmin);
620 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
621 , tmaxfd, stemax, deemax, epsil, stmin);
623 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
624 , tmaxfd, stemax, deemax, epsil, stmin);
626 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
627 , tmaxfd, stemax, deemax, epsil, stmin);
629 // Gas-mixture (Xe/CO2)
630 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
631 , tmaxfd, stemax, deemax, epsil, stmin);
634 // Gas-mixture (Xe/Isobutane)
635 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
636 , tmaxfd, stemax, deemax, epsil, stmin);
638 // Nomex-honeycomb (use carbon for the time being)
639 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
640 , tmaxfd, stemax, deemax, epsil, stmin);
641 // Kapton foils (use Mylar for the time being)
642 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
643 , tmaxfd, stemax, deemax, epsil, stmin);
644 // Gas-filling of the radiator
645 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
646 , tmaxfd, stemax, deemax, epsil, stmin);
648 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
649 , tmaxfd, stemax, deemax, epsil, stmin);
651 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
652 , tmaxfd, stemax, deemax, epsil, stmin);
653 // Rohacell (plexiglas) for the radiator
654 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
655 , tmaxfd, stemax, deemax, epsil, stmin);
657 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
658 , tmaxfd, stemax, deemax, epsil, stmin);
660 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
661 , tmaxfd, stemax, deemax, epsil, stmin);
663 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
664 , tmaxfd, stemax, deemax, epsil, stmin);
666 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
667 , tmaxfd, stemax, deemax, epsil, stmin);
668 // Si in readout chips
669 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
670 , tmaxfd, stemax, deemax, epsil, stmin);
671 // Epoxy in readout chips
672 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
673 , tmaxfd, stemax, deemax, epsil, stmin);
675 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
676 , tmaxfd, stemax, deemax, epsil, stmin);
678 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
679 , tmaxfd, stemax, deemax, epsil, stmin);
680 // Al of cooling pipes
681 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
682 , tmaxfd, stemax, deemax, epsil, stmin);
684 AliMedium(25, "Serv-Cu" , 5, 0, isxfld, sxmgmx
685 , tmaxfd, stemax, deemax, epsil, stmin);
687 // Save the density values for the TRD absorbtion
696 //_____________________________________________________________________________
697 void AliTRD::DrawModule() const
700 // Draw a shaded view of the Transition Radiation Detector version 0
703 // Set everything unseen
704 gMC->Gsatt("*" ,"SEEN",-1);
706 // Set ALIC mother transparent
707 gMC->Gsatt("ALIC","SEEN", 0);
709 // Set the volumes visible
710 if (fGeometry->IsVersion() == 0) {
711 gMC->Gsatt("B071","SEEN", 0);
712 gMC->Gsatt("B074","SEEN", 0);
713 gMC->Gsatt("B075","SEEN", 0);
714 gMC->Gsatt("B077","SEEN", 0);
715 gMC->Gsatt("BTR1","SEEN", 0);
716 gMC->Gsatt("BTR2","SEEN", 0);
717 gMC->Gsatt("BTR3","SEEN", 0);
718 gMC->Gsatt("UTR1","SEEN", 0);
719 gMC->Gsatt("UTR2","SEEN", 0);
720 gMC->Gsatt("UTR3","SEEN", 0);
723 gMC->Gsatt("B071","SEEN", 0);
724 gMC->Gsatt("B074","SEEN", 0);
725 gMC->Gsatt("B075","SEEN", 0);
726 gMC->Gsatt("B077","SEEN", 0);
727 gMC->Gsatt("BTR1","SEEN", 0);
728 gMC->Gsatt("BTR2","SEEN", 0);
729 gMC->Gsatt("BTR3","SEEN", 0);
730 gMC->Gsatt("UTR1","SEEN", 0);
731 if (fGeometry->GetPHOShole())
732 gMC->Gsatt("UTR2","SEEN", 0);
733 if (fGeometry->GetRICHhole())
734 gMC->Gsatt("UTR3","SEEN", 0);
736 // gMC->Gsatt("UCII","SEEN", 0);
737 // gMC->Gsatt("UCIM","SEEN", 0);
738 // gMC->Gsatt("UCIO","SEEN", 0);
739 // gMC->Gsatt("UL02","SEEN", 1);
740 // gMC->Gsatt("UL05","SEEN", 1);
741 // gMC->Gsatt("UL06","SEEN", 1);
743 gMC->Gdopt("hide", "on");
744 gMC->Gdopt("shad", "on");
745 gMC->Gsatt("*", "fill", 7);
746 gMC->SetClipBox(".");
747 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
749 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
750 gMC->Gdhead(1111, "Transition Radiation Detector");
751 gMC->Gdman(18, 4, "MAN");
755 //_____________________________________________________________________________
756 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t ) const
759 // Distance between the mouse and the TRD detector on the screen
766 //_____________________________________________________________________________
770 // Initialize the TRD detector after the geometry has been created
776 printf("\n%s: ",ClassName());
777 for (i = 0; i < 35; i++) printf("*");
778 printf(" TRD_INIT ");
779 for (i = 0; i < 35; i++) printf("*");
783 if (fGeometry->IsVersion() == 1) {
784 printf("%s: Full geometry version initialized\n",ClassName());
785 if (fGeometry->GetPHOShole())
786 printf("%s: Leave space in front of PHOS free\n",ClassName());
787 if (fGeometry->GetRICHhole())
788 printf("%s: Leave space in front of RICH free\n",ClassName());
791 printf("%s: Not a valid geometry\n",ClassName());
795 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
798 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
803 //_____________________________________________________________________________
804 void AliTRD::LoadPoints(Int_t )
807 // Store x, y, z of all hits in memory.
808 // Hit originating from TR photons are given a different color
812 // AliDetector::LoadPoints(track);
816 if (fHits == 0) return;
818 Int_t nhits = fHits->GetEntriesFast();
819 if (nhits == 0) return;
821 Int_t tracks = gAlice->GetMCApp()->GetNtrack();
822 if (fPoints == 0) fPoints = new TObjArray(tracks);
826 Int_t *ntrkE = new Int_t[tracks];
827 Int_t *ntrkT = new Int_t[tracks];
828 Int_t *limiE = new Int_t[tracks];
829 Int_t *limiT = new Int_t[tracks];
830 Float_t **coorE = new Float_t*[tracks];
831 Float_t **coorT = new Float_t*[tracks];
832 for(Int_t i = 0; i < tracks; i++) {
841 AliTRDpoints *points = 0;
844 Int_t chunk = nhits / 4 + 1;
846 // Loop over all the hits and store their position
847 ahit = (AliTRDhit *) FirstHit(-1);
851 if (ahit->GetCharge() >= 0) {
853 trk = ahit->GetTrack();
854 if (ntrkE[trk] == limiE[trk]) {
855 // Initialise a new track
856 fp = new Float_t[3*(limiE[trk]+chunk)];
858 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
859 delete [] coorE[trk];
867 fp[3*ntrkE[trk] ] = ahit->X();
868 fp[3*ntrkE[trk]+1] = ahit->Y();
869 fp[3*ntrkE[trk]+2] = ahit->Z();
874 else if ((ahit->GetCharge() < 0) && (fDrawTR)) {
876 trk = ahit->GetTrack();
877 if (ntrkT[trk] == limiT[trk]) {
878 // Initialise a new track
879 fp = new Float_t[3*(limiT[trk]+chunk)];
881 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
882 delete [] coorT[trk];
890 fp[3*ntrkT[trk] ] = ahit->X();
891 fp[3*ntrkT[trk]+1] = ahit->Y();
892 fp[3*ntrkT[trk]+2] = ahit->Z();
897 ahit = (AliTRDhit *) NextHit();
901 for (trk = 0; trk < tracks; ++trk) {
903 if (ntrkE[trk] || ntrkT[trk]) {
905 points = new AliTRDpoints();
906 points->SetDetector(this);
907 points->SetParticle(trk);
909 // Set the dEdx points
911 points->SetMarkerColor(GetMarkerColor());
912 points->SetMarkerSize(GetMarkerSize());
913 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
914 delete [] coorE[trk];
918 // Set the TR photon points
920 points->SetTRpoints(ntrkT[trk],coorT[trk]);
921 delete [] coorT[trk];
925 fPoints->AddAt(points,trk);
940 //_____________________________________________________________________________
941 void AliTRD::MakeBranch(Option_t* option)
944 // Create Tree branches for the TRD digits.
947 Int_t buffersize = 4000;
948 Char_t branchname[15];
949 sprintf(branchname,"%s",GetName());
951 const char *cD = strstr(option,"D");
953 AliDetector::MakeBranch(option);
955 if (fDigits && gAlice->TreeD() && cD) {
956 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,0);
961 //_____________________________________________________________________________
962 void AliTRD::ResetDigits()
965 // Reset number of digits and the digits array for this detector
969 if (fDigits) fDigits->Clear();
973 //_____________________________________________________________________________
974 void AliTRD::SetTreeAddress()
977 // Set the branch addresses for the trees.
980 if ( fLoader->TreeH() && (fHits == 0x0)) {
981 fHits = new TClonesArray("AliTRDhit",405);
983 AliDetector::SetTreeAddress();
987 //_____________________________________________________________________________
988 void AliTRD::SetGasMix(Int_t imix)
991 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
994 if ((imix < 0) || (imix > 1)) {
995 printf("Wrong input value: %d\n",imix);
996 printf("Use standard setting\n");
1005 //_____________________________________________________________________________
1006 void AliTRD::SetPHOShole()
1009 // Selects a geometry with a hole in front of the PHOS
1012 fGeometry->SetPHOShole();
1016 //_____________________________________________________________________________
1017 void AliTRD::SetRICHhole()
1020 // Selects a geometry with a hole in front of the RICH
1023 fGeometry->SetRICHhole();
1027 //_____________________________________________________________________________
1028 AliTRD &AliTRD::operator=(const AliTRD &trd)
1031 // Assignment operator
1034 if (this != &trd) ((AliTRD &) trd).Copy(*this);