New version of TRD introduced
[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
16/*
17$Log$
5c7f4665 18Revision 1.12 1999/11/01 20:41:51 fca
19Added protections against using the wrong version of FRAME
20
ab76897d 21Revision 1.11 1999/09/29 09:24:34 fca
22Introduction of the Copyright and cvs Log
23
4c039060 24*/
25
fe4da5cc 26///////////////////////////////////////////////////////////////////////////////
27// //
28// Transition Radiation Detector //
29// This class contains the basic functions for the Transition Radiation //
5c7f4665 30// Detector, as well as the geometry. //
31// Functions specific to one particular geometry are contained in the //
32// derived classes. //
fe4da5cc 33// //
34//Begin_Html
35/*
1439f98e 36<img src="picts/AliTRDClass.gif">
fe4da5cc 37*/
38//End_Html
39// //
40// //
41///////////////////////////////////////////////////////////////////////////////
42
5c7f4665 43#include <stdlib.h>
44
fe4da5cc 45#include <TMath.h>
fe4da5cc 46#include <TNode.h>
fe4da5cc 47#include <TPGON.h>
48
fe4da5cc 49#include "AliTRD.h"
50#include "AliRun.h"
d3f347ff 51#include "AliConst.h"
fe4da5cc 52
53ClassImp(AliTRD)
54
55//_____________________________________________________________________________
56AliTRD::AliTRD()
57{
58 //
59 // Default constructor
60 //
82bbf98a 61
d3f347ff 62 fIshunt = 0;
63 fGasMix = 0;
99d5402e 64 fHits = 0;
65 fDigits = 0;
5c7f4665 66 fHole = 0;
67
68 fClusters = 0;
69 fNclusters = 0;
82bbf98a 70
71 // The chamber dimensions
72 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
5c7f4665 73 fClengthI[iplan] = 0.;
74 fClengthM1[iplan] = 0.;
75 fClengthM2[iplan] = 0.;
76 fClengthO1[iplan] = 0.;
77 fClengthO2[iplan] = 0.;
78 fClengthO3[iplan] = 0.;
79 fCwidth[iplan] = 0.;
80 }
81
82 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
83 for (Int_t icham = 0; icham < kNcham; icham++) {
84 for (Int_t isect = 0; isect < kNsect; isect++) {
85 fRowMax[iplan][icham][isect] = 0;
86 }
87 }
88 fColMax[iplan] = 0;
82bbf98a 89 }
5c7f4665 90 fTimeMax = 0;
91
92 fRowPadSize = 0;
93 fColPadSize = 0;
94 fTimeBinSize = 0;
82bbf98a 95
fe4da5cc 96}
97
98//_____________________________________________________________________________
99AliTRD::AliTRD(const char *name, const char *title)
100 : AliDetector(name,title)
101{
102 //
103 // Standard constructor for the TRD
104 //
105
5c7f4665 106 // Check that FRAME is there otherwise we have no place where to
107 // put TRD
108 AliModule* FRAME=gAlice->GetModule("FRAME");
109 if (!FRAME) {
110 Error("Ctor","TRD needs FRAME to be present\n");
111 exit(1);
112 }
113
114 // Define the TRD geometry according to the FRAME geometry
115 if (FRAME->IsVersion() == 0)
116 // With hole
117 fHole = 1;
118 else
119 // Without hole
120 fHole = 0;
121
fe4da5cc 122 // Allocate the hit array
5c7f4665 123 fHits = new TClonesArray("AliTRDhit" , 405);
99d5402e 124
125 // Allocate the digits array
5c7f4665 126 fDigits = new TClonesArray("AliTRDdigit" ,10000);
127
128 // Allocate the cluster array
129 fClusters = new TClonesArray("AliTRDcluster", 400);
130 fNclusters = 0;
99d5402e 131
82bbf98a 132 fIshunt = 0;
133 fGasMix = 0;
134
135 // The chamber dimensions
136 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
5c7f4665 137 fClengthI[iplan] = 0.;
138 fClengthM1[iplan] = 0.;
139 fClengthM2[iplan] = 0.;
140 fClengthO1[iplan] = 0.;
141 fClengthO2[iplan] = 0.;
142 fClengthO3[iplan] = 0.;
143 fCwidth[iplan] = 0.;
82bbf98a 144 }
fe4da5cc 145
5c7f4665 146 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
147 for (Int_t icham = 0; icham < kNcham; icham++) {
148 for (Int_t isect = 0; isect < kNsect; isect++) {
149 fRowMax[iplan][icham][isect] = 0;
150 }
151 }
152 fColMax[iplan] = 0;
153 }
154 fTimeMax = 0;
155
156 fRowPadSize = 0;
157 fColPadSize = 0;
158 fTimeBinSize = 0;
159
fe4da5cc 160 SetMarkerColor(kWhite);
82bbf98a 161
fe4da5cc 162}
99d5402e 163
164//_____________________________________________________________________________
165AliTRD::~AliTRD()
166{
167 //
168 // TRD destructor
169 //
170
171 fIshunt = 0;
172
173 delete fHits;
174 delete fDigits;
5c7f4665 175 delete fClusters;
176
177}
178
179//_____________________________________________________________________________
180void AliTRD::AddCluster(Int_t *tracks, Int_t *clusters, Float_t *position)
181{
182 //
183 // Add a cluster for the TRD
184 //
185
186 TClonesArray &lclusters = *fClusters;
187 new(lclusters[fNclusters++]) AliTRDcluster(tracks,clusters,position);
99d5402e 188
189}
190
191//_____________________________________________________________________________
192void AliTRD::AddDigit(Int_t *tracks, Int_t *digits)
193{
194 //
195 // Add a digit for the TRD
196 //
197
198 TClonesArray &ldigits = *fDigits;
199 new(ldigits[fNdigits++]) AliTRDdigit(tracks,digits);
200
201}
202
fe4da5cc 203//_____________________________________________________________________________
204void AliTRD::AddHit(Int_t track, Int_t *vol, Float_t *hits)
205{
206 //
207 // Add a hit for the TRD
208 //
82bbf98a 209
fe4da5cc 210 TClonesArray &lhits = *fHits;
211 new(lhits[fNhits++]) AliTRDhit(fIshunt,track,vol,hits);
82bbf98a 212
fe4da5cc 213}
214
215//_____________________________________________________________________________
216void AliTRD::BuildGeometry()
217{
218 //
219 // Create the ROOT TNode geometry for the TRD
220 //
82bbf98a 221
fe4da5cc 222 TNode *Node, *Top;
223 TPGON *pgon;
224 const Int_t kColorTRD = 46;
d3f347ff 225
fe4da5cc 226 // Find the top node alice
82bbf98a 227 Top = gAlice->GetGeometry()->GetNode("alice");
d3f347ff 228
82bbf98a 229 pgon = new TPGON("S_TRD","TRD","void",0,360,kNsect,4);
230 Float_t ff = TMath::Cos(kDegrad * 180 / kNsect);
231 Float_t rrmin = kRmin / ff;
232 Float_t rrmax = kRmax / ff;
233 pgon->DefineSection(0,-kZmax1,rrmax,rrmax);
234 pgon->DefineSection(1,-kZmax2,rrmin,rrmax);
235 pgon->DefineSection(2, kZmax2,rrmin,rrmax);
236 pgon->DefineSection(3, kZmax1,rrmax,rrmax);
fe4da5cc 237 Top->cd();
238 Node = new TNode("TRD","TRD","S_TRD",0,0,0,"");
239 Node->SetLineColor(kColorTRD);
240 fNodes->Add(Node);
d3f347ff 241
fe4da5cc 242}
243
244//_____________________________________________________________________________
82bbf98a 245void AliTRD::CreateGeometry()
fe4da5cc 246{
82bbf98a 247 //
248 // Creates the volumes for the TRD chambers
249 //
250 // Author: Christoph Blume (C.Blume@gsi.de) 20/07/99
251 //
252 // The volumes:
5c7f4665 253 // TRD1-3 (Air) --- The TRD mother volumes for one sector.
82bbf98a 254 // To be placed into the spaceframe.
255 //
256 // UAFI(/M/O) (Al) --- The aluminum frame of the inner(/middle/outer) chambers (readout)
257 // UCFI(/M/O) (C) --- The carbon frame of the inner(/middle/outer) chambers
258 // (driftchamber + radiator)
259 // UAII(/M/O) (Air) --- The inner part of the readout of the inner(/middle/outer) chambers
260 // UFII(/M/O) (Air) --- The inner part of the chamner and radiator of the
261 // inner(/middle/outer) chambers
262 //
263 // The material layers in one chamber:
264 // UL01 (G10) --- The gas seal of the radiator
265 // UL02 (CO2) --- The gas in the radiator
266 // UL03 (PE) --- The foil stack
267 // UL04 (Mylar) --- Entrance window to the driftvolume and HV-cathode
268 // UL05 (Xe) --- The driftvolume
269 // UL06 (Xe) --- The amplification region
270 //
271 // UL07 (Cu) --- The pad plane
272 // UL08 (G10) --- The Nomex honeycomb support structure
273 // UL09 (Cu) --- FEE and signal lines
274 // UL10 (PE) --- The cooling devices
275 // UL11 (Water) --- The cooling water
276
277 // Check that FRAME is there otherwise we have no place where to put the TRD
278 AliModule* FRAME = gAlice->GetModule("FRAME");
279 if (!FRAME) return;
280
281 const Int_t npar_trd = 4;
282 const Int_t npar_cha = 3;
283
284 Float_t par_dum[3];
285 Float_t par_trd[npar_trd];
286 Float_t par_cha[npar_cha];
287
288 Float_t xpos, ypos, zpos;
289
5c7f4665 290 Int_t *idtmed = fIdtmed->GetArray() - 1299;
82bbf98a 291
292 // The length of the inner chambers
5c7f4665 293 for (Int_t iplan = 0; iplan < kNplan; iplan++)
294 fClengthI[iplan] = 110.0;
295
82bbf98a 296 // The length of the middle chambers
5c7f4665 297 fClengthM1[0] = 123.5;
298 fClengthM1[1] = 131.0;
299 fClengthM1[2] = 138.5;
300 fClengthM1[3] = 146.0;
301 fClengthM1[4] = 153.0;
302 fClengthM1[5] = 160.5;
303
304 fClengthM2[0] = 123.5 - 7.0;
305 fClengthM2[1] = 131.0 - 7.0;
306 fClengthM2[2] = 138.5 - 7.0;
307 fClengthM2[3] = 146.0 - 7.0;
308 fClengthM2[4] = 153.0 - 7.0;
309 fClengthM2[5] = 160.4 - 7.0;
310
82bbf98a 311 // The length of the outer chambers
5c7f4665 312 fClengthO1[0] = 123.5;
313 fClengthO1[1] = 131.0;
314 fClengthO1[2] = 134.5;
315 fClengthO1[3] = 142.0;
316 fClengthO1[4] = 142.0;
317 fClengthO1[5] = 134.5;
318
319 fClengthO2[0] = 123.5;
320 fClengthO2[1] = 131.0;
321 fClengthO2[2] = 134.5;
322 fClengthO2[3] = 142.0;
323 fClengthO2[4] = 142.0;
324 fClengthO2[5] = 134.5;
325
326 fClengthO3[0] = 86.5;
327 fClengthO3[1] = 101.5;
328 fClengthO3[2] = 112.5;
329 fClengthO3[3] = 127.5;
330 fClengthO3[4] = 134.5;
331 fClengthO3[5] = 134.5;
82bbf98a 332
333 // The width of the chambers
5c7f4665 334 fCwidth[0] = 99.6;
335 fCwidth[1] = 104.1;
336 fCwidth[2] = 108.5;
337 fCwidth[3] = 112.9;
338 fCwidth[4] = 117.4;
339 fCwidth[5] = 121.8;
340
341 // The TRD mother volume for one sector (Air) (dimensions identical to BTR1)
82bbf98a 342 par_trd[0] = kSwidth1/2.;
343 par_trd[1] = kSwidth2/2.;
5c7f4665 344 par_trd[2] = kSlenTR1/2.;
82bbf98a 345 par_trd[3] = kSheight/2.;
5c7f4665 346 gMC->Gsvolu("TRD1","TRD1",idtmed[1302-1],par_trd,npar_trd);
347
348 // The TRD mother volume for one sector (Air) (dimensions identical to BTR2 + BTR3).
349 // Only used for the geometry with holes.
350 if (fHole) {
351
352 par_trd[0] = kSwidth1/2.;
353 par_trd[1] = kSwidth2/2.;
354 par_trd[2] = kSlenTR2/2.;
355 par_trd[3] = kSheight/2.;
356 gMC->Gsvolu("TRD2","TRD1",idtmed[1302-1],par_trd,npar_trd);
357
358 par_trd[0] = kSwidth1/2.;
359 par_trd[1] = kSwidth2/2.;
360 par_trd[2] = kSlenTR3/2.;
361 par_trd[3] = kSheight/2.;
362 gMC->Gsvolu("TRD3","TRD1",idtmed[1302-1],par_trd,npar_trd);
363
364 }
82bbf98a 365
366 // The aluminum frames - readout + electronics (Al)
367 // The inner chambers
368 gMC->Gsvolu("UAFI","BOX ",idtmed[1301-1],par_dum,0);
369 // The middle chambers
370 gMC->Gsvolu("UAFM","BOX ",idtmed[1301-1],par_dum,0);
371 // The outer chambers
372 gMC->Gsvolu("UAFO","BOX ",idtmed[1301-1],par_dum,0);
373
374 // The inner part of the aluminum frames (Air)
375 // The inner chambers
376 gMC->Gsvolu("UAII","BOX ",idtmed[1302-1],par_dum,0);
377 // The middle chambers
378 gMC->Gsvolu("UAIM","BOX ",idtmed[1302-1],par_dum,0);
379 // The outer chambers
380 gMC->Gsvolu("UAIO","BOX ",idtmed[1302-1],par_dum,0);
381
382 // The carbon frames - radiator + driftchamber (C)
383 // The inner chambers
384 gMC->Gsvolu("UCFI","BOX ",idtmed[1307-1],par_dum,0);
385 // The middle chambers
386 gMC->Gsvolu("UCFM","BOX ",idtmed[1307-1],par_dum,0);
387 // The outer chambers
388 gMC->Gsvolu("UCFO","BOX ",idtmed[1307-1],par_dum,0);
389
390 // The inner part of the carbon frames (Air)
391 // The inner chambers
392 gMC->Gsvolu("UCII","BOX ",idtmed[1302-1],par_dum,0);
393 // The middle chambers
394 gMC->Gsvolu("UCIM","BOX ",idtmed[1302-1],par_dum,0);
395 // The outer chambers
396 gMC->Gsvolu("UCIO","BOX ",idtmed[1302-1],par_dum,0);
397
398 // The material layers inside the chambers
399 par_cha[0] = -1.;
400 par_cha[1] = -1.;
401 // G10 layer (radiator seal)
402 par_cha[2] = kSeThick/2;
403 gMC->Gsvolu("UL01","BOX ",idtmed[1313-1],par_cha,npar_cha);
404 // CO2 layer (radiator)
405 par_cha[2] = kRaThick/2;
406 gMC->Gsvolu("UL02","BOX ",idtmed[1312-1],par_cha,npar_cha);
407 // PE layer (radiator)
408 par_cha[2] = kPeThick/2;
409 gMC->Gsvolu("UL03","BOX ",idtmed[1303-1],par_cha,npar_cha);
410 // Mylar layer (entrance window + HV cathode)
411 par_cha[2] = kMyThick/2;
412 gMC->Gsvolu("UL04","BOX ",idtmed[1308-1],par_cha,npar_cha);
413 // Xe/Isobutane layer (drift volume, sensitive)
414 par_cha[2] = kDrThick/2.;
415 gMC->Gsvolu("UL05","BOX ",idtmed[1309-1],par_cha,npar_cha);
416 // Xe/Isobutane layer (amplification volume, not sensitive)
417 par_cha[2] = kAmThick/2.;
418 gMC->Gsvolu("UL06","BOX ",idtmed[1309-1],par_cha,npar_cha);
419
420 // Cu layer (pad plane)
421 par_cha[2] = kCuThick/2;
422 gMC->Gsvolu("UL07","BOX ",idtmed[1305-1],par_cha,npar_cha);
423 // G10 layer (support structure)
424 par_cha[2] = kSuThick/2;
425 gMC->Gsvolu("UL08","BOX ",idtmed[1313-1],par_cha,npar_cha);
426 // Cu layer (FEE + signal lines)
427 par_cha[2] = kFeThick/2;
428 gMC->Gsvolu("UL09","BOX ",idtmed[1305-1],par_cha,npar_cha);
429 // PE layer (cooling devices)
430 par_cha[2] = kCoThick/2;
431 gMC->Gsvolu("UL10","BOX ",idtmed[1303-1],par_cha,npar_cha);
432 // Water layer (cooling)
433 par_cha[2] = kWaThick/2;
434 gMC->Gsvolu("UL11","BOX ",idtmed[1314-1],par_cha,npar_cha);
435
436 // Position the layers in the chambers
437 xpos = 0;
438 ypos = 0;
439
440 // G10 layer (radiator seal)
441 zpos = kSeZpos;
442 gMC->Gspos("UL01",1,"UCII",xpos,ypos,zpos,0,"ONLY");
443 gMC->Gspos("UL01",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
444 gMC->Gspos("UL01",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
445 // CO2 layer (radiator)
446 zpos = kRaZpos;
447 gMC->Gspos("UL02",1,"UCII",xpos,ypos,zpos,0,"ONLY");
448 gMC->Gspos("UL02",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
449 gMC->Gspos("UL02",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
450 // PE layer (radiator)
451 zpos = 0;
452 gMC->Gspos("UL03",1,"UL02",xpos,ypos,zpos,0,"ONLY");
453 // Mylar layer (entrance window + HV cathode)
454 zpos = kMyZpos;
455 gMC->Gspos("UL04",1,"UCII",xpos,ypos,zpos,0,"ONLY");
456 gMC->Gspos("UL04",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
457 gMC->Gspos("UL04",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
458 // Xe/Isobutane layer (drift volume)
459 zpos = kDrZpos;
460 gMC->Gspos("UL05",1,"UCII",xpos,ypos,zpos,0,"ONLY");
461 gMC->Gspos("UL05",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
462 gMC->Gspos("UL05",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
463 // Xe/Isobutane layer (amplification volume)
464 zpos = kAmZpos;
465 gMC->Gspos("UL06",1,"UCII",xpos,ypos,zpos,0,"ONLY");
466 gMC->Gspos("UL06",2,"UCIM",xpos,ypos,zpos,0,"ONLY");
467 gMC->Gspos("UL06",3,"UCIO",xpos,ypos,zpos,0,"ONLY");
468
469 // Cu layer (pad plane)
470 zpos = kCuZpos;
471 gMC->Gspos("UL07",1,"UAII",xpos,ypos,zpos,0,"ONLY");
472 gMC->Gspos("UL07",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
473 gMC->Gspos("UL07",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
474 // G10 layer (support structure)
475 zpos = kSuZpos;
476 gMC->Gspos("UL08",1,"UAII",xpos,ypos,zpos,0,"ONLY");
477 gMC->Gspos("UL08",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
478 gMC->Gspos("UL08",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
479 // Cu layer (FEE + signal lines)
480 zpos = kFeZpos;
481 gMC->Gspos("UL09",1,"UAII",xpos,ypos,zpos,0,"ONLY");
482 gMC->Gspos("UL09",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
483 gMC->Gspos("UL09",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
484 // PE layer (cooling devices)
485 zpos = kCoZpos;
486 gMC->Gspos("UL10",1,"UAII",xpos,ypos,zpos,0,"ONLY");
487 gMC->Gspos("UL10",2,"UAIM",xpos,ypos,zpos,0,"ONLY");
488 gMC->Gspos("UL10",3,"UAIO",xpos,ypos,zpos,0,"ONLY");
489 // Water layer (cooling)
490 zpos = kWaZpos;
491 gMC->Gspos("UL11",1,"UAII",xpos,ypos,zpos,0,"ONLY");
492 gMC->Gspos("UL11",1,"UAIM",xpos,ypos,zpos,0,"ONLY");
493 gMC->Gspos("UL11",1,"UAIO",xpos,ypos,zpos,0,"ONLY");
494
495 // Position the chambers in the TRD mother volume
5c7f4665 496 for (Int_t iplan = 1; iplan <= kNplan; iplan++) {
82bbf98a 497
498 // The inner chambers ---------------------------------------------------------------
499
500 // the aluminum frame
82bbf98a 501 par_cha[0] = fCwidth[iplan-1]/2.;
502 par_cha[1] = fClengthI[iplan-1]/2.;
503 par_cha[2] = kCaframe/2.;
504 xpos = 0.;
505 ypos = 0.;
506 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
5c7f4665 507 gMC->Gsposp("UAFI",iplan ,"TRD1",xpos,ypos,zpos,0,"MANY",par_cha,npar_cha);
82bbf98a 508
509 // the inner part of the aluminum frame
82bbf98a 510 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
511 par_cha[1] = fClengthI[iplan-1]/2. - kCathick;
512 par_cha[2] = kCaframe/2.;
513 xpos = 0.;
514 ypos = 0.;
515 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
5c7f4665 516 gMC->Gsposp("UAII",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",par_cha,npar_cha);
82bbf98a 517
518 // the carbon frame
82bbf98a 519 par_cha[0] = fCwidth[iplan-1]/2.;
520 par_cha[1] = fClengthI[iplan-1]/2.;
521 par_cha[2] = kCcframe/2.;
522 xpos = 0.;
523 ypos = 0.;
524 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
5c7f4665 525 gMC->Gsposp("UCFI",iplan ,"TRD1",xpos,ypos,zpos,0,"MANY",par_cha,npar_cha);
82bbf98a 526
527 // the inner part of the carbon frame
82bbf98a 528 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
529 par_cha[1] = fClengthI[iplan-1]/2. - kCcthick;
530 par_cha[2] = kCcframe/2.;
531 xpos = 0.;
532 ypos = 0.;
533 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
5c7f4665 534 gMC->Gsposp("UCII",iplan ,"TRD1",xpos,ypos,zpos,0,"ONLY",par_cha,npar_cha);
82bbf98a 535
536 // The middle chambers --------------------------------------------------------------
537
538 // the aluminum frame
82bbf98a 539 par_cha[0] = fCwidth[iplan-1]/2.;
5c7f4665 540 par_cha[1] = fClengthM1[iplan-1]/2.;
82bbf98a 541 par_cha[2] = kCaframe/2.;
542 xpos = 0.;
5c7f4665 543 ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
82bbf98a 544 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
5c7f4665 545 gMC->Gsposp("UAFM",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
546 gMC->Gsposp("UAFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
82bbf98a 547
548 // the inner part of the aluminum frame
5c7f4665 549 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
550 par_cha[1] = fClengthM1[iplan-1]/2. - kCathick;
82bbf98a 551 par_cha[2] = kCaframe/2.;
552 xpos = 0.;
5c7f4665 553 ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
82bbf98a 554 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
5c7f4665 555 gMC->Gsposp("UAIM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
556 gMC->Gsposp("UAIM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
82bbf98a 557
558 // the carbon frame
82bbf98a 559 par_cha[0] = fCwidth[iplan-1]/2.;
5c7f4665 560 par_cha[1] = fClengthM1[iplan-1]/2.;
82bbf98a 561 par_cha[2] = kCcframe/2.;
562 xpos = 0.;
5c7f4665 563 ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
564 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
565 gMC->Gsposp("UCFM",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
566 gMC->Gsposp("UCFM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
82bbf98a 567
568 // the inner part of the carbon frame
5c7f4665 569 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
570 par_cha[1] = fClengthM1[iplan-1]/2. - kCcthick;
82bbf98a 571 par_cha[2] = kCcframe/2.;
572 xpos = 0.;
5c7f4665 573 ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1]/2.;
574 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
575 gMC->Gsposp("UCIM",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
576 gMC->Gsposp("UCIM",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
577
578 // Only for the geometry with holes
579 if (fHole) {
580
581 // the aluminum frame
582 par_cha[0] = fCwidth[iplan-1]/2.;
583 par_cha[1] = fClengthM2[iplan-1]/2.;
584 par_cha[2] = kCaframe/2.;
585 xpos = 0.;
586 ypos = fClengthM2[iplan-1]/2. - kSlenTR2/2.;
587 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
588 gMC->Gsposp("UAFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
589
590 // the inner part of the aluminum frame
591 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
592 par_cha[1] = fClengthM2[iplan-1]/2. - kCathick;
593 par_cha[2] = kCaframe/2.;
594 xpos = 0.;
595 ypos = fClengthM2[iplan-1]/2. - kSlenTR2/2.;
596 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
597 gMC->Gsposp("UAIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
598
599 // the carbon frame
600 par_cha[0] = fCwidth[iplan-1]/2.;
601 par_cha[1] = fClengthM2[iplan-1]/2.;
602 par_cha[2] = kCcframe/2.;
603 xpos = 0.;
604 ypos = fClengthM2[iplan-1]/2. - kSlenTR2/2.;
605 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
606 gMC->Gsposp("UCFM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
607
608 // the inner part of the carbon frame
609 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
610 par_cha[1] = fClengthM2[iplan-1]/2. - kCcthick;
611 par_cha[2] = kCcframe/2.;
612 xpos = 0.;
613 ypos = fClengthM2[iplan-1]/2. - kSlenTR2/2.;
614 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
615 gMC->Gsposp("UCIM",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
616
617 }
82bbf98a 618
619 // The outer chambers ---------------------------------------------------------------
620
621 // the aluminum frame
82bbf98a 622 par_cha[0] = fCwidth[iplan-1]/2.;
5c7f4665 623 par_cha[1] = fClengthO1[iplan-1]/2.;
82bbf98a 624 par_cha[2] = kCaframe/2.;
625 xpos = 0.;
5c7f4665 626 ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
82bbf98a 627 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
5c7f4665 628 gMC->Gsposp("UAFO",iplan ,"TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
629 gMC->Gsposp("UAFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
82bbf98a 630
631 // the inner part of the aluminum frame
5c7f4665 632 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
633 par_cha[1] = fClengthO1[iplan-1]/2. - kCathick;
82bbf98a 634 par_cha[2] = kCaframe/2.;
635 xpos = 0.;
5c7f4665 636 ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
82bbf98a 637 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
5c7f4665 638 gMC->Gsposp("UAIO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
639 gMC->Gsposp("UAIO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
82bbf98a 640
641 // the carbon frame
82bbf98a 642 par_cha[0] = fCwidth[iplan-1]/2.;
5c7f4665 643 par_cha[1] = fClengthO1[iplan-1]/2.;
82bbf98a 644 par_cha[2] = kCcframe/2.;
645 xpos = 0.;
5c7f4665 646 ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
647 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
648 gMC->Gsposp("UCFO",iplan, "TRD1",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
649 gMC->Gsposp("UCFO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"MANY",par_cha,npar_cha);
82bbf98a 650
651 // the inner part of the carbon frame
5c7f4665 652 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
653 par_cha[1] = fClengthO1[iplan-1]/2. - kCcthick;
82bbf98a 654 par_cha[2] = kCcframe/2.;
655 xpos = 0.;
5c7f4665 656 ypos = fClengthI[iplan-1]/2. + fClengthM1[iplan-1] + fClengthO1[iplan-1]/2.;
657 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
658 gMC->Gsposp("UCIO",iplan ,"TRD1",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
659 gMC->Gsposp("UCIO",iplan+ kNplan,"TRD1",xpos,-ypos,zpos,0,"ONLY",par_cha,npar_cha);
660
661 // Only for the geometry with holes
662 if (fHole) {
663
664 // the aluminum frame
665 par_cha[0] = fCwidth[iplan-1]/2.;
666 par_cha[1] = fClengthO2[iplan-1]/2.;
667 par_cha[2] = kCaframe/2.;
668 xpos = 0.;
669 ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - kSlenTR2/2.;
670 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
671 gMC->Gsposp("UAFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
672
673 // the inner part of the aluminum frame
674 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
675 par_cha[1] = fClengthO2[iplan-1]/2. - kCathick;
676 par_cha[2] = kCaframe/2.;
677 xpos = 0.;
678 ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - kSlenTR2/2.;
679 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
680 gMC->Gsposp("UAIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
681
682 // the carbon frame
683 par_cha[0] = fCwidth[iplan-1]/2.;
684 par_cha[1] = fClengthO2[iplan-1]/2.;
685 par_cha[2] = kCcframe/2.;
686 xpos = 0.;
687 ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - kSlenTR2/2.;
688 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
689 gMC->Gsposp("UCFO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
690
691 // the inner part of the carbon frame
692 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
693 par_cha[1] = fClengthO2[iplan-1]/2. - kCcthick;
694 par_cha[2] = kCcframe/2.;
695 xpos = 0.;
696 ypos = fClengthM2[iplan-1] + fClengthO2[iplan-1]/2. - kSlenTR2/2.;
697 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
698 gMC->Gsposp("UCIO",iplan+2*kNplan,"TRD2",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
699
700 // the aluminum frame
701 par_cha[0] = fCwidth[iplan-1]/2.;
702 par_cha[1] = fClengthO3[iplan-1]/2.;
703 par_cha[2] = kCaframe/2.;
704 xpos = 0.;
705 ypos = fClengthO3[iplan-1]/2. - kSlenTR3/2.;
706 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
707 gMC->Gsposp("UAFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
708
709 // the inner part of the aluminum frame
710 par_cha[0] = fCwidth[iplan-1]/2. - kCathick;
711 par_cha[1] = fClengthO3[iplan-1]/2. - kCathick;
712 par_cha[2] = kCaframe/2.;
713 xpos = 0.;
714 ypos = fClengthO3[iplan-1]/2. - kSlenTR3/2.;
715 zpos = kCheight - kCaframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
716 gMC->Gsposp("UAIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
717
718 // the carbon frame
719 par_cha[0] = fCwidth[iplan-1]/2.;
720 par_cha[1] = fClengthO3[iplan-1]/2.;
721 par_cha[2] = kCcframe/2.;
722 xpos = 0.;
723 ypos = fClengthO3[iplan-1]/2. - kSlenTR3/2.;
724 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
725 gMC->Gsposp("UCFO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"MANY",par_cha,npar_cha);
726
727 // the inner part of the carbon frame
728 par_cha[0] = fCwidth[iplan-1]/2. - kCcthick;
729 par_cha[1] = fClengthO3[iplan-1]/2. - kCcthick;
730 par_cha[2] = kCcframe/2.;
731 xpos = 0.;
732 ypos = fClengthO3[iplan-1]/2. - kSlenTR3/2.;
733 zpos = kCcframe/2. - kSheight/2. + (iplan-1) * (kCheight + kCspace);
734 gMC->Gsposp("UCIO",iplan+4*kNplan,"TRD3",xpos, ypos,zpos,0,"ONLY",par_cha,npar_cha);
735
736 }
82bbf98a 737
738 }
d3f347ff 739
5c7f4665 740 if (fHole) {
741 xpos = 0.;
742 ypos = 0.;
743 zpos = 0.;
744 gMC->Gspos("TRD1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
745 gMC->Gspos("TRD2",1,"BTR2",xpos,ypos,zpos,0,"ONLY");
746 gMC->Gspos("TRD3",1,"BTR3",xpos,ypos,zpos,0,"ONLY");
747 }
748 else {
749 xpos = 0.;
750 ypos = 0.;
751 zpos = 0.;
752 gMC->Gspos("TRD1",1,"BTR1",xpos,ypos,zpos,0,"ONLY");
753 gMC->Gspos("TRD1",2,"BTR2",xpos,ypos,zpos,0,"ONLY");
754 gMC->Gspos("TRD1",3,"BTR3",xpos,ypos,zpos,0,"ONLY");
755 }
756
82bbf98a 757}
758
759//_____________________________________________________________________________
760void AliTRD::CreateMaterials()
761{
fe4da5cc 762 //
763 // Create the materials for the TRD
764 // Origin Y.Foka
765 //
766
fe4da5cc 767 Int_t ISXFLD = gAlice->Field()->Integ();
768 Float_t SXMGMX = gAlice->Field()->Max();
769
d3f347ff 770 // For polyethilene (CH2)
771 Float_t ape[2] = { 12., 1. };
772 Float_t zpe[2] = { 6., 1. };
773 Float_t wpe[2] = { 1., 2. };
774 Float_t dpe = 0.95;
775
776 // For mylar (C5H4O2)
777 Float_t amy[3] = { 12., 1., 16. };
778 Float_t zmy[3] = { 6., 1., 8. };
779 Float_t wmy[3] = { 5., 4., 2. };
fe4da5cc 780 Float_t dmy = 1.39;
d3f347ff 781
782 // For CO2
783 Float_t aco[2] = { 12., 16. };
784 Float_t zco[2] = { 6., 8. };
785 Float_t wco[2] = { 1., 2. };
786 Float_t dco = 0.001977;
787
788 // For water
789 Float_t awa[2] = { 1., 16. };
790 Float_t zwa[2] = { 1., 8. };
791 Float_t wwa[2] = { 2., 1. };
792 Float_t dwa = 1.0;
793
794 // For isobutane (C4H10)
795 Float_t ais[2] = { 12., 1. };
796 Float_t zis[2] = { 6., 1. };
797 Float_t wis[2] = { 4., 10. };
798 Float_t dis = 0.00267;
799
800 // For Xe/CO2-gas-mixture
801 // Xe-content of the Xe/CO2-mixture (90% / 10%)
802 Float_t fxc = .90;
803 // Xe-content of the Xe/Isobutane-mixture (97% / 3%)
804 Float_t fxi = .97;
fe4da5cc 805 Float_t dxe = .005858;
806
d3f347ff 807 // General tracking parameter
fe4da5cc 808 Float_t tmaxfd = -10.;
809 Float_t stemax = -1e10;
d3f347ff 810 Float_t deemax = -0.1;
811 Float_t epsil = 1e-4;
812 Float_t stmin = -0.001;
fe4da5cc 813
814 Float_t absl, radl, d, buf[1];
815 Float_t agm[2], dgm, zgm[2], wgm[2];
d3f347ff 816 Int_t nbuf;
fe4da5cc 817
d3f347ff 818 //////////////////////////////////////////////////////////////////////////
fe4da5cc 819 // Define Materials
d3f347ff 820 //////////////////////////////////////////////////////////////////////////
821
822 AliMaterial( 1, "Al $", 26.98, 13.0, 2.7 , 8.9 , 37.2);
823 AliMaterial( 2, "Air$", 14.61, 7.3, 0.001205, 30420.0 , 67500.0);
824 AliMaterial( 4, "Xe $", 131.29, 54.0, dxe , 1447.59, 0.0);
825 AliMaterial( 5, "Cu $", 63.54, 29.0, 8.96 , 1.43, 14.8);
826 AliMaterial( 6, "C $", 12.01, 6.0, 2.265 , 18.8 , 74.4);
827 AliMaterial(12, "G10$", 20.00, 10.0, 1.7 , 19.4 , 999.0);
828
829 // Mixtures
830 AliMixture(3, "Polyethilene$", ape, zpe, dpe, -2, wpe);
831 AliMixture(7, "Mylar$", amy, zmy, dmy, -3, wmy);
832 AliMixture(8, "CO2$", aco, zco, dco, -2, wco);
833 AliMixture(9, "Isobutane$", ais, zis, dis, -2, wis);
82bbf98a 834 AliMixture(13,"Water$", awa, zwa, dwa, -2, wwa);
d3f347ff 835
836 // Gas mixtures
82bbf98a 837 Char_t namate[21];
d3f347ff 838 // Xe/CO2-mixture
839 // Get properties of Xe
cfce8870 840 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
d3f347ff 841 // Get properties of CO2
cfce8870 842 gMC->Gfmate((*fIdmate)[8], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
d3f347ff 843 // Create gas mixture
844 wgm[0] = fxc;
845 wgm[1] = 1. - fxc;
fe4da5cc 846 dgm = wgm[0] * dxe + wgm[1] * dco;
d3f347ff 847 AliMixture(10, "Gas mixture 1$", agm, zgm, dgm, 2, wgm);
848 // Xe/Isobutane-mixture
849 // Get properties of Xe
cfce8870 850 gMC->Gfmate((*fIdmate)[4], namate, agm[0], zgm[0], d, radl, absl, buf, nbuf);
d3f347ff 851 // Get properties of Isobutane
cfce8870 852 gMC->Gfmate((*fIdmate)[9], namate, agm[1], zgm[1], d, radl, absl, buf, nbuf);
d3f347ff 853 // Create gas mixture
854 wgm[0] = fxi;
855 wgm[1] = 1. - fxi;
856 dgm = wgm[0] * dxe + wgm[1] * dis;
857 AliMixture(11, "Gas mixture 2$", agm, zgm, dgm, 2, wgm);
858
859 //////////////////////////////////////////////////////////////////////////
fe4da5cc 860 // Tracking Media Parameters
d3f347ff 861 //////////////////////////////////////////////////////////////////////////
862
863 // Al Frame
ad51aeb0 864 AliMedium(1, "Al Frame$", 1, 0, ISXFLD, SXMGMX
d3f347ff 865 , tmaxfd, stemax, deemax, epsil, stmin);
866 // Air
ad51aeb0 867 AliMedium(2, "Air$", 2, 0, ISXFLD, SXMGMX
d3f347ff 868 , tmaxfd, stemax, deemax, epsil, stmin);
869 // Polyethilene
ad51aeb0 870 AliMedium(3, "Radiator$", 3, 0, ISXFLD, SXMGMX
d3f347ff 871 , tmaxfd, stemax, deemax, epsil, stmin);
872 // Xe
ad51aeb0 873 AliMedium(4, "Xe$", 4, 1, ISXFLD, SXMGMX
d3f347ff 874 , tmaxfd, stemax, deemax, epsil, stmin);
875 // Cu pads
ad51aeb0 876 AliMedium(5, "Padplane$", 5, 1, ISXFLD, SXMGMX
d3f347ff 877 , tmaxfd, stemax, deemax, epsil, stmin);
878 // Fee + cables
ad51aeb0 879 AliMedium(6, "Readout$", 1, 0, ISXFLD, SXMGMX
d3f347ff 880 , tmaxfd, stemax, deemax, epsil, stmin);
881 // C frame
ad51aeb0 882 AliMedium(7, "C Frame$", 6, 0, ISXFLD, SXMGMX
d3f347ff 883 , tmaxfd, stemax, deemax, epsil, stmin);
884 // Mylar foils
ad51aeb0 885 AliMedium(8, "Mylar$", 7, 0, ISXFLD, SXMGMX
d3f347ff 886 , tmaxfd, stemax, deemax, epsil, stmin);
887 if (fGasMix == 1) {
888 // Gas-mixture (Xe/CO2)
ad51aeb0 889 AliMedium(9, "Gas-mix$", 10, 1, ISXFLD, SXMGMX
d3f347ff 890 , tmaxfd, stemax, deemax, epsil, stmin);
891 }
892 else {
893 // Gas-mixture (Xe/Isobutane)
ad51aeb0 894 AliMedium(9, "Gas-mix$", 11, 1, ISXFLD, SXMGMX
d3f347ff 895 , tmaxfd, stemax, deemax, epsil, stmin);
896 }
897 // Nomex-honeycomb (use carbon for the time being)
ad51aeb0 898 AliMedium(10, "Nomex$", 6, 0, ISXFLD, SXMGMX
d3f347ff 899 , tmaxfd, stemax, deemax, epsil, stmin);
900 // Kapton foils (use Mylar for the time being)
ad51aeb0 901 AliMedium(11, "Kapton$", 7, 0, ISXFLD, SXMGMX
d3f347ff 902 , tmaxfd, stemax, deemax, epsil, stmin);
903 // Gas-filling of the radiator
ad51aeb0 904 AliMedium(12, "CO2$", 8, 0, ISXFLD, SXMGMX
d3f347ff 905 , tmaxfd, stemax, deemax, epsil, stmin);
906 // G10-plates
ad51aeb0 907 AliMedium(13, "G10-plates$",12, 0, ISXFLD, SXMGMX
d3f347ff 908 , tmaxfd, stemax, deemax, epsil, stmin);
909 // Cooling water
ad51aeb0 910 AliMedium(14, "Water$", 13, 0, ISXFLD, SXMGMX
d3f347ff 911 , tmaxfd, stemax, deemax, epsil, stmin);
912
fe4da5cc 913}
914
915//_____________________________________________________________________________
82bbf98a 916void AliTRD::DrawModule()
917{
918 //
919 // Draw a shaded view of the Transition Radiation Detector version 0
920 //
921
922 // Set everything unseen
923 gMC->Gsatt("*" ,"SEEN",-1);
924
925 // Set ALIC mother transparent
926 gMC->Gsatt("ALIC","SEEN", 0);
927
928 // Set the volumes visible
5c7f4665 929 if (fHole) {
930 gMC->Gsatt("B071","SEEN", 0);
931 gMC->Gsatt("B074","SEEN", 0);
932 gMC->Gsatt("B075","SEEN", 0);
933 gMC->Gsatt("B077","SEEN", 0);
934 gMC->Gsatt("BTR1","SEEN", 0);
935 gMC->Gsatt("BTR2","SEEN", 0);
936 gMC->Gsatt("BTR3","SEEN", 0);
937 gMC->Gsatt("TRD1","SEEN", 0);
938 gMC->Gsatt("TRD2","SEEN", 0);
939 gMC->Gsatt("TRD3","SEEN", 0);
940 }
941 else {
942 gMC->Gsatt("B071","SEEN", 0);
943 gMC->Gsatt("B074","SEEN", 0);
944 gMC->Gsatt("B075","SEEN", 0);
945 gMC->Gsatt("B077","SEEN", 0);
946 gMC->Gsatt("BTR1","SEEN", 0);
947 gMC->Gsatt("BTR2","SEEN", 0);
948 gMC->Gsatt("BTR3","SEEN", 0);
949 gMC->Gsatt("TRD1","SEEN", 0);
950 }
82bbf98a 951 gMC->Gsatt("UCII","SEEN", 0);
952 gMC->Gsatt("UCIM","SEEN", 0);
953 gMC->Gsatt("UCIO","SEEN", 0);
954 gMC->Gsatt("UL02","SEEN", 1);
955 gMC->Gsatt("UL05","SEEN", 1);
956 gMC->Gsatt("UL06","SEEN", 1);
957
958 gMC->Gdopt("hide", "on");
959 gMC->Gdopt("shad", "on");
960 gMC->Gsatt("*", "fill", 7);
961 gMC->SetClipBox(".");
962 gMC->SetClipBox("*", 0, 2000, -2000, 2000, -2000, 2000);
963 gMC->DefaultRange();
964 gMC->Gdraw("alic", 40, 30, 0, 12, 9.4, .021, .021);
965 gMC->Gdhead(1111, "Transition Radiation Detector");
966 gMC->Gdman(18, 4, "MAN");
967
968}
969
970//_____________________________________________________________________________
fe4da5cc 971Int_t AliTRD::DistancetoPrimitive(Int_t , Int_t )
972{
973 //
974 // Distance between the mouse and the TRD detector on the screen
975 // Dummy routine
82bbf98a 976
977 return 9999;
978
fe4da5cc 979}
980
981//_____________________________________________________________________________
982void AliTRD::Init()
983{
984 //
985 // Initialise the TRD detector after the geometry has been created
986 //
82bbf98a 987
5c7f4665 988 Int_t i;
989
990 printf("\n");
991 for(i=0;i<35;i++) printf("*");
992 printf(" TRD_INIT ");
993 for(i=0;i<35;i++) printf("*");
994 printf("\n");
995
fe4da5cc 996 // Here the TRD initialisation code (if any!)
d3f347ff 997 if (fGasMix == 1)
998 printf(" Gas Mixture: 90%% Xe + 10%% CO2\n");
999 else
1000 printf(" Gas Mixture: 97%% Xe + 3%% Isobutane\n");
82bbf98a 1001
5c7f4665 1002 if (fHole)
1003 printf(" Geometry with holes\n");
1004 else
1005 printf(" Full geometry\n");
1006
1007 // The default pad dimensions
1008 if (!(fRowPadSize)) fRowPadSize = 4.5;
1009 if (!(fColPadSize)) fColPadSize = 1.0;
1010 if (!(fTimeBinSize)) fTimeBinSize = 0.1;
1011
1012 // The maximum number of pads
1013 // and the position of pad 0,0,0
1014 //
1015 // chambers seen from the top:
1016 // +----------------------------+
1017 // | |
1018 // | | ^
1019 // | | rphi|
1020 // | | |
1021 // |0 | |
1022 // +----------------------------+ +------>
1023 // z
1024 // chambers seen from the side: ^
1025 // +----------------------------+ time|
1026 // | | |
1027 // |0 | |
1028 // +----------------------------+ +------>
1029 // z
1030 //
1031 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
1032
1033 // The pad row (z-direction)
1034 for (Int_t isect = 0; isect < kNsect; isect++) {
1035 Float_t clengthI = fClengthI[iplan];
1036 Float_t clengthM = fClengthM1[iplan];
1037 Float_t clengthO = fClengthO1[iplan];
1038 if (fHole) {
1039 switch (isect) {
1040 case 12:
1041 case 13:
1042 case 14:
1043 case 15:
1044 case 16:
1045 clengthM = fClengthM2[iplan];
1046 clengthO = fClengthO2[iplan];
1047 break;
1048 case 4:
1049 case 5:
1050 case 6:
1051 clengthO = fClengthO3[iplan];
1052 break;
1053 };
1054 }
1055 fRowMax[iplan][0][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick)
1056 / fRowPadSize - 0.5);
1057 fRowMax[iplan][1][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick)
1058 / fRowPadSize - 0.5);
1059 fRowMax[iplan][2][isect] = 1 + TMath::Nint((clengthI - 2. * kCcthick)
1060 / fRowPadSize - 0.5);
1061 fRowMax[iplan][3][isect] = 1 + TMath::Nint((clengthM - 2. * kCcthick)
1062 / fRowPadSize - 0.5);
1063 fRowMax[iplan][4][isect] = 1 + TMath::Nint((clengthO - 2. * kCcthick)
1064 / fRowPadSize - 0.5);
1065 fRow0[iplan][0][isect] = -clengthI/2. - clengthM - clengthO + kCcthick;
1066 fRow0[iplan][1][isect] = -clengthI/2. - clengthM + kCcthick;
1067 fRow0[iplan][2][isect] = -clengthI/2. + kCcthick;
1068 fRow0[iplan][3][isect] = clengthI/2. + kCcthick;
1069 fRow0[iplan][4][isect] = clengthI/2. + clengthM + kCcthick;
1070 }
1071
1072 // The pad column (rphi-direction)
1073 fColMax[iplan] = 1 + TMath::Nint((fCwidth[iplan] - 2. * kCcthick)
1074 / fColPadSize - 0.5);
1075 fCol0[iplan] = -fCwidth[iplan]/2. + kCcthick;
1076
1077 }
1078
1079 // The time bucket
1080 fTimeMax = 1 + TMath::Nint(kDrThick / fTimeBinSize - 0.5);
1081 for (Int_t iplan = 0; iplan < kNplan; iplan++) {
1082 fTime0[iplan] = kRmin + kCcframe/2. + kDrZpos - 0.5 * kDrThick
1083 + iplan * (kCheight + kCspace);
1084 }
1085
1086}
1087
1088//_____________________________________________________________________________
1089void AliTRD::MakeBranch(Option_t* option)
1090{
1091 //
1092 // Create Tree branches for the TRD digits and cluster.
1093 //
1094
1095 Int_t buffersize = 4000;
1096 Char_t branchname[15];
1097
1098 AliDetector::MakeBranch(option);
1099
1100 Char_t *D = strstr(option,"D");
1101 sprintf(branchname,"%s",GetName());
1102 if (fDigits && gAlice->TreeD() && D) {
1103 gAlice->TreeD()->Branch(branchname,&fDigits, buffersize);
1104 printf("* AliTRD::MakeBranch * Making Branch %s for digits in TreeD\n",branchname);
1105 }
1106
1107 sprintf(branchname,"%scluster",GetName());
1108 if (fClusters && gAlice->TreeD() && D) {
1109 gAlice->TreeD()->Branch(branchname,&fClusters,buffersize);
1110 printf("* AliTRD::MakeBranch * Making Branch %s for cluster in TreeD\n",branchname);
1111 }
1112
1113}
1114
1115//_____________________________________________________________________________
1116void AliTRD::SetTreeAddress()
1117{
1118 //
1119 // Set the branch addresses for the trees.
1120 //
1121
1122 Char_t branchname[15];
1123
1124 AliDetector::SetTreeAddress();
1125
1126 TBranch *branch;
1127 TTree *treeD = gAlice->TreeD();
1128
1129 if (treeD) {
1130 sprintf(branchname,"%scluster",GetName());
1131 if (fClusters) {
1132 branch = treeD->GetBranch(branchname);
1133 if (branch) branch->SetAddress(&fClusters);
1134 }
1135 }
1136
fe4da5cc 1137}
1138
d3f347ff 1139//_____________________________________________________________________________
b060c36f 1140void AliTRD::SetGasMix(Int_t imix)
d3f347ff 1141{
82bbf98a 1142 //
1143 // Defines the gas mixture (imix=0: Xe/Isobutane imix=1: Xe/CO2)
1144 //
1145
d3f347ff 1146 if ((imix < 0) || (imix > 1)) {
1147 printf("Wrong input value: %d\n",imix);
1148 printf("Use standard setting\n");
1149 fGasMix = 0;
1150 return;
1151 }
1152
1153 fGasMix = imix;
1154
1155}
1156
5c7f4665 1157//______________________________________________________________________________
1158void AliTRD::Streamer(TBuffer &R__b)
1159{
1160 // Stream an object of class AliTRD.
1161
1162 if (R__b.IsReading()) {
1163 Version_t R__v = R__b.ReadVersion(); if (R__v) { }
1164 AliDetector::Streamer(R__b);
1165 R__b >> fGasMix;
1166 R__b.ReadStaticArray(fClengthI);
1167 R__b.ReadStaticArray(fClengthM1);
1168 R__b.ReadStaticArray(fClengthM2);
1169 R__b.ReadStaticArray(fClengthO1);
1170 R__b.ReadStaticArray(fClengthO2);
1171 R__b.ReadStaticArray(fClengthO3);
1172 R__b.ReadStaticArray(fCwidth);
1173 R__b.ReadStaticArray((int*)fRowMax);
1174 R__b.ReadStaticArray(fColMax);
1175 R__b >> fTimeMax;
1176 R__b.ReadStaticArray((float*)fRow0);
1177 R__b.ReadStaticArray(fCol0);
1178 R__b.ReadStaticArray(fTime0);
1179 R__b >> fRowPadSize;
1180 R__b >> fColPadSize;
1181 R__b >> fTimeBinSize;
1182 R__b >> fHole;
1183 // Stream the pointers but not the TClonesArray
1184 R__b >> fClusters; // diff
1185 //R__b >> fNclusters;
1186 } else {
1187 R__b.WriteVersion(AliTRD::IsA());
1188 AliDetector::Streamer(R__b);
1189 R__b << fGasMix;
1190 R__b.WriteArray(fClengthI, 6);
1191 R__b.WriteArray(fClengthM1, 6);
1192 R__b.WriteArray(fClengthM2, 6);
1193 R__b.WriteArray(fClengthO1, 6);
1194 R__b.WriteArray(fClengthO2, 6);
1195 R__b.WriteArray(fClengthO3, 6);
1196 R__b.WriteArray(fCwidth, 6);
1197 R__b.WriteArray((int*)fRowMax, 540);
1198 R__b.WriteArray(fColMax, 6);
1199 R__b << fTimeMax;
1200 R__b.WriteArray((float*)fRow0, 540);
1201 R__b.WriteArray(fCol0, 6);
1202 R__b.WriteArray(fTime0, 6);
1203 R__b << fRowPadSize;
1204 R__b << fColPadSize;
1205 R__b << fTimeBinSize;
1206 R__b << fHole;
1207 // Stream the pointers but not the TClonesArrays
1208 R__b << fClusters; // diff
1209 //R__b << fNclusters;
1210 }
1211
1212}
1213
fe4da5cc 1214ClassImp(AliTRDhit)
1215
1216//_____________________________________________________________________________
5c7f4665 1217AliTRDhit::AliTRDhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
1218 :AliHit(shunt, track)
fe4da5cc 1219{
1220 //
1221 // Create a TRD hit
1222 //
1223
fe4da5cc 1224 // Store volume hierarchy
1225 fSector = vol[0];
1226 fChamber = vol[1];
1227 fPlane = vol[2];
82bbf98a 1228
fe4da5cc 1229 // Store position and charge
1230 fX = hits[0];
1231 fY = hits[1];
1232 fZ = hits[2];
1233 fQ = hits[3];
82bbf98a 1234
fe4da5cc 1235}
99d5402e 1236
1237ClassImp(AliTRDdigit)
1238
1239//_____________________________________________________________________________
1240AliTRDdigit::AliTRDdigit(Int_t *tracks, Int_t *digits)
1241 :AliDigit(tracks)
1242{
1243 //
1244 // Create a TRD digit
1245 //
1246
1247 // Store the volume hierarchy
1248 fSector = digits[0];
1249 fChamber = digits[1];
1250 fPlane = digits[2];
1251
1252 // Store the row, pad, and time bucket number
1253 fRow = digits[3];
1254 fCol = digits[4];
1255 fTime = digits[5];
1256
1257 // Store the signal amplitude
1258 fSignal = digits[6];
1259
1260}
5c7f4665 1261
1262ClassImp(AliTRDcluster)
1263
1264//_____________________________________________________________________________
1265AliTRDcluster::AliTRDcluster(Int_t *tracks, Int_t *cluster, Float_t* position)
1266 :TObject()
1267{
1268 //
1269 // Create a TRD cluster
1270 //
1271
1272 fSector = cluster[0];
1273 fChamber = cluster[1];
1274 fPlane = cluster[2];
1275
1276 fTimeSlice = cluster[3];
1277 fEnergy = cluster[4];
1278
1279 fX = position[0];
1280 fY = position[1];
1281 fZ = position[2];
1282
1283 fTracks[0] = tracks[0];
1284 fTracks[1] = tracks[1];
1285 fTracks[2] = tracks[2];
1286
1287}
1288