Removed unused data members and methods
[u/mrichter/AliRoot.git] / TRD / AliTRD.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
88cb7938 16/* $Id$ */
4c039060 17
fe4da5cc 18///////////////////////////////////////////////////////////////////////////////
19// //
20// Transition Radiation Detector //
21// This class contains the basic functions for the Transition Radiation //
6f1e466d 22// Detector. //
fe4da5cc 23// //
24///////////////////////////////////////////////////////////////////////////////
25
5c7f4665 26#include <stdlib.h>
a2cb5b3d 27#include <Riostream.h>
5c7f4665 28
88cb7938 29#include <TFile.h>
30#include <TGeometry.h>
31#include <TLorentzVector.h>
fe4da5cc 32#include <TMath.h>
fe4da5cc 33#include <TNode.h>
793ff80c 34#include <TPGON.h>
332e9569 35#include <TParticle.h>
88cb7938 36#include <TROOT.h>
37#include <TTree.h>
38#include <TVirtualMC.h>
39
d3f347ff 40#include "AliConst.h"
793ff80c 41#include "AliDigit.h"
88cb7938 42#include "AliLoader.h"
793ff80c 43#include "AliMagF.h"
88cb7938 44#include "AliRun.h"
793ff80c 45#include "AliTRD.h"
88cb7938 46#include "AliTRDcluster.h"
793ff80c 47#include "AliTRDdigit.h"
851d3db9 48#include "AliTRDdigitizer.h"
88cb7938 49#include "AliTRDdigitsManager.h"
851d3db9 50#include "AliTRDgeometryFull.h"
88cb7938 51#include "AliTRDgeometryHole.h"
52#include "AliTRDhit.h"
53#include "AliTRDpoints.h"
851d3db9 54#include "AliTRDrecPoint.h"
332e9569 55#include "AliTRDtrackHits.h"
88cb7938 56#include "AliTrackReference.h"
5d12ce38 57#include "AliMC.h"
793ff80c 58
fe4da5cc 59ClassImp(AliTRD)
60
61//_____________________________________________________________________________
62AliTRD::AliTRD()
63{
64 //
65 // Default constructor
66 //
82bbf98a 67
6244debe 68 fIshunt = 0;
69 fGasMix = 0;
70 fHits = 0;
71 fDigits = 0;
5c7f4665 72
6244debe 73 fRecPoints = 0;
74 fNRecPoints = 0;
5c7f4665 75
6244debe 76 fGeometry = 0;
82bbf98a 77
6244debe 78 fGasDensity = 0;
79 fFoilDensity = 0;
793ff80c 80
6244debe 81 fDrawTR = 0;
332e9569 82 fDisplayType = 0;
83
84 fTrackHits = 0;
85 fHitType = 0;
6244debe 86
fe4da5cc 87}
88
89//_____________________________________________________________________________
90AliTRD::AliTRD(const char *name, const char *title)
91 : AliDetector(name,title)
92{
93 //
94 // Standard constructor for the TRD
95 //
96
5c7f4665 97 // Check that FRAME is there otherwise we have no place where to
98 // put TRD
8230f242 99 AliModule* frame = gAlice->GetModule("FRAME");
100 if (!frame) {
5c7f4665 101 Error("Ctor","TRD needs FRAME to be present\n");
102 exit(1);
103 }
104
d37eec5e 105 // Define the TRD geometry
106 if ((frame->IsVersion() == 0) ||
107 (frame->IsVersion() == 1)) {
851d3db9 108 fGeometry = new AliTRDgeometryFull();
109 }
110 else {
111 Error("Ctor","Could not find valid FRAME version\n");
112 exit(1);
113 }
5c7f4665 114
fe4da5cc 115 // Allocate the hit array
f73816f5 116 fHits = new TClonesArray("AliTRDhit" ,405);
5d12ce38 117 gAlice->GetMCApp()->AddHitList(fHits);
99d5402e 118
119 // Allocate the digits array
f73816f5 120 fDigits = 0;
5c7f4665 121
851d3db9 122 // Allocate the rec point array
6244debe 123 fRecPoints = new TObjArray(400);
124 fNRecPoints = 0;
99d5402e 125
6244debe 126 fIshunt = 0;
127 fGasMix = 1;
793ff80c 128
6244debe 129 fGasDensity = 0;
130 fFoilDensity = 0;
793ff80c 131
6244debe 132 fDrawTR = 0;
133 fDisplayType = 0;
134
332e9569 135 fTrackHits = 0;
136 fHitType = 2;
137
fe4da5cc 138 SetMarkerColor(kWhite);
82bbf98a 139
fe4da5cc 140}
99d5402e 141
142//_____________________________________________________________________________
73ae7b59 143AliTRD::AliTRD(const AliTRD &trd):AliDetector(trd)
8230f242 144{
145 //
146 // Copy constructor
147 //
148
dd9a6ee3 149 ((AliTRD &) trd).Copy(*this);
8230f242 150
151}
152
153//_____________________________________________________________________________
99d5402e 154AliTRD::~AliTRD()
155{
156 //
157 // TRD destructor
158 //
159
160 fIshunt = 0;
161
abaf1f1d 162 if (fGeometry) {
163 delete fGeometry;
332e9569 164 fGeometry = 0;
abaf1f1d 165 }
166 if (fHits) {
167 delete fHits;
332e9569 168 fHits = 0;
abaf1f1d 169 }
170 if (fRecPoints) {
171 delete fRecPoints;
332e9569 172 fRecPoints = 0;
173 }
174 if (fTrackHits) {
175 delete fTrackHits;
176 fTrackHits = 0;
6244debe 177 }
5c7f4665 178
179}
180
181//_____________________________________________________________________________
5443e65e 182void AliTRD::AddCluster(Float_t *pos, Int_t det, Float_t amp
183 , Int_t *tracks, Float_t *sig, Int_t iType)
5c7f4665 184{
185 //
f73816f5 186 // Add a cluster for the TRD
851d3db9 187 //
793ff80c 188
f73816f5 189 AliTRDcluster *c = new AliTRDcluster();
190
191 c->SetDetector(det);
192 c->AddTrackIndex(tracks);
f73816f5 193 c->SetQ(amp);
5443e65e 194 c->SetY(pos[0]);
195 c->SetZ(pos[1]);
196 c->SetSigmaY2(sig[0]);
197 c->SetSigmaZ2(sig[1]);
f73816f5 198 c->SetLocalTimeBin(((Int_t) pos[2]));
f73816f5 199
db30bf0f 200 switch (iType) {
201 case 0:
202 c->Set2pad();
203 break;
204 case 1:
205 c->Set3pad();
206 break;
207 case 2:
208 c->Set4pad();
209 break;
210 case 3:
211 c->Set5pad();
212 break;
213 case 4:
214 c->SetLarge();
215 break;
216 };
793ff80c 217
f73816f5 218 fRecPoints->Add(c);
6f1e466d 219
99d5402e 220}
6244debe 221
222//_____________________________________________________________________________
223void AliTRD::Hits2Digits()
2ab0c725 224{
225 //
226 // Create digits
227 //
be385a87 228 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
229 digitizer.SetDebug(GetDebug());
88cb7938 230
6244debe 231 // Initialization
be385a87 232 digitizer.InitDetector();
6244debe 233
85a5290f 234 if (!fLoader->TreeH()) fLoader->LoadHits("read");
235 fLoader->LoadDigits("recreate");
236 AliRunLoader* runLoader = fLoader->GetRunLoader();
6244debe 237
85a5290f 238 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
be385a87 239 digitizer.Open(runLoader->GetFileName().Data(), iEvent);
240 digitizer.MakeDigits();
241 digitizer.WriteDigits();
6244debe 242 }
243
85a5290f 244 fLoader->UnloadHits();
245 fLoader->UnloadDigits();
6244debe 246}
247
248//_____________________________________________________________________________
249void AliTRD::Hits2SDigits()
250{
251 //
252 // Create summable digits
253 //
be385a87 254 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
6244debe 255 // For the summable digits
be385a87 256 digitizer.SetSDigits(kTRUE);
257 digitizer.SetDebug(GetDebug());
6244debe 258
259 // Initialization
be385a87 260 digitizer.InitDetector();
2ab0c725 261
85a5290f 262 if (!fLoader->TreeH()) fLoader->LoadHits("read");
263 fLoader->LoadSDigits("recreate");
264 AliRunLoader* runLoader = fLoader->GetRunLoader();
6244debe 265
85a5290f 266 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
be385a87 267 digitizer.Open(runLoader->GetFileName().Data(), iEvent);
268 digitizer.MakeDigits();
269 digitizer.WriteDigits();
85a5290f 270 }
2ab0c725 271
85a5290f 272 fLoader->UnloadHits();
273 fLoader->UnloadSDigits();
2ab0c725 274 }
6244debe 275
85a5290f 276//_____________________________________________________________________________
c92eb8ad 277AliDigitizer* AliTRD::CreateDigitizer(AliRunDigitizer* manager) const
85a5290f 278{
279 return new AliTRDdigitizer(manager);
6244debe 280}
281
282//_____________________________________________________________________________
283void AliTRD::SDigits2Digits()
284{
285 //
286 // Create final digits from summable digits
287 //
288
abaf1f1d 289 // Create the TRD digitizer
be385a87 290 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
291 digitizer.SetDebug(GetDebug());
99d5402e 292
abaf1f1d 293 // Set the parameter
be385a87 294 digitizer.SetEvent(gAlice->GetEvNumber());
abaf1f1d 295
296 // Initialization
be385a87 297 digitizer.InitDetector();
abaf1f1d 298
299 // Read the s-digits via digits manager
be385a87 300 AliTRDdigitsManager sdigitsManager;
88cb7938 301
be385a87 302 sdigitsManager.SetDebug(GetDebug());
303 sdigitsManager.SetSDigits(kTRUE);
304 sdigitsManager.CreateArrays();
88cb7938 305
306 if (!fLoader->TreeS())
307 if (fLoader->LoadSDigits("read"))
308 {
309 Error("SDigits2Digits","Error while reading SDigits for event %d",gAlice->GetEvNumber());
310 return;
311 }
312 if (!fLoader->TreeS()) return;
313
be385a87 314 sdigitsManager.ReadDigits(fLoader->TreeS());
abaf1f1d 315
316 // Add the s-digits to the input list
be385a87 317 digitizer.AddSDigitsManager(&sdigitsManager);
99d5402e 318
abaf1f1d 319 // Convert the s-digits to normal digits
be385a87 320 digitizer.SDigits2Digits();
abaf1f1d 321
322 // Store the digits
88cb7938 323 if (!fLoader->TreeD()) fLoader->MakeTree("D");
be385a87 324 if (digitizer.MakeBranch(fLoader->TreeD())){
325 digitizer.WriteDigits();
abaf1f1d 326 }
99d5402e 327
328}
329
fe4da5cc 330//_____________________________________________________________________________
332e9569 331void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
332 , Bool_t inDrift)
fe4da5cc 333{
334 //
335 // Add a hit for the TRD
332e9569 336 //
337 // The data structure is set according to fHitType:
338 // bit0: standard TClonesArray
339 // bit1: compressed trackHits structure
fe4da5cc 340 //
82bbf98a 341
332e9569 342 if (fHitType & 1) {
343 TClonesArray &lhits = *fHits;
344 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,det,hits,q);
345 }
346
347 if (fHitType > 1) {
348 AddHit2(track,det,hits,q,inDrift);
349 }
82bbf98a 350
fe4da5cc 351}
352
353//_____________________________________________________________________________
354void AliTRD::BuildGeometry()
355{
356 //
357 // Create the ROOT TNode geometry for the TRD
358 //
82bbf98a 359
8230f242 360 TNode *node, *top;
fe4da5cc 361 TPGON *pgon;
793ff80c 362
363 Float_t rmin, rmax;
364 Float_t zmax1, zmax2;
db30bf0f 365
366 Int_t iPlan;
793ff80c 367
fe4da5cc 368 const Int_t kColorTRD = 46;
d3f347ff 369
fe4da5cc 370 // Find the top node alice
8230f242 371 top = gAlice->GetGeometry()->GetNode("alice");
d3f347ff 372
db30bf0f 373 if (fDisplayType == 0) {
793ff80c 374
375 pgon = new TPGON("S_TRD","TRD","void",0,360,AliTRDgeometry::Nsect(),4);
376 rmin = AliTRDgeometry::Rmin();
377 rmax = AliTRDgeometry::Rmax();
378 pgon->DefineSection(0,-AliTRDgeometry::Zmax1(),rmax,rmax);
379 pgon->DefineSection(1,-AliTRDgeometry::Zmax2(),rmin,rmax);
380 pgon->DefineSection(2, AliTRDgeometry::Zmax2(),rmin,rmax);
381 pgon->DefineSection(3, AliTRDgeometry::Zmax1(),rmax,rmax);
382 top->cd();
383 node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
384 node->SetLineColor(kColorTRD);
385 fNodes->Add(node);
386
db30bf0f 387 }
388 else if (fDisplayType == 1) {
793ff80c 389
f73816f5 390 Char_t name[7];
391
793ff80c 392 Float_t slope = (AliTRDgeometry::Zmax1() - AliTRDgeometry::Zmax2())
393 / (AliTRDgeometry::Rmax() - AliTRDgeometry::Rmin());
394
332e9569 395 rmin = AliTRDgeometry::Rmin() + AliTRDgeometry::CraHght();
396 rmax = rmin + AliTRDgeometry::CdrHght();
f73816f5 397
398 Float_t thickness = rmin - AliTRDgeometry::Rmin();
399 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
793ff80c 400 zmax1 = zmax2 + slope * AliTRDgeometry::DrThick();
793ff80c 401
db30bf0f 402 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
793ff80c 403
f73816f5 404 sprintf(name,"S_TR1%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);
410 top->cd();
411 node = new TNode("TRD","TRD",name,0,0,0,"");
412 node->SetLineColor(kColorTRD);
413 fNodes->Add(node);
414
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;
420
421 }
422
423 thickness += AliTRDgeometry::DrThick();
424 rmin = AliTRDgeometry::Rmin() + thickness;
425 rmax = rmin + AliTRDgeometry::AmThick();
426 zmax2 = AliTRDgeometry::Zmax2() + slope * thickness;
427 zmax1 = zmax2 + slope * AliTRDgeometry::AmThick();
428
db30bf0f 429 for (iPlan = 0; iPlan < AliTRDgeometry::Nplan(); iPlan++) {
f73816f5 430
431 sprintf(name,"S_TR2%d",iPlan);
793ff80c 432 pgon = new TPGON(name,"TRD","void",0,360,AliTRDgeometry::Nsect(),4);
433 pgon->DefineSection(0,-zmax1,rmax,rmax);
434 pgon->DefineSection(1,-zmax2,rmin,rmax);
435 pgon->DefineSection(2, zmax2,rmin,rmax);
436 pgon->DefineSection(3, zmax1,rmax,rmax);
437 top->cd();
438 node = new TNode("TRD","TRD",name,0,0,0,"");
439 node->SetLineColor(kColorTRD);
440 fNodes->Add(node);
441
442 Float_t height = AliTRDgeometry::Cheight() + AliTRDgeometry::Cspace();
443 rmin = rmin + height;
444 rmax = rmax + height;
445 zmax1 = zmax1 + slope * height;
446 zmax2 = zmax2 + slope * height;
447
448 }
449
db30bf0f 450 }
d3f347ff 451
fe4da5cc 452}
453
454//_____________________________________________________________________________
dd9a6ee3 455void AliTRD::Copy(TObject &trd)
8230f242 456{
457 //
458 // Copy function
459 //
460
793ff80c 461 ((AliTRD &) trd).fGasMix = fGasMix;
462 ((AliTRD &) trd).fGeometry = fGeometry;
463 ((AliTRD &) trd).fRecPoints = fRecPoints;
464 ((AliTRD &) trd).fNRecPoints = fNRecPoints;
465 ((AliTRD &) trd).fGasDensity = fGasDensity;
466 ((AliTRD &) trd).fFoilDensity = fFoilDensity;
467 ((AliTRD &) trd).fDrawTR = fDrawTR;
468 ((AliTRD &) trd).fDisplayType = fDisplayType;
332e9569 469 ((AliTRD &) trd).fHitType = fHitType;
8230f242 470
471 //AliDetector::Copy(trd);
472
473}
474
475//_____________________________________________________________________________
82bbf98a 476void AliTRD::CreateGeometry()
fe4da5cc 477{
82bbf98a 478 //
479 // Creates the volumes for the TRD chambers
480 //
82bbf98a 481
482 // Check that FRAME is there otherwise we have no place where to put the TRD
8230f242 483 AliModule* frame = gAlice->GetModule("FRAME");
484 if (!frame) {
851d3db9 485 printf(" The TRD needs the FRAME to be defined first\n");
486 return;
82bbf98a 487 }
d3f347ff 488
851d3db9 489 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
5c7f4665 490
82bbf98a 491}
492
493//_____________________________________________________________________________
494void AliTRD::CreateMaterials()
495{
fe4da5cc 496 //
497 // Create the materials for the TRD
498 // Origin Y.Foka
499 //
500
8230f242 501 Int_t isxfld = gAlice->Field()->Integ();
502 Float_t sxmgmx = gAlice->Field()->Max();
fe4da5cc 503
d3f347ff 504 // For polyethilene (CH2)
505 Float_t ape[2] = { 12., 1. };
506 Float_t zpe[2] = { 6., 1. };
507 Float_t wpe[2] = { 1., 2. };
508 Float_t dpe = 0.95;
509
510 // For mylar (C5H4O2)
511 Float_t amy[3] = { 12., 1., 16. };
512 Float_t zmy[3] = { 6., 1., 8. };
513 Float_t wmy[3] = { 5., 4., 2. };
fe4da5cc 514 Float_t dmy = 1.39;
d3f347ff 515
516 // For CO2
517 Float_t aco[2] = { 12., 16. };
518 Float_t zco[2] = { 6., 8. };
519 Float_t wco[2] = { 1., 2. };
520 Float_t dco = 0.001977;
521
522 // For water
523 Float_t awa[2] = { 1., 16. };
524 Float_t zwa[2] = { 1., 8. };
525 Float_t wwa[2] = { 2., 1. };
526 Float_t dwa = 1.0;
527
528 // For isobutane (C4H10)
529 Float_t ais[2] = { 12., 1. };
530 Float_t zis[2] = { 6., 1. };
531 Float_t wis[2] = { 4., 10. };
532 Float_t dis = 0.00267;
533
db30bf0f 534 // For plexiglas (C5H8O2)
535 Float_t apg[3] = { 12.011 , 1.0 , 15.9994 };
536 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
537 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
538 Float_t dpg = 1.18;
539
d3f347ff 540 // For Xe/CO2-gas-mixture
db30bf0f 541 // Xe-content of the Xe/CO2-mixture (85% / 15%)
542 Float_t fxc = .85;
d3f347ff 543 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
544 Float_t fxi = .97;
fe4da5cc 545 Float_t dxe = .005858;
546
d3f347ff 547 // General tracking parameter
fe4da5cc 548 Float_t tmaxfd = -10.;
549 Float_t stemax = -1e10;
d3f347ff 550 Float_t deemax = -0.1;
551 Float_t epsil = 1e-4;
552 Float_t stmin = -0.001;
fe4da5cc 553
554 Float_t absl, radl, d, buf[1];
793ff80c 555 Float_t agm[2], zgm[2], wgm[2];
556 Float_t dgm1, dgm2;
d3f347ff 557 Int_t nbuf;
fe4da5cc 558
d3f347ff 559 //////////////////////////////////////////////////////////////////////////
fe4da5cc 560 // Define Materials
d3f347ff 561 //////////////////////////////////////////////////////////////////////////
562
16bf9884 563 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
564 AliMaterial( 2, "Air" , 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
565 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1447.59, 0.0);
566 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
567 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
568 AliMaterial(12, "G10" , 20.00, 10.0, 1.7 , 19.4 , 999.0);
569 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
570 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
571 AliMaterial(17, "Epoxy", 17.75, 8.9, 1.8 , 21.82, 999.0);
d3f347ff 572
573 // Mixtures
db30bf0f 574 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe);
575 AliMixture(7, "Mylar", amy, zmy, dmy, -3, wmy);
576 AliMixture(8, "CO2", aco, zco, dco, -2, wco);
577 AliMixture(9, "Isobutane", ais, zis, dis, -2, wis);
578 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa);
579 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg);
d3f347ff 580
581 // Gas mixtures
00d6d986 582 Char_t namate[21]="";
d3f347ff 583 // Xe/CO2-mixture
584 // Get properties of Xe
cfce8870 585 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
d3f347ff 586 // Get properties of CO2
cfce8870 587 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
d3f347ff 588 // Create gas mixture
589 wgm[0] = fxc;
590 wgm[1] = 1. - fxc;
793ff80c 591 dgm1 = wgm[0] * dxe + wgm[1] * dco;
db30bf0f 592 AliMixture(10, "Gas mixture 1", agm, zgm, dgm1, 2, wgm);
d3f347ff 593 // Xe/Isobutane-mixture
594 // Get properties of Xe
cfce8870 595 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
d3f347ff 596 // Get properties of Isobutane
cfce8870 597 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
d3f347ff 598 // Create gas mixture
599 wgm[0] = fxi;
600 wgm[1] = 1. - fxi;
793ff80c 601 dgm2 = wgm[0] * dxe + wgm[1] * dis;
db30bf0f 602 AliMixture(11, "Gas mixture 2", agm, zgm, dgm2, 2, wgm);
d3f347ff 603
604 //////////////////////////////////////////////////////////////////////////
fe4da5cc 605 // Tracking Media Parameters
d3f347ff 606 //////////////////////////////////////////////////////////////////////////
607
608 // Al Frame
db30bf0f 609 AliMedium(1, "Al Frame", 1, 0, isxfld, sxmgmx
d3f347ff 610 , tmaxfd, stemax, deemax, epsil, stmin);
611 // Air
db30bf0f 612 AliMedium(2, "Air", 2, 0, isxfld, sxmgmx
d3f347ff 613 , tmaxfd, stemax, deemax, epsil, stmin);
614 // Polyethilene
db30bf0f 615 AliMedium(3, "Radiator", 3, 0, isxfld, sxmgmx
d3f347ff 616 , tmaxfd, stemax, deemax, epsil, stmin);
617 // Xe
db30bf0f 618 AliMedium(4, "Xe", 4, 1, isxfld, sxmgmx
d3f347ff 619 , tmaxfd, stemax, deemax, epsil, stmin);
620 // Cu pads
db30bf0f 621 AliMedium(5, "Padplane", 5, 1, isxfld, sxmgmx
d3f347ff 622 , tmaxfd, stemax, deemax, epsil, stmin);
623 // Fee + cables
db30bf0f 624 AliMedium(6, "Readout", 1, 0, isxfld, sxmgmx
d3f347ff 625 , tmaxfd, stemax, deemax, epsil, stmin);
626 // C frame
db30bf0f 627 AliMedium(7, "C Frame", 6, 0, isxfld, sxmgmx
d3f347ff 628 , tmaxfd, stemax, deemax, epsil, stmin);
629 // Mylar foils
db30bf0f 630 AliMedium(8, "Mylar", 7, 0, isxfld, sxmgmx
d3f347ff 631 , tmaxfd, stemax, deemax, epsil, stmin);
632 if (fGasMix == 1) {
633 // Gas-mixture (Xe/CO2)
db30bf0f 634 AliMedium(9, "Gas-mix", 10, 1, isxfld, sxmgmx
d3f347ff 635 , tmaxfd, stemax, deemax, epsil, stmin);
636 }
637 else {
638 // Gas-mixture (Xe/Isobutane)
db30bf0f 639 AliMedium(9, "Gas-mix", 11, 1, isxfld, sxmgmx
d3f347ff 640 , tmaxfd, stemax, deemax, epsil, stmin);
641 }
642 // Nomex-honeycomb (use carbon for the time being)
db30bf0f 643 AliMedium(10, "Nomex", 6, 0, isxfld, sxmgmx
d3f347ff 644 , tmaxfd, stemax, deemax, epsil, stmin);
645 // Kapton foils (use Mylar for the time being)
db30bf0f 646 AliMedium(11, "Kapton", 7, 0, isxfld, sxmgmx
d3f347ff 647 , tmaxfd, stemax, deemax, epsil, stmin);
648 // Gas-filling of the radiator
db30bf0f 649 AliMedium(12, "CO2", 8, 0, isxfld, sxmgmx
d3f347ff 650 , tmaxfd, stemax, deemax, epsil, stmin);
651 // G10-plates
db30bf0f 652 AliMedium(13, "G10-plates",12, 0, isxfld, sxmgmx
d3f347ff 653 , tmaxfd, stemax, deemax, epsil, stmin);
654 // Cooling water
db30bf0f 655 AliMedium(14, "Water", 13, 0, isxfld, sxmgmx
656 , tmaxfd, stemax, deemax, epsil, stmin);
657 // Rohacell (plexiglas) for the radiator
658 AliMedium(15, "Rohacell", 14, 0, isxfld, sxmgmx
d3f347ff 659 , tmaxfd, stemax, deemax, epsil, stmin);
16bf9884 660 // Al layer in MCMs
661 AliMedium(16, "MCM-Al" , 1, 0, isxfld, sxmgmx
662 , tmaxfd, stemax, deemax, epsil, stmin);
663 // Sn layer in MCMs
664 AliMedium(17, "MCM-Sn" , 15, 0, isxfld, sxmgmx
665 , tmaxfd, stemax, deemax, epsil, stmin);
666 // Cu layer in MCMs
667 AliMedium(18, "MCM-Cu" , 5, 0, isxfld, sxmgmx
668 , tmaxfd, stemax, deemax, epsil, stmin);
669 // G10 layer in MCMs
670 AliMedium(19, "MCM-G10" , 12, 0, isxfld, sxmgmx
671 , tmaxfd, stemax, deemax, epsil, stmin);
672 // Si in readout chips
673 AliMedium(20, "Chip-Si" , 16, 0, isxfld, sxmgmx
674 , tmaxfd, stemax, deemax, epsil, stmin);
675 // Epoxy in readout chips
676 AliMedium(21, "Chip-Ep" , 17, 0, isxfld, sxmgmx
677 , tmaxfd, stemax, deemax, epsil, stmin);
678 // PE in connectors
679 AliMedium(22, "Conn-PE" , 3, 0, isxfld, sxmgmx
680 , tmaxfd, stemax, deemax, epsil, stmin);
681 // Cu in connectors
682 AliMedium(23, "Chip-Cu" , 5, 0, isxfld, sxmgmx
683 , tmaxfd, stemax, deemax, epsil, stmin);
684 // Al of cooling pipes
685 AliMedium(24, "Cooling" , 1, 0, isxfld, sxmgmx
686 , tmaxfd, stemax, deemax, epsil, stmin);
73ae7b59 687 // Cu in services
688 AliMedium(25, "Serv-Cu" , 5, 0, isxfld, sxmgmx
689 , tmaxfd, stemax, deemax, epsil, stmin);
d3f347ff 690
793ff80c 691 // Save the density values for the TRD absorbtion
692 fFoilDensity = dmy;
693 if (fGasMix == 1)
694 fGasDensity = dgm1;
695 else
696 fGasDensity = dgm2;
697
fe4da5cc 698}
699
700//_____________________________________________________________________________
0a29d0f1 701void AliTRD::DrawModule() const
82bbf98a 702{
703 //
704 // Draw a shaded view of the Transition Radiation Detector version 0
705 //
706
707 // Set everything unseen
708 gMC->Gsatt("*" ,"SEEN",-1);
709
710 // Set ALIC mother transparent
711 gMC->Gsatt("ALIC","SEEN", 0);
712
713 // Set the volumes visible
851d3db9 714 if (fGeometry->IsVersion() == 0) {
5c7f4665 715 gMC->Gsatt("B071","SEEN", 0);
716 gMC->Gsatt("B074","SEEN", 0);
717 gMC->Gsatt("B075","SEEN", 0);
718 gMC->Gsatt("B077","SEEN", 0);
719 gMC->Gsatt("BTR1","SEEN", 0);
720 gMC->Gsatt("BTR2","SEEN", 0);
721 gMC->Gsatt("BTR3","SEEN", 0);
332e9569 722 gMC->Gsatt("UTR1","SEEN", 0);
723 gMC->Gsatt("UTR2","SEEN", 0);
724 gMC->Gsatt("UTR3","SEEN", 0);
5c7f4665 725 }
726 else {
727 gMC->Gsatt("B071","SEEN", 0);
728 gMC->Gsatt("B074","SEEN", 0);
729 gMC->Gsatt("B075","SEEN", 0);
730 gMC->Gsatt("B077","SEEN", 0);
731 gMC->Gsatt("BTR1","SEEN", 0);
732 gMC->Gsatt("BTR2","SEEN", 0);
733 gMC->Gsatt("BTR3","SEEN", 0);
332e9569 734 gMC->Gsatt("UTR1","SEEN", 0);
6f1e466d 735 if (fGeometry->GetPHOShole())
332e9569 736 gMC->Gsatt("UTR2","SEEN", 0);
6f1e466d 737 if (fGeometry->GetRICHhole())
332e9569 738 gMC->Gsatt("UTR3","SEEN", 0);
5c7f4665 739 }
332e9569 740// gMC->Gsatt("UCII","SEEN", 0);
741// gMC->Gsatt("UCIM","SEEN", 0);
742// gMC->Gsatt("UCIO","SEEN", 0);
743// gMC->Gsatt("UL02","SEEN", 1);
744// gMC->Gsatt("UL05","SEEN", 1);
745// gMC->Gsatt("UL06","SEEN", 1);
82bbf98a 746
747 gMC->Gdopt("hide", "on");
748 gMC->Gdopt("shad", "on");
749 gMC->Gsatt("*", "fill", 7);
750 gMC->SetClipBox(".");
751 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
752 gMC->DefaultRange();
753 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
754 gMC->Gdhead(1111, "Transition Radiation Detector");
755 gMC->Gdman(18, 4, "MAN");
756
757}
758
759//_____________________________________________________________________________
0a29d0f1 760Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t ) const
fe4da5cc 761{
762 //
763 // Distance between the mouse and the TRD detector on the screen
764 // Dummy routine
82bbf98a 765
766 return 9999;
767
fe4da5cc 768}
769
770//_____________________________________________________________________________
771void AliTRD::Init()
772{
773 //
851d3db9 774 // Initialize the TRD detector after the geometry has been created
fe4da5cc 775 //
82bbf98a 776
5c7f4665 777 Int_t i;
851d3db9 778
abaf1f1d 779 if (fDebug) {
9e1a0ddb 780 printf("\n%s: ",ClassName());
781 for (i = 0; i < 35; i++) printf("*");
782 printf(" TRD_INIT ");
783 for (i = 0; i < 35; i++) printf("*");
784 printf("\n");
785 }
5c7f4665 786
d37eec5e 787 if (fGeometry->IsVersion() == 1) {
788 printf("%s: Full geometry version initialized\n",ClassName());
6f1e466d 789 if (fGeometry->GetPHOShole())
9e1a0ddb 790 printf("%s: Leave space in front of PHOS free\n",ClassName());
6f1e466d 791 if (fGeometry->GetRICHhole())
9e1a0ddb 792 printf("%s: Leave space in front of RICH free\n",ClassName());
5c7f4665 793 }
d37eec5e 794 else {
795 printf("%s: Not a valid geometry\n",ClassName());
796 }
9e1a0ddb 797
abaf1f1d 798 if (fGasMix == 1) {
db30bf0f 799 printf("%s: Gas Mixture: 85%% Xe + 15%% CO2\n",ClassName());
abaf1f1d 800 }
801 else {
9e1a0ddb 802 printf("%s: Gas Mixture: 97%% Xe + 3%% Isobutane\n",ClassName());
abaf1f1d 803 }
5c7f4665 804
805}
806
807//_____________________________________________________________________________
73ae7b59 808void AliTRD::LoadPoints(Int_t )
793ff80c 809{
810 //
811 // Store x, y, z of all hits in memory.
812 // Hit originating from TR photons are given a different color
813 //
814
332e9569 815 //if (!fDrawTR) {
816 // AliDetector::LoadPoints(track);
817 // return;
818 //}
793ff80c 819
332e9569 820 if ((fHits == 0) && (fTrackHits == 0)) return;
793ff80c 821
332e9569 822 Int_t nhits;
823 if (fHitType < 2) {
824 nhits = fHits->GetEntriesFast();
825 }
826 else {
827 nhits = fTrackHits->GetEntriesFast();
828 }
793ff80c 829 if (nhits == 0) return;
830
5d12ce38 831 Int_t tracks = gAlice->GetMCApp()->GetNtrack();
793ff80c 832 if (fPoints == 0) fPoints = new TObjArray(tracks);
833
834 AliTRDhit *ahit;
835
836 Int_t *ntrkE = new Int_t[tracks];
837 Int_t *ntrkT = new Int_t[tracks];
838 Int_t *limiE = new Int_t[tracks];
839 Int_t *limiT = new Int_t[tracks];
840 Float_t **coorE = new Float_t*[tracks];
841 Float_t **coorT = new Float_t*[tracks];
842 for(Int_t i = 0; i < tracks; i++) {
843 ntrkE[i] = 0;
844 ntrkT[i] = 0;
845 coorE[i] = 0;
846 coorT[i] = 0;
847 limiE[i] = 0;
848 limiT[i] = 0;
849 }
850
332e9569 851 AliTRDpoints *points = 0;
852 Float_t *fp = 0;
853 Int_t trk;
854 Int_t chunk = nhits / 4 + 1;
793ff80c 855
856 // Loop over all the hits and store their position
332e9569 857 ahit = (AliTRDhit *) FirstHit(-1);
858 while (ahit) {
793ff80c 859
860 // dEdx hits
332e9569 861 if (ahit->GetCharge() >= 0) {
793ff80c 862
863 trk = ahit->GetTrack();
864 if (ntrkE[trk] == limiE[trk]) {
865 // Initialise a new track
866 fp = new Float_t[3*(limiE[trk]+chunk)];
867 if (coorE[trk]) {
868 memcpy(fp,coorE[trk],sizeof(Float_t)*3*limiE[trk]);
869 delete [] coorE[trk];
870 }
871 limiE[trk] += chunk;
872 coorE[trk] = fp;
873 }
874 else {
875 fp = coorE[trk];
876 }
877 fp[3*ntrkE[trk] ] = ahit->X();
878 fp[3*ntrkE[trk]+1] = ahit->Y();
879 fp[3*ntrkE[trk]+2] = ahit->Z();
880 ntrkE[trk]++;
881
882 }
883 // TR photon hits
332e9569 884 else if ((ahit->GetCharge() < 0) && (fDrawTR)) {
793ff80c 885
886 trk = ahit->GetTrack();
887 if (ntrkT[trk] == limiT[trk]) {
888 // Initialise a new track
889 fp = new Float_t[3*(limiT[trk]+chunk)];
890 if (coorT[trk]) {
891 memcpy(fp,coorT[trk],sizeof(Float_t)*3*limiT[trk]);
892 delete [] coorT[trk];
893 }
894 limiT[trk] += chunk;
895 coorT[trk] = fp;
896 }
897 else {
898 fp = coorT[trk];
899 }
900 fp[3*ntrkT[trk] ] = ahit->X();
901 fp[3*ntrkT[trk]+1] = ahit->Y();
902 fp[3*ntrkT[trk]+2] = ahit->Z();
903 ntrkT[trk]++;
904
905 }
906
332e9569 907 ahit = (AliTRDhit *) NextHit();
908
793ff80c 909 }
910
911 for (trk = 0; trk < tracks; ++trk) {
912
913 if (ntrkE[trk] || ntrkT[trk]) {
914
915 points = new AliTRDpoints();
916 points->SetDetector(this);
917 points->SetParticle(trk);
918
919 // Set the dEdx points
920 if (ntrkE[trk]) {
921 points->SetMarkerColor(GetMarkerColor());
922 points->SetMarkerSize(GetMarkerSize());
923 points->SetPolyMarker(ntrkE[trk],coorE[trk],GetMarkerStyle());
924 delete [] coorE[trk];
925 coorE[trk] = 0;
926 }
927
928 // Set the TR photon points
929 if (ntrkT[trk]) {
930 points->SetTRpoints(ntrkT[trk],coorT[trk]);
931 delete [] coorT[trk];
932 coorT[trk] = 0;
933 }
934
935 fPoints->AddAt(points,trk);
936
937 }
938
939 }
940
941 delete [] coorE;
942 delete [] coorT;
943 delete [] ntrkE;
944 delete [] ntrkT;
945 delete [] limiE;
946 delete [] limiT;
947
948}
949
950//_____________________________________________________________________________
88cb7938 951void AliTRD::MakeBranch(Option_t* option)
5c7f4665 952{
953 //
abaf1f1d 954 // Create Tree branches for the TRD digits.
5c7f4665 955 //
956
abaf1f1d 957 Int_t buffersize = 4000;
958 Char_t branchname[15];
959 sprintf(branchname,"%s",GetName());
5c7f4665 960
aa9d00f0 961 const char *cD = strstr(option,"D");
962
88cb7938 963 AliDetector::MakeBranch(option);
5c7f4665 964
abaf1f1d 965 if (fDigits && gAlice->TreeD() && cD) {
88cb7938 966 MakeBranchInTree(gAlice->TreeD(),branchname,&fDigits,buffersize,0);
abaf1f1d 967 }
968
332e9569 969 if (fHitType > 1) {
88cb7938 970 MakeBranch2(option,0);
332e9569 971 }
972
851d3db9 973}
974
975//_____________________________________________________________________________
6244debe 976void AliTRD::ResetDigits()
977{
978 //
abaf1f1d 979 // Reset number of digits and the digits array for this detector
6244debe 980 //
981
abaf1f1d 982 fNdigits = 0;
983 if (fDigits) fDigits->Clear();
6244debe 984
985}
986
987//_____________________________________________________________________________
851d3db9 988void AliTRD::ResetRecPoints()
989{
990 //
991 // Reset number of reconstructed points and the point array
992 //
993
f73816f5 994 if (fRecPoints) {
793ff80c 995 fNRecPoints = 0;
996 Int_t nentr = fRecPoints->GetEntriesFast();
f73816f5 997 for (Int_t i = 0; i < nentr; i++) delete fRecPoints->RemoveAt(i);
793ff80c 998 }
5c7f4665 999
1000}
1001
1002//_____________________________________________________________________________
1003void AliTRD::SetTreeAddress()
1004{
1005 //
1006 // Set the branch addresses for the trees.
1007 //
1008
1009 Char_t branchname[15];
1010
88cb7938 1011 if ( fLoader->TreeH() && (fHits == 0x0)) fHits = new TClonesArray("AliTRDhit",405);
5c7f4665 1012 AliDetector::SetTreeAddress();
1013
1014 TBranch *branch;
88cb7938 1015 TTree *treeR = fLoader->TreeR();
851d3db9 1016
1017 if (treeR) {
f73816f5 1018 sprintf(branchname,"%scluster",GetName());
88cb7938 1019 if (fRecPoints == 0x0) fRecPoints = new TObjArray(400);
851d3db9 1020 if (fRecPoints) {
1021 branch = treeR->GetBranch(branchname);
1022 if (branch) {
1023 branch->SetAddress(&fRecPoints);
1024 }
5c7f4665 1025 }
1026 }
1027
332e9569 1028 if (fHitType > 0) {
1029 SetTreeAddress2();
1030 }
1031
fe4da5cc 1032}
1033
d3f347ff 1034//_____________________________________________________________________________
b060c36f 1035void AliTRD::SetGasMix(Int_t imix)
d3f347ff 1036{
82bbf98a 1037 //
1038 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1039 //
1040
d3f347ff 1041 if ((imix < 0) || (imix > 1)) {
1042 printf("Wrong input value: %d\n",imix);
1043 printf("Use standard setting\n");
6244debe 1044 fGasMix = 1;
d3f347ff 1045 return;
1046 }
1047
1048 fGasMix = imix;
1049
1050}
1051
dd9a6ee3 1052//_____________________________________________________________________________
793ff80c 1053void AliTRD::SetPHOShole()
1054{
1055 //
1056 // Selects a geometry with a hole in front of the PHOS
1057 //
1058
1059 fGeometry->SetPHOShole();
1060
1061}
1062
1063//_____________________________________________________________________________
1064void AliTRD::SetRICHhole()
1065{
1066 //
1067 // Selects a geometry with a hole in front of the RICH
1068 //
1069
1070 fGeometry->SetRICHhole();
1071
1072}
1073
1074//_____________________________________________________________________________
dd9a6ee3 1075AliTRD &AliTRD::operator=(const AliTRD &trd)
1076{
1077 //
1078 // Assignment operator
1079 //
1080
1081 if (this != &trd) ((AliTRD &) trd).Copy(*this);
1082 return *this;
1083
f73816f5 1084}
abaf1f1d 1085
332e9569 1086//_____________________________________________________________________________
1087void AliTRD::FinishPrimary()
1088{
1089 //
1090 // Store the hits in the containers after all primaries are finished
1091 //
1092
1093 if (fTrackHits) {
1094 fTrackHits->FlushHitStack();
1095 }
1096
1097}
1098
1099//_____________________________________________________________________________
1100void AliTRD::RemapTrackHitIDs(Int_t *map)
1101{
1102 //
1103 // Remap the track IDs
1104 //
1105
1106 if (!fTrackHits) {
1107 return;
1108 }
1109
1110 if (fTrackHits) {
1111 TClonesArray *arr = fTrackHits->GetArray();;
1112 for (Int_t i = 0; i < arr->GetEntriesFast(); i++){
1113 AliTrackHitsParamV2 *info = (AliTrackHitsParamV2 *) (arr->At(i));
1114 info->fTrackID = map[info->fTrackID];
1115 }
1116 }
1117
1118}
1119
1120//_____________________________________________________________________________
1121void AliTRD::ResetHits()
1122{
1123 //
1124 // Reset the hits
1125 //
1126
1127 AliDetector::ResetHits();
1128 if (fTrackHits) {
1129 fTrackHits->Clear();
1130 }
1131
1132}
1133
1134//_____________________________________________________________________________
1135AliHit* AliTRD::FirstHit(Int_t track)
1136{
1137 //
1138 // Return the first hit of a track
1139 //
1140
1141 if (fHitType > 1) {
1142 return FirstHit2(track);
1143 }
abaf1f1d 1144
332e9569 1145 return AliDetector::FirstHit(track);
abaf1f1d 1146
332e9569 1147}
1148
1149//_____________________________________________________________________________
1150AliHit* AliTRD::NextHit()
1151{
1152 //
1153 // Returns the next hit of a track
1154 //
1155
1156 if (fHitType > 1) {
1157 return NextHit2();
1158 }
1159
1160 return AliDetector::NextHit();
1161
1162}
1163
1164//_____________________________________________________________________________
0a29d0f1 1165AliHit* AliTRD::FirstHit2(Int_t track)
332e9569 1166{
1167 //
1168 // Initializes the hit iterator.
1169 // Returns the address of the first hit of a track.
1170 // If <track> >= 0 the track is read from disk,
1171 // while if <track> < 0 the first hit of the current
1172 // track is returned.
1173 //
1174
1175 if (track >= 0) {
1176 gAlice->ResetHits();
88cb7938 1177 TreeH()->GetEvent(track);
332e9569 1178 }
1179
1180 if (fTrackHits) {
1181 fTrackHits->First();
1182 return (AliHit*) fTrackHits->GetHit();
1183 }
1184 else {
1185 return 0;
1186 }
1187
1188}
1189
1190//_____________________________________________________________________________
1191AliHit* AliTRD::NextHit2()
1192{
1193 //
1194 // Returns the next hit of the current track
1195 //
1196
1197 if (fTrackHits) {
1198 fTrackHits->Next();
1199 return (AliHit *) fTrackHits->GetHit();
1200 }
1201 else {
1202 return 0;
1203 }
1204
1205}
1206
1207//_____________________________________________________________________________
73ae7b59 1208void AliTRD::MakeBranch2(Option_t *option, const char* )
332e9569 1209{
1210 //
1211 // Create a new branch in the current Root tree.
1212 // The branch of fHits is automatically split.
1213 //
1214
1215 if (fHitType < 2) {
1216 return;
1217 }
1218
1219 char branchname[10];
1220 sprintf(branchname,"%s2",GetName());
1221
1222 // Get the pointer to the header
1223 const char *cH = strstr(option,"H");
1224
1225 if (!fTrackHits) {
1226 fTrackHits = new AliTRDtrackHits();
88cb7938 1227 }
332e9569 1228
332e9569 1229
88cb7938 1230 if (fTrackHits && TreeH() && cH)
1231 {
1232 TreeH()->Branch(branchname,"AliTRDtrackHits",&fTrackHits,fBufferSize,99);
1233 Info("MakeBranch2","Making Branch %s for trackhits",branchname);
1234 }
332e9569 1235}
1236
1237//_____________________________________________________________________________
1238void AliTRD::SetTreeAddress2()
1239{
1240 //
1241 // Set the branch address for the trackHits tree
1242 //
f2a509af 1243 if (GetDebug()) Info("SetTreeAddress2","");
332e9569 1244
1245 TBranch *branch;
332e9569 1246 char branchname[20];
332e9569 1247 sprintf(branchname,"%s2",GetName());
1248
1249 // Branch address for hit tree
88cb7938 1250 TTree *treeH = TreeH();
332e9569 1251 if ((treeH) && (fHitType > 0)) {
1252 branch = treeH->GetBranch(branchname);
88cb7938 1253 if (branch)
1254 {
1255 branch->SetAddress(&fTrackHits);
f2a509af 1256 if (GetDebug())
1257 Info("SetTreeAddress2","Success.");
88cb7938 1258 }
1259 else
1260 {
f2a509af 1261 if (GetDebug())
1262 Info("SetTreeAddress2","Can NOT get the branch %s",branchname);
88cb7938 1263 }
332e9569 1264 }
1265
1266}
1267
1268//_____________________________________________________________________________
1269void AliTRD::AddHit2(Int_t track, Int_t det, Float_t *hits, Int_t q
1270 , Bool_t inDrift)
1271{
1272 //
1273 // Add a hit to the list
1274 //
1275
1276 Int_t rtrack;
1277
1278 if (fIshunt) {
5d12ce38 1279 Int_t primary = gAlice->GetMCApp()->GetPrimary(track);
1280 gAlice->GetMCApp()->Particle(primary)->SetBit(kKeepBit);
332e9569 1281 rtrack = primary;
1282 }
1283 else {
1284 rtrack = track;
5d12ce38 1285 gAlice->GetMCApp()->FlagTrack(track);
332e9569 1286 }
1287
1288 if ((fTrackHits) && (fHitType > 0)) {
1289 fTrackHits->AddHitTRD(det,rtrack,hits[0],hits[1],hits[2],q,inDrift);
1290 }
1291
1292}
abaf1f1d 1293
1294
abaf1f1d 1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629