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