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 "AliTRDhit.h"
51 #include "AliTRDpoints.h"
52 #include "AliTRDrawData.h"
53 #include "AliTrackReference.h"
58 //_____________________________________________________________________________
62 // Default constructor
80 //_____________________________________________________________________________
81 AliTRD::AliTRD(const char *name, const char *title)
82 : AliDetector(name,title)
85 // Standard constructor for the TRD
88 // Check that FRAME is there otherwise we have no place where to
90 AliModule* frame = gAlice->GetModule("FRAME");
92 Error("Ctor","TRD needs FRAME to be present\n");
96 // Define the TRD geometry
97 if ((frame->IsVersion() == 0) ||
98 (frame->IsVersion() == 1)) {
99 fGeometry = new AliTRDgeometryFull();
102 Error("Ctor","Could not find valid FRAME version\n");
107 TDirectory* saveDir = gDirectory;
108 gAlice->GetRunLoader()->CdGAFile();
109 fGeometry->Write("TRDgeometry");
112 // Allocate the hit array
113 fHits = new TClonesArray("AliTRDhit" ,405);
114 gAlice->GetMCApp()->AddHitList(fHits);
116 // Allocate the digits array
128 SetMarkerColor(kWhite);
132 //_____________________________________________________________________________
133 AliTRD::AliTRD(const AliTRD &trd):AliDetector(trd)
139 ((AliTRD &) trd).Copy(*this);
143 //_____________________________________________________________________________
163 //_____________________________________________________________________________
164 void AliTRD::Hits2Digits()
169 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
170 digitizer.SetDebug(GetDebug());
173 digitizer.InitDetector();
175 if (!fLoader->TreeH()) fLoader->LoadHits("read");
176 fLoader->LoadDigits("recreate");
177 AliRunLoader* runLoader = fLoader->GetRunLoader();
179 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
180 digitizer.Open(runLoader->GetFileName().Data(), iEvent);
181 digitizer.MakeDigits();
182 digitizer.WriteDigits();
185 fLoader->UnloadHits();
186 fLoader->UnloadDigits();
190 //_____________________________________________________________________________
191 void AliTRD::Hits2SDigits()
194 // Create summable digits
197 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
198 // For the summable digits
199 digitizer.SetSDigits(kTRUE);
200 digitizer.SetDebug(GetDebug());
203 digitizer.InitDetector();
205 if (!fLoader->TreeH()) fLoader->LoadHits("read");
206 fLoader->LoadSDigits("recreate");
207 AliRunLoader* runLoader = fLoader->GetRunLoader();
209 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
210 digitizer.Open(runLoader->GetFileName().Data(), iEvent);
211 digitizer.MakeDigits();
212 digitizer.WriteDigits();
215 fLoader->UnloadHits();
216 fLoader->UnloadSDigits();
220 //_____________________________________________________________________________
221 AliDigitizer* AliTRD::CreateDigitizer(AliRunDigitizer* manager) const
224 // Creates a new digitizer object
227 return new AliTRDdigitizer(manager);
231 //_____________________________________________________________________________
232 void AliTRD::SDigits2Digits()
235 // Create final digits from summable digits
238 // Create the TRD digitizer
239 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
240 digitizer.SetDebug(GetDebug());
243 digitizer.SetEvent(gAlice->GetEvNumber());
246 digitizer.InitDetector();
248 // Read the s-digits via digits manager
249 AliTRDdigitsManager sdigitsManager;
251 sdigitsManager.SetDebug(GetDebug());
252 sdigitsManager.SetSDigits(kTRUE);
253 sdigitsManager.CreateArrays();
255 if (!fLoader->TreeS())
256 if (fLoader->LoadSDigits("read"))
258 Error("SDigits2Digits","Error while reading SDigits for event %d",gAlice->GetEvNumber());
261 if (!fLoader->TreeS()) return;
263 sdigitsManager.ReadDigits(fLoader->TreeS());
265 // Add the s-digits to the input list
266 digitizer.AddSDigitsManager(&sdigitsManager);
268 // Convert the s-digits to normal digits
269 digitizer.SDigits2Digits();
272 if (!fLoader->TreeD()) fLoader->MakeTree("D");
273 if (digitizer.MakeBranch(fLoader->TreeD())){
274 digitizer.WriteDigits();
279 //_____________________________________________________________________________
280 void AliTRD::Digits2Raw()
283 // convert digits of the current event to raw data
286 fLoader->LoadDigits();
287 TTree* digits = fLoader->TreeD();
289 Error("Digits2Raw", "no digits tree");
293 AliTRDrawData rawWriter;
294 // rawWriter.SetDebug(2);
295 if (!rawWriter.Digits2Raw(digits)) {
296 Error("AliTRD::Digits2Raw","The raw writer could not load the digits tree");
299 fLoader->UnloadDigits();
303 //_____________________________________________________________________________
304 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
308 // Add a hit for the TRD
311 TClonesArray &lhits = *fHits;
312 AliTRDhit *hit = new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
317 hit->SetAmplification();
325 //_____________________________________________________________________________
326 void AliTRD::BuildGeometry()
329 // Create the ROOT TNode geometry for the TRD
336 Float_t zmax1, zmax2;
340 const Int_t kColorTRD = 46;
342 // Find the top node alice
343 top = gAlice->GetGeometry()->GetNode("alice");
345 if (fDisplayType == 0) {
347 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
348 rmin = AliTRDgeometry::Rmin();
349 rmax = AliTRDgeometry::Rmax();
350 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
351 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
352 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
353 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
355 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
356 node->SetLineColor(kColorTRD);
360 else if (fDisplayType == 1) {
364 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
365 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
367 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght();
368 rmax = rmin + AliTRDgeometry::CdrHght();
370 Float_t thickness = rmin - AliTRDgeometry::Rmin();
371 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
372 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
374 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
376 sprintf(name,"S_TR1%d",iPlan);
377 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
378 pgon->DefineSection(0,-zmax1,rmax,rmax);
379 pgon->DefineSection(1,-zmax2,rmin,rmax);
380 pgon->DefineSection(2, zmax2,rmin,rmax);
381 pgon->DefineSection(3, zmax1,rmax,rmax);
383 node = new TNode("TRD","TRD",name,0,0,0,"");
384 node->SetLineColor(kColorTRD);
387 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
388 rmin = rmin + height;
389 rmax = rmax + height;
390 zmax1 = zmax1 + slope * height;
391 zmax2 = zmax2 + slope * height;
395 thickness += AliTRDgeometry::DrThick();
396 rmin = AliTRDgeometry::Rmin() + thickness;
397 rmax = rmin + AliTRDgeometry::AmThick();
398 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
399 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
401 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
403 sprintf(name,"S_TR2%d",iPlan);
404 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
405 pgon->DefineSection(0,-zmax1,rmax,rmax);
406 pgon->DefineSection(1,-zmax2,rmin,rmax);
407 pgon->DefineSection(2, zmax2,rmin,rmax);
408 pgon->DefineSection(3, zmax1,rmax,rmax);
410 node = new TNode("TRD","TRD",name,0,0,0,"");
411 node->SetLineColor(kColorTRD);
414 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
415 rmin = rmin + height;
416 rmax = rmax + height;
417 zmax1 = zmax1 + slope * height;
418 zmax2 = zmax2 + slope * height;
426 //_____________________________________________________________________________
427 void AliTRD::Copy(TObject &trd) const
433 ((AliTRD &) trd).fGasMix = fGasMix;
434 ((AliTRD &) trd).fGeometry = fGeometry;
435 ((AliTRD &) trd).fGasDensity = fGasDensity;
436 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
437 ((AliTRD &) trd).fDrawTR = fDrawTR;
438 ((AliTRD &) trd).fDisplayType = fDisplayType;
440 //AliDetector::Copy(trd);
444 //_____________________________________________________________________________
445 void AliTRD::CreateGeometry()
448 // Creates the volumes for the TRD chambers
451 // Check that FRAME is there otherwise we have no place where to put the TRD
452 AliModule* frame = gAlice->GetModule("FRAME");
454 printf(" The TRD needs the FRAME to be defined first\n");
458 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
462 //_____________________________________________________________________________
463 void AliTRD::CreateMaterials()
466 // Create the materials for the TRD
470 Int_t isxfld = gAlice->Field()->Integ();
471 Float_t sxmgmx = gAlice->Field()->Max();
473 // For polyethilene (CH2)
474 Float_t ape[2] = { 12., 1. };
475 Float_t zpe[2] = { 6., 1. };
476 Float_t wpe[2] = { 1., 2. };
479 // For mylar (C5H4O2)
480 Float_t amy[3] = { 12., 1., 16. };
481 Float_t zmy[3] = { 6., 1., 8. };
482 Float_t wmy[3] = { 5., 4., 2. };
486 Float_t aco[2] = { 12., 16. };
487 Float_t zco[2] = { 6., 8. };
488 Float_t wco[2] = { 1., 2. };
489 Float_t dco = 0.001977;
492 Float_t awa[2] = { 1., 16. };
493 Float_t zwa[2] = { 1., 8. };
494 Float_t wwa[2] = { 2., 1. };
497 // For isobutane (C4H10)
498 Float_t ais[2] = { 12., 1. };
499 Float_t zis[2] = { 6., 1. };
500 Float_t wis[2] = { 4., 10. };
501 Float_t dis = 0.00267;
503 // For plexiglas (C5H8O2)
504 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
505 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
506 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
509 // For epoxy (C18H19O3)
510 Float_t aEpoxy[3] = { 15.9994 , 1.00794 , 12.0107 };
511 Float_t zEpoxy[3] = { 8.0 , 1.0 , 6.0 };
512 Float_t wEpoxy[3] = { 3.0 , 19.0 , 18.0 };
513 Float_t dEpoxy = 1.8 ;
516 Float_t aAir[4] = { 12.0 , 14.0 , 16.0 , 36.0 };
517 Float_t zAir[4] = { 6.0 , 7.0 , 8.0 , 18.0 };
518 Float_t wAir[4] = { 0.000124 , 0.755267 , 0.231781 , 0.012827};
519 Float_t dAir = 1.20479E-3;
522 Float_t aG10[4] = { 1.0 , 12.011 , 15.9994 , 28.086 };
523 Float_t zG10[4] = { 1.0 , 6.0 , 8.0 , 14.0 };
524 //PH Float_t wG10[4] = { 0.148648649 , 0.104054054 , 0.483499056 , 0.241666667 };
525 Float_t wG10[4]={0.15201,0.10641,0.49444,0.24714};
528 // For Xe/CO2-gas-mixture
529 Float_t aXeCO2[3] = { 39.948, 12.0107, 15.9994 };
530 Float_t zXeCO2[3] = { 18.0, 6.0, 8.0 };
531 Float_t wXeCO2[3] = { 0.85, 0.0375, 0.1125 };
532 // Xe-content of the Xe/CO2-mixture (85% / 15%)
534 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
536 Float_t dxe = .005858;
538 // General tracking parameter
539 Float_t tmaxfd = -10.;
540 Float_t stemax = -1e10;
541 Float_t deemax = -0.1;
542 Float_t epsil = 1e-4;
543 Float_t stmin = -0.001;
545 Float_t absl, radl, d, buf[1];
546 Float_t agm[2], zgm[2], wgm[2];
550 //////////////////////////////////////////////////////////////////////////
552 //////////////////////////////////////////////////////////////////////////
554 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
555 //AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
556 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
557 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
558 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
559 //AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
560 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
561 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
562 //AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
565 AliMixture(2, "Air" , aAir, zAir, dAir, 4, wAir);
566 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
567 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
568 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
569 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
570 AliMixture(12,"G10", aG10, zG10, dG10, 4, wG10);
571 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
572 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
573 AliMixture(17,"Epoxy", aEpoxy,zEpoxy,dEpoxy, -3, wEpoxy);
576 Char_t namate[21]="";
578 // Get properties of Xe
579 //gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
580 // Get properties of CO2
581 //gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
582 // Create gas mixture
585 dgm1 = wgm[0] * dxe + wgm[1] * dco;
586 AliMixture(10, "Gas mixture 1", aXeCO2, zXeCO2, dgm1, 3, wXeCO2);
588 // Xe/Isobutane-mixture
589 // Get properties of Xe
590 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
591 // Get properties of Isobutane
592 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
593 // Create gas mixture
596 dgm2 = wgm[0] * dxe + wgm[1] * dis;
597 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
599 //////////////////////////////////////////////////////////////////////////
600 // Tracking Media Parameters
601 //////////////////////////////////////////////////////////////////////////
604 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
605 , tmaxfd, stemax, deemax, epsil, stmin);
607 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
608 , tmaxfd, stemax, deemax, epsil, stmin);
610 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
611 , tmaxfd, stemax, deemax, epsil, stmin);
613 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
614 , tmaxfd, stemax, deemax, epsil, stmin);
616 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
617 , tmaxfd, stemax, deemax, epsil, stmin);
619 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
620 , tmaxfd, stemax, deemax, epsil, stmin);
622 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
623 , tmaxfd, stemax, deemax, epsil, stmin);
625 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
626 , tmaxfd, stemax, deemax, epsil, stmin);
628 // Gas-mixture (Xe/CO2)
629 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
630 , tmaxfd, stemax, deemax, epsil, stmin);
633 // Gas-mixture (Xe/Isobutane)
634 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
635 , tmaxfd, stemax, deemax, epsil, stmin);
637 // Nomex-honeycomb (use carbon for the time being)
638 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
639 , tmaxfd, stemax, deemax, epsil, stmin);
640 // Kapton foils (use Mylar for the time being)
641 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
642 , tmaxfd, stemax, deemax, epsil, stmin);
643 // Gas-filling of the radiator
644 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
645 , tmaxfd, stemax, deemax, epsil, stmin);
647 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
648 , tmaxfd, stemax, deemax, epsil, stmin);
650 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
651 , tmaxfd, stemax, deemax, epsil, stmin);
652 // Rohacell (plexiglas) for the radiator
653 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
654 , tmaxfd, stemax, deemax, epsil, stmin);
656 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
657 , tmaxfd, stemax, deemax, epsil, stmin);
659 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
660 , tmaxfd, stemax, deemax, epsil, stmin);
662 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
663 , tmaxfd, stemax, deemax, epsil, stmin);
665 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
666 , tmaxfd, stemax, deemax, epsil, stmin);
667 // Si in readout chips
668 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
669 , tmaxfd, stemax, deemax, epsil, stmin);
670 // Epoxy in readout chips
671 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
672 , tmaxfd, stemax, deemax, epsil, stmin);
674 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
675 , tmaxfd, stemax, deemax, epsil, stmin);
677 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
678 , tmaxfd, stemax, deemax, epsil, stmin);
679 // Al of cooling pipes
680 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
681 , tmaxfd, stemax, deemax, epsil, stmin);
683 AliMedium(25, "Serv-Cu" , 5, 0, isxfld, sxmgmx
684 , tmaxfd, stemax, deemax, epsil, stmin);
686 // Save the density values for the TRD absorbtion
695 //_____________________________________________________________________________
696 void AliTRD::DrawModule() const
699 // Draw a shaded view of the Transition Radiation Detector version 0
702 // Set everything unseen
703 gMC->Gsatt("*" ,"SEEN",-1);
705 // Set ALIC mother transparent
706 gMC->Gsatt("ALIC","SEEN", 0);
708 // Set the volumes visible
709 if (fGeometry->IsVersion() == 0) {
710 gMC->Gsatt("B071","SEEN", 0);
711 gMC->Gsatt("B074","SEEN", 0);
712 gMC->Gsatt("B075","SEEN", 0);
713 gMC->Gsatt("B077","SEEN", 0);
714 gMC->Gsatt("BTR1","SEEN", 0);
715 gMC->Gsatt("BTR2","SEEN", 0);
716 gMC->Gsatt("BTR3","SEEN", 0);
717 gMC->Gsatt("UTR1","SEEN", 0);
718 gMC->Gsatt("UTR2","SEEN", 0);
719 gMC->Gsatt("UTR3","SEEN", 0);
722 gMC->Gsatt("B071","SEEN", 0);
723 gMC->Gsatt("B074","SEEN", 0);
724 gMC->Gsatt("B075","SEEN", 0);
725 gMC->Gsatt("B077","SEEN", 0);
726 gMC->Gsatt("BTR1","SEEN", 0);
727 gMC->Gsatt("BTR2","SEEN", 0);
728 gMC->Gsatt("BTR3","SEEN", 0);
729 gMC->Gsatt("UTR1","SEEN", 0);
730 if (fGeometry->GetPHOShole())
731 gMC->Gsatt("UTR2","SEEN", 0);
732 if (fGeometry->GetRICHhole())
733 gMC->Gsatt("UTR3","SEEN", 0);
735 // gMC->Gsatt("UCII","SEEN", 0);
736 // gMC->Gsatt("UCIM","SEEN", 0);
737 // gMC->Gsatt("UCIO","SEEN", 0);
738 // gMC->Gsatt("UL02","SEEN", 1);
739 // gMC->Gsatt("UL05","SEEN", 1);
740 // gMC->Gsatt("UL06","SEEN", 1);
742 gMC->Gdopt("hide", "on");
743 gMC->Gdopt("shad", "on");
744 gMC->Gsatt("*", "fill", 7);
745 gMC->SetClipBox(".");
746 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
748 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
749 gMC->Gdhead(1111, "Transition Radiation Detector");
750 gMC->Gdman(18, 4, "MAN");
754 //_____________________________________________________________________________
755 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
758 // Distance between the mouse and the TRD detector on the screen
765 //_____________________________________________________________________________
769 // Initialize the TRD detector after the geometry has been created
775 printf("\n%s: ",ClassName());
776 for (i = 0; i < 35; i++) printf("*");
777 printf(" TRD_INIT ");
778 for (i = 0; i < 35; i++) printf("*");
782 if (fGeometry->IsVersion() == 1) {
783 printf("%s: Full geometry version initialized\n",ClassName());
784 if (fGeometry->GetPHOShole())
785 printf("%s: Leave space in front of PHOS free\n",ClassName());
786 if (fGeometry->GetRICHhole())
787 printf("%s: Leave space in front of RICH free\n",ClassName());
790 printf("%s: Not a valid geometry\n",ClassName());
794 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
797 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
802 //_____________________________________________________________________________
803 void AliTRD::LoadPoints(Int_t )
806 // Store x, y, z of all hits in memory.
807 // Hit originating from TR photons are given a different color
811 // AliDetector::LoadPoints(track);
815 if (fHits == 0) return;
817 Int_t nhits = fHits->GetEntriesFast();
818 if (nhits == 0) return;
820 Int_t tracks = gAlice->GetMCApp()->GetNtrack();
821 if (fPoints == 0) fPoints = new TObjArray(tracks);
825 Int_t *ntrkE = new Int_t[tracks];
826 Int_t *ntrkT = new Int_t[tracks];
827 Int_t *limiE = new Int_t[tracks];
828 Int_t *limiT = new Int_t[tracks];
829 Float_t **coorE = new Float_t*[tracks];
830 Float_t **coorT = new Float_t*[tracks];
831 for(Int_t i = 0; i < tracks; i++) {
840 AliTRDpoints *points = 0;
843 Int_t chunk = nhits / 4 + 1;
845 // Loop over all the hits and store their position
846 ahit = (AliTRDhit *) FirstHit(-1);
850 if (ahit->GetCharge() >= 0) {
852 trk = ahit->GetTrack();
853 if (ntrkE[trk] == limiE[trk]) {
854 // Initialise a new track
855 fp = new Float_t[3*(limiE[trk]+chunk)];
857 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
858 delete [] coorE[trk];
866 fp[3*ntrkE[trk] ] = ahit->X();
867 fp[3*ntrkE[trk]+1] = ahit->Y();
868 fp[3*ntrkE[trk]+2] = ahit->Z();
873 else if ((ahit->GetCharge() < 0) && (fDrawTR)) {
875 trk = ahit->GetTrack();
876 if (ntrkT[trk] == limiT[trk]) {
877 // Initialise a new track
878 fp = new Float_t[3*(limiT[trk]+chunk)];
880 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
881 delete [] coorT[trk];
889 fp[3*ntrkT[trk] ] = ahit->X();
890 fp[3*ntrkT[trk]+1] = ahit->Y();
891 fp[3*ntrkT[trk]+2] = ahit->Z();
896 ahit = (AliTRDhit *) NextHit();
900 for (trk = 0; trk < tracks; ++trk) {
902 if (ntrkE[trk] || ntrkT[trk]) {
904 points = new AliTRDpoints();
905 points->SetDetector(this);
906 points->SetParticle(trk);
908 // Set the dEdx points
910 points->SetMarkerColor(GetMarkerColor());
911 points->SetMarkerSize(GetMarkerSize());
912 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
913 delete [] coorE[trk];
917 // Set the TR photon points
919 points->SetTRpoints(ntrkT[trk],coorT[trk]);
920 delete [] coorT[trk];
924 fPoints->AddAt(points,trk);
939 //_____________________________________________________________________________
940 void AliTRD::MakeBranch(Option_t* option)
943 // Create Tree branches for the TRD digits.
946 Int_t buffersize = 4000;
947 Char_t branchname[15];
948 sprintf(branchname,"%s",GetName());
950 const char *cD = strstr(option,"D");
952 AliDetector::MakeBranch(option);
954 if (fDigits && gAlice->TreeD() && cD) {
955 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,0);
960 //_____________________________________________________________________________
961 void AliTRD::ResetDigits()
964 // Reset number of digits and the digits array for this detector
968 if (fDigits) fDigits->Clear();
972 //_____________________________________________________________________________
973 void AliTRD::SetTreeAddress()
976 // Set the branch addresses for the trees.
979 if ( fLoader->TreeH() && (fHits == 0x0)) {
980 fHits = new TClonesArray("AliTRDhit",405);
982 AliDetector::SetTreeAddress();
986 //_____________________________________________________________________________
987 void AliTRD::SetGasMix(Int_t imix)
990 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
993 if ((imix < 0) || (imix > 1)) {
994 printf("Wrong input value: %d\n",imix);
995 printf("Use standard setting\n");
1004 //_____________________________________________________________________________
1005 void AliTRD::SetPHOShole()
1008 // Selects a geometry with a hole in front of the PHOS
1011 fGeometry->SetPHOShole();
1015 //_____________________________________________________________________________
1016 void AliTRD::SetRICHhole()
1019 // Selects a geometry with a hole in front of the RICH
1022 fGeometry->SetRICHhole();
1026 //_____________________________________________________________________________
1027 AliTRD &AliTRD::operator=(const AliTRD &trd)
1030 // Assignment operator
1033 if (this != &trd) ((AliTRD &) trd).Copy(*this);