Moving to the new VMC naming convention
[u/mrichter/AliRoot.git] / TPC / AliTPCv2.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
73042f01 18//
fe4da5cc 19///////////////////////////////////////////////////////////////////////////////
20// //
21// Time Projection Chamber version 2 -- detailed TPC and slow simulation //
22// //
23//Begin_Html
24/*
1439f98e 25<img src="picts/AliTPCv2Class.gif">
fe4da5cc 26*/
27//End_Html
28// //
29// //
30///////////////////////////////////////////////////////////////////////////////
116cbefd 31
2a49965d 32#include <stdlib.h>
fe4da5cc 33
88cb7938 34#include <TLorentzVector.h>
fe4da5cc 35#include <TMath.h>
88cb7938 36#include <TVirtualMC.h>
116cbefd 37#include <TPDGCode.h>
bcac8ae4 38
fe4da5cc 39#include "AliConst.h"
116cbefd 40#include "AliRun.h"
41#include "AliTPCDigitsArray.h"
73042f01 42#include "AliTPCParam.h"
43#include "AliTPCParamSR.h"
4ed5dced 44#include "AliTPCTrackHitsV2.h"
116cbefd 45#include "AliTPCv2.h"
6a905708 46
fe4da5cc 47ClassImp(AliTPCv2)
48
49//_____________________________________________________________________________
50AliTPCv2::AliTPCv2(const char *name, const char *title) :
51 AliTPC(name, title)
52{
53 //
54 // Standard constructor for Time Projection Chamber version 2
55 //
37831078 56 fIdSens=0;
57 fIdLSec=0;
58 fIdUSec=0;
59
fe4da5cc 60 SetBufferSize(128000);
73042f01 61
62 SetGasMixt(2,20,10,-1,0.9,0.1,0.); // Ne-CO2 90-10
63
64 // Default sectors
65
66 SetSecAL(4);
67 SetSecAU(4);
68 SetSecLows(1, 2, 3, 19, 20, 21);
69 SetSecUps(37, 38, 39, 37+18, 38+18, 39+18, -1, -1, -1, -1, -1, -1);
37831078 70 SetSens(1); // sensitive strips set
73042f01 71
72 if (fTPCParam)
73 fTPCParam->Write(fTPCParam->GetTitle());
fe4da5cc 74}
75
76//_____________________________________________________________________________
77void AliTPCv2::CreateGeometry()
78{
79 //
80 // Create the geometry of Time Projection Chamber version 2
81 //
82 //Begin_Html
83 /*
37831078 84 <img src="picts/AliTPC.gif">
fe4da5cc 85 */
86 //End_Html
87 //Begin_Html
88 /*
1439f98e 89 <img src="picts/AliTPCv2Tree.gif">
fe4da5cc 90 */
91 //End_Html
92
8c555625 93
1283eee5 94 Int_t *idtmed = fIdtmed->GetArray();
95
37831078 96 Float_t dm[50];
62a73ee5 97 Int_t idrotm[120];
1283eee5 98
99 Int_t nRotMat = 0;
100
d4c354b9 101 Int_t i,ifl1=0;
1283eee5 102
37831078 103 // number of sectors
104
1283eee5 105 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
106 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
fe4da5cc 107
108 // ---------------------------------------------------
109 // sector specification check
88cb7938 110 // ---------------------------------------------------
fe4da5cc 111 if (fSecAL >= 0) {
112 ifl1 = 0;
113
114 for (i = 0; i < 6; ++i) {
1283eee5 115 if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
88cb7938 116 ifl1 = 1;
117 printf("%s: *** SECTOR %d selected\n",ClassName(),fSecLows[i]);
fe4da5cc 118 }
119 }
120
121 } else {
9e1a0ddb 122 printf("%s: *** ALL LOWER SECTORS SELECTED ***\n",ClassName());
8c555625 123 ifl1 = 1;
fe4da5cc 124 }
125
d4c354b9 126 if (ifl1 == 0) {
9e1a0ddb 127 printf("%s: *** ERROR: AT LEAST ONE LOWER SECTOR MUST BE SPECIFIED ***\n",ClassName());
128 printf("%s: !!! PROGRAM STOPPED !!!\n",ClassName());
d4c354b9 129 exit(1);
130 }
131
fe4da5cc 132 if (fSecAU >= 0) {
fe4da5cc 133
134 for (i = 0; i < 12; ++i) {
1283eee5 135 if (fSecUps[i] > 2*nInnerSector-1 &&
136 fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
9e1a0ddb 137 printf("%s: *** SECTOR %d selected\n",ClassName(),fSecUps[i]);
fe4da5cc 138 }
139 }
140
141 } else {
9e1a0ddb 142 printf("%s: *** ALL UPPER SECTORS SELECTED ***\n",ClassName());
fe4da5cc 143 }
144
d4c354b9 145
37831078 146
147 //--------------------------------------------------------------------
148
149 //
79575d04 150 // Mother volume TPC (Air) - all volumes will be positioned in it
37831078 151 //
79575d04 152
37831078 153 dm[0]=0.;
154 dm[1]=360.;
79575d04 155 dm[2]=8.;
1283eee5 156
37831078 157 //
1283eee5 158
79575d04 159 dm[3]=-283.7;
160 dm[4]=65.6;
161 dm[5]=278.;
1283eee5 162
37831078 163 //
1283eee5 164
79575d04 165 dm[6]=-253.6;
166 dm[7]=65.6;
167 dm[8]=278.;
1283eee5 168
37831078 169 //
1283eee5 170
79575d04 171 dm[9]=-73.3;
172 dm[10]=60.9;
173 dm[11]=278.;
1283eee5 174
37831078 175 //
1283eee5 176
79575d04 177 dm[12]=-73.3;
178 dm[13]=56.9;
179 dm[14]=278.;
1283eee5 180
37831078 181 //
1283eee5 182
79575d04 183 dm[15]=73.3;
184 dm[16]=56.9;
185 dm[17]=278.;
1283eee5 186
37831078 187 //
1283eee5 188
79575d04 189 dm[18]=73.3;
190 dm[19]=60.9;
191 dm[20]=278.;
1283eee5 192
37831078 193 //
1283eee5 194
79575d04 195 dm[21]=253.6;
196 dm[22]=65.6;
197 dm[23]=278.;
1283eee5 198
37831078 199 //
1283eee5 200
79575d04 201 dm[24]=283.7;
202 dm[25]=65.6;
203 dm[26]=278.;
204
205 gMC->Gsvolu("TPC ","PCON",idtmed[0],dm,27);
1283eee5 206
79575d04 207 // outer part
1283eee5 208
37831078 209 //-------------------------------------------------------------------
79575d04 210 // Tpc Outer INsulator (CO2) - contains cont. vessel and field cage
37831078 211 //-------------------------------------------------------------------
1283eee5 212
37831078 213 dm[0]= 0.;
214 dm[1]= 360.;
215 dm[2]= 6.;
1283eee5 216
37831078 217 //
1283eee5 218
79575d04 219 dm[3]=-253.6;
220 dm[4]=258.;
221 dm[5]=275.5;
1283eee5 222
37831078 223 //
1283eee5 224
79575d04 225 dm[6]=-250.6;
226 dm[7]=258.;
227 dm[8]=275.5;
1283eee5 228
37831078 229 //
cc80f89e 230
79575d04 231 dm[9]=-250.6;
232 dm[10]=258.;
233 dm[11]=278.;
1283eee5 234
79575d04 235 //
1283eee5 236
79575d04 237 dm[12]=253.6;
238 dm[13]=258.;
239 dm[14]=278.;
1283eee5 240
37831078 241 //
1283eee5 242
79575d04 243 dm[15]=253.6;
244 dm[16]=264.8;
245 dm[17]=278.;
1283eee5 246
37831078 247 //
1283eee5 248
79575d04 249 dm[18]=256.6;
250 dm[19]=264.8;
251 dm[20]=278.;
1283eee5 252
79575d04 253 gMC->Gsvolu("TOIN","PCON",idtmed[3],dm,21);
1283eee5 254
37831078 255 //----------------------------------------------------------------
256 // Tpc Outer Contaiment Vessel
257 // mother volume - Al, daughters - composite (sandwich)
258 //----------------------------------------------------------------
79575d04 259
260 dm[0]=0.;
261 dm[1]=360.;
720b23b8 262 dm[2]=6.;
1283eee5 263
37831078 264 //
cc80f89e 265
79575d04 266 dm[3]=-250.6;
267 dm[4]=270.4;
268 dm[5]=278.;
1283eee5 269
37831078 270 //
1283eee5 271
79575d04 272 dm[6]=-247.6;
273 dm[7]=270.4;
274 dm[8]=278.;
1283eee5 275
37831078 276 //
79575d04 277
278 dm[9]=-247.6;
cea9b4f7 279 dm[10]=274.8124;
79575d04 280 dm[11]=278.;
281
37831078 282 //
283
79575d04 284 dm[12]=253.6;
cea9b4f7 285 dm[13]=274.8124;
79575d04 286 dm[14]=278.;
37831078 287
720b23b8 288 //
37831078 289
79575d04 290 dm[15]=253.6;
291 dm[16]=264.8;
292 dm[17]=278.;
1283eee5 293
79575d04 294 //
720b23b8 295
79575d04 296 dm[18]=256.6;
297 dm[19]=264.8;
298 dm[20]=278.;
720b23b8 299
300 gMC->Gsvolu("TOCV","PCON",idtmed[4],dm,21);
37831078 301
79575d04 302 // Daughter volumes - sandwich
37831078 303
304 // Tpc SAndwich 1 - Al
79575d04 305
cea9b4f7 306 dm[0]=274.8124;
79575d04 307 dm[1]=278.;
308 dm[2]=252.1;
37831078 309
310 gMC->Gsvolu("TSA1","TUBE",idtmed[4],dm,3);
311
79575d04 312 // Tpc SAndwich 2 - epoxy glue (I use Lexan)
37831078 313
314 dm[0] += 5.e-3;
315 dm[1] -= 5.e-3;
79575d04 316
317 gMC->Gsvolu("TSA2","TUBE",idtmed[14],dm,3);
318
319 // Tpc SAndwich 3 - Tedlar
320
321 dm[0] += 0.01;
322 dm[1] -= 0.01;
1283eee5 323
79575d04 324 gMC->Gsvolu("TSA3","TUBE",idtmed[9],dm,3);
37831078 325
37831078 326
79575d04 327 // Tpc SAndwich 4 - fiber glass (G10)
37831078 328
cea9b4f7 329 dm[0] += 3.8e-3;
330 dm[1] -= 3.8e-3;
37831078 331
79575d04 332 gMC->Gsvolu("TSA4","TUBE",idtmed[12],dm,3);
1283eee5 333
79575d04 334 // Tpc SAndwich 5 - NOMEX honeycomb
37831078 335
79575d04 336 dm[0] += 0.075;
337 dm[1] -= 0.075;
1283eee5 338
79575d04 339 gMC->Gsvolu("TSA5","TUBE",idtmed[6],dm,3);
340
341 // 5->4->3->2->1->TCOV
1283eee5 342
79575d04 343
344 gMC->Gspos("TSA5",1,"TSA4",0.,0.,0.,0,"ONLY");
37831078 345 gMC->Gspos("TSA4",1,"TSA3",0.,0.,0.,0,"ONLY");
346 gMC->Gspos("TSA3",1,"TSA2",0.,0.,0.,0,"ONLY");
79575d04 347 gMC->Gspos("TSA2",1,"TSA1",0.,0.,0.,0,"ONLY");
1283eee5 348
79575d04 349 gMC->Gspos("TSA1",1,"TOCV",0.,0.,3.,0,"ONLY");
1283eee5 350
37831078 351 // TCOV-> TOIN
1283eee5 352
37831078 353 gMC->Gspos("TOCV",1,"TOIN",0.,0.,0.,0,"ONLY");
1283eee5 354
37831078 355 //-------------------------------------------------------
356 // Tpc Outer Field Cage
357 // mother volume - Al, daughters - composite (sandwich)
358 //-------------------------------------------------------
1283eee5 359
37831078 360 dm[0]=0.;
361 dm[1]=360.;
362 dm[2]=6.;
1283eee5 363
79575d04 364 //
365
366 dm[3]=-253.6;
367 dm[4]=258.;
368 dm[5]=275.5;
1283eee5 369
37831078 370 //
8c555625 371
79575d04 372 dm[6]=-250.6;
373 dm[7]=258.;
374 dm[8]=275.5;
8c555625 375
37831078 376 //
79575d04 377
378 dm[9]=-250.6;
379 dm[10]=258.;
cea9b4f7 380 dm[11]=260.0476;
37831078 381
382 //
8c555625 383
79575d04 384 dm[12]=250.6;
385 dm[13]=258.;
cea9b4f7 386 dm[14]=260.0476;
1283eee5 387
37831078 388 //
1283eee5 389
79575d04 390 dm[15]=250.6;
391 dm[16]=258.;
dcf38560 392 dm[17]=269.6;
8c555625 393
37831078 394 //
fe4da5cc 395
79575d04 396 dm[18]=253.6;
397 dm[19]=258.;
dcf38560 398 dm[20]=269.6;
fe4da5cc 399
79575d04 400 gMC->Gsvolu("TOFC","PCON",idtmed[4],dm,21);
fe4da5cc 401
37831078 402 // Daughter volumes
fe4da5cc 403
79575d04 404 // Tpc SAndwich 6 - Tedlar
1283eee5 405
37831078 406 dm[0]= 258.;
cea9b4f7 407 dm[1]= 260.0476;
79575d04 408 dm[2]= 252.1;
1283eee5 409
79575d04 410 gMC->Gsvolu("TSA6","TUBE",idtmed[9],dm,3);
1283eee5 411
79575d04 412 // Tpc SAndwich 7 - fiber glass
1283eee5 413
cea9b4f7 414 dm[0] += 3.8e-3;
415 dm[1] -= 3.8e-3;
1283eee5 416
79575d04 417 gMC->Gsvolu("TSA7","TUBE",idtmed[12],dm,3);
1283eee5 418
1283eee5 419
37831078 420 // Tpc SAndwich 8 - NOMEX
1283eee5 421
37831078 422 dm[0] += 0.02;
423 dm[1] -= 0.02;
1283eee5 424
79575d04 425 gMC->Gsvolu("TSA8","TUBE",idtmed[6],dm,3);
1283eee5 426
79575d04 427 // 8->7->6->TOFC
1283eee5 428
79575d04 429 gMC->Gspos("TSA8",1,"TSA7",0.,0.,0.,0,"ONLY");
430 gMC->Gspos("TSA7",1,"TSA6",0.,0.,0.,0,"ONLY");
431 gMC->Gspos("TSA6",1,"TOFC",0.,0.,0.,0,"ONLY");
1283eee5 432
dcf38560 433 // TOFC->TOIN
434 // TOFC overlaps with
1283eee5 435
79575d04 436 gMC->Gspos("TOFC",1,"TOIN",0.,0.,0.,0,"ONLY");
1283eee5 437
37831078 438 // TOIN->TPC
1283eee5 439
37831078 440 gMC->Gspos("TOIN",1,"TPC ",0.,0.,0.,0,"ONLY");
1283eee5 441
79575d04 442 // inner part
1283eee5 443
79575d04 444 //--------------------------------------------------------------------
445 // Tpc Inner INsulator (CO2) - inner f.c. will be placed there
446 // Inner containment vessel will be placed directly in the TPC
447 //--------------------------------------------------------------------
1283eee5 448
37831078 449 dm[0]=0.;
79575d04 450 dm[1]=360.;
451 dm[2]=4.;
1283eee5 452
79575d04 453 //
1283eee5 454
79575d04 455 dm[3]=-253.6;
456 dm[4]=65.9;
457 dm[5]=79.2;
fe4da5cc 458
37831078 459 //
fe4da5cc 460
79575d04 461 dm[6]=-73.3;
462 dm[7]=61.2;
463 dm[8]=79.2;
1283eee5 464
37831078 465 //
466
79575d04 467 dm[9]=73.3;
468 dm[10]=61.2;
469 dm[11]=79.2;
37831078 470
471 //
472
79575d04 473 dm[12]=253.6;
474 dm[13]=65.9;
475 dm[14]=79.2;
37831078 476
79575d04 477 gMC->Gsvolu("TIIN","PCON",idtmed[3],dm,15);
37831078 478
79575d04 479 // the middle part of the F.C. is thinner - carve out the strip - Ne-CO2
37831078 480
79575d04 481 dm[0]=79.16;
482 dm[1]=79.2;
483 dm[2]=88.;
37831078 484
79575d04 485 gMC->Gsvolu("TII1","TUBE",idtmed[1],dm,3);
37831078 486
79575d04 487 gMC->Gspos("TII1",1,"TIIN",0.,0.,0.,0,"ONLY");
37831078 488
79575d04 489 //-----------------------------------------------------
490 // Tpc Inner Field Cage
491 // mother volume - Al, daughters - composite (sandwich)
492 //------------------------------------------------------
37831078 493
79575d04 494 dm[0]=0.;
495 dm[1]=360.;
496 dm[2]=10.;
37831078 497
498 //
499
79575d04 500 dm[3]=-253.6;
501 dm[4]=70.3;
502 dm[5]=79.2;
37831078 503
504 //
505
79575d04 506 dm[6]=-250.6;
507 dm[7]=70.3;
508 dm[8]=79.2;
37831078 509
510 //
511
79575d04 512 dm[9]=-250.6;
cea9b4f7 513 dm[10]=77.0524;
79575d04 514 dm[11]=79.2;
37831078 515
516 //
517
79575d04 518 dm[12]=-88.;
cea9b4f7 519 dm[13]=77.0524;
79575d04 520 dm[14]=79.2;
37831078 521
522 //
523
79575d04 524 dm[15]=-88.;
cea9b4f7 525 dm[16]=77.0924;
79575d04 526 dm[17]=79.16;
37831078 527
528 //
529
79575d04 530 dm[18]=88.;
cea9b4f7 531 dm[19]=77.0924;
79575d04 532 dm[20]=79.16;
37831078 533
534 //
535
79575d04 536 dm[21]=88.;
cea9b4f7 537 dm[22]=77.0524;
79575d04 538 dm[23]=79.2;
37831078 539
540 //
1283eee5 541
79575d04 542 dm[24]=250.6;
cea9b4f7 543 dm[25]=77.0524;
79575d04 544 dm[26]=79.2;
1283eee5 545
37831078 546 //
547
79575d04 548 dm[27]=250.6;
549 dm[28]=70.3;
550 dm[29]=79.2;
37831078 551
552 //
553
79575d04 554 dm[30]=253.6;
555 dm[31]=70.3;
556 dm[32]=79.2;
37831078 557
79575d04 558 gMC->Gsvolu("TIFC","PCON",idtmed[4],dm,33);
37831078 559
79575d04 560 // daughter volumes - central part
37831078 561
79575d04 562 // Tpc Sandwich 9 -Tedlar
37831078 563
cea9b4f7 564 dm[0]=77.0924;
79575d04 565 dm[1]=79.16;
566 dm[2]=88.;
37831078 567
79575d04 568 gMC->Gsvolu("TSA9","TUBE",idtmed[9],dm,3);
37831078 569
79575d04 570 // Tpc Sandwich 10 - fiber glass (G10)
37831078 571
cea9b4f7 572 dm[0] += 3.8e-3;
573 dm[1] -= 3.8e-3;
37831078 574
79575d04 575 gMC->Gsvolu("TS10","TUBE",idtmed[12],dm,3);
37831078 576
79575d04 577 // Tpc Sandwich 11 - NOMEX
37831078 578
79575d04 579 dm[0] += 0.03;
580 dm[1] -= 0.03;
37831078 581
79575d04 582 gMC->Gsvolu("TS11","TUBE",idtmed[6],dm,3);
37831078 583
79575d04 584 // 11->10->9->TIFC
37831078 585
79575d04 586 gMC->Gspos("TS11",1,"TS10",0.,0.,0.,0,"ONLY");
587 gMC->Gspos("TS10",1,"TSA9",0.,0.,0.,0,"ONLY");
37831078 588
79575d04 589 gMC->Gspos("TSA9",1,"TIFC",0.,0.,0.,0,"ONLY");
37831078 590
79575d04 591 // daughter volumes - outer parts (reinforced)
37831078 592
79575d04 593 // Tpc Sandwich 12 -Tedlar
37831078 594
cea9b4f7 595 dm[0]=77.0524;
79575d04 596 dm[1]=79.2;
597 dm[2]=82.05;
37831078 598
79575d04 599 gMC->Gsvolu("TS12","TUBE",idtmed[9],dm,3);
37831078 600
79575d04 601 // Tpc Sandwich 13 - fiber glass (G10)
37831078 602
cea9b4f7 603 dm[0] += 3.8e-3;
604 dm[1] -= 3.8e-3;
37831078 605
79575d04 606 gMC->Gsvolu("TS13","TUBE",idtmed[12],dm,3);
37831078 607
79575d04 608 // Tpc Sandwich 14 - NOMEX
37831078 609
79575d04 610 dm[0] += 0.07;
611 dm[1] -= 0.07;
37831078 612
79575d04 613 gMC->Gsvolu("TS14","TUBE",idtmed[6],dm,3);
37831078 614
79575d04 615 // 14->13->12->TIFC
37831078 616
79575d04 617 gMC->Gspos("TS14",1,"TS13",0.,0.,0.,0,"ONLY");
618 gMC->Gspos("TS13",1,"TS12",0.,0.,0.,0,"ONLY");
37831078 619
79575d04 620 gMC->Gspos("TS12",1,"TIFC",0.,0.,170.05,0,"ONLY");
621 gMC->Gspos("TS12",2,"TIFC",0.,0.,-170.05,0,"ONLY");
37831078 622
79575d04 623 // place this inside the inner insulator
37831078 624
79575d04 625 gMC->Gspos("TIFC",1,"TIIN",0.,0.,0.,0,"ONLY");
37831078 626
79575d04 627 // and now in the TPC...
37831078 628
79575d04 629 gMC->Gspos("TIIN",1,"TPC ",0.,0.,0.,0,"ONLY");
37831078 630
79575d04 631 //---------------------------------------------------------
632 // Tpc Inner Containment vessel - Cones
633 //---------------------------------------------------------
1283eee5 634
79575d04 635 dm[0]=0.;
636 dm[1]=360.;
37831078 637 dm[2]=8.;
1283eee5 638
37831078 639 //
1283eee5 640
79575d04 641 dm[3]=71.8;
642 dm[4]=56.9;
643 dm[5]=59.4;
1283eee5 644
37831078 645 //
1283eee5 646
79575d04 647 dm[6]=73.;
648 dm[7]=56.9;
649 dm[8]=59.4;
1283eee5 650
37831078 651 //
1283eee5 652
79575d04 653 dm[9]=73.;
654 dm[10]=56.9;
655 dm[11]=61.2;
1283eee5 656
37831078 657 //
1283eee5 658
79575d04 659 dm[12]=73.3;
660 dm[13]=56.9;
661 dm[14]=61.2;
1283eee5 662
37831078 663 //
79575d04 664
665 dm[15]=73.3;
666 dm[16]=60.9;
667 dm[17]=61.2;
1283eee5 668
79575d04 669 //
1283eee5 670
79575d04 671 dm[18]=253.6;
672 dm[19]=65.6;
673 dm[20]=65.9;
1283eee5 674
37831078 675 //
1283eee5 676
79575d04 677 dm[21]=253.6;
678 dm[22]=65.6;
f4900c61 679 dm[23]=74.6;
1283eee5 680
37831078 681 //
1283eee5 682
f4900c61 683 dm[24]=256.6;
79575d04 684 dm[25]=65.6;
f4900c61 685 dm[26]=74.6;
1283eee5 686
79575d04 687 gMC->Gsvolu("TICC","PCON",idtmed[4],dm,27);
1283eee5 688
79575d04 689 Float_t phi1,phi2,phi3,theta1,theta2,theta3; // rotation angles
1283eee5 690
79575d04 691 // reflection matrix
692
693 theta1 = 90.;
694 phi1 = 0.;
695 theta2 = 90.;
696 phi2 = 270.;
697 theta3 = 180.;
698 phi3 = 0.;
37831078 699
79575d04 700 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
37831078 701
79575d04 702 gMC->Gspos("TICC",1,"TPC ",0.,0.,0.,0,"ONLY");
703 gMC->Gspos("TICC",2,"TPC ",0.,0.,0.,idrotm[nRotMat],"ONLY");
37831078 704
1283eee5 705
79575d04 706 //---------------------------------------------------------
707 // Tpc Inner Containment vessel - Middle part -Al
708 //---------------------------------------------------------
1283eee5 709
79575d04 710 dm[0]=0.;
711 dm[1]=360.;
712 dm[2]=6.;
1283eee5 713
714 //
37831078 715
79575d04 716 dm[3]=-71.6;
717 dm[4]=60.2;
718 dm[5]=61.2;
37831078 719
1283eee5 720 //
721
79575d04 722 dm[6]=-69.1;
723 dm[7]=60.2;
724 dm[8]=61.2;
1283eee5 725
37831078 726 //
727
79575d04 728 dm[9]=-69.1;
cea9b4f7 729 dm[10]=60.6224;
79575d04 730 dm[11]=61.2;
1283eee5 731
732 //
37831078 733
79575d04 734 dm[12]=69.1;
cea9b4f7 735 dm[13]=60.6224;
79575d04 736 dm[14]=61.2;
37831078 737
1283eee5 738 //
739
79575d04 740 dm[15]=69.1;
741 dm[16]=60.2;
742 dm[17]=61.2;
1283eee5 743
37831078 744 //
1283eee5 745
79575d04 746 dm[18]=71.6;
747 dm[19]=60.2;
748 dm[20]=61.2;
37831078 749
79575d04 750 gMC->Gsvolu("TICM","PCON",idtmed[4],dm,21);
1283eee5 751
79575d04 752 // Tpc Sandwich 15 - Al
1283eee5 753
cea9b4f7 754 dm[0]=60.6224;
79575d04 755 dm[1]=61.2;
756 dm[2]=70.1;
1283eee5 757
79575d04 758 gMC->Gsvolu("TS15","TUBE",idtmed[4],dm,3);
1283eee5 759
79575d04 760 // Tpc Sandwich 16 - epoxy glue
1283eee5 761
79575d04 762 dm[0] += 5.e-3;
763 dm[1] -= 5.e-3;
1283eee5 764
79575d04 765 gMC->Gsvolu("TS16","TUBE",idtmed[14],dm,3);
1283eee5 766
6a905708 767 // Tpc Sandwich 17 - Tedlar
1283eee5 768
79575d04 769 dm[0] += 0.01;
770 dm[1] -= 0.01;
1283eee5 771
6a905708 772 gMC->Gsvolu("TS17","TUBE",idtmed[9],dm,3);
1283eee5 773
cea9b4f7 774 // Tpc Sandwich 18 - carbon fiber
1283eee5 775
cea9b4f7 776 dm[0] += 3.8e-3;
777 dm[1] -= 3.8e-3;
1283eee5 778
cea9b4f7 779 gMC->Gsvolu("TS18","TUBE",idtmed[15],dm,3);
1283eee5 780
79575d04 781 // Tpc Sandwich 19 - Nomex
1283eee5 782
cea9b4f7 783 dm[0] += 0.02;
784 dm[1] -= 0.02;
1283eee5 785
90222263 786 gMC->Gsvolu("TS19","TUBE",idtmed[6],dm,3);
1283eee5 787
79575d04 788 // 19->18->17->16->15-> TICM
1283eee5 789
79575d04 790 gMC->Gspos("TS19",1,"TS18",0.,0.,0.,0,"ONLY");
37831078 791 gMC->Gspos("TS18",1,"TS17",0.,0.,0.,0,"ONLY");
79575d04 792 gMC->Gspos("TS17",1,"TS16",0.,0.,0.,0,"ONLY");
793 gMC->Gspos("TS16",1,"TS15",0.,0.,0.,0,"ONLY");
1283eee5 794
79575d04 795 gMC->Gspos("TS15",1,"TICM ",0.,0.,0.,0,"ONLY");
796
1283eee5 797
79575d04 798 // TPc inner cont. vessel Joints
1283eee5 799
79575d04 800 dm[0]=60.2;
801 dm[1]=61.2;
802 dm[2]=0.5;
1283eee5 803
79575d04 804 gMC->Gsvolu("TPJ1","TUBE",idtmed[4],dm,3);
1283eee5 805
79575d04 806 gMC->Gspos("TPJ1",1,"TPC ",0.,0.,72.3,0,"ONLY");
807 gMC->Gspos("TPJ1",2,"TPC ",0.,0.,-72.3,0,"ONLY");
1283eee5 808
79575d04 809 //
1283eee5 810
79575d04 811 dm[0]=0.;
812 dm[1]=360.;
813 dm[2]=4.;
1283eee5 814
79575d04 815 //
37831078 816
79575d04 817 dm[3]=70.8;
818 dm[4]=58.4;
819 dm[5]=60.1;
37831078 820
79575d04 821 //
37831078 822
79575d04 823 dm[6]=71.2;
824 dm[7]=58.4;
825 dm[8]=60.1;
37831078 826
79575d04 827 //
37831078 828
79575d04 829 dm[9]=71.2;
830 dm[10]=58.4;
831 dm[11]=59.4;
37831078 832
79575d04 833 //
37831078 834
79575d04 835 dm[12]=71.6;
836 dm[13]=58.4;
837 dm[14]=59.4;
37831078 838
79575d04 839 gMC->Gsvolu("TPJ2","PCON",idtmed[4],dm,15);
37831078 840
79575d04 841 gMC->Gspos("TPJ2",1,"TPC ",0.,0.,0.,0,"ONLY");
842 gMC->Gspos("TPJ2",2,"TPC ",0.,0.,0.,idrotm[nRotMat],"ONLY");
37831078 843
37831078 844
37831078 845
79575d04 846 // Tpc Inner Containment vessel Seal (Viton, I use Lexan for a time being)
37831078 847
79575d04 848 dm[0]=58.4;
849 dm[1]=61.2;
850 dm[2]=0.1;
37831078 851
79575d04 852 gMC->Gsvolu("TICS","TUBE",idtmed[14],dm,3);
37831078 853
79575d04 854 gMC->Gspos("TICS",1,"TPC ",0.,0.,71.7,0,"ONLY");
855 gMC->Gspos("TICS",2,"TPC ",0.,0.,-71.7,0,"ONLY");
37831078 856
79575d04 857 // TICM -> TPC
37831078 858
79575d04 859 gMC->Gspos("TICM",1,"TPC ",0.,0.,0.,0,"ONLY");
37831078 860
79575d04 861 //
1283eee5 862
79575d04 863 nRotMat++; // prepare for the next rotation matrix
1283eee5 864
1283eee5 865 //---------------------------------------------------------
37831078 866 // Tpc Dift Gas volume Nonsensitive (Ne-CO2 90/10)
867 // and its daughters (HV membrane, rods, readout chambers)
1283eee5 868 //---------------------------------------------------------
869
37831078 870 dm[0]= 79.2;
871 dm[1]= 258.0;
872 dm[2]= 253.6;
873
79575d04 874 gMC->Gsvolu("TDGN","TUBE",idtmed[1],dm,3);
37831078 875
79575d04 876 // sector opening angles
37831078 877
878 Float_t innerOpenAngle = fTPCParam->GetInnerAngle();
879 Float_t outerOpenAngle = fTPCParam->GetOuterAngle();
880
881 // sector angle shift
882
883 Float_t innerAngleShift = fTPCParam->GetInnerAngleShift();
884
79575d04 885
37831078 886 // All above parameters are identical for inner and outer
887 // sectors. The distinction is kept for the historical reasons
888 // and eventually will disappear.
889
890 Float_t tanAlpha = TMath::Tan(0.5*innerOpenAngle);
891 Float_t cosAlpha = TMath::Sqrt(1.+tanAlpha*tanAlpha);
892 Float_t space;
893
894 //-------------------------------------------------------------------------
895 // Tpc Inner Readout Chambers
896 //-------------------------------------------------------------------------
897
898 dm[0]= 14.483;
899 dm[1]= 23.3345;
900 dm[2]= 1.6; // thickness
901 dm[3]= 25.1;
902
903 gMC->Gsvolu("TIRC","TRD1",idtmed[4],dm,4);
904
905 // this volume will be positioned in the empty space
906 // of the end-cap to avoid overlaps
907
908 dm[0]= 13.7305;
909 dm[1]= 21.1895;
910 dm[2]= 2.25;
911 dm[3]= 21.15;
912
913 gMC->Gsvolu("TIC1","TRD1",idtmed[4],dm,4);
914
79575d04 915
37831078 916 //------------------------------------------------
917 // Tpc Inner readout chamber Pad Plane
918 //------------------------------------------------
919
920 dm[0]= 14.483;
921 dm[1]= 23.3345;
922 dm[2]= 0.5;
923 dm[3]= 25.1;
924
925 gMC->Gsvolu("TIPP","TRD1",idtmed[12],dm,4);
926
927 //
928
929 dm[0] -= 1.218511934;
930 dm[1] -= 1.218511934;
931 dm[2] = 0.35;
1283eee5 932
37831078 933 gMC->Gsvolu("TIC3","TRD1",idtmed[1],dm,4);
1283eee5 934
37831078 935 gMC->Gspos("TIC3",1,"TIPP",0.,0.15,0.,0,"ONLY");
1283eee5 936
37831078 937 gMC->Gspos("TIPP",1,"TIRC",0.,1.1,0.,0,"ONLY");
1283eee5 938
79575d04 939
37831078 940 //----------------------------------------------
941 // Tpc Readout Chambers Empty spaces - for both
942 // inner and outer sectors
943 //----------------------------------------------
1283eee5 944
37831078 945 gMC->Gsvolu("TRCE","TRD1",idtmed[0],dm,0);
1283eee5 946
37831078 947 // Inner sector - 4 spaces
1283eee5 948
1283eee5 949
37831078 950 dm[3] = 4.7625;
951 dm[0] = 12.472;
1283eee5 952
37831078 953 Float_t rr = 90.52;
954 Float_t zz;
1283eee5 955
37831078 956 zz= -12.7875;
957
958 space = rr*tanAlpha-dm[0];
959
960 for(Int_t nsLow=0;nsLow<4;nsLow++){
961
962 rr += 9.525;
963 dm[1]= rr*tanAlpha - space;
964
965 dm[2]=0.8;
966
967 gMC->Gsposp("TRCE",nsLow+1,"TIRC",0.,-0.8,zz,0,"ONLY",dm,4);
968
969 //
1283eee5 970
79575d04 971 dm[2] = 1.2;
1283eee5 972
37831078 973 gMC->Gsposp("TRCE",nsLow+5,"TIC1",0.,1.05,zz-2.1,0,"ONLY",dm,4);
974
975 rr += 0.4;
976 dm[0] = rr*tanAlpha - space;
977 zz += (0.4+9.525);
1283eee5 978
979 }
980
37831078 981 dm[0]= 12.472;
982 // dm[1] - this is the dm[1] from the previous TRCE
983 dm[2]= 1.05;
984 dm[3]= 19.65;
1283eee5 985
79575d04 986 gMC->Gsposp("TRCE",9,"TIC1",0.,-1.2,0.,0,"ONLY",dm,4);
1283eee5 987
37831078 988 //
989 // TPc Space for Connectors
990 //
1283eee5 991
37831078 992 dm[0]= .3;
993 dm[1]= .3;
994 dm[2]= 4.5;
1283eee5 995
37831078 996 gMC->Gsvolu("TPSC","BOX ",idtmed[0],dm,3);
1283eee5 997
37831078 998 // TPC Connectors
1283eee5 999
37831078 1000 dm[0]= .25;
1001 dm[1]= .15;
1002 dm[2]= 3.75;
1283eee5 1003
37831078 1004 gMC->Gsvolu("TPCC","BOX ",idtmed[13],dm,3);
1283eee5 1005
37831078 1006 gMC->Gspos("TPCC",1,"TPSC",0.,0.15,0.,0,"ONLY");
1283eee5 1007
37831078 1008 zz = -12.7875;
1283eee5 1009
79575d04 1010
37831078 1011 Float_t alpha;
1012 Float_t astep;
1283eee5 1013
37831078 1014 // inner part of the inner sector - 2 x 20 holes
1015
1016 astep = 20.00096874/19.;
1017
1018 alpha = 10.00048437-astep;
1019
1020 Float_t x1,x2;
1021
1022 x1 = 13.31175725;
1023 x1 -= 0.996357832;
1024
1025 x2 = 15.06180253;
1026 x2 -= 1.163028812;
1027
1028 Int_t ncon;
1029
1030 for(ncon=0;ncon<20;ncon++){
1031
1032 phi1 = 0.;
1033 theta1 = 90.+alpha;
1034 phi2=90.;
1035 theta2 = 90.;
1036 phi3 = (alpha>0) ? 0. : 180.;
1037 theta3 = TMath::Abs(alpha);
1038
1039 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1040
1041
1283eee5 1042
37831078 1043 gMC->Gspos("TPSC",ncon+1,"TIRC",x1,0.3,-12.7875,idrotm[nRotMat],"ONLY");
1044 gMC->Gspos("TPSC",ncon+21,"TIRC",x2,0.3,-2.8625,idrotm[nRotMat],"ONLY");
1045
1046
1047 x1 -= 1.296357833;
1048 x2 -= 1.463028812;
1049
1050 alpha -= astep;
1051 nRotMat++;
1052
1053 }
1054
1055 // outer part of the inner sector - 2 x 25 holes
1056
1057 astep = 20.00096874/24.;
1058 alpha = 10.00048437-astep;
1059
1060 x1 = 16.81184781;
1061 x1 -= 1.016295986;
1062
1063 x2 = 18.5618931;
1064 x2 -= 1.150914854;
1065
1066 for(ncon=0;ncon<25;ncon++){
1067
1068 phi1 = 0.;
1069 theta1 = 90.+alpha;
1070 phi2=90.;
1071 theta2 = 90.;
1072 phi3 = (alpha>0) ? 0. : 180.;
1073 theta3 = TMath::Abs(alpha);
1074
1075 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1076
1077
1078
1079 gMC->Gspos("TPSC",ncon+41,"TIRC",x1,0.3,7.0625,idrotm[nRotMat],"ONLY");
1080 gMC->Gspos("TPSC",ncon+66,"TIRC",x2,0.3,16.9875,idrotm[nRotMat],"ONLY");
1081
1082
1083 x1 -= 1.316295986;
1084 x2 -= 1.450914854;
1085
1086 alpha -= astep;
1087 nRotMat++;
1283eee5 1088
1089 }
37831078 1090
1091 //--------------------------------------------------------------------------
1092 // TPC Outer Readout Chambers
1093 // this is NOT a final design
1094 //--------------------------------------------------------------------------
1095
1096 dm[0]= 23.3875;
1097 dm[1]= 43.524;
1098 dm[2]= 1.5; //thickness
1099 dm[3]= 57.1;
1100
1101 gMC->Gsvolu("TORC","TRD1",idtmed[4],dm,4);
1102
1103 //------------------------------------------------
1104 // Tpc Outer readout chamber Pad Plane
1105 //------------------------------------------------
1106
1107 dm[2]= 0.5;
1108
1109 gMC->Gsvolu("TOPP","TRD1",idtmed[12],dm,4);
1110
1111 dm[0] -= 1.218511934;
1112 dm[1] -= 1.218511934;
1113 dm[2] = 0.35;
1114
1115 gMC->Gsvolu("TOC3","TRD1",idtmed[1],dm,4);
1116
1117 gMC->Gspos("TOC3",1,"TOPP",0.,0.15,0.,0,"ONLY");
1118
1119 gMC->Gspos("TOPP",1,"TORC",0.,1.0,0.,0,"ONLY");
1120
1121 // empty space
1122
37831078 1123 dm[0]= 21.035;
1124 dm[1]= 38.7205;
1125 dm[2]= 0.7;
1126 dm[3]= 50.15;
1127
1128 gMC->Gsposp("TRCE",10,"TORC",0.,-0.8,-2.15,0,"ONLY",dm,4);
1129
1130 dm[0]= 22.2935;
1131 dm[1]= 40.5085;
1132 dm[2]= 2.25;
1133 dm[3]= 51.65;
1134
1135 gMC->Gsvolu("TOC1","TRD1",idtmed[4],dm,4);
1136
1137 dm[0]= 21.35;
1138 dm[1]= 38.7205;
1139 dm[2]= 2.25;
1140 dm[3]= 50.15;
1141
79575d04 1142 gMC->Gsposp("TRCE",11,"TOC1",0.,0.,0.,0,"ONLY",dm,4);
37831078 1143
1144 //-----------------------------------------------
1145 // Tpc Services Support Wheel
1146 //-----------------------------------------------
1147
1148 dm[0]=0.;
1149 dm[1]=360.;
1150 dm[2]=18.;
1151 dm[3]=2.;
1152
1153 dm[4]= -5.;
1154 dm[5]= 77.017;
1155 dm[6]= 255.267;
1156
1157 dm[7]= 5.;
1158 dm[8]= dm[5];
1159 dm[9]= dm[6];
1160
1161 gMC->Gsvolu("TSSW","PGON",idtmed[4],dm,10);
1162
1163 // Tpc Services Wheel Cover
1164
1165 dm[4]= -0.5;
1166 dm[7]= 0.5;
1167
1168 gMC->Gsvolu("TSWC","PGON",idtmed[4],dm,10);
1169
1170 // Tpc Service wheel Cover Empty space
1171
1172 dm[0]= 10.99;
1173 dm[1]= 39.599;
1174 dm[2]= .5;
1175 dm[3]= 81.125;
1176
1177 gMC->Gsvolu("TSCE","TRD1",idtmed[0],dm,4);
1178
1179 // Tpc services Wheel Empty Spaces
1180
1181 dm[0]= 13.18017507;
1182 dm[1]= 44.61045938;
1183 dm[2]= 4.;
1184 dm[3]= 89.125;
1185
1186 gMC->Gsvolu("TWES","TRD1",idtmed[0],dm,4);
1187
1188 // Tpc Services Wheel Bars
1189
1190 gMC->Gsvolu("TSWB","TRD1",idtmed[4],dm,0);
1191
1192 // bars-> TWES
1193
1194 dm[2]= 4.;
1195 dm[3]= .4;
1196
1197 dm[0]= 13.8149522;
1198 dm[1]= 13.95601379;
1283eee5 1199
37831078 1200 gMC->Gsposp("TSWB",1,"TWES",0.,0.,-85.125,0,"ONLY",dm,4);
1201
1202 dm[0]= 43.83462067;
1203 dm[1]= 43.97568225;
1204
1205 gMC->Gsposp("TSWB",2,"TWES",0.,0.,85.125,0,"ONLY",dm,4);
1206
1207 // TPc ELectronics - right now 30% X0 Si
1283eee5 1208
37831078 1209 dm[0]= 14.03813696;
1210 dm[1]= 43.3524075;
1211 dm[2]= 1.404;
1212 dm[3]= 83.125;
1213
1214 gMC->Gsvolu("TPEL","TRD1",idtmed[11],dm,4);
1215 gMC->Gspos("TPEL",1,"TWES",0.,0.,0.,0,"ONLY");
1216
1217 //--------------------------------------------------------------------------
1218 // End caps
1219 //--------------------------------------------------------------------------
1220
1221 // TPc Main Wheel - Al
1222
79575d04 1223 dm[0]= 74.9;
1224 dm[1]= 264.4;
37831078 1225 dm[2]= 3.0;
1226
1227 gMC->Gsvolu("TPMW","TUBE",idtmed[4],dm,3);
1228
37831078 1229 //--------------------------------------------------------------------------
1230 // Tpc Empty Space for the Readout chambers
1231 //--------------------------------------------------------------------------
1232
1233 Float_t rLow= 86.2;
1234 Float_t rUp= 243.5;
1235 Float_t dR = 0.5*(rUp-rLow);
1236
79575d04 1237 space= 1.5/cosAlpha; // wheel ribs are 3.0 cm wide
37831078 1238
1239 dm[0]= rLow*tanAlpha-space;
1240 dm[1]= rUp*tanAlpha-space;
79575d04 1241 dm[2] = 3.0;
37831078 1242 dm[3]= dR;
1243
1244 gMC->Gsvolu("TESR","TRD1",idtmed[0],dm,4);
1245
1246 // TIC1->TESR
1247
37831078 1248 gMC->Gspos("TIC1",1,"TESR",0.,0.75,-dR+23.97,0,"ONLY");
1249
37831078 1250 // TOC1->TESR
1251
1252 gMC->Gspos("TOC1",1,"TESR",0.,0.75,dR-55.02,0,"ONLY");
1253
1254 // Tpc Empty Space Bars - Al (daughters of TESR)
1255
1256 Float_t zBar;
1257
1258 gMC->Gsvolu("TESB","TRD1",idtmed[4],dm,0);
1259
1260 // lower bar
1261
1262 dm[0]= rLow*tanAlpha-space;
1263 dm[1]= 88.7*tanAlpha-space;
79575d04 1264 dm[2]= 2.25;
37831078 1265 dm[3]= 1.275;
1266
1267 zBar = -dR+dm[3];
1268
79575d04 1269 gMC->Gsposp("TESB",1,"TESR",0.,0.75,zBar,0,"ONLY",dm,4);
37831078 1270
1271 // middle bar
1272
1273 dm[0]= 131.65*tanAlpha-space;
1274 dm[1]= 136.5*tanAlpha-space;
1275 dm[3]= 2.425;
1276
1277 zBar = -dR +131.65+dm[3]-rLow;
1278
79575d04 1279 gMC->Gsposp("TESB",2,"TESR",0.,0.75,zBar,0,"ONLY",dm,4);
37831078 1280
1281 // upper bar
1282
1283 dm[0]= 240.4*tanAlpha-space;
1284 dm[1]= rUp*tanAlpha-space;
1285 dm[3]= 1.55;
1286
1287 zBar = dR-dm[3];
1288
79575d04 1289 gMC->Gsposp("TESB",3,"TESR",0.,0.75,zBar,0,"ONLY",dm,4);
37831078 1290
1291 //------------------------------------------------------
1292 // TPc Lower "S" Sectors
1293 //------------------------------------------------------
1294
1295
1296 Float_t inSecLowEdge = fTPCParam->GetInnerRadiusLow();
1297 Float_t inSecUpEdge = fTPCParam->GetInnerRadiusUp();
1298
1299 dm[0] = inSecLowEdge*TMath::Tan(0.5*innerOpenAngle)-0.01;
1300 dm[1] = inSecUpEdge*TMath::Tan(0.5*innerOpenAngle)-0.01;
79575d04 1301 dm[2] = 0.5*(250. - 5.e-3);
37831078 1302 dm[3] = 0.5*(inSecUpEdge-inSecLowEdge);
1303
1304 gMC->Gsvolu("TPLS", "TRD1", idtmed[2], dm, 4); // sensitive
1305
79575d04 1306
37831078 1307 //----------------------------------------------------------
1308 // TPc Upper Sectors
1309 //----------------------------------------------------------
1310
1311 Float_t ouSecLowEdge = fTPCParam->GetOuterRadiusLow();
1312 Float_t ouSecUpEdge = fTPCParam->GetOuterRadiusUp();
1313
1314 dm[0] = ouSecLowEdge*TMath::Tan(0.5*outerOpenAngle)-0.01;
1315 dm[1] = ouSecUpEdge*TMath::Tan(0.5*outerOpenAngle)-0.01;
79575d04 1316 dm[2] = 0.5*(250. - 5.e-3);
37831078 1317 dm[3] = 0.5*(ouSecUpEdge-ouSecLowEdge);
1318
1319 gMC->Gsvolu("TPUS", "TRD1", idtmed[2], dm, 4); // sensitive
1320
1321
37831078 1322
79575d04 1323 // sensitive strips
37831078 1324
1325 gMC->Gsvolu("TPSS","TRD1",idtmed[2],dm,0); // sensitive
1326
1327 Int_t nofStrips,nstr;
1328 Float_t r1,r2,zs;
1329 Float_t stripThick = 0.01; // 100 microns
1330 Float_t deadSpace;
1331
1332 // inner sector
1333
d4c354b9 1334
1335 // if all lower sectors selected define only 1 strip
1336
1337 nofStrips=((fSecAL <0)||(fSecAL>=0 && fSens<0)) ? 1 : fTPCParam->GetNRowLow();
37831078 1338 deadSpace = fTPCParam->GetInnerWireMount();
1339
79575d04 1340 dm[2] = 0.5*(250. - 5.e-3);
1341 dm[3] = 0.5 * stripThick;
d4c354b9 1342
37831078 1343 for(nstr=0;nstr<nofStrips;nstr++){
1344
1345 r1 = fTPCParam->GetPadRowRadiiLow(nstr);
1346 r2 = r1 + stripThick;
1347 dm[0] = r1 * TMath::Tan(0.5*innerOpenAngle) - deadSpace;
1348 dm[1] = r2 * TMath::Tan(0.5*innerOpenAngle) - deadSpace;
1349 zs = -inSecLowEdge -0.5*(inSecUpEdge-inSecLowEdge);
1350 zs += r1;
1351 zs += dm[3];
1352
1353 gMC->Gsposp("TPSS", nstr+1, "TPLS", 0., 0., zs, 0, "ONLY", dm, 4);
1354
37831078 1355
1356 }
1357
d4c354b9 1358 // strips only if several upper sectors selected end fSens > 0
1359
1360 if(fSecAU >=0 && fSens >0){
1361
37831078 1362 Int_t nsSave = nofStrips;
1363
1364 // outer sector
1365
1366 nofStrips = fTPCParam->GetNRowUp();
1367 deadSpace = fTPCParam->GetOuterWireMount();
1368
79575d04 1369 dm[2] = 0.5*(250. - 5.e-3);
37831078 1370 dm[3] = 0.5 * stripThick;
d4c354b9 1371
1283eee5 1372
37831078 1373 for(nstr=0;nstr<nofStrips;nstr++){
1374
1375 r1 = fTPCParam->GetPadRowRadiiUp(nstr);
1376 r2 = r1 + stripThick;
1377 dm[0] = r1 * TMath::Tan(0.5*outerOpenAngle) - deadSpace;
1378 dm[1] = r2 * TMath::Tan(0.5*outerOpenAngle) - deadSpace;
1379 zs = -ouSecLowEdge -0.5*(ouSecUpEdge-ouSecLowEdge);
1380 zs += r1;
1381 zs += dm[3];
1382
1383 gMC->Gsposp("TPSS", nstr+1+nsSave, "TPUS", 0., 0., zs, 0, "ONLY", dm, 4);
1384
1385 }
79575d04 1386 }
1387
37831078 1388
1389 //-------------------------------------------------------
1390 // positioning of the empty spaces into the main wheel
1391 // and readout chambers and sectors into the drift gas
1392 //-------------------------------------------------------
1393
1394 Float_t rCenter,xc,yc;
1395 Float_t rInner,rOuter; // center of the inner and outer chamber
1396
1397 rCenter = rLow+dR;
1398
1399 rInner = 108.07;
1400 rOuter = 190.68;
1401
79575d04 1402
37831078 1403 for(Int_t ns=0; ns<nInnerSector;ns++){
1404
1405 phi1 = ns * innerOpenAngle + innerAngleShift;
1406 phi1 *= kRaddeg; // in degrees
1407
1408 phi1 = (Float_t)TMath::Nint(phi1) + 270.;
1409
1410 if (phi1 > 360.) phi1 -= 360.;
1411
1412 theta1 = 90.;
1413 phi2 = 90.;
1414 theta2 = 180.;
1415 phi3 = ns * innerOpenAngle + innerAngleShift;
1416 phi3 *= kRaddeg; // in degrees
1417
1418 phi3 = (Float_t)TMath::Nint(phi3);
1419
1420 if(phi3 > 360.) phi3 -= 360.;
1421
1422 theta3 = 90.;
1423
1424 // "holes"->End plate
1425
1426 xc = rCenter*TMath::Cos(phi3*kDegrad);
1427 yc = rCenter*TMath::Sin(phi3*kDegrad);
1428
1429 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1430
1431 gMC->Gspos("TESR",ns+1,"TPMW",xc,yc,0.,idrotm[nRotMat],"ONLY");
1432
1433 // TSCE->TSWC (services wheel volumes)
1434
1435 xc = 166.142*TMath::Cos(phi3*kDegrad);
1436 yc = 166.142*TMath::Sin(phi3*kDegrad);
1437
1438 gMC->Gspos("TSCE",ns+1,"TSWC",xc,yc,0.,idrotm[nRotMat],"ONLY");
1439 gMC->Gspos("TWES",ns+1,"TSSW",xc,yc,0.,idrotm[nRotMat],"ONLY");
1440
79575d04 1441
37831078 1442 // readout chambers->TDGN (drift gas)
1443
1444 xc = rInner*TMath::Cos(phi3*kDegrad);
1445 yc = rInner*TMath::Sin(phi3*kDegrad);
1446
1447 gMC->Gspos("TIRC",ns+1,"TDGN",xc,yc,252.,idrotm[nRotMat],"ONLY");
1448
1449 // here lower sectors
1450
1451 if(fSecAL <0){
1452
1453 // all lower sectors are positioned
1454
79575d04 1455 gMC->Gspos("TPLS",ns+1,"TDGN",xc,yc,125.0025,idrotm[nRotMat],"ONLY");
37831078 1456 gMC->
79575d04 1457 Gspos("TPLS",ns+nInnerSector+1,"TDGN",xc,yc,-125.0025,idrotm[nRotMat],"ONLY");
37831078 1458 }
1459 else{
1460
1461 // only selected sectors are positioned (up to 6 sectors)
1462
1463 for(Int_t sel=0;sel<6;sel++){
1464
1465 if(fSecLows[sel] == ns){
79575d04 1466 gMC->Gspos("TPLS",ns+1,"TDGN",xc,yc,125.0025,idrotm[nRotMat],"ONLY");
37831078 1467 }
1468 else if(fSecLows[sel] == ns+nInnerSector){
1469 gMC->
79575d04 1470 Gspos("TPLS",ns+nInnerSector+1,"TDGN",xc,yc,-125.0025,idrotm[nRotMat],"ONLY");
37831078 1471 }
1472 }
1473 } // lower sectors finished
79575d04 1474
1475
37831078 1476 xc = rOuter*TMath::Cos(phi3*kDegrad);
1477 yc = rOuter*TMath::Sin(phi3*kDegrad);
1478
1479 gMC->Gspos("TORC",ns+1,"TDGN",xc,yc,252.1,idrotm[nRotMat],"ONLY");
1480
1481 // here upper sectors
1482
1483 if(fSecAU <0){
1484
1485 // all upper sectors
1486
79575d04 1487 gMC->Gspos("TPUS",ns+1,"TDGN",xc,yc,125.0025,idrotm[nRotMat],"ONLY");
37831078 1488 gMC->
79575d04 1489 Gspos("TPUS",ns+nOuterSector+1,"TDGN",xc,yc,-125.0025,idrotm[nRotMat],"ONLY");
37831078 1490 }
1491 else{
1492
1493 // only selected sectors (up to 12)
1494
1495 for(Int_t sel=0;sel<12;sel++){
1496 if(fSecUps[sel] == ns+2*nInnerSector){
79575d04 1497 gMC->Gspos("TPUS",ns+1,"TDGN",xc,yc,125.0025,idrotm[nRotMat],"ONLY");
37831078 1498 }
1499 else if(fSecUps[sel] == ns+2*nInnerSector+nOuterSector){
1500 gMC->
79575d04 1501 Gspos("TPUS",ns+nOuterSector+1,"TDGN",xc,yc,-125.0025,idrotm[nRotMat],"ONLY");
37831078 1502 }
1503 }
1504 } // upper sectors finished
1505
79575d04 1506
37831078 1507 nRotMat++;
1508
79575d04 1509 theta2 = 0.; // reflection
37831078 1510
1511 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
1512
1513 xc = rInner*TMath::Cos(phi3*kDegrad);
1514 yc = rInner*TMath::Sin(phi3*kDegrad);
1515
1516 gMC->Gspos("TIRC",ns+nInnerSector+1,"TDGN",xc,yc,-252.,idrotm[nRotMat],"ONLY");
1517
1518 xc = rOuter*TMath::Cos(phi3*kDegrad);
1519 yc = rOuter*TMath::Sin(phi3*kDegrad);
1520
1521 gMC->Gspos("TORC",ns+nOuterSector+1,"TDGN",xc,yc,-252.1,idrotm[nRotMat],"ONLY");
1522
1523 nRotMat++;
1524
37831078 1525 }
37831078 1526 // TPMW->TPC
1283eee5 1527
37831078 1528 gMC->Gspos("TPMW",1,"TPC ",0.,0.,256.6,0,"ONLY");
79575d04 1529 gMC->Gspos("TPMW",2,"TPC ",0.,0.,-256.6,idrotm[0],"ONLY");
1283eee5 1530
79575d04 1531 //---------------------------------------------------------
1532 // Tpc High Voltage Membrane - 100 microns of mylar
1533 //---------------------------------------------------------
1283eee5 1534
79575d04 1535 dm[0]=82.8;
1536 dm[1]=252.;
1537 dm[2]=0.005;
1283eee5 1538
79575d04 1539 gMC->Gsvolu("THVM","TUBE",idtmed[8],dm,3);
1283eee5 1540
79575d04 1541 gMC->Gspos("THVM",1,"TDGN",0.,0.,0.,0,"ONLY");
1283eee5 1542
79575d04 1543 // Tpc High Voltage membrane Holders
1283eee5 1544
79575d04 1545 gMC->Gsvolu("THVH","TUBE",idtmed[4],dm,0);
37831078 1546
79575d04 1547
37831078 1548
79575d04 1549 // inner
1283eee5 1550
79575d04 1551 dm[0]=79.3;
1552 dm[1]=82.8;
1553 dm[2]=0.2;
1283eee5 1554
79575d04 1555 gMC->Gsposp("THVH",1,"TDGN",0.,0.,0.,0,"ONLY",dm,3);
1556
1557 // outer
1558
1559 dm[0]= 252.;
1560 dm[1]= 257.9;
1561 dm[2]= 0.4;
1562
1563 gMC->Gsposp("THVH",2,"TDGN",0.,0.,0.,0,"ONLY",dm,3);
1283eee5 1564
37831078 1565 //----------------------------------------------------------
1566 // TPc Support Rods - MAKROLON
1567 //----------------------------------------------------------
1283eee5 1568
37831078 1569 dm[0]= 0.9;
1570 dm[1]= 1.2;
1283eee5 1571
79575d04 1572 gMC->Gsvolu("TPSR","TUBE",idtmed[7],dm,0); // inner and outer rods differ
1283eee5 1573
79575d04 1574
1575 for(Int_t nrod=0;nrod<18;nrod++){
37831078 1576 Float_t angle=innerOpenAngle*(Float_t)nrod;
1283eee5 1577
79575d04 1578 xc=81.5*TMath::Cos(angle);
1579 yc=81.5*TMath::Sin(angle);
1580
1581 dm[2]=126.7;
1283eee5 1582
79575d04 1583 gMC->Gsposp("TPSR",nrod+1,"TDGN",xc,yc,126.9,0,"ONLY",dm,3);
1584 gMC->Gsposp("TPSR",nrod+19,"TDGN",xc,yc,-126.9,0,"ONLY",dm,3);
1283eee5 1585
79575d04 1586 dm[2]=126.6;
1283eee5 1587
79575d04 1588 xc=254.25*TMath::Cos(angle);
1589 yc=254.25*TMath::Sin(angle);
1590
1591 // rod number 54 contans the HV cable
1283eee5 1592
79575d04 1593 if(nrod<17) {
1594 gMC->Gsposp("TPSR",nrod+37,"TDGN",xc,yc,127.,0,"ONLY",dm,3);
1595 gMC->Gsposp("TPSR",nrod+54,"TDGN",xc,yc,-127.,0,"ONLY",dm,3);
1596 }
1597
37831078 1598 }
1283eee5 1599
37831078 1600 //----------------------------------------------------------
79575d04 1601 // Tpc High Voltage Rod - MAKROLON + Copper cable
37831078 1602 //----------------------------------------------------------
1603
1604 // rod with cable (Left)
1605
1606 dm[0]=0.;
1607 dm[1]=2.25;
79575d04 1608 dm[2]=126.6;
37831078 1609
1610 gMC->Gsvolu("THVL","TUBE",idtmed[7],dm,3);
1611
1612 // HV cable
1613
1614 dm[0]=0.;
1615 dm[1]=0.3;
79575d04 1616 dm[2]=126.6;
37831078 1617
79575d04 1618 gMC->Gsvolu("THVC","TUBE",idtmed[10],dm,3);
37831078 1619
1620 // empty space
1621
1622 dm[0]=0.3;
1623 dm[1]=1.;
79575d04 1624 dm[2]=126.6;
37831078 1625
1626 gMC->Gsvolu("THVE","TUBE",idtmed[1],dm,3);
1627
1628 gMC->Gspos("THVC",1,"THVL",0.,0.,0.,0,"ONLY");
1629 gMC->Gspos("THVE",1,"THVL",0.,0.,0.,0,"ONLY");
1630
1631 // rod without cable
1632
1633 dm[0]=1.8;
1634 dm[1]=2.25;
79575d04 1635 dm[2]=126.6;
37831078 1636
1637 gMC->Gsvolu("THVR","TUBE",idtmed[7],dm,3);
1638
79575d04 1639 gMC->Gspos("THVL",1,"TDGN",xc,yc,-127.,0,"ONLY");
1640 gMC->Gspos("THVR",1,"TDGN",xc,yc,127.,0,"ONLY");
37831078 1641
1642 gMC->Gspos("TDGN",1,"TPC ",0.,0.,0.,0,"ONLY");
79575d04 1643
37831078 1644 // services wheel cover -> wheel
1645
1646
1647 gMC->Gspos("TSWC",1,"TSSW",0.,0.,4.5,0,"ONLY");
1648 gMC->Gspos("TSWC",2,"TSSW",0.,0.,-4.5,0,"ONLY");
1649
1650
1651 // put the wheel into the TPC
1652
1653 gMC->Gspos("TSSW",1,"TPC ",0.,0.,278.7,0,"ONLY");
1654 gMC->Gspos("TSSW",2,"TPC ",0.,0.,-278.7,0,"ONLY");
1655
79575d04 1656 //
1657
37831078 1658 gMC->Gsord("TPMW",6);
79575d04 1659 gMC->Gsord("TSSW",6);
1660 gMC->Gsord("TSWC",6);
d4c354b9 1661 if(fSecAL >=0) gMC->Gsord("TPLS",3);
1662 if(fSecAU >=0 && fSens >0) gMC->Gsord("TPUS",3);
37831078 1663 gMC->Gsord("TDGN",6);
37831078 1664
1665 // put the TPC into ALIC (main mother volume)
1666
79575d04 1667 gMC->Gspos("TPC ",1,"ALIC",0.,0.,0.,0,"ONLY");
1668
1669
1283eee5 1670
1671} // end of function
fe4da5cc 1672
1673//_____________________________________________________________________________
8c555625 1674void AliTPCv2::DrawDetector()
fe4da5cc 1675{
1676 //
1677 // Draw a shaded view of the Time Projection Chamber version 1
1678 //
1679
fe4da5cc 1680 // Set everything unseen
cfce8870 1681 gMC->Gsatt("*", "seen", -1);
fe4da5cc 1682 //
1683 // Set ALIC mother transparent
cfce8870 1684 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 1685 //
1686 // Set the volumes visible
37831078 1687 //
1688
1689 gMC->Gsatt("TPC ","SEEN",0);
1690 gMC->Gsatt("TOIN","SEEN",1);
1691 gMC->Gsatt("TOIN","COLO",7);
37831078 1692 gMC->Gsatt("TOCV","SEEN",1);
1693 gMC->Gsatt("TOCV","COLO",4);
1694 gMC->Gsatt("TSA1","SEEN",0);
1695 gMC->Gsatt("TSA2","SEEN",0);
1696 gMC->Gsatt("TSA3","SEEN",0);
79575d04 1697 gMC->Gsatt("TSA4","SEEN",0);
1698 gMC->Gsatt("TSA5","SEEN",0);
37831078 1699 gMC->Gsatt("TOFC","SEEN",1);
1700 gMC->Gsatt("TOFC","COLO",4);
37831078 1701 gMC->Gsatt("TSA6","SEEN",0);
1702 gMC->Gsatt("TSA7","SEEN",0);
79575d04 1703 gMC->Gsatt("TSA8","SEEN",0);
37831078 1704 gMC->Gsatt("TIIN","SEEN",1);
79575d04 1705 gMC->Gsatt("TIIN","COLO",7);
1706 gMC->Gsatt("TII1","SEEN",0);
1707 gMC->Gsatt("TIFC","SEEN",1);
1708 gMC->Gsatt("TIFC","COLO",4);
1709 gMC->Gsatt("TSA9","SEEN",0);
37831078 1710 gMC->Gsatt("TS10","SEEN",0);
1711 gMC->Gsatt("TS11","SEEN",0);
1712 gMC->Gsatt("TS12","SEEN",0);
37831078 1713 gMC->Gsatt("TS13","SEEN",0);
1714 gMC->Gsatt("TS14","SEEN",0);
79575d04 1715 gMC->Gsatt("TICC","SEEN",0);
1716 gMC->Gsatt("TICM","SEEN",0);
37831078 1717 gMC->Gsatt("TS15","SEEN",0);
1718 gMC->Gsatt("TS16","SEEN",0);
37831078 1719 gMC->Gsatt("TS17","SEEN",0);
79575d04 1720 gMC->Gsatt("TS18","SEEN",0);
1721 gMC->Gsatt("TS19","SEEN",0);
1722 gMC->Gsatt("TPJ1","SEEN",0);
1723 gMC->Gsatt("TPJ2","SEEN",0);
1724 gMC->Gsatt("TICS","SEEN",0);
1725 gMC->Gsatt("TDGN","SEEN",0);
37831078 1726 gMC->Gsatt("TIRC","SEEN",0);
1727 gMC->Gsatt("TIC1","SEEN",1);
1728 gMC->Gsatt("TIPP","SEEN",0);
1729 gMC->Gsatt("TIC3","SEEN",0);
1730 gMC->Gsatt("TRCE","SEEN",0);
1731 gMC->Gsatt("TPSC","SEEN",0);
79575d04 1732 gMC->Gsatt("TPCC","SEEN",0);
37831078 1733 gMC->Gsatt("TORC","SEEN",0);
1734 gMC->Gsatt("TOPP","SEEN",0);
1735 gMC->Gsatt("TOC3","SEEN",0);
1736 gMC->Gsatt("TOC1","SEEN",1);
1737 gMC->Gsatt("TSSW","SEEN",1);
1738 gMC->Gsatt("TSWC","SEEN",1);
37831078 1739 gMC->Gsatt("TSSW","COLO",3);
1740 gMC->Gsatt("TSWC","COLO",3);
1741 gMC->Gsatt("TSCE","COLO",6);
79575d04 1742 gMC->Gsatt("TSCE","SEEN",1);
37831078 1743 gMC->Gsatt("TWES","SEEN",0);
1744 gMC->Gsatt("TSWB","SEEN",0);
1745 gMC->Gsatt("TPEL","SEEN",0);
1746 gMC->Gsatt("TPMW","SEEN",1);
37831078 1747 gMC->Gsatt("TESR","SEEN",1);
1748 gMC->Gsatt("TPMW","COLO",12);
37831078 1749 gMC->Gsatt("TIC1","COLO",5);
79575d04 1750 gMC->Gsatt("TOC1","COLO",5);
37831078 1751 gMC->Gsatt("TESB","SEEN",0);
37831078 1752 gMC->Gsatt("THVM","SEEN",1);
1753 gMC->Gsatt("THVM","COLO",11);
79575d04 1754 gMC->Gsatt("THVH","SEEN",0);
1755 gMC->Gsatt("TPSR","SEEN",0);
37831078 1756 gMC->Gsatt("THVL","SEEN",0);
79575d04 1757 gMC->Gsatt("THVC","SEEN",0);
37831078 1758 gMC->Gsatt("THVE","SEEN",0);
1759 gMC->Gsatt("THVR","SEEN",0);
79575d04 1760 gMC->Gsatt("TPSS","SEEN",0);
1761 gMC->Gsatt("TPUS","SEEN",0);
1762 gMC->Gsatt("TPLS","SEEN",0);
37831078 1763
fe4da5cc 1764 //
cfce8870 1765 gMC->Gdopt("hide", "on");
1766 gMC->Gdopt("shad", "on");
1767 gMC->Gsatt("*", "fill", 7);
1768 gMC->SetClipBox(".");
37831078 1769 gMC->SetClipBox("TPMW",-300,300,-300,300,254.,270.);
1770 gMC->SetClipBox("TESR",-300,300,-300,300,254.,270.);
1771 gMC->SetClipBox("TSSW",-300,300,-300,300,283.,284.);
1772 gMC->SetClipBox("TSWC",-300,300,-300,300,283.,284.);
1773 gMC->SetClipBox("*", 0, 300, -300, 300, -290, 290);
cfce8870 1774 gMC->DefaultRange();
1775 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
1776 gMC->Gdhead(1111, "Time Projection Chamber");
1777 gMC->Gdman(18, 4, "MAN");
1778 gMC->Gdopt("hide","off");
fe4da5cc 1779}
1780
1781//_____________________________________________________________________________
1782void AliTPCv2::CreateMaterials()
1783{
1784 //
1785 // Define materials for version 2 of the Time Projection Chamber
1786 //
37831078 1787
fe4da5cc 1788 AliTPC::CreateMaterials();
1789}
1790
1791//_____________________________________________________________________________
1792void AliTPCv2::Init()
1793{
1794 //
1795 // Initialises version 2 of the TPC after that it has been built
1796 //
37831078 1797
1798 Int_t *idtmed = fIdtmed->GetArray();
1799
fe4da5cc 1800 AliTPC::Init();
d4c354b9 1801
1802
1803
1804 fIdSens=gMC->VolId("TPSS");
1805
1806 fIdLSec=gMC->VolId("TPLS"); // lower sector
37831078 1807 fIdUSec=gMC->VolId("TPUS"); // upper sector
fe4da5cc 1808
cfce8870 1809 gMC->SetMaxNStep(30000); // max. number of steps increased
fe4da5cc 1810
37831078 1811 gMC->Gstpar(idtmed[2],"LOSS",5); // specific energy loss
fe4da5cc 1812
9e1a0ddb 1813 printf("%s: *** TPC version 2 initialized ***\n",ClassName());
1814 printf("%s: Maximum number of steps = %d\n",ClassName(),gMC->GetMaxNStep());
fe4da5cc 1815
1816 //
1817
1818}
1819
1820//_____________________________________________________________________________
1821void AliTPCv2::StepManager()
1822{
1823 //
1824 // Called for every step in the Time Projection Chamber
1825 //
1826
1827 //
1828 // parameters used for the energy loss calculations
1829 //
73042f01 1830 const Float_t kprim = 14.35; // number of primary collisions per 1 cm
1831 const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2
1832 const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation
fe4da5cc 1833
1834
73042f01 1835 const Float_t kbig = 1.e10;
fe4da5cc 1836
1837 Int_t id,copy;
1838 Float_t hits[4];
1839 Int_t vol[2];
37831078 1840 TLorentzVector p;
fe4da5cc 1841
37831078 1842 vol[1]=0; // preset row number to 0
fe4da5cc 1843
1844 //
1845
73042f01 1846 gMC->SetMaxStep(kbig);
fe4da5cc 1847
0a6d8768 1848 if(!gMC->IsTrackAlive()) return; // particle has disappeared
fe4da5cc 1849
cfce8870 1850 Float_t charge = gMC->TrackCharge();
fe4da5cc 1851
1852 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1853
37831078 1854 // check the sensitive volume
1855
1856 id = gMC->CurrentVolID(copy); // current volume Id
1857
2d74ba4f 1858 if ( (gMC->IsTrackEntering() || gMC->IsTrackExiting()) &&
1859 ((id == fIdLSec) || (id == fIdUSec)) ) {
da33556f 1860
642f15cf 1861 AddTrackReference(gAlice->GetCurrentTrackNumber());
da33556f 1862 }
1863
37831078 1864 if(id == fIdLSec){
1865 vol[0] = copy-1; // lower sector number
1866 }
1867 else if(id == fIdUSec){
1868 vol[0] = copy+fTPCParam->GetNInnerSector()-1; // upper sector number
1869 }
1870 else if(id == fIdSens && gMC->IsTrackEntering()){
1871
1872 // track is entering the sensitive strip
1873
1874 vol[1]= copy-1; // row number (absolute)
1875
1876 // sector type
1877
1878 id = gMC->CurrentVolOffID(1,copy);
1879
1880 if(id == fIdLSec){
1881
1882 // lower sector
1883
1884 vol[0] = copy-1; // sector number
1885
fe4da5cc 1886 }
37831078 1887 else {
1888
1889 // upper sector
1890
1891 vol[0] = copy-1+fTPCParam->GetNInnerSector(); // sector number
6a905708 1892 vol[1] -= fTPCParam->GetNRowLow(); // row number (starts also from 0)
37831078 1893
1894 }
1895
1896 if(vol[1] == 0){
1897
1898 // because Jouri wants to have this
1899
1900 gMC->TrackMomentum(p);
1901 hits[0]=p[0];
1902 hits[1]=p[1];
1903 hits[2]=p[2];
fe4da5cc 1904 hits[3]=0.; // this hit has no energy loss
642f15cf 1905 // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
6a905708 1906
642f15cf 1907 AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); //MI change
37831078 1908
930ee558 1909 }
37831078 1910
930ee558 1911 gMC->TrackPosition(p);
1912 hits[0]=p[0];
1913 hits[1]=p[1];
1914 hits[2]=p[2];
1915 hits[3]=0.; // this hit has no energy loss
642f15cf 1916 // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
6a905708 1917
642f15cf 1918 AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); //MI change
930ee558 1919
37831078 1920 }
fe4da5cc 1921 else return;
37831078 1922
1923 //-----------------------------------------------------------------
fe4da5cc 1924 // charged particle is in the sensitive volume
37831078 1925 //-----------------------------------------------------------------
fe4da5cc 1926
cfce8870 1927 if(gMC->TrackStep() > 0) {
fe4da5cc 1928
73042f01 1929 Int_t nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
fe4da5cc 1930 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
1931
37831078 1932 gMC->TrackPosition(p);
1933 hits[0]=p[0];
1934 hits[1]=p[1];
1935 hits[2]=p[2];
fe4da5cc 1936 hits[3]=(Float_t)nel;
1937
1938 // Add this hit
1939
642f15cf 1940 // new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->GetCurrentTrackNumber(),vol,hits);
6a905708 1941 if (fHitType&&2){
1942 gMC->TrackMomentum(p);
1943 Float_t momentum = TMath::Sqrt(p[0]*p[0]+p[1]*p[1]);
1944 Float_t precision = (momentum>0.1) ? 0.002 :0.01;
1945 fTrackHits->SetHitPrecision(precision);
1946 }
642f15cf 1947 AddHit(gAlice->GetCurrentTrackNumber(), vol,hits); //MI change
fe4da5cc 1948
1949 }
1950
1951 // Stemax calculation for the next step
1952
1953 Float_t pp;
0a6d8768 1954 TLorentzVector mom;
1955 gMC->TrackMomentum(mom);
1956 Float_t ptot=mom.Rho();
73042f01 1957 Float_t betaGamma = ptot/gMC->TrackMass();
fe4da5cc 1958
69e40cce 1959 Int_t pid=gMC->TrackPid();
cc80f89e 1960 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
fe4da5cc 1961 {
73042f01 1962 pp = kprim*1.58; // electrons above 20 MeV/c are on the plateau!
fe4da5cc 1963 }
1964 else
1965 {
595bf2c3 1966
07521998 1967 betaGamma = TMath::Max(betaGamma,(Float_t)7.e-3); // protection against too small bg
595bf2c3 1968 pp=kprim*BetheBloch(betaGamma);
1969
fe4da5cc 1970 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1971 }
1972
b9d0a01d 1973 Double_t rnd = gMC->GetRandom()->Rndm();
fe4da5cc 1974
cfce8870 1975 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
fe4da5cc 1976
1977}
1978
1979//_____________________________________________________________________________
1980Float_t AliTPCv2::BetheBloch(Float_t bg)
1981{
1982 //
1983 // Bethe-Bloch energy loss formula
1984 //
73042f01 1985 const Double_t kp1=0.76176e-1;
1986 const Double_t kp2=10.632;
1987 const Double_t kp3=0.13279e-4;
1988 const Double_t kp4=1.8631;
1989 const Double_t kp5=1.9479;
fe4da5cc 1990
1991 Double_t dbg = (Double_t) bg;
1992
1993 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1994
73042f01 1995 Double_t aa = TMath::Power(beta,kp4);
1996 Double_t bb = TMath::Power(1./dbg,kp5);
fe4da5cc 1997
73042f01 1998 bb=TMath::Log(kp3+bb);
fe4da5cc 1999
73042f01 2000 return ((Float_t)((kp2-aa-bb)*kp1/aa));
fe4da5cc 2001}
73042f01 2002
2003