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