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