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