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