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