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.18 1999/10/14 16:52:08 fca
19 Only use PDG codes and not GEANT ones
21 Revision 1.17 1999/10/08 06:27:23 fca
22 Corrected bug in the HV degrader geometry, thanks to G.Tabary
24 Revision 1.16 1999/10/04 13:39:54 fca
25 Correct array index problem
27 Revision 1.15 1999/09/29 09:24:34 fca
28 Introduction of the Copyright and cvs Log
32 ///////////////////////////////////////////////////////////////////////////////
34 // Time Projection Chamber version 2 -- detailed TPC and slow simulation //
38 <img src="picts/AliTPCv2Class.gif">
43 ///////////////////////////////////////////////////////////////////////////////
56 //_____________________________________________________________________________
57 AliTPCv2::AliTPCv2(const char *name, const char *title) :
61 // Standard constructor for Time Projection Chamber version 2
65 SetBufferSize(128000);
68 //_____________________________________________________________________________
69 void AliTPCv2::CreateGeometry()
72 // Create the geometry of Time Projection Chamber version 2
76 <img src="picts/AliTPCv2.gif">
81 <img src="picts/AliTPCv2Tree.gif">
85 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
87 Int_t *idtmed = fIdtmed->GetArray();
96 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
97 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
99 // ---------------------------------------------------
100 // sector specification check
101 // ---------------------------------------------------
105 for (i = 0; i < 6; ++i) {
106 if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
108 printf("*** SECTOR %d selected\n",fSecLows[i]);
113 printf("*** ALL LOWER SECTORS SELECTED ***\n");
120 for (i = 0; i < 12; ++i) {
121 if (fSecUps[i] > 2*nInnerSector-1 &&
122 fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
124 printf("*** SECTOR %d selected\n",fSecUps[i]);
129 printf("*** ALL UPPER SECTORS SELECTED ***\n");
133 if (ifl1 == 0 && ifl2 == 0) {
134 printf("*** ERROR: AT LEAST ONE SECTOR MUST BE SPECIFIED ***\n");
135 printf("!!! PROGRAM STOPPED !!!\n");
139 if ((fSecAL < 0 || fSecAU < 0) && fSens >= 0) {
140 printf("** ERROR: STRIPS CANNOT BE SPECIFIED FOR ALL SECTORS **\n");
141 printf("!!! PROGRAM STOPPED !!!\n");
145 // ----------------------------------------------------
146 // FIELD CAGE WITH ENDCAPS - G10
147 // THIS IS ALSO A TPC MOTHER VOLUME
148 // ----------------------------------------------------
154 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
156 //-----------------------------------------------------
157 // Endcap cover c-fibre 0.86% X0
158 //-----------------------------------------------------
164 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
166 //-----------------------------------------------------
167 // Drift gas , leave 2 cm at the outer radius
169 //-----------------------------------------------------
175 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
177 //------------------------------------------------------
178 // membrane holder - carbon fiber
179 //------------------------------------------------------
182 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
188 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
194 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
196 //----------------------------------------------------------
197 // HV membrane - 25 microns of mylar
198 //----------------------------------------------------------
204 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
206 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
208 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
210 //----------------------------------------------------------
211 // "side" gas volume, the same as the drift gas
212 // the readout chambers are placed there.
213 //----------------------------------------------------------
217 dm[2] = 0.5*(275. - 250.);
219 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
221 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
223 //-----------------------------------------------------------
224 // Readout chambers , 25% of X0, I use Al as the material
225 //-----------------------------------------------------------
227 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
228 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
230 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
231 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
233 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
234 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
236 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
237 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
240 Float_t SecThick = 2.225; // Al
242 Float_t edge = fTPCParam->GetEdge();
246 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
247 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
248 dm[2] = 0.5*SecThick;
249 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
251 Float_t xCenterS = InSecLowEdge+dm[3];
253 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
257 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
258 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
259 dm[2] = 0.5*SecThick;
260 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
262 Float_t xCenterL = OuSecLowEdge+dm[3];
264 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
266 Float_t z1 = -z_side + SecThick*0.5;
268 //------------------------------------------------------------------
269 // S sectors - "gas sectors" (TRD1)
270 //------------------------------------------------------------------
272 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
273 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
274 dm[2] = 0.5*(250. - 0.001);
275 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
277 gMC->Gsvolu("TSGA", "TRD1", idtmed[4], dm, 4); // sensitive
279 // -------------------------------------------------------------
280 // Only for the debugging purpose and resolution calculation
281 // Sensitive strips at the pad-row center
282 // -------------------------------------------------------------
290 Float_t StripThick = 0.01; // 100 microns
291 Float_t dead = fTPCParam->GetDeadZone();
293 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
295 dm[2] = 0.5*(250. - 0.002);
296 dm[3] = 0.5 * StripThick;
299 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
301 r1 = fTPCParam->GetPadRowRadiiLow(ns);
302 r2 = r1 + StripThick;
303 dm[0] = r1 * TMath::Tan(0.5*InnerOpenAngle) - dead;
304 dm[1] = r2 * TMath::Tan(0.5*InnerOpenAngle) - dead;
306 zz = -InSecLowEdge -0.5*(InSecUpEdge-InSecLowEdge);
310 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
315 gMC->Gsord("TSGA", 3);
317 } // if strips selected
320 //-----------------------------------------------------------------
321 // L sectors - "gas sectors" (PGON to avoid overlaps)
322 //-----------------------------------------------------------------
324 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
326 dm[0] = (Float_t)TMath::Nint(dm[0]);
328 dm[1] = OuterOpenAngle*kRaddeg;
329 dm[1] = (Float_t)TMath::Nint(dm[1]);
335 dm[5] = OuSecLowEdge;
336 dm[6] = 252.*TMath::Cos(0.5*OuterOpenAngle)-0.002;
343 dm[11] = OuSecLowEdge;
344 dm[12] = OuSecUpEdge;
350 gMC->Gsvolu("TLGA","PGON",idtmed[4],dm,16);
354 Float_t rmax = dm[6];
356 Float_t dead = fTPCParam->GetDeadZone();
358 Float_t StripThick = 0.01; // 100 microns
360 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
362 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
364 dm[0] = (Float_t)TMath::Nint(dm[0]);
366 dm[1] = OuterOpenAngle*kRaddeg;
367 dm[1] = (Float_t)TMath::Nint(dm[1]);
374 Float_t xx = dead/TMath::Tan(0.5*OuterOpenAngle);
376 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
378 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
379 r2 = r1 + StripThick;
394 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
398 gMC->Gsord("TLGA", 4);
400 } // if strips selected
402 //------------------------------------------------------------------
403 // Positioning of the S-sector readout chambers
404 //------------------------------------------------------------------
406 Float_t zs = 0.5*(250.+0.002);
408 Float_t theta1,theta2,theta3;
409 Float_t phi1,phi2,phi3;
413 for(ns=0;ns<nInnerSector;ns++){
415 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
416 phi1 *= kRaddeg; // in degrees
418 phi1 = (Float_t)TMath::Nint(phi1);
420 if (phi1 > 360.) phi1 -= 360.;
425 phi3 = ns * InnerOpenAngle + InnerAngleShift;
426 phi3 *= kRaddeg; // in degrees
428 phi3 = (Float_t)TMath::Nint(phi3);
430 if(phi3 > 360.) phi3 -= 360.;
434 alpha = phi3*kDegrad;
436 x = xCenterS * TMath::Cos(alpha);
437 y = xCenterS * TMath::Sin(alpha);
439 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
441 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
445 //---------------------------------------------------------------
446 // position all sectors
447 //---------------------------------------------------------------
449 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
450 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
455 //---------------------------------------------------------------
456 // position selected sectors
457 //---------------------------------------------------------------
459 for(Int_t sel=0;sel<6;sel++){
461 if(fSecLows[sel] == ns){
462 gMC->Gspos("TSGA", ns+1, "TGAS", x, y, zs, idrotm[nRotMat], "ONLY");
464 else if(fSecLows[sel] == ns+nInnerSector){
466 Gspos("TSGA",ns+1+nInnerSector,"TGAS", x, y,-zs,idrotm[nRotMat],"ONLY");
475 //-------------------------------------------------------------------
476 // Positioning of the L-sectors readout chambers
477 //-------------------------------------------------------------------
479 for(ns=0;ns<nOuterSector;ns++){
480 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
481 phi1 *= kRaddeg; // in degrees
483 phi1 = (Float_t)TMath::Nint(phi1);
486 if (phi1 > 360.) phi1 -= 360.;
491 phi3 = ns * OuterOpenAngle+OuterAngleShift;
492 phi3 *= kRaddeg; // in degrees
494 phi3 = (Float_t)TMath::Nint(phi3);
497 if(phi3 > 360.) phi3 -= 360.;
501 alpha = phi3*kDegrad;
503 x = xCenterL * TMath::Cos(alpha);
504 y = xCenterL * TMath::Sin(alpha);
506 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
509 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
515 //-------------------------------------------------------------------
516 // Positioning of the L-sectors (gas sectors)
517 //-------------------------------------------------------------------
519 for(ns=0;ns<nOuterSector;ns++){
521 phi1 = ns*OuterOpenAngle + OuterAngleShift;
524 phi1 = (Float_t)TMath::Nint(phi1);
525 if(phi1>360.) phi1 -= 360.;
530 if(phi2>360.) phi2 -= 360.;
539 //--------------------------------------------------------------
540 // position all sectors
541 //--------------------------------------------------------------
543 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
545 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
554 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
556 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
563 //---------------------------------------------------------------
564 // position selected sectors
565 //---------------------------------------------------------------
567 for(Int_t sel=0;sel<12;sel++){
569 if(fSecUps[sel] == ns+2*nInnerSector){
571 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
572 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
576 else if(fSecUps[sel] == ns+2*nInnerSector+nOuterSector){
583 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
585 Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
596 Float_t z0 = z_side - 0.95;
598 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
600 // ==========================================================
602 // ==========================================================
605 // auxilary structures
609 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
611 // ----------------------------------------------------------
612 // Large wheel -> positioned in the TPC
613 // ----------------------------------------------------------
616 z0 = 263.5; // TPC length - 1/2 spoke wheel width
622 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
628 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
630 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
631 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
634 // Outer vessel + CO2 HV degrader
641 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
646 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
648 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
657 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
658 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
659 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
661 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
664 //----------------------------------------------------------
665 // Small wheel -> positioned in "side gas
666 //----------------------------------------------------------
672 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
678 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
680 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
682 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
684 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
693 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
697 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
699 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
703 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
704 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
712 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
716 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
717 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
720 //---------------------------------------------------------
721 // central wheel 6 (radial direction) x 4 (along z) cm2
722 //---------------------------------------------------------
728 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
734 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
736 z0 = z_side - 1.9 - 2.;
738 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
742 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
745 //---------------------------------------------------------
746 // inner spokes (nSectorInner)
747 //---------------------------------------------------------
749 dm[0] = 0.5*(139.9-82.1);
753 Float_t x1 = dm[0]+82.;
755 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
760 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
762 for(ns=0;ns<nInnerSector;ns++){
764 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
768 phi1 = (Float_t)TMath::Nint(phi1);
769 if(phi1>360.) phi1 -= 360.;
772 if(phi2>360.) phi2 -= 360.;
777 alpha = phi1 * kDegrad;
778 x = x1 * TMath::Cos(alpha);
779 y = x1 * TMath::Sin(alpha);
781 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
783 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
789 //-------------------------------------------------------------
790 // outer spokes (nSectorOuter)
791 //-------------------------------------------------------------
793 dm[0] = 0.5*(257.9-146.1);
799 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
804 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
806 for(ns=0;ns<nOuterSector;ns++){
808 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
812 phi1 = (Float_t)TMath::Nint(phi1);
813 if(phi1>360.) phi1 -= 360.;
816 if(phi2>360.) phi2 -= 360.;
821 alpha = phi1 * kDegrad;
822 x = x1 * TMath::Cos(alpha);
823 y = x1 * TMath::Sin(alpha);
825 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
827 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
835 // --------------------------------------------------------
836 // put the readout chambers into the TPC
837 // --------------------------------------------------------
846 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
850 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
851 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
853 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
855 //----------------------------------------------------
856 // Inner vessel and HV degrader
857 //----------------------------------------------------
879 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
896 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
898 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
899 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
907 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
909 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
911 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
914 // ---------------------------------------------------
916 // ---------------------------------------------------
918 gMC->Gsord("TGAS", 6);
919 gMC->Gsord("TPSG", 6);
925 //_____________________________________________________________________________
926 void AliTPCv2::DrawDetector()
929 // Draw a shaded view of the Time Projection Chamber version 1
932 // Set everything unseen
933 gMC->Gsatt("*", "seen", -1);
935 // Set ALIC mother transparent
936 gMC->Gsatt("ALIC","SEEN",0);
938 // Set the volumes visible
939 gMC->Gsatt("TPC","SEEN",0);
940 gMC->Gsatt("TGAS","SEEN",0);
941 gMC->Gsatt("TPSG","SEEN",0);
942 gMC->Gsatt("TPHV","SEEN",1);
943 gMC->Gsatt("TPMH","SEEN",1);
944 gMC->Gsatt("TPEC","SEEN",0);
945 gMC->Gsatt("TRCS","SEEN",1);
946 gMC->Gsatt("TRCL","SEEN",1);
947 gMC->Gsatt("TPWL","SEEN",1);
948 gMC->Gsatt("TPWI","SEEN",1);
949 gMC->Gsatt("TPWS","SEEN",1);
950 gMC->Gsatt("TPW1","SEEN",1);
951 gMC->Gsatt("TPS1","SEEN",1);
952 gMC->Gsatt("TPS2","SEEN",1);
953 gMC->Gsatt("TPG1","SEEN",1);
954 gMC->Gsatt("TPG2","SEEN",1);
955 gMC->Gsatt("TPWC","SEEN",1);
956 gMC->Gsatt("TPSI","SEEN",1);
957 gMC->Gsatt("TPSO","SEEN",1);
958 gMC->Gsatt("TPCO","SEEN",1);
959 gMC->Gsatt("TPOV","SEEN",1);
960 gMC->Gsatt("TPVD","SEEN",1);
962 gMC->Gdopt("hide", "on");
963 gMC->Gdopt("shad", "on");
964 gMC->Gsatt("*", "fill", 7);
965 gMC->SetClipBox(".");
966 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
968 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
969 gMC->Gdhead(1111, "Time Projection Chamber");
970 gMC->Gdman(18, 4, "MAN");
971 gMC->Gdopt("hide","off");
974 //_____________________________________________________________________________
975 void AliTPCv2::CreateMaterials()
978 // Define materials for version 2 of the Time Projection Chamber
982 // Increase maximum number of steps
983 gMC->SetMaxNStep(30000);
985 AliTPC::CreateMaterials();
988 //_____________________________________________________________________________
989 void AliTPCv2::Init()
992 // Initialises version 2 of the TPC after that it has been built
994 Int_t *idtmed = fIdtmed->GetArray()-399;
996 fIdSens1=gMC->VolId("TLGA"); // L-sector
997 fIdSens2=gMC->VolId("TSGA"); // S-sector
998 fIdSens3=gMC->VolId("TSST"); // strip - S-sector (not always used)
999 fIdSens4=gMC->VolId("TLST"); // strip - S-sector (not always used)
1001 gMC->SetMaxNStep(30000); // max. number of steps increased
1003 gMC->Gstpar(idtmed[403],"LOSS",5);
1005 printf("*** TPC version 2 initialized ***\n");
1006 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
1012 //_____________________________________________________________________________
1013 void AliTPCv2::StepManager()
1016 // Called for every step in the Time Projection Chamber
1020 // parameters used for the energy loss calculations
1022 const Float_t prim = 14.35; // number of primary collisions per 1 cm
1023 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
1024 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
1026 // const Float_t prim = 17.65;
1027 // const Float_t poti = 19.02e-9;
1028 // const Float_t w_ion = 33.06e-9;
1031 const Float_t big = 1.e10;
1036 TClonesArray &lhits = *fHits;
1039 AliTPCParam *fTPCParam = &(fDigParam->GetParam());
1045 gMC->SetMaxStep(big);
1047 if(!gMC->IsTrackAlive()) return; // particle has disappeared
1049 Float_t charge = gMC->TrackCharge();
1051 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1054 id=gMC->CurrentVolID(copy);
1056 // Check the sensitive volume
1060 vol[0] = copy + fTPCParam->GetNInnerSector()-1; // L-sector number
1062 else if(id == fIdSens2)
1064 vol[0] = copy-1; // S-sector number
1066 else if(id == fIdSens3 && gMC->IsTrackEntering())
1068 vol[1] = copy-1; // row number
1069 id = gMC->CurrentVolOffID(1,copy);
1070 vol[0] = copy-1; // sector number (S-sector)
1072 gMC->TrackPosition(pos);
1076 hits[3]=0.; // this hit has no energy loss
1077 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1079 else if(id == fIdSens4 && gMC->IsTrackEntering())
1081 vol[1] = copy-1; // row number
1082 id = gMC->CurrentVolOffID(1,copy);
1083 vol[0] = copy+fTPCParam->GetNInnerSector()-1; // sector number (L-sector)
1085 gMC->TrackPosition(pos);
1089 hits[3]=0.; // this hit has no energy loss
1090 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1095 // charged particle is in the sensitive volume
1098 if(gMC->TrackStep() > 0) {
1100 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
1101 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
1103 gMC->TrackPosition(pos);
1107 hits[3]=(Float_t)nel;
1111 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1115 // Stemax calculation for the next step
1119 gMC->TrackMomentum(mom);
1120 Float_t ptot=mom.Rho();
1121 Float_t beta_gamma = ptot/gMC->TrackMass();
1123 Int_t pid=gMC->TrackPid();
1124 if((pid==kElectron || pid==kPositron || pid==kGamma) && ptot > 0.002)
1126 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
1130 pp=prim*BetheBloch(beta_gamma);
1131 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1135 gMC->Rndm(random,1); // good, old GRNDM from Geant3
1137 Double_t rnd = (Double_t)random[0];
1139 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1143 //_____________________________________________________________________________
1144 Float_t AliTPCv2::BetheBloch(Float_t bg)
1147 // Bethe-Bloch energy loss formula
1149 const Double_t p1=0.76176e-1;
1150 const Double_t p2=10.632;
1151 const Double_t p3=0.13279e-4;
1152 const Double_t p4=1.8631;
1153 const Double_t p5=1.9479;
1155 Double_t dbg = (Double_t) bg;
1157 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1159 Double_t aa = TMath::Power(beta,p4);
1160 Double_t bb = TMath::Power(1./dbg,p5);
1162 bb=TMath::Log(p3+bb);
1164 return ((Float_t)((p2-aa-bb)*p1/aa));