]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRD.cxx
remove Fluka related Gstpar parameters. Waiting for new tests.
[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
f7a1cc68 26#include <TGeoGlobalMagField.h>
88cb7938 27#include <TVirtualMC.h>
28
45160b1f 29#include "AliMC.h"
793ff80c 30#include "AliMagF.h"
88cb7938 31#include "AliRun.h"
030b4415 32
793ff80c 33#include "AliTRD.h"
851d3db9 34#include "AliTRDdigitizer.h"
88cb7938 35#include "AliTRDdigitsManager.h"
bd0f8685 36#include "AliTRDgeometry.h"
88cb7938 37#include "AliTRDhit.h"
b864d801 38#include "AliTRDrawData.h"
3551db50 39#include "AliTRDSimParam.h"
89ba6aa1 40#include "TTreeStream.h"
3551db50 41
fe4da5cc 42ClassImp(AliTRD)
43
44//_____________________________________________________________________________
45AliTRD::AliTRD()
030b4415 46 :AliDetector()
47 ,fGeometry(0)
48 ,fGasDensity(0)
49 ,fFoilDensity(0)
f2979d08 50 ,fGasNobleFraction(0)
89ba6aa1 51 ,fDebugStream(0x0)
fe4da5cc 52{
53 //
54 // Default constructor
55 //
332e9569 56
fe4da5cc 57}
58
59//_____________________________________________________________________________
60AliTRD::AliTRD(const char *name, const char *title)
030b4415 61 :AliDetector(name,title)
62 ,fGeometry(0)
63 ,fGasDensity(0)
64 ,fFoilDensity(0)
457b47bb 65 ,fGasNobleFraction(0)
89ba6aa1 66 ,fDebugStream(0x0)
fe4da5cc 67{
68 //
69 // Standard constructor for the TRD
70 //
71
030b4415 72 // Check that FRAME is there otherwise we have no place where to put TRD
73 AliModule *frame = gAlice->GetModule("FRAME");
8230f242 74 if (!frame) {
030b4415 75 AliError("TRD needs FRAME to be present\n");
5c7f4665 76 exit(1);
77 }
78
d37eec5e 79 // Define the TRD geometry
80 if ((frame->IsVersion() == 0) ||
81 (frame->IsVersion() == 1)) {
bd0f8685 82 fGeometry = new AliTRDgeometry();
851d3db9 83 }
84 else {
030b4415 85 AliError("Could not find valid FRAME version\n");
851d3db9 86 exit(1);
87 }
5c7f4665 88
fe4da5cc 89 // Allocate the hit array
030b4415 90 fHits = new TClonesArray("AliTRDhit",405);
5d12ce38 91 gAlice->GetMCApp()->AddHitList(fHits);
8230f242 92}
93
99d5402e 94//_____________________________________________________________________________
95AliTRD::~AliTRD()
96{
97 //
98 // TRD destructor
99 //
89ba6aa1 100 delete fDebugStream;
abaf1f1d 101 if (fGeometry) {
102 delete fGeometry;
030b4415 103 fGeometry = 0;
abaf1f1d 104 }
030b4415 105
abaf1f1d 106 if (fHits) {
107 delete fHits;
030b4415 108 fHits = 0;
abaf1f1d 109 }
bd0f8685 110
5c7f4665 111}
112
6244debe 113//_____________________________________________________________________________
114void AliTRD::Hits2Digits()
2ab0c725 115{
116 //
117 // Create digits
118 //
bd0f8685 119
be385a87 120 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
45160b1f 121 AliLog::SetClassDebugLevel("TRDdigitizer",AliDebugLevel());
9a96f175 122
6244debe 123 // Initialization
be385a87 124 digitizer.InitDetector();
89ba6aa1 125
126 TDirectory *savedir = gDirectory;
127 fDebugStream = new TTreeSRedirector("TRD.SimDebug.root");
128 savedir->cd();
129 digitizer.SetDebugStream(fDebugStream);
130
030b4415 131 if (!fLoader->TreeH()) {
132 fLoader->LoadHits("read");
133 }
85a5290f 134 fLoader->LoadDigits("recreate");
95867fd1 135
030b4415 136 AliRunLoader *runLoader = fLoader->GetRunLoader();
6244debe 137
85a5290f 138 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
95867fd1 139 runLoader->GetEvent(iEvent);
140 digitizer.Open(runLoader,iEvent);
be385a87 141 digitizer.MakeDigits();
142 digitizer.WriteDigits();
6244debe 143 }
144
85a5290f 145 fLoader->UnloadHits();
146 fLoader->UnloadDigits();
a328fff9 147
6244debe 148}
149
150//_____________________________________________________________________________
151void AliTRD::Hits2SDigits()
152{
153 //
154 // Create summable digits
155 //
a328fff9 156
be385a87 157 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
6244debe 158 // For the summable digits
be385a87 159 digitizer.SetSDigits(kTRUE);
45160b1f 160 AliLog::SetClassDebugLevel("TRDdigitizer",AliDebugLevel());
6244debe 161
162 // Initialization
be385a87 163 digitizer.InitDetector();
89ba6aa1 164
165 TDirectory *savedir = gDirectory;
166 fDebugStream = new TTreeSRedirector("TRD.SimDebug.root");
167 savedir->cd();
168 digitizer.SetDebugStream(fDebugStream);
169
030b4415 170 if (!fLoader->TreeH()) {
171 fLoader->LoadHits("read");
172 }
85a5290f 173 fLoader->LoadSDigits("recreate");
95867fd1 174
175 AliRunLoader *runLoader = fLoader->GetRunLoader();
6244debe 176
85a5290f 177 for (Int_t iEvent = 0; iEvent < runLoader->GetNumberOfEvents(); iEvent++) {
95867fd1 178 runLoader->GetEvent(iEvent);
179 digitizer.Open(runLoader,iEvent);
be385a87 180 digitizer.MakeDigits();
181 digitizer.WriteDigits();
85a5290f 182 }
2ab0c725 183
85a5290f 184 fLoader->UnloadHits();
185 fLoader->UnloadSDigits();
a328fff9 186
187}
6244debe 188
85a5290f 189//_____________________________________________________________________________
95867fd1 190AliDigitizer *AliTRD::CreateDigitizer(AliRunDigitizer *manager) const
85a5290f 191{
a328fff9 192 //
193 // Creates a new digitizer object
194 //
195
85a5290f 196 return new AliTRDdigitizer(manager);
a328fff9 197
6244debe 198}
199
200//_____________________________________________________________________________
201void AliTRD::SDigits2Digits()
202{
203 //
204 // Create final digits from summable digits
205 //
206
bd0f8685 207 // Create the TRD digitizer
be385a87 208 AliTRDdigitizer digitizer("TRDdigitizer","TRD digitizer class");
45160b1f 209 AliLog::SetClassDebugLevel("TRDdigitizer",AliDebugLevel());
99d5402e 210
abaf1f1d 211 // Set the parameter
be385a87 212 digitizer.SetEvent(gAlice->GetEvNumber());
abaf1f1d 213
214 // Initialization
be385a87 215 digitizer.InitDetector();
abaf1f1d 216
217 // Read the s-digits via digits manager
be385a87 218 AliTRDdigitsManager sdigitsManager;
88cb7938 219
45160b1f 220 AliLog::SetClassDebugLevel("TRDdigitisManager",AliDebugLevel());
be385a87 221 sdigitsManager.SetSDigits(kTRUE);
222 sdigitsManager.CreateArrays();
88cb7938 223
030b4415 224 if (!fLoader->TreeS()) {
225 if (fLoader->LoadSDigits("read")) {
226 return;
227 }
228 }
229 if (!fLoader->TreeS()) {
230 AliError(Form("Error while reading SDigits for event %d",gAlice->GetEvNumber()));
231 return;
232 }
88cb7938 233
be385a87 234 sdigitsManager.ReadDigits(fLoader->TreeS());
abaf1f1d 235
236 // Add the s-digits to the input list
be385a87 237 digitizer.AddSDigitsManager(&sdigitsManager);
99d5402e 238
abaf1f1d 239 // Convert the s-digits to normal digits
be385a87 240 digitizer.SDigits2Digits();
abaf1f1d 241
242 // Store the digits
030b4415 243 if (!fLoader->TreeD()) {
244 fLoader->MakeTree("D");
245 }
be385a87 246 if (digitizer.MakeBranch(fLoader->TreeD())){
247 digitizer.WriteDigits();
abaf1f1d 248 }
99d5402e 249
250}
251
b864d801 252//_____________________________________________________________________________
253void AliTRD::Digits2Raw()
254{
255 //
030b4415 256 // Convert digits of the current event to raw data
b864d801 257 //
258
259 fLoader->LoadDigits();
030b4415 260 TTree *digits = fLoader->TreeD();
b864d801 261 if (!digits) {
030b4415 262 AliError("No digits tree");
b864d801 263 return;
264 }
265
266 AliTRDrawData rawWriter;
b864d801 267 if (!rawWriter.Digits2Raw(digits)) {
030b4415 268 AliError("The raw writer could not load the digits tree");
b864d801 269 }
270
271 fLoader->UnloadDigits();
272
273}
274
fe4da5cc 275//_____________________________________________________________________________
332e9569 276void AliTRD::AddHit(Int_t track, Int_t det, Float_t *hits, Int_t q
2fa01832 277 , Float_t time, Bool_t inDrift)
fe4da5cc 278{
279 //
280 // Add a hit for the TRD
332e9569 281 //
82bbf98a 282
a328fff9 283 TClonesArray &lhits = *fHits;
2fa01832 284 AliTRDhit *hit = new(lhits[fNhits++]) AliTRDhit(fIshunt
285 ,track
286 ,det
287 ,hits
288 ,q
289 ,time);
290
a328fff9 291 if (inDrift) {
292 hit->SetDrift();
332e9569 293 }
a328fff9 294 else {
295 hit->SetAmplification();
296 }
030b4415 297
a328fff9 298 if (q < 0) {
299 hit->SetTRphoton();
332e9569 300 }
82bbf98a 301
fe4da5cc 302}
fe4da5cc 303
304//_____________________________________________________________________________
82bbf98a 305void AliTRD::CreateGeometry()
fe4da5cc 306{
82bbf98a 307 //
308 // Creates the volumes for the TRD chambers
309 //
82bbf98a 310
311 // Check that FRAME is there otherwise we have no place where to put the TRD
030b4415 312 AliModule *frame = gAlice->GetModule("FRAME");
8230f242 313 if (!frame) {
45160b1f 314 AliFatal("The TRD needs the FRAME to be defined first");
82bbf98a 315 }
d3f347ff 316
851d3db9 317 fGeometry->CreateGeometry(fIdtmed->GetArray() - 1299);
5c7f4665 318
82bbf98a 319}
2d0eca96 320
82bbf98a 321//_____________________________________________________________________________
322void AliTRD::CreateMaterials()
323{
fe4da5cc 324 //
325 // Create the materials for the TRD
fe4da5cc 326 //
327
f7a1cc68 328 Int_t isxfld = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
329 Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
fe4da5cc 330
d3f347ff 331 // For polyethilene (CH2)
030b4415 332 Float_t ape[2] = { 12.011 , 1.0079 };
333 Float_t zpe[2] = { 6.0 , 1.0 };
334 Float_t wpe[2] = { 1.0 , 2.0 };
335 Float_t dpe = 0.95;
d3f347ff 336
d3f347ff 337 // For CO2
030b4415 338 Float_t aco[2] = { 12.011 , 15.9994 };
339 Float_t zco[2] = { 6.0 , 8.0 };
340 Float_t wco[2] = { 1.0 , 2.0 };
f2979d08 341 Float_t dco = 0.00186; // at 20C
d3f347ff 342
343 // For water
030b4415 344 Float_t awa[2] = { 1.0079, 15.9994 };
345 Float_t zwa[2] = { 1.0 , 8.0 };
346 Float_t wwa[2] = { 2.0 , 1.0 };
347 Float_t dwa = 1.0;
d3f347ff 348
db30bf0f 349 // For plexiglas (C5H8O2)
030b4415 350 Float_t apg[3] = { 12.011 , 1.0079, 15.9994 };
351 Float_t zpg[3] = { 6.0 , 1.0 , 8.0 };
352 Float_t wpg[3] = { 5.0 , 8.0 , 2.0 };
353 Float_t dpg = 1.18;
08ca3951 354
355 // For epoxy (C18H19O3)
3dac2b2d 356 Float_t aEpoxy[3] = { 15.9994, 1.0079, 12.011 };
357 Float_t zEpoxy[3] = { 8.0 , 1.0 , 6.0 };
358 Float_t wEpoxy[3] = { 3.0 , 19.0 , 18.0 };
08ca3951 359 Float_t dEpoxy = 1.8 ;
360
0c5a8090 361 // For Araldite, low density epoxy (C18H19O3)
362 Float_t aAral[3] = { 15.9994, 1.0079, 12.011 };
363 Float_t zAral[3] = { 8.0 , 1.0 , 6.0 };
364 Float_t wAral[3] = { 3.0 , 19.0 , 18.0 };
365 Float_t dAral = 1.05;
366
08ca3951 367 // For air
3dac2b2d 368 Float_t aAir[4] = { 12.011 , 14.0 , 15.9994 , 36.0 };
369 Float_t zAir[4] = { 6.0 , 7.0 , 8.0 , 18.0 };
370 Float_t wAir[4] = { 0.000124, 0.755267, 0.231781, 0.012827 };
0c5a8090 371 Float_t dAir = 1.20479e-03;
08ca3951 372
373 // For G10
3dac2b2d 374 Float_t aG10[4] = { 1.0079 , 12.011 , 15.9994 , 28.086 };
375 Float_t zG10[4] = { 1.0 , 6.0 , 8.0 , 14.0 };
376 Float_t wG10[4] = { 0.15201 , 0.10641 , 0.49444 , 0.24714 };
08ca3951 377 Float_t dG10 = 1.7;
db30bf0f 378
d3f347ff 379 // For Xe/CO2-gas-mixture
3dac2b2d 380 Float_t aXeCO2[3] = { 131.29 , 12.0107 , 15.9994 };
381 Float_t zXeCO2[3] = { 54.0 , 6.0 , 8.0 };
330bfc2f 382 Float_t wXeCO2[3] = { 8.5 , 1.5 , 3.0 };
db30bf0f 383 // Xe-content of the Xe/CO2-mixture (85% / 15%)
3dac2b2d 384 Float_t fxc = 0.85;
f2979d08 385 Float_t dxe = 0.00549; // at 20C
386 Float_t dgmXe = fxc * dxe + (1.0 - fxc) * dco;
387
388 // For Ar/CO2-gas-mixture
389 Float_t aArCO2[3] = { 39.948 , 12.0107 , 15.9994 };
390 Float_t zArCO2[3] = { 18.0 , 6.0 , 8.0 };
391 Float_t wArCO2[3] = { 8.2 , 1.8 , 3.6 };
392 // Ar-content of the Ar/CO2-mixture (82% / 18%)
393 Float_t fac = 0.82;
394 Float_t dar = 0.00166; // at 20C
395 Float_t dgmAr = fac * dar + (1.0 - fac) * dco;
fe4da5cc 396
d3f347ff 397 // General tracking parameter
030b4415 398 Float_t tmaxfd = -10.0;
399 Float_t stemax = -1.0e10;
400 Float_t deemax = -0.1;
401 Float_t epsil = 1.0e-4;
402 Float_t stmin = -0.001;
fe4da5cc 403
d3f347ff 404 //////////////////////////////////////////////////////////////////////////
fe4da5cc 405 // Define Materials
d3f347ff 406 //////////////////////////////////////////////////////////////////////////
407
16bf9884 408 AliMaterial( 1, "Al" , 26.98, 13.0, 2.7 , 8.9 , 37.2);
3dac2b2d 409 AliMaterial( 4, "Xe" , 131.29, 54.0, dxe , 1546.16, 0.0);
16bf9884 410 AliMaterial( 5, "Cu" , 63.54, 29.0, 8.96 , 1.43, 14.8);
411 AliMaterial( 6, "C" , 12.01, 6.0, 2.265 , 18.8 , 74.4);
16bf9884 412 AliMaterial(15, "Sn" , 118.71, 50.0, 7.31 , 1.21, 14.8);
413 AliMaterial(16, "Si" , 28.09, 14.0, 2.33 , 9.36, 37.2);
0c5a8090 414 AliMaterial(18, "Fe" , 55.85, 26.0, 7.87 , 1.76, 14.8);
d3f347ff 415
416 // Mixtures
3dac2b2d 417 AliMixture(2, "Air" , aAir, zAir, dAir, 4, wAir );
418 AliMixture(3, "Polyethilene", ape, zpe, dpe, -2, wpe );
3dac2b2d 419 AliMixture(8, "CO2", aco, zco, dco, -2, wco );
f2979d08 420 if (AliTRDSimParam::Instance()->IsXenon()) {
421 AliMixture(10,"XeCO2", aXeCO2, zXeCO2, dgmXe, -3, wXeCO2);
422 }
423 else if (AliTRDSimParam::Instance()->IsArgon()) {
424 AliInfo("Gas mixture: Ar C02 (80/20)");
425 AliMixture(10,"ArCO2", aArCO2, zArCO2, dgmAr, -3, wArCO2);
426 }
427 else {
428 AliFatal("Wrong gas mixture");
429 exit(1);
430 }
3dac2b2d 431 AliMixture(12,"G10", aG10, zG10, dG10, 4, wG10 );
432 AliMixture(13,"Water", awa, zwa, dwa, -2, wwa );
433 AliMixture(14,"Plexiglas", apg, zpg, dpg, -3, wpg );
434 AliMixture(17,"Epoxy", aEpoxy, zEpoxy, dEpoxy, -3, wEpoxy);
0c5a8090 435 AliMixture(19,"Araldite", aAral, zAral, dAral, -3, wAral );
3dac2b2d 436
d3f347ff 437 //////////////////////////////////////////////////////////////////////////
fe4da5cc 438 // Tracking Media Parameters
d3f347ff 439 //////////////////////////////////////////////////////////////////////////
440
441 // Al Frame
0c5a8090 442 AliMedium( 1,"Al Frame" , 1,0,isxfld,sxmgmx
443 ,tmaxfd,stemax,deemax,epsil,stmin);
d3f347ff 444 // Air
0c5a8090 445 AliMedium( 2,"Air" , 2,0,isxfld,sxmgmx
446 ,tmaxfd,stemax,deemax,epsil,stmin);
447 // Wires
448 AliMedium( 3,"Wires" , 5,0,isxfld,sxmgmx
449 ,tmaxfd,stemax,deemax,epsil,stmin);
450 // All other ROB materials (caps, etc.)
451 AliMedium( 4,"ROB Other" , 5,0,isxfld,sxmgmx
452 ,tmaxfd,stemax,deemax,epsil,stmin);
d3f347ff 453 // Cu pads
0c5a8090 454 AliMedium( 5,"Padplane" , 5,1,isxfld,sxmgmx
455 ,tmaxfd,stemax,deemax,epsil,stmin);
d3f347ff 456 // Fee + cables
0c5a8090 457 AliMedium( 6,"Readout" , 5,0,isxfld,sxmgmx
458 ,tmaxfd,stemax,deemax,epsil,stmin);
d3f347ff 459 // C frame
0c5a8090 460 AliMedium( 7,"C Frame" , 6,0,isxfld,sxmgmx
461 ,tmaxfd,stemax,deemax,epsil,stmin);
462 // INOX of cooling bus bars
463 AliMedium( 8,"Cooling bus",18,0,isxfld,sxmgmx
464 ,tmaxfd,stemax,deemax,epsil,stmin);
3dac2b2d 465 // Gas-mixture (Xe/CO2)
0c5a8090 466 AliMedium( 9,"Gas-mix" ,10,1,isxfld,sxmgmx
467 ,tmaxfd,stemax,deemax,epsil,stmin);
468 // Nomex-honeycomb
469 AliMedium(10,"Nomex" ,12,0,isxfld,sxmgmx
470 ,tmaxfd,stemax,deemax,epsil,stmin);
471 // Araldite glue
472 AliMedium(11,"Glue" ,19,0,isxfld,sxmgmx
473 ,tmaxfd,stemax,deemax,epsil,stmin);
d3f347ff 474 // G10-plates
0c5a8090 475 AliMedium(13,"G10-plates" ,12,0,isxfld,sxmgmx
476 ,tmaxfd,stemax,deemax,epsil,stmin);
d3f347ff 477 // Cooling water
0c5a8090 478 AliMedium(14,"Water" ,13,0,isxfld,sxmgmx
479 ,tmaxfd,stemax,deemax,epsil,stmin);
db30bf0f 480 // Rohacell (plexiglas) for the radiator
0c5a8090 481 AliMedium(15,"Rohacell" ,14,0,isxfld,sxmgmx
482 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 483 // Al layer in MCMs
0c5a8090 484 AliMedium(16,"MCM-Al" , 1,0,isxfld,sxmgmx
485 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 486 // Sn layer in MCMs
0c5a8090 487 AliMedium(17,"MCM-Sn" ,15,0,isxfld,sxmgmx
488 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 489 // Cu layer in MCMs
0c5a8090 490 AliMedium(18,"MCM-Cu" , 5,0,isxfld,sxmgmx
491 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 492 // G10 layer in MCMs
0c5a8090 493 AliMedium(19,"MCM-G10" ,12,0,isxfld,sxmgmx
494 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 495 // Si in readout chips
0c5a8090 496 AliMedium(20,"Chip-Si" ,16,0,isxfld,sxmgmx
497 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 498 // Epoxy in readout chips
0c5a8090 499 AliMedium(21,"Chip-Ep" ,17,0,isxfld,sxmgmx
500 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 501 // PE in connectors
0c5a8090 502 AliMedium(22,"Conn-PE" , 3,0,isxfld,sxmgmx
503 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 504 // Cu in connectors
0c5a8090 505 AliMedium(23,"Chip-Cu" , 5,0,isxfld,sxmgmx
506 ,tmaxfd,stemax,deemax,epsil,stmin);
16bf9884 507 // Al of cooling pipes
0c5a8090 508 AliMedium(24,"Cooling" , 1,0,isxfld,sxmgmx
509 ,tmaxfd,stemax,deemax,epsil,stmin);
73ae7b59 510 // Cu in services
0c5a8090 511 AliMedium(25,"Serv-Cu" , 5,0,isxfld,sxmgmx
512 ,tmaxfd,stemax,deemax,epsil,stmin);
d3f347ff 513
793ff80c 514 // Save the density values for the TRD absorbtion
0c5a8090 515 Float_t dmy = 1.39;
793ff80c 516 fFoilDensity = dmy;
f2979d08 517 if (AliTRDSimParam::Instance()->IsXenon()) {
518 fGasDensity = dgmXe;
519 fGasNobleFraction = fxc;
520 }
521 else if (AliTRDSimParam::Instance()->IsArgon()) {
522 fGasDensity = dgmAr;
523 fGasNobleFraction = fac;
524 }
793ff80c 525
fe4da5cc 526}
fe4da5cc 527
528//_____________________________________________________________________________
529void AliTRD::Init()
530{
531 //
851d3db9 532 // Initialize the TRD detector after the geometry has been created
fe4da5cc 533 //
82bbf98a 534
45160b1f 535 AliDebug(1,"++++++++++++++++++++++++++++++++++++++++++++++");
5c7f4665 536
bd0f8685 537 if (fGeometry->IsVersion() != 1) {
45160b1f 538 AliError("Not a valid geometry");
d37eec5e 539 }
5f06bf41 540
7235aed2 541 // Special tracking options for charged particles for XeCO2
5f06bf41 542 gMC->Gstpar((* fIdtmed)[9],"DRAY" , 1.0);
543 gMC->Gstpar((* fIdtmed)[9],"STRA" , 1.0);
544 gMC->Gstpar((* fIdtmed)[9],"LOSS" ,13.0); // Specific energy loss
89ba6aa1 545 // Parameters related to Fluka MC machine
546 //gMC->Gstpar((* fIdtmed)[9],"PRIMIO_E",23.53); // 1st ionisation potential
547 //gMC->Gstpar((* fIdtmed)[9],"PRIMIO_N",19.344431); // Number of primaries
5f06bf41 548
5c7f4665 549}
550
6244debe 551//_____________________________________________________________________________
552void AliTRD::ResetDigits()
553{
554 //
abaf1f1d 555 // Reset number of digits and the digits array for this detector
6244debe 556 //
557
abaf1f1d 558 fNdigits = 0;
030b4415 559
560 if (fDigits) {
561 fDigits->Clear();
562 }
6244debe 563
564}
565
5c7f4665 566//_____________________________________________________________________________
567void AliTRD::SetTreeAddress()
568{
569 //
570 // Set the branch addresses for the trees.
571 //
572
030b4415 573 if (fLoader->TreeH() &&
574 (fHits == 0x0)) {
a328fff9 575 fHits = new TClonesArray("AliTRDhit",405);
332e9569 576 }
a328fff9 577 AliDetector::SetTreeAddress();
332e9569 578
fe4da5cc 579}
580
68119ad1 581//_____________________________________________________________________________
582Bool_t AliTRD::Raw2SDigits(AliRawReader *rawReader)
583{
584 //
585 // Converts RAW data to SDigits
586 //
587
588 AliLoader *loader = fRunLoader->GetLoader("TRDLoader");
589 if (!loader) {
590 AliError("Can not get TRD loader from Run Loader");
591 return kFALSE;
592 }
593
594 TTree *tree = 0;
595 tree = loader->TreeS();
596 if (!tree) {
597 loader->MakeTree("S");
598 tree = loader->TreeS();
599 }
600
601 AliTRDrawData *rawdata = new AliTRDrawData();
602 AliTRDdigitsManager *sdigitsManager = rawdata->Raw2Digits(rawReader);
603 if (sdigitsManager) {
604 sdigitsManager->SetSDigits(kTRUE);
605 sdigitsManager->MakeBranch(tree);
606 sdigitsManager->WriteDigits();
607 return kTRUE;
608 }
609 else {
610 return kFALSE;
611 }
612
613}
614
9c7c9ec1 615//_____________________________________________________________________________
616AliLoader* AliTRD::MakeLoader(const char* topfoldername)
617{
618 fLoader = new AliLoader(GetName(),topfoldername);
619
620 AliInfo("Adding Tracklets-loader");
621 AliDataLoader *dl = new AliDataLoader("TRD.Tracklets.root","tracklets", "tracklets");
622 fLoader->AddDataLoader(dl);
623
624 return fLoader;
625}
626
dd9a6ee3 627//_____________________________________________________________________________
628AliTRD &AliTRD::operator=(const AliTRD &trd)
629{
630 //
631 // Assignment operator
632 //
633
0c5a8090 634 if (this != &trd) {
635 ((AliTRD &) trd).Copy(*this);
636 }
030b4415 637
dd9a6ee3 638 return *this;
639
68119ad1 640}