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 "AliTRDcluster.h"
47 #include "AliTRDclusterizer.h"
48 #include "AliTRDdigit.h"
49 #include "AliTRDdigitizer.h"
50 #include "AliTRDdigitsManager.h"
51 #include "AliTRDgeometryFull.h"
52 #include "AliTRDgeometryHole.h"
53 #include "AliTRDhit.h"
54 #include "AliTRDpoints.h"
55 #include "AliTRDrecPoint.h"
56 #include "AliTRDtrackHits.h"
57 #include "AliTrackReference.h"
61 //_____________________________________________________________________________
65 // Default constructor
89 //_____________________________________________________________________________
90 AliTRD::AliTRD(const char *name, const char *title)
91 : AliDetector(name,title)
94 // Standard constructor for the TRD
97 // Check that FRAME is there otherwise we have no place where to
99 AliModule* frame = gAlice->GetModule("FRAME");
101 Error("Ctor","TRD needs FRAME to be present\n");
105 // Define the TRD geometry according to the FRAME geometry
106 if (frame->IsVersion() == 0) {
107 // Geometry with hole
108 fGeometry = new AliTRDgeometryHole();
110 else if (frame->IsVersion() == 1) {
111 // Geometry without hole
112 fGeometry = new AliTRDgeometryFull();
115 Error("Ctor","Could not find valid FRAME version\n");
119 // Allocate the hit array
120 fHits = new TClonesArray("AliTRDhit" ,405);
121 gAlice->AddHitList(fHits);
123 // Allocate the digits array
126 // Allocate the rec point array
127 fRecPoints = new TObjArray(400);
142 SetMarkerColor(kWhite);
146 //_____________________________________________________________________________
147 AliTRD::AliTRD(const AliTRD &trd):AliDetector(trd)
153 ((AliTRD &) trd).Copy(*this);
157 //_____________________________________________________________________________
185 //_____________________________________________________________________________
186 void AliTRD::AddCluster(Float_t *pos, Int_t det, Float_t amp
187 , Int_t *tracks, Float_t *sig, Int_t iType)
190 // Add a cluster for the TRD
193 AliTRDcluster *c = new AliTRDcluster();
196 c->AddTrackIndex(tracks);
200 c->SetSigmaY2(sig[0]);
201 c->SetSigmaZ2(sig[1]);
202 c->SetLocalTimeBin(((Int_t) pos[2]));
226 //_____________________________________________________________________________
227 void AliTRD::Hits2Digits()
232 if (!fLoader->TreeH()) fLoader->LoadHits("read");
235 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
236 ,"TRD digitizer class");
237 digitizer->SetDebug(GetDebug());
238 digitizer->SetEvent(gAlice->GetEvNumber());
241 digitizer->InitDetector();
244 digitizer->MakeDigits();
246 // Write the digits into the input file
248 if (!fLoader->TreeD()) fLoader->MakeTree("D");
249 if (digitizer->MakeBranch(fLoader->TreeD())) {
251 digitizer->WriteDigits();
253 // Save the digitizer class in the AliROOT
260 //_____________________________________________________________________________
261 void AliTRD::Hits2SDigits()
264 // Create summable digits
266 if (!fLoader->TreeH()) fLoader->LoadHits("read");
269 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
270 ,"TRD digitizer class");
271 digitizer->SetDebug(GetDebug());
273 // For the summable digits
274 digitizer->SetSDigits(kTRUE);
275 digitizer->SetEvent(gAlice->GetEvNumber());
278 digitizer->InitDetector();
280 // Create the TRD s-digits branch
281 digitizer->MakeDigits();
283 // Write the digits into the input file
284 if (!fLoader->TreeS()) fLoader->MakeTree("S");
286 if (digitizer->MakeBranch(fLoader->TreeS())) {
288 digitizer->WriteDigits();
290 // Save the digitizer class in the AliROOT
297 //_____________________________________________________________________________
298 void AliTRD::SDigits2Digits()
301 // Create final digits from summable digits
304 // Create the TRD digitizer
305 AliTRDdigitizer *digitizer = new AliTRDdigitizer("TRDdigitizer"
306 ,"TRD digitizer class");
307 digitizer->SetDebug(GetDebug());
310 digitizer->SetEvent(gAlice->GetEvNumber());
313 digitizer->InitDetector();
315 // Read the s-digits via digits manager
316 AliTRDdigitsManager *sdigitsManager = new AliTRDdigitsManager();
318 sdigitsManager->SetDebug(GetDebug());
319 sdigitsManager->SetSDigits(kTRUE);
320 sdigitsManager->CreateArrays();
322 if (!fLoader->TreeS())
323 if (fLoader->LoadSDigits("read"))
325 Error("SDigits2Digits","Error while reading SDigits for event %d",gAlice->GetEvNumber());
328 if (!fLoader->TreeS()) return;
330 sdigitsManager->ReadDigits(fLoader->TreeS());
332 // Add the s-digits to the input list
333 digitizer->AddSDigitsManager(sdigitsManager);
335 // Convert the s-digits to normal digits
336 digitizer->SDigits2Digits();
339 if (!fLoader->TreeD()) fLoader->MakeTree("D");
340 if (digitizer->MakeBranch(fLoader->TreeD())){
341 digitizer->WriteDigits();
346 //_____________________________________________________________________________
347 void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
351 // Add a hit for the TRD
353 // The data structure is set according to fHitType:
354 // bit0: standard TClonesArray
355 // bit1: compressed trackHits structure
359 TClonesArray &lhits = *fHits;
360 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
364 AddHit2(track,det,hits,q,inDrift);
369 //_____________________________________________________________________________
370 void AliTRD::BuildGeometry()
373 // Create the ROOT TNode geometry for the TRD
380 Float_t zmax1, zmax2;
384 const Int_t kColorTRD = 46;
386 // Find the top node alice
387 top = gAlice->GetGeometry()->GetNode("alice");
389 if (fDisplayType == 0) {
391 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
392 rmin = AliTRDgeometry::Rmin();
393 rmax = AliTRDgeometry::Rmax();
394 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
395 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
396 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
397 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
399 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
400 node->SetLineColor(kColorTRD);
404 else if (fDisplayType == 1) {
408 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
409 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
411 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght();
412 rmax = rmin + AliTRDgeometry::CdrHght();
414 Float_t thickness = rmin - AliTRDgeometry::Rmin();
415 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
416 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
418 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
420 sprintf(name,"S_TR1%d",iPlan);
421 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
422 pgon->DefineSection(0,-zmax1,rmax,rmax);
423 pgon->DefineSection(1,-zmax2,rmin,rmax);
424 pgon->DefineSection(2, zmax2,rmin,rmax);
425 pgon->DefineSection(3, zmax1,rmax,rmax);
427 node = new TNode("TRD","TRD",name,0,0,0,"");
428 node->SetLineColor(kColorTRD);
431 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
432 rmin = rmin + height;
433 rmax = rmax + height;
434 zmax1 = zmax1 + slope * height;
435 zmax2 = zmax2 + slope * height;
439 thickness += AliTRDgeometry::DrThick();
440 rmin = AliTRDgeometry::Rmin() + thickness;
441 rmax = rmin + AliTRDgeometry::AmThick();
442 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
443 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
445 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
447 sprintf(name,"S_TR2%d",iPlan);
448 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
449 pgon->DefineSection(0,-zmax1,rmax,rmax);
450 pgon->DefineSection(1,-zmax2,rmin,rmax);
451 pgon->DefineSection(2, zmax2,rmin,rmax);
452 pgon->DefineSection(3, zmax1,rmax,rmax);
454 node = new TNode("TRD","TRD",name,0,0,0,"");
455 node->SetLineColor(kColorTRD);
458 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
459 rmin = rmin + height;
460 rmax = rmax + height;
461 zmax1 = zmax1 + slope * height;
462 zmax2 = zmax2 + slope * height;
470 //_____________________________________________________________________________
471 void AliTRD::Copy(TObject &trd)
477 ((AliTRD &) trd).fGasMix = fGasMix;
478 ((AliTRD &) trd).fGeometry = fGeometry;
479 ((AliTRD &) trd).fRecPoints = fRecPoints;
480 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
481 ((AliTRD &) trd).fGasDensity = fGasDensity;
482 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
483 ((AliTRD &) trd).fDrawTR = fDrawTR;
484 ((AliTRD &) trd).fDisplayType = fDisplayType;
485 ((AliTRD &) trd).fHitType = fHitType;
487 //AliDetector::Copy(trd);
491 //_____________________________________________________________________________
492 void AliTRD::CreateGeometry()
495 // Creates the volumes for the TRD chambers
498 // Check that FRAME is there otherwise we have no place where to put the TRD
499 AliModule* frame = gAlice->GetModule("FRAME");
501 printf(" The TRD needs the FRAME to be defined first\n");
505 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
509 //_____________________________________________________________________________
510 void AliTRD::CreateMaterials()
513 // Create the materials for the TRD
517 Int_t isxfld = gAlice->Field()->Integ();
518 Float_t sxmgmx = gAlice->Field()->Max();
520 // For polyethilene (CH2)
521 Float_t ape[2] = { 12., 1. };
522 Float_t zpe[2] = { 6., 1. };
523 Float_t wpe[2] = { 1., 2. };
526 // For mylar (C5H4O2)
527 Float_t amy[3] = { 12., 1., 16. };
528 Float_t zmy[3] = { 6., 1., 8. };
529 Float_t wmy[3] = { 5., 4., 2. };
533 Float_t aco[2] = { 12., 16. };
534 Float_t zco[2] = { 6., 8. };
535 Float_t wco[2] = { 1., 2. };
536 Float_t dco = 0.001977;
539 Float_t awa[2] = { 1., 16. };
540 Float_t zwa[2] = { 1., 8. };
541 Float_t wwa[2] = { 2., 1. };
544 // For isobutane (C4H10)
545 Float_t ais[2] = { 12., 1. };
546 Float_t zis[2] = { 6., 1. };
547 Float_t wis[2] = { 4., 10. };
548 Float_t dis = 0.00267;
550 // For plexiglas (C5H8O2)
551 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
552 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
553 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
556 // For Xe/CO2-gas-mixture
557 // Xe-content of the Xe/CO2-mixture (85% / 15%)
559 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
561 Float_t dxe = .005858;
563 // General tracking parameter
564 Float_t tmaxfd = -10.;
565 Float_t stemax = -1e10;
566 Float_t deemax = -0.1;
567 Float_t epsil = 1e-4;
568 Float_t stmin = -0.001;
570 Float_t absl, radl, d, buf[1];
571 Float_t agm[2], zgm[2], wgm[2];
575 //////////////////////////////////////////////////////////////////////////
577 //////////////////////////////////////////////////////////////////////////
579 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
580 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
581 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
582 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
583 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
584 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
585 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
586 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
587 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
590 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
591 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
592 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
593 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
594 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
595 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
598 Char_t namate[21]="";
600 // Get properties of Xe
601 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
602 // Get properties of CO2
603 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
604 // Create gas mixture
607 dgm1 = wgm[0] * dxe + wgm[1] * dco;
608 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
609 // Xe/Isobutane-mixture
610 // Get properties of Xe
611 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
612 // Get properties of Isobutane
613 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
614 // Create gas mixture
617 dgm2 = wgm[0] * dxe + wgm[1] * dis;
618 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
620 //////////////////////////////////////////////////////////////////////////
621 // Tracking Media Parameters
622 //////////////////////////////////////////////////////////////////////////
625 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
626 , tmaxfd, stemax, deemax, epsil, stmin);
628 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
629 , tmaxfd, stemax, deemax, epsil, stmin);
631 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
632 , tmaxfd, stemax, deemax, epsil, stmin);
634 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
635 , tmaxfd, stemax, deemax, epsil, stmin);
637 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
638 , tmaxfd, stemax, deemax, epsil, stmin);
640 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
641 , tmaxfd, stemax, deemax, epsil, stmin);
643 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
644 , tmaxfd, stemax, deemax, epsil, stmin);
646 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
647 , tmaxfd, stemax, deemax, epsil, stmin);
649 // Gas-mixture (Xe/CO2)
650 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
651 , tmaxfd, stemax, deemax, epsil, stmin);
654 // Gas-mixture (Xe/Isobutane)
655 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
656 , tmaxfd, stemax, deemax, epsil, stmin);
658 // Nomex-honeycomb (use carbon for the time being)
659 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
660 , tmaxfd, stemax, deemax, epsil, stmin);
661 // Kapton foils (use Mylar for the time being)
662 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
663 , tmaxfd, stemax, deemax, epsil, stmin);
664 // Gas-filling of the radiator
665 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
666 , tmaxfd, stemax, deemax, epsil, stmin);
668 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
669 , tmaxfd, stemax, deemax, epsil, stmin);
671 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
672 , tmaxfd, stemax, deemax, epsil, stmin);
673 // Rohacell (plexiglas) for the radiator
674 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
675 , tmaxfd, stemax, deemax, epsil, stmin);
677 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
678 , tmaxfd, stemax, deemax, epsil, stmin);
680 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
681 , tmaxfd, stemax, deemax, epsil, stmin);
683 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
684 , tmaxfd, stemax, deemax, epsil, stmin);
686 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
687 , tmaxfd, stemax, deemax, epsil, stmin);
688 // Si in readout chips
689 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
690 , tmaxfd, stemax, deemax, epsil, stmin);
691 // Epoxy in readout chips
692 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
693 , tmaxfd, stemax, deemax, epsil, stmin);
695 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
696 , tmaxfd, stemax, deemax, epsil, stmin);
698 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
699 , tmaxfd, stemax, deemax, epsil, stmin);
700 // Al of cooling pipes
701 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
702 , tmaxfd, stemax, deemax, epsil, stmin);
704 AliMedium(25, "Serv-Cu" , 5, 0, isxfld, sxmgmx
705 , tmaxfd, stemax, deemax, epsil, stmin);
707 // Save the density values for the TRD absorbtion
716 //_____________________________________________________________________________
717 void AliTRD::DrawModule() const
720 // Draw a shaded view of the Transition Radiation Detector version 0
723 // Set everything unseen
724 gMC->Gsatt("*" ,"SEEN",-1);
726 // Set ALIC mother transparent
727 gMC->Gsatt("ALIC","SEEN", 0);
729 // Set the volumes visible
730 if (fGeometry->IsVersion() == 0) {
731 gMC->Gsatt("B071","SEEN", 0);
732 gMC->Gsatt("B074","SEEN", 0);
733 gMC->Gsatt("B075","SEEN", 0);
734 gMC->Gsatt("B077","SEEN", 0);
735 gMC->Gsatt("BTR1","SEEN", 0);
736 gMC->Gsatt("BTR2","SEEN", 0);
737 gMC->Gsatt("BTR3","SEEN", 0);
738 gMC->Gsatt("UTR1","SEEN", 0);
739 gMC->Gsatt("UTR2","SEEN", 0);
740 gMC->Gsatt("UTR3","SEEN", 0);
743 gMC->Gsatt("B071","SEEN", 0);
744 gMC->Gsatt("B074","SEEN", 0);
745 gMC->Gsatt("B075","SEEN", 0);
746 gMC->Gsatt("B077","SEEN", 0);
747 gMC->Gsatt("BTR1","SEEN", 0);
748 gMC->Gsatt("BTR2","SEEN", 0);
749 gMC->Gsatt("BTR3","SEEN", 0);
750 gMC->Gsatt("UTR1","SEEN", 0);
751 if (fGeometry->GetPHOShole())
752 gMC->Gsatt("UTR2","SEEN", 0);
753 if (fGeometry->GetRICHhole())
754 gMC->Gsatt("UTR3","SEEN", 0);
756 // gMC->Gsatt("UCII","SEEN", 0);
757 // gMC->Gsatt("UCIM","SEEN", 0);
758 // gMC->Gsatt("UCIO","SEEN", 0);
759 // gMC->Gsatt("UL02","SEEN", 1);
760 // gMC->Gsatt("UL05","SEEN", 1);
761 // gMC->Gsatt("UL06","SEEN", 1);
763 gMC->Gdopt("hide", "on");
764 gMC->Gdopt("shad", "on");
765 gMC->Gsatt("*", "fill", 7);
766 gMC->SetClipBox(".");
767 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
769 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
770 gMC->Gdhead(1111, "Transition Radiation Detector");
771 gMC->Gdman(18, 4, "MAN");
775 //_____________________________________________________________________________
776 Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t ) const
779 // Distance between the mouse and the TRD detector on the screen
786 //_____________________________________________________________________________
790 // Initialize the TRD detector after the geometry has been created
796 printf("\n%s: ",ClassName());
797 for (i = 0; i < 35; i++) printf("*");
798 printf(" TRD_INIT ");
799 for (i = 0; i < 35; i++) printf("*");
803 if (fGeometry->IsVersion() == 0) {
804 printf("%s: Geometry for spaceframe with holes initialized\n",ClassName());
806 else if (fGeometry->IsVersion() == 1) {
807 printf("%s: Geometry for spaceframe without holes initialized\n",ClassName());
808 if (fGeometry->GetPHOShole())
809 printf("%s: Leave space in front of PHOS free\n",ClassName());
810 if (fGeometry->GetRICHhole())
811 printf("%s: Leave space in front of RICH free\n",ClassName());
815 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
818 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
823 //_____________________________________________________________________________
824 void AliTRD::LoadPoints(Int_t )
827 // Store x, y, z of all hits in memory.
828 // Hit originating from TR photons are given a different color
832 // AliDetector::LoadPoints(track);
836 if ((fHits == 0) && (fTrackHits == 0)) return;
840 nhits = fHits->GetEntriesFast();
843 nhits = fTrackHits->GetEntriesFast();
845 if (nhits == 0) return;
847 Int_t tracks = gAlice->GetNtrack();
848 if (fPoints == 0) fPoints = new TObjArray(tracks);
852 Int_t *ntrkE = new Int_t[tracks];
853 Int_t *ntrkT = new Int_t[tracks];
854 Int_t *limiE = new Int_t[tracks];
855 Int_t *limiT = new Int_t[tracks];
856 Float_t **coorE = new Float_t*[tracks];
857 Float_t **coorT = new Float_t*[tracks];
858 for(Int_t i = 0; i < tracks; i++) {
867 AliTRDpoints *points = 0;
870 Int_t chunk = nhits / 4 + 1;
872 // Loop over all the hits and store their position
873 ahit = (AliTRDhit *) FirstHit(-1);
877 if (ahit->GetCharge() >= 0) {
879 trk = ahit->GetTrack();
880 if (ntrkE[trk] == limiE[trk]) {
881 // Initialise a new track
882 fp = new Float_t[3*(limiE[trk]+chunk)];
884 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
885 delete [] coorE[trk];
893 fp[3*ntrkE[trk] ] = ahit->X();
894 fp[3*ntrkE[trk]+1] = ahit->Y();
895 fp[3*ntrkE[trk]+2] = ahit->Z();
900 else if ((ahit->GetCharge() < 0) && (fDrawTR)) {
902 trk = ahit->GetTrack();
903 if (ntrkT[trk] == limiT[trk]) {
904 // Initialise a new track
905 fp = new Float_t[3*(limiT[trk]+chunk)];
907 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
908 delete [] coorT[trk];
916 fp[3*ntrkT[trk] ] = ahit->X();
917 fp[3*ntrkT[trk]+1] = ahit->Y();
918 fp[3*ntrkT[trk]+2] = ahit->Z();
923 ahit = (AliTRDhit *) NextHit();
927 for (trk = 0; trk < tracks; ++trk) {
929 if (ntrkE[trk] || ntrkT[trk]) {
931 points = new AliTRDpoints();
932 points->SetDetector(this);
933 points->SetParticle(trk);
935 // Set the dEdx points
937 points->SetMarkerColor(GetMarkerColor());
938 points->SetMarkerSize(GetMarkerSize());
939 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
940 delete [] coorE[trk];
944 // Set the TR photon points
946 points->SetTRpoints(ntrkT[trk],coorT[trk]);
947 delete [] coorT[trk];
951 fPoints->AddAt(points,trk);
966 //_____________________________________________________________________________
967 void AliTRD::MakeBranch(Option_t* option)
970 // Create Tree branches for the TRD digits.
973 Int_t buffersize = 4000;
974 Char_t branchname[15];
975 sprintf(branchname,"%s",GetName());
977 const char *cD = strstr(option,"D");
979 AliDetector::MakeBranch(option);
981 if (fDigits && gAlice->TreeD() && cD) {
982 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,0);
986 MakeBranch2(option,0);
991 //_____________________________________________________________________________
992 void AliTRD::ResetDigits()
995 // Reset number of digits and the digits array for this detector
999 if (fDigits) fDigits->Clear();
1003 //_____________________________________________________________________________
1004 void AliTRD::ResetRecPoints()
1007 // Reset number of reconstructed points and the point array
1012 Int_t nentr = fRecPoints->GetEntriesFast();
1013 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
1018 //_____________________________________________________________________________
1019 void AliTRD::SetTreeAddress()
1022 // Set the branch addresses for the trees.
1025 Char_t branchname[15];
1027 if ( fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliTRDhit",405);
1028 AliDetector::SetTreeAddress();
1031 TTree *treeR = fLoader->TreeR();
1034 sprintf(branchname,"%scluster",GetName());
1035 if (fRecPoints == 0x0) fRecPoints = new TObjArray(400);
1037 branch = treeR->GetBranch(branchname);
1039 branch->SetAddress(&fRecPoints);
1050 //_____________________________________________________________________________
1051 void AliTRD::SetGasMix(Int_t imix)
1054 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1057 if ((imix < 0) || (imix > 1)) {
1058 printf("Wrong input value: %d\n",imix);
1059 printf("Use standard setting\n");
1068 //_____________________________________________________________________________
1069 void AliTRD::SetPHOShole()
1072 // Selects a geometry with a hole in front of the PHOS
1075 fGeometry->SetPHOShole();
1079 //_____________________________________________________________________________
1080 void AliTRD::SetRICHhole()
1083 // Selects a geometry with a hole in front of the RICH
1086 fGeometry->SetRICHhole();
1090 //_____________________________________________________________________________
1091 AliTRD &AliTRD::operator=(const AliTRD &trd)
1094 // Assignment operator
1097 if (this != &trd) ((AliTRD &) trd).Copy(*this);
1102 //_____________________________________________________________________________
1103 void AliTRD::FinishPrimary()
1106 // Store the hits in the containers after all primaries are finished
1110 fTrackHits->FlushHitStack();
1115 //_____________________________________________________________________________
1116 void AliTRD::RemapTrackHitIDs(Int_t *map)
1119 // Remap the track IDs
1127 TClonesArray *arr = fTrackHits->GetArray();;
1128 for (Int_t i = 0; i < arr->GetEntriesFast(); i++){
1129 AliTrackHitsParamV2 *info = (AliTrackHitsParamV2 *) (arr->At(i));
1130 info->fTrackID = map[info->fTrackID];
1136 //_____________________________________________________________________________
1137 void AliTRD::ResetHits()
1143 AliDetector::ResetHits();
1145 fTrackHits->Clear();
1150 //_____________________________________________________________________________
1151 AliHit* AliTRD::FirstHit(Int_t track)
1154 // Return the first hit of a track
1158 return FirstHit2(track);
1161 return AliDetector::FirstHit(track);
1165 //_____________________________________________________________________________
1166 AliHit* AliTRD::NextHit()
1169 // Returns the next hit of a track
1176 return AliDetector::NextHit();
1180 //_____________________________________________________________________________
1181 AliHit* AliTRD::FirstHit2(Int_t track)
1184 // Initializes the hit iterator.
1185 // Returns the address of the first hit of a track.
1186 // If <track> >= 0 the track is read from disk,
1187 // while if <track> < 0 the first hit of the current
1188 // track is returned.
1192 gAlice->ResetHits();
1193 TreeH()->GetEvent(track);
1197 fTrackHits->First();
1198 return (AliHit*) fTrackHits->GetHit();
1206 //_____________________________________________________________________________
1207 AliHit* AliTRD::NextHit2()
1210 // Returns the next hit of the current track
1215 return (AliHit *) fTrackHits->GetHit();
1223 //_____________________________________________________________________________
1224 void AliTRD::MakeBranch2(Option_t *option, const char* )
1227 // Create a new branch in the current Root tree.
1228 // The branch of fHits is automatically split.
1235 char branchname[10];
1236 sprintf(branchname,"%s2",GetName());
1238 // Get the pointer to the header
1239 const char *cH = strstr(option,"H");
1242 fTrackHits = new AliTRDtrackHits();
1246 if (fTrackHits && TreeH() && cH)
1248 TreeH()->Branch(branchname,"AliTRDtrackHits",&fTrackHits,fBufferSize,99);
1249 Info("MakeBranch2","Making Branch %s for trackhits",branchname);
1253 //_____________________________________________________________________________
1254 void AliTRD::SetTreeAddress2()
1257 // Set the branch address for the trackHits tree
1259 if (GetDebug()) Info("SetTreeAddress2","");
1262 char branchname[20];
1263 sprintf(branchname,"%s2",GetName());
1265 // Branch address for hit tree
1266 TTree *treeH = TreeH();
1267 if ((treeH) && (fHitType > 0)) {
1268 branch = treeH->GetBranch(branchname);
1271 branch->SetAddress(&fTrackHits);
1273 Info("SetTreeAddress2","Success.");
1278 Info("SetTreeAddress2","Can NOT get the branch %s",branchname);
1284 //_____________________________________________________________________________
1285 void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q
1289 // Add a hit to the list
1295 Int_t primary = gAlice->GetPrimary(track);
1296 gAlice->Particle(primary)->SetBit(kKeepBit);
1301 gAlice->FlagTrack(track);
1304 if ((fTrackHits) && (fHitType > 0)) {
1305 fTrackHits->AddHitTRD(det,rtrack,hits[0],hits[1],hits[2],q,inDrift);