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