1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.21.2.4 2000/06/26 07:39:42 kowal2
19 Changes to obey the coding rules
21 Revision 1.21.2.3 2000/06/25 08:38:41 kowal2
22 Splitted from AliTPCtracking
24 Revision 1.21.2.2 2000/06/16 12:58:13 kowal2
25 Changed parameter settings
27 Revision 1.21.2.1 2000/06/09 07:15:07 kowal2
29 Defaults loaded automatically (hard-wired)
30 Optional parameters can be set via macro called in the constructor
32 Revision 1.21 2000/05/15 10:00:30 kowal2
33 Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova
35 Revision 1.20 2000/04/17 09:37:33 kowal2
36 removed obsolete AliTPCDigitsDisplay.C
38 Revision 1.19.8.2 2000/04/10 08:31:52 kowal2
40 Different geometry for different sectors
41 Updated readout chambers
42 Some modifications to StepManager by J.Belikov
44 Revision 1.19.8.1 2000/04/10 07:56:53 kowal2
45 Not used anymore - removed
47 Revision 1.19 1999/11/04 17:28:07 fca
48 Correct barrel part of HV Degrader
50 Revision 1.18 1999/10/14 16:52:08 fca
51 Only use PDG codes and not GEANT ones
53 Revision 1.17 1999/10/08 06:27:23 fca
54 Corrected bug in the HV degrader geometry, thanks to G.Tabary
56 Revision 1.16 1999/10/04 13:39:54 fca
57 Correct array index problem
59 Revision 1.15 1999/09/29 09:24:34 fca
60 Introduction of the Copyright and cvs Log
65 ///////////////////////////////////////////////////////////////////////////////
67 // Time Projection Chamber version 2 -- detailed TPC and slow simulation //
71 <img src="picts/AliTPCv2Class.gif">
76 ///////////////////////////////////////////////////////////////////////////////
82 #include "AliTPCDigitsArray.h"
86 #include "AliTPCParam.h"
87 #include "AliTPCParamSR.h"
91 //_____________________________________________________________________________
92 AliTPCv2::AliTPCv2(const char *name, const char *title) :
96 // Standard constructor for Time Projection Chamber version 2
100 SetBufferSize(128000);
102 SetGasMixt(2,20,10,-1,0.9,0.1,0.); // Ne-CO2 90-10
108 SetSecLows(1, 2, 3, 19, 20, 21);
109 SetSecUps(37, 38, 39, 37+18, 38+18, 39+18, -1, -1, -1, -1, -1, -1);
110 SetSens(1); // sensitive strips
113 fTPCParam->Write(fTPCParam->GetTitle());
116 //_____________________________________________________________________________
117 void AliTPCv2::CreateGeometry()
120 // Create the geometry of Time Projection Chamber version 2
124 <img src="picts/AliTPCv2.gif">
129 <img src="picts/AliTPCv2Tree.gif">
134 Int_t *idtmed = fIdtmed->GetArray();
143 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
144 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
146 // ---------------------------------------------------
147 // sector specification check
148 // ---------------------------------------------------
152 for (i = 0; i < 6; ++i) {
153 if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
155 printf("*** SECTOR %d selected\n",fSecLows[i]);
160 printf("*** ALL LOWER SECTORS SELECTED ***\n");
167 for (i = 0; i < 12; ++i) {
168 if (fSecUps[i] > 2*nInnerSector-1 &&
169 fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
171 printf("*** SECTOR %d selected\n",fSecUps[i]);
176 printf("*** ALL UPPER SECTORS SELECTED ***\n");
180 if (ifl1 == 0 && ifl2 == 0) {
181 printf("*** ERROR: AT LEAST ONE SECTOR MUST BE SPECIFIED ***\n");
182 printf("!!! PROGRAM STOPPED !!!\n");
186 if ((fSecAL < 0 || fSecAU < 0) && fSens >= 0) {
187 printf("** ERROR: STRIPS CANNOT BE SPECIFIED FOR ALL SECTORS **\n");
188 printf("!!! PROGRAM STOPPED !!!\n");
192 // ----------------------------------------------------
193 // FIELD CAGE WITH ENDCAPS - G10
194 // THIS IS ALSO A TPC MOTHER VOLUME
195 // ----------------------------------------------------
201 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
203 //-----------------------------------------------------
204 // Endcap cover c-fibre 0.86% X0
205 //-----------------------------------------------------
211 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
213 //-----------------------------------------------------
214 // Drift gas , leave 2 cm at the outer radius
216 //-----------------------------------------------------
222 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
224 //------------------------------------------------------
225 // membrane holder - carbon fiber
226 //------------------------------------------------------
229 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
235 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
241 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
243 //----------------------------------------------------------
244 // HV membrane - 25 microns of mylar
245 //----------------------------------------------------------
251 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
253 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
255 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
257 //----------------------------------------------------------
258 // "side" gas volume, the same as the drift gas
259 // the readout chambers are placed there.
260 //----------------------------------------------------------
264 dm[2] = 0.5*(275. - 250.);
266 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
268 Float_t zSide = dm[2]; // 1/2 of the side gas thickness
270 //------------------------------------------------------------
271 // Readout chambers , 25% of X0, I use Al as the material
272 //------------------------------------------------------------
274 Float_t innerOpenAngle = fTPCParam->GetInnerAngle();
275 Float_t outerOpenAngle = fTPCParam->GetOuterAngle();
277 Float_t innerAngleShift = fTPCParam->GetInnerAngleShift();
278 Float_t outerAngleShift = fTPCParam->GetOuterAngleShift();
280 Float_t inSecLowEdge = fTPCParam->GetInnerRadiusLow();
281 Float_t inSecUpEdge = fTPCParam->GetInnerRadiusUp();
283 Float_t ouSecLowEdge = fTPCParam->GetOuterRadiusLow();
284 Float_t ouSecUpEdge = fTPCParam->GetOuterRadiusUp();
287 Float_t secThick = 2.225; // Al
289 Float_t lowEdge = fTPCParam->GetInnerFrameSpace();
293 dm[0] = inSecLowEdge*TMath::Tan(0.5*innerOpenAngle)-lowEdge;
294 dm[1] = inSecUpEdge*TMath::Tan(0.5*innerOpenAngle)-lowEdge;
295 dm[2] = 0.5*secThick;
296 dm[3] = 0.5*(inSecUpEdge-inSecLowEdge);
298 Float_t xCenterS = inSecLowEdge+dm[3];
300 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
304 Float_t upEdge = fTPCParam->GetOuterFrameSpace();
306 dm[0] = ouSecLowEdge*TMath::Tan(0.5*outerOpenAngle)-upEdge;
307 dm[1] = ouSecUpEdge*TMath::Tan(0.5*outerOpenAngle)-upEdge;
308 dm[2] = 0.5*secThick;
309 dm[3] = 0.5*(ouSecUpEdge-ouSecLowEdge);
311 Float_t xCenterL = ouSecLowEdge+dm[3];
313 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
315 Float_t z1 = -zSide + secThick*0.5;
317 //------------------------------------------------------------------
318 // S sectors - "gas sectors" (TRD1)
319 //------------------------------------------------------------------
321 dm[0] = inSecLowEdge*TMath::Tan(0.5*innerOpenAngle)-0.01;
322 dm[1] = inSecUpEdge*TMath::Tan(0.5*innerOpenAngle)-0.01;
323 dm[2] = 0.5*(250. - 0.001);
324 dm[3] = 0.5*(inSecUpEdge-inSecLowEdge);
326 gMC->Gsvolu("TSGA", "TRD1", idtmed[4], dm, 4); // sensitive
328 // -------------------------------------------------------------
329 // Only for the debugging purpose and resolution calculation
330 // Sensitive strips at the pad-row center
331 // -------------------------------------------------------------
339 Float_t stripThick = 0.01; // 100 microns
342 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
344 dm[2] = 0.5*(250. - 0.002);
345 dm[3] = 0.5 * stripThick;
347 dead= fTPCParam->GetInnerWireMount();
350 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
352 r1 = fTPCParam->GetPadRowRadiiLow(ns);
353 r2 = r1 + stripThick;
354 dm[0] = r1 * TMath::Tan(0.5*innerOpenAngle) - dead;
355 dm[1] = r2 * TMath::Tan(0.5*innerOpenAngle) - dead;
357 zz = -inSecLowEdge -0.5*(inSecUpEdge-inSecLowEdge);
361 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
366 gMC->Gsord("TSGA", 3);
368 } // if strips selected
371 //-----------------------------------------------------------------
372 // L sectors - "gas sectors" (PGON to avoid overlaps)
373 //-----------------------------------------------------------------
375 dm[0] = 360.*kDegrad - 0.5*outerOpenAngle;
377 dm[0] = (Float_t)TMath::Nint(dm[0]);
379 dm[1] = outerOpenAngle*kRaddeg;
380 dm[1] = (Float_t)TMath::Nint(dm[1]);
386 dm[5] = ouSecLowEdge;
387 dm[6] = 252.*TMath::Cos(0.5*outerOpenAngle)-0.002;
394 dm[11] = ouSecLowEdge;
395 dm[12] = ouSecUpEdge;
401 gMC->Gsvolu("TLGA","PGON",idtmed[4],dm,16);
405 Float_t rmax = dm[6];
407 Float_t dead = fTPCParam->GetOuterWireMount();
409 Float_t stripThick = 0.01; // 100 microns
411 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
413 dm[0] = 360.*kDegrad - 0.5*outerOpenAngle;
415 dm[0] = (Float_t)TMath::Nint(dm[0]);
417 dm[1] = outerOpenAngle*kRaddeg;
418 dm[1] = (Float_t)TMath::Nint(dm[1]);
425 Float_t xx = dead/TMath::Tan(0.5*outerOpenAngle);
427 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
429 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
430 r2 = r1 + stripThick;
445 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
449 gMC->Gsord("TLGA", 4);
451 } // if strips selected
453 //------------------------------------------------------------------
454 // Positioning of the S-sector readout chambers
455 //------------------------------------------------------------------
457 Float_t zs = 0.5*(250.+0.002);
459 Float_t theta1,theta2,theta3;
460 Float_t phi1,phi2,phi3;
464 for(ns=0;ns<nInnerSector;ns++){
466 phi1 = ns * innerOpenAngle + 270.*kDegrad + innerAngleShift;
467 phi1 *= kRaddeg; // in degrees
469 phi1 = (Float_t)TMath::Nint(phi1);
471 if (phi1 > 360.) phi1 -= 360.;
476 phi3 = ns * innerOpenAngle + innerAngleShift;
477 phi3 *= kRaddeg; // in degrees
479 phi3 = (Float_t)TMath::Nint(phi3);
481 if(phi3 > 360.) phi3 -= 360.;
485 alpha = phi3*kDegrad;
487 x = xCenterS * TMath::Cos(alpha);
488 y = xCenterS * TMath::Sin(alpha);
490 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
492 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
496 //---------------------------------------------------------------
497 // position all sectors
498 //---------------------------------------------------------------
500 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
501 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
506 //---------------------------------------------------------------
507 // position selected sectors
508 //---------------------------------------------------------------
510 for(Int_t sel=0;sel<6;sel++){
512 if(fSecLows[sel] == ns){
513 gMC->Gspos("TSGA", ns+1, "TGAS", x, y, zs, idrotm[nRotMat], "ONLY");
515 else if(fSecLows[sel] == ns+nInnerSector){
517 Gspos("TSGA",ns+1+nInnerSector,"TGAS", x, y,-zs,idrotm[nRotMat],"ONLY");
526 //-------------------------------------------------------------------
527 // Positioning of the L-sectors readout chambers
528 //-------------------------------------------------------------------
530 for(ns=0;ns<nOuterSector;ns++){
531 phi1 = ns * outerOpenAngle + 270.*kDegrad + outerAngleShift;
532 phi1 *= kRaddeg; // in degrees
534 phi1 = (Float_t)TMath::Nint(phi1);
537 if (phi1 > 360.) phi1 -= 360.;
542 phi3 = ns * outerOpenAngle+outerAngleShift;
543 phi3 *= kRaddeg; // in degrees
545 phi3 = (Float_t)TMath::Nint(phi3);
548 if(phi3 > 360.) phi3 -= 360.;
552 alpha = phi3*kDegrad;
554 x = xCenterL * TMath::Cos(alpha);
555 y = xCenterL * TMath::Sin(alpha);
557 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
560 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
566 //-------------------------------------------------------------------
567 // Positioning of the L-sectors (gas sectors)
568 //-------------------------------------------------------------------
570 for(ns=0;ns<nOuterSector;ns++){
572 phi1 = ns*outerOpenAngle + outerAngleShift;
575 phi1 = (Float_t)TMath::Nint(phi1);
576 if(phi1>360.) phi1 -= 360.;
581 if(phi2>360.) phi2 -= 360.;
590 //--------------------------------------------------------------
591 // position all sectors
592 //--------------------------------------------------------------
594 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
596 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
605 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
607 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
614 //---------------------------------------------------------------
615 // position selected sectors
616 //---------------------------------------------------------------
618 for(Int_t sel=0;sel<12;sel++){
620 if(fSecUps[sel] == ns+2*nInnerSector){
622 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
623 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
627 else if(fSecUps[sel] == ns+2*nInnerSector+nOuterSector){
634 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
636 Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
647 Float_t z0 = zSide - 0.95;
649 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
651 // ==========================================================
653 // ==========================================================
656 // auxilary structures
660 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
662 // ----------------------------------------------------------
663 // Large wheel -> positioned in the TPC
664 // ----------------------------------------------------------
667 z0 = 263.5; // TPC length - 1/2 spoke wheel width
673 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
679 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
681 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
682 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
685 // Outer vessel + CO2 HV degrader
692 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
697 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
699 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
703 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
706 //----------------------------------------------------------
707 // Small wheel -> positioned in "side gas
708 //----------------------------------------------------------
714 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
720 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
722 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
724 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
726 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
735 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
739 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
741 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
745 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
746 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
754 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
758 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
759 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
762 //---------------------------------------------------------
763 // central wheel 6 (radial direction) x 4 (along z) cm2
764 //---------------------------------------------------------
770 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
776 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
778 z0 = zSide - 1.9 - 2.;
780 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
784 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
787 //---------------------------------------------------------
788 // inner spokes (nSectorInner)
789 //---------------------------------------------------------
791 dm[0] = 0.5*(139.9-82.1);
795 Float_t x1 = dm[0]+82.;
797 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
802 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
804 for(ns=0;ns<nInnerSector;ns++){
806 phi1 = 0.5*innerOpenAngle + ns*innerOpenAngle + innerAngleShift;
810 phi1 = (Float_t)TMath::Nint(phi1);
811 if(phi1>360.) phi1 -= 360.;
814 if(phi2>360.) phi2 -= 360.;
819 alpha = phi1 * kDegrad;
820 x = x1 * TMath::Cos(alpha);
821 y = x1 * TMath::Sin(alpha);
823 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
825 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
831 //-------------------------------------------------------------
832 // outer spokes (nSectorOuter)
833 //-------------------------------------------------------------
835 dm[0] = 0.5*(257.9-146.1);
841 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
846 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
848 for(ns=0;ns<nOuterSector;ns++){
850 phi1 = 0.5*outerOpenAngle + ns*outerOpenAngle + outerAngleShift;
854 phi1 = (Float_t)TMath::Nint(phi1);
855 if(phi1>360.) phi1 -= 360.;
858 if(phi2>360.) phi2 -= 360.;
863 alpha = phi1 * kDegrad;
864 x = x1 * TMath::Cos(alpha);
865 y = x1 * TMath::Sin(alpha);
867 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
869 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
877 // --------------------------------------------------------
878 // put the readout chambers into the TPC
879 // --------------------------------------------------------
888 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
892 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
893 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
895 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
897 //----------------------------------------------------
898 // Inner vessel and HV degrader
899 //----------------------------------------------------
921 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
938 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
940 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
941 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
949 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
951 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
953 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
956 // ---------------------------------------------------
958 // ---------------------------------------------------
960 gMC->Gsord("TGAS", 6);
961 gMC->Gsord("TPSG", 6);
967 //_____________________________________________________________________________
968 void AliTPCv2::DrawDetector()
971 // Draw a shaded view of the Time Projection Chamber version 1
974 // Set everything unseen
975 gMC->Gsatt("*", "seen", -1);
977 // Set ALIC mother transparent
978 gMC->Gsatt("ALIC","SEEN",0);
980 // Set the volumes visible
981 gMC->Gsatt("TPC","SEEN",0);
982 gMC->Gsatt("TGAS","SEEN",0);
983 gMC->Gsatt("TPSG","SEEN",0);
984 gMC->Gsatt("TPHV","SEEN",1);
985 gMC->Gsatt("TPMH","SEEN",1);
986 gMC->Gsatt("TPEC","SEEN",0);
987 gMC->Gsatt("TRCS","SEEN",1);
988 gMC->Gsatt("TRCL","SEEN",1);
989 gMC->Gsatt("TPWL","SEEN",1);
990 gMC->Gsatt("TPWI","SEEN",1);
991 gMC->Gsatt("TPWS","SEEN",1);
992 gMC->Gsatt("TPW1","SEEN",1);
993 gMC->Gsatt("TPS1","SEEN",1);
994 gMC->Gsatt("TPS2","SEEN",1);
995 gMC->Gsatt("TPG1","SEEN",1);
996 gMC->Gsatt("TPG2","SEEN",1);
997 gMC->Gsatt("TPWC","SEEN",1);
998 gMC->Gsatt("TPSI","SEEN",1);
999 gMC->Gsatt("TPSO","SEEN",1);
1000 gMC->Gsatt("TPCO","SEEN",1);
1001 gMC->Gsatt("TPOV","SEEN",1);
1002 gMC->Gsatt("TPVD","SEEN",1);
1004 gMC->Gdopt("hide", "on");
1005 gMC->Gdopt("shad", "on");
1006 gMC->Gsatt("*", "fill", 7);
1007 gMC->SetClipBox(".");
1008 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
1009 gMC->DefaultRange();
1010 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
1011 gMC->Gdhead(1111, "Time Projection Chamber");
1012 gMC->Gdman(18, 4, "MAN");
1013 gMC->Gdopt("hide","off");
1016 //_____________________________________________________________________________
1017 void AliTPCv2::CreateMaterials()
1020 // Define materials for version 2 of the Time Projection Chamber
1024 // Increase maximum number of steps
1025 gMC->SetMaxNStep(30000);
1027 AliTPC::CreateMaterials();
1030 //_____________________________________________________________________________
1031 void AliTPCv2::Init()
1034 // Initialises version 2 of the TPC after that it has been built
1036 Int_t *idtmed = fIdtmed->GetArray()-399;
1038 fIdSens1=gMC->VolId("TLGA"); // L-sector
1039 fIdSens2=gMC->VolId("TSGA"); // S-sector
1040 fIdSens3=gMC->VolId("TSST"); // strip - S-sector (not always used)
1041 fIdSens4=gMC->VolId("TLST"); // strip - S-sector (not always used)
1043 gMC->SetMaxNStep(30000); // max. number of steps increased
1045 gMC->Gstpar(idtmed[403],"LOSS",5);
1047 printf("*** TPC version 2 initialized ***\n");
1048 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
1054 //_____________________________________________________________________________
1055 void AliTPCv2::StepManager()
1058 // Called for every step in the Time Projection Chamber
1062 // parameters used for the energy loss calculations
1064 const Float_t kprim = 14.35; // number of primary collisions per 1 cm
1065 const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2
1066 const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation
1069 const Float_t kbig = 1.e10;
1074 TClonesArray &lhits = *fHits;
1081 gMC->SetMaxStep(kbig);
1083 if(!gMC->IsTrackAlive()) return; // particle has disappeared
1085 Float_t charge = gMC->TrackCharge();
1087 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1090 id=gMC->CurrentVolID(copy);
1092 // Check the sensitive volume
1096 vol[0] = copy + fTPCParam->GetNInnerSector()-1; // L-sector number
1098 else if(id == fIdSens2)
1100 vol[0] = copy-1; // S-sector number
1102 else if(id == fIdSens3 && gMC->IsTrackEntering())
1104 vol[1] = copy-1; // row number
1105 id = gMC->CurrentVolOffID(1,copy);
1106 vol[0] = copy-1; // sector number (S-sector)
1108 //I.Belikov's modification
1110 gMC->TrackMomentum(pos);
1114 hits[3]=0.; // this hit has no energy loss
1115 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1117 //end of I.Belikov's modification
1119 gMC->TrackPosition(pos);
1123 hits[3]=0.; // this hit has no energy loss
1124 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1126 else if(id == fIdSens4 && gMC->IsTrackEntering())
1128 vol[1] = copy-1; // row number
1129 id = gMC->CurrentVolOffID(1,copy);
1130 vol[0] = copy+fTPCParam->GetNInnerSector()-1; // sector number (L-sector)
1132 //I.Belikov's modification
1134 gMC->TrackMomentum(pos);
1138 hits[3]=0.; // this hit has no energy loss
1139 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1141 //end of I.Belikov's modification
1143 gMC->TrackPosition(pos);
1147 hits[3]=0.; // this hit has no energy loss
1148 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1153 // charged particle is in the sensitive volume
1156 if(gMC->TrackStep() > 0) {
1158 Int_t nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
1159 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
1161 gMC->TrackPosition(pos);
1165 hits[3]=(Float_t)nel;
1169 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1173 // Stemax calculation for the next step
1177 gMC->TrackMomentum(mom);
1178 Float_t ptot=mom.Rho();
1179 Float_t betaGamma = ptot/gMC->TrackMass();
1181 Int_t pid=gMC->TrackPid();
1182 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
1184 pp = kprim*1.58; // electrons above 20 MeV/c are on the plateau!
1188 pp=kprim*BetheBloch(betaGamma);
1189 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1193 gMC->Rndm(random,1); // good, old GRNDM from Geant3
1195 Double_t rnd = (Double_t)random[0];
1197 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1201 //_____________________________________________________________________________
1202 Float_t AliTPCv2::BetheBloch(Float_t bg)
1205 // Bethe-Bloch energy loss formula
1207 const Double_t kp1=0.76176e-1;
1208 const Double_t kp2=10.632;
1209 const Double_t kp3=0.13279e-4;
1210 const Double_t kp4=1.8631;
1211 const Double_t kp5=1.9479;
1213 Double_t dbg = (Double_t) bg;
1215 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1217 Double_t aa = TMath::Power(beta,kp4);
1218 Double_t bb = TMath::Power(1./dbg,kp5);
1220 bb=TMath::Log(kp3+bb);
1222 return ((Float_t)((kp2-aa-bb)*kp1/aa));