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.15 1999/09/29 09:24:34 fca
19 Introduction of the Copyright and cvs Log
23 ///////////////////////////////////////////////////////////////////////////////
25 // Time Projection Chamber version 2 -- detailed TPC and slow simulation //
29 <img src="picts/AliTPCv2Class.gif">
34 ///////////////////////////////////////////////////////////////////////////////
46 //_____________________________________________________________________________
47 AliTPCv2::AliTPCv2(const char *name, const char *title) :
51 // Standard constructor for Time Projection Chamber version 2
55 SetBufferSize(128000);
58 //_____________________________________________________________________________
59 void AliTPCv2::CreateGeometry()
62 // Create the geometry of Time Projection Chamber version 2
66 <img src="picts/AliTPCv2.gif">
71 <img src="picts/AliTPCv2Tree.gif">
75 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
77 Int_t *idtmed = fIdtmed->GetArray();
86 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
87 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
89 // ---------------------------------------------------
90 // sector specification check
91 // ---------------------------------------------------
95 for (i = 0; i < 6; ++i) {
96 if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
98 printf("*** SECTOR %d selected\n",fSecLows[i]);
103 printf("*** ALL LOWER SECTORS SELECTED ***\n");
110 for (i = 0; i < 12; ++i) {
111 if (fSecUps[i] > 2*nInnerSector-1 &&
112 fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
114 printf("*** SECTOR %d selected\n",fSecUps[i]);
119 printf("*** ALL UPPER SECTORS SELECTED ***\n");
123 if (ifl1 == 0 && ifl2 == 0) {
124 printf("*** ERROR: AT LEAST ONE SECTOR MUST BE SPECIFIED ***\n");
125 printf("!!! PROGRAM STOPPED !!!\n");
129 if ((fSecAL < 0 || fSecAU < 0) && fSens >= 0) {
130 printf("** ERROR: STRIPS CANNOT BE SPECIFIED FOR ALL SECTORS **\n");
131 printf("!!! PROGRAM STOPPED !!!\n");
135 // ----------------------------------------------------
136 // FIELD CAGE WITH ENDCAPS - G10
137 // THIS IS ALSO A TPC MOTHER VOLUME
138 // ----------------------------------------------------
144 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
146 //-----------------------------------------------------
147 // Endcap cover c-fibre 0.86% X0
148 //-----------------------------------------------------
154 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
156 //-----------------------------------------------------
157 // Drift gas , leave 2 cm at the outer radius
159 //-----------------------------------------------------
165 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
167 //------------------------------------------------------
168 // membrane holder - carbon fiber
169 //------------------------------------------------------
172 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
178 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
184 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
186 //----------------------------------------------------------
187 // HV membrane - 25 microns of mylar
188 //----------------------------------------------------------
194 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
196 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
198 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
200 //----------------------------------------------------------
201 // "side" gas volume, the same as the drift gas
202 // the readout chambers are placed there.
203 //----------------------------------------------------------
207 dm[2] = 0.5*(275. - 250.);
209 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
211 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
213 //-----------------------------------------------------------
214 // Readout chambers , 25% of X0, I use Al as the material
215 //-----------------------------------------------------------
217 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
218 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
220 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
221 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
223 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
224 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
226 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
227 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
230 Float_t SecThick = 2.225; // Al
232 Float_t edge = fTPCParam->GetEdge();
236 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
237 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
238 dm[2] = 0.5*SecThick;
239 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
241 Float_t xCenterS = InSecLowEdge+dm[3];
243 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
247 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
248 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
249 dm[2] = 0.5*SecThick;
250 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
252 Float_t xCenterL = OuSecLowEdge+dm[3];
254 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
256 Float_t z1 = -z_side + SecThick*0.5;
258 //------------------------------------------------------------------
259 // S sectors - "gas sectors" (TRD1)
260 //------------------------------------------------------------------
262 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
263 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
264 dm[2] = 0.5*(250. - 0.001);
265 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
267 gMC->Gsvolu("TSGA", "TRD1", idtmed[4], dm, 4); // sensitive
269 // -------------------------------------------------------------
270 // Only for the debugging purpose and resolution calculation
271 // Sensitive strips at the pad-row center
272 // -------------------------------------------------------------
280 Float_t StripThick = 0.01; // 100 microns
281 Float_t dead = fTPCParam->GetDeadZone();
283 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
285 dm[2] = 0.5*(250. - 0.002);
286 dm[3] = 0.5 * StripThick;
289 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
291 r1 = fTPCParam->GetPadRowRadiiLow(ns);
292 r2 = r1 + StripThick;
293 dm[0] = r1 * TMath::Tan(0.5*InnerOpenAngle) - dead;
294 dm[1] = r2 * TMath::Tan(0.5*InnerOpenAngle) - dead;
296 zz = -InSecLowEdge -0.5*(InSecUpEdge-InSecLowEdge);
300 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
305 gMC->Gsord("TSGA", 3);
307 } // if strips selected
310 //-----------------------------------------------------------------
311 // L sectors - "gas sectors" (PGON to avoid overlaps)
312 //-----------------------------------------------------------------
314 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
316 dm[0] = (Float_t)TMath::Nint(dm[0]);
318 dm[1] = OuterOpenAngle*kRaddeg;
319 dm[1] = (Float_t)TMath::Nint(dm[1]);
325 dm[5] = OuSecLowEdge;
326 dm[6] = 252.*TMath::Cos(0.5*OuterOpenAngle)-0.002;
333 dm[11] = OuSecLowEdge;
334 dm[12] = OuSecUpEdge;
340 gMC->Gsvolu("TLGA","PGON",idtmed[4],dm,16);
344 Float_t rmax = dm[6];
346 Float_t dead = fTPCParam->GetDeadZone();
348 Float_t StripThick = 0.01; // 100 microns
350 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
352 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
354 dm[0] = (Float_t)TMath::Nint(dm[0]);
356 dm[1] = OuterOpenAngle*kRaddeg;
357 dm[1] = (Float_t)TMath::Nint(dm[1]);
364 Float_t xx = dead/TMath::Tan(0.5*OuterOpenAngle);
366 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
368 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
369 r2 = r1 + StripThick;
384 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
388 gMC->Gsord("TLGA", 4);
390 } // if strips selected
392 //------------------------------------------------------------------
393 // Positioning of the S-sector readout chambers
394 //------------------------------------------------------------------
396 Float_t zs = 0.5*(250.+0.002);
398 Float_t theta1,theta2,theta3;
399 Float_t phi1,phi2,phi3;
403 for(ns=0;ns<nInnerSector;ns++){
405 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
406 phi1 *= kRaddeg; // in degrees
408 phi1 = (Float_t)TMath::Nint(phi1);
410 if (phi1 > 360.) phi1 -= 360.;
415 phi3 = ns * InnerOpenAngle + InnerAngleShift;
416 phi3 *= kRaddeg; // in degrees
418 phi3 = (Float_t)TMath::Nint(phi3);
420 if(phi3 > 360.) phi3 -= 360.;
424 alpha = phi3*kDegrad;
426 x = xCenterS * TMath::Cos(alpha);
427 y = xCenterS * TMath::Sin(alpha);
429 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
431 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
435 //---------------------------------------------------------------
436 // position all sectors
437 //---------------------------------------------------------------
439 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
440 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
445 //---------------------------------------------------------------
446 // position selected sectors
447 //---------------------------------------------------------------
449 for(Int_t sel=0;sel<6;sel++){
451 if(fSecLows[sel] == ns){
452 gMC->Gspos("TSGA", ns+1, "TGAS", x, y, zs, idrotm[nRotMat], "ONLY");
454 else if(fSecLows[sel] == ns+nInnerSector){
456 Gspos("TSGA",ns+1+nInnerSector,"TGAS", x, y,-zs,idrotm[nRotMat],"ONLY");
465 //-------------------------------------------------------------------
466 // Positioning of the L-sectors readout chambers
467 //-------------------------------------------------------------------
469 for(ns=0;ns<nOuterSector;ns++){
470 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
471 phi1 *= kRaddeg; // in degrees
473 phi1 = (Float_t)TMath::Nint(phi1);
476 if (phi1 > 360.) phi1 -= 360.;
481 phi3 = ns * OuterOpenAngle+OuterAngleShift;
482 phi3 *= kRaddeg; // in degrees
484 phi3 = (Float_t)TMath::Nint(phi3);
487 if(phi3 > 360.) phi3 -= 360.;
491 alpha = phi3*kDegrad;
493 x = xCenterL * TMath::Cos(alpha);
494 y = xCenterL * TMath::Sin(alpha);
496 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
499 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
505 //-------------------------------------------------------------------
506 // Positioning of the L-sectors (gas sectors)
507 //-------------------------------------------------------------------
509 for(ns=0;ns<nOuterSector;ns++){
511 phi1 = ns*OuterOpenAngle + OuterAngleShift;
514 phi1 = (Float_t)TMath::Nint(phi1);
515 if(phi1>360.) phi1 -= 360.;
520 if(phi2>360.) phi2 -= 360.;
529 //--------------------------------------------------------------
530 // position all sectors
531 //--------------------------------------------------------------
533 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
535 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
544 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
546 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
553 //---------------------------------------------------------------
554 // position selected sectors
555 //---------------------------------------------------------------
557 for(Int_t sel=0;sel<12;sel++){
559 if(fSecUps[sel] == ns+2*nInnerSector){
561 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
562 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
566 else if(fSecUps[sel] == ns+2*nInnerSector+nOuterSector){
573 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
575 Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
586 Float_t z0 = z_side - 0.95;
588 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
590 // ==========================================================
592 // ==========================================================
595 // auxilary structures
599 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
601 // ----------------------------------------------------------
602 // Large wheel -> positioned in the TPC
603 // ----------------------------------------------------------
606 z0 = 263.5; // TPC length - 1/2 spoke wheel width
612 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
618 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
620 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
621 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
624 // Outer vessel + CO2 HV degrader
631 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
636 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
638 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
647 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
648 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
649 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
651 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
654 //----------------------------------------------------------
655 // Small wheel -> positioned in "side gas
656 //----------------------------------------------------------
662 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
668 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
670 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
672 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
674 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
683 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
687 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
689 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
693 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
694 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
702 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
706 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
707 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
710 //---------------------------------------------------------
711 // central wheel 6 (radial direction) x 4 (along z) cm2
712 //---------------------------------------------------------
718 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
724 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
726 z0 = z_side - 1.9 - 2.;
728 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
732 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
735 //---------------------------------------------------------
736 // inner spokes (nSectorInner)
737 //---------------------------------------------------------
739 dm[0] = 0.5*(139.9-82.1);
743 Float_t x1 = dm[0]+82.;
745 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
750 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
752 for(ns=0;ns<nInnerSector;ns++){
754 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
758 phi1 = (Float_t)TMath::Nint(phi1);
759 if(phi1>360.) phi1 -= 360.;
762 if(phi2>360.) phi2 -= 360.;
767 alpha = phi1 * kDegrad;
768 x = x1 * TMath::Cos(alpha);
769 y = x1 * TMath::Sin(alpha);
771 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
773 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
779 //-------------------------------------------------------------
780 // outer spokes (nSectorOuter)
781 //-------------------------------------------------------------
783 dm[0] = 0.5*(257.9-146.1);
789 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
794 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
796 for(ns=0;ns<nOuterSector;ns++){
798 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
802 phi1 = (Float_t)TMath::Nint(phi1);
803 if(phi1>360.) phi1 -= 360.;
806 if(phi2>360.) phi2 -= 360.;
811 alpha = phi1 * kDegrad;
812 x = x1 * TMath::Cos(alpha);
813 y = x1 * TMath::Sin(alpha);
815 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
817 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
825 // --------------------------------------------------------
826 // put the readout chambers into the TPC
827 // --------------------------------------------------------
836 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
840 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
841 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
843 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
845 //----------------------------------------------------
846 // Inner vessel and HV degrader
847 //----------------------------------------------------
869 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
886 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
888 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
889 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
897 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
899 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
901 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
904 // ---------------------------------------------------
906 // ---------------------------------------------------
908 gMC->Gsord("TGAS", 6);
909 gMC->Gsord("TPSG", 6);
915 //_____________________________________________________________________________
916 void AliTPCv2::DrawDetector()
919 // Draw a shaded view of the Time Projection Chamber version 1
922 // Set everything unseen
923 gMC->Gsatt("*", "seen", -1);
925 // Set ALIC mother transparent
926 gMC->Gsatt("ALIC","SEEN",0);
928 // Set the volumes visible
929 gMC->Gsatt("TPC","SEEN",0);
930 gMC->Gsatt("TGAS","SEEN",0);
931 gMC->Gsatt("TPSG","SEEN",0);
932 gMC->Gsatt("TPHV","SEEN",1);
933 gMC->Gsatt("TPMH","SEEN",1);
934 gMC->Gsatt("TPEC","SEEN",0);
935 gMC->Gsatt("TRCS","SEEN",1);
936 gMC->Gsatt("TRCL","SEEN",1);
937 gMC->Gsatt("TPWL","SEEN",1);
938 gMC->Gsatt("TPWI","SEEN",1);
939 gMC->Gsatt("TPWS","SEEN",1);
940 gMC->Gsatt("TPW1","SEEN",1);
941 gMC->Gsatt("TPS1","SEEN",1);
942 gMC->Gsatt("TPS2","SEEN",1);
943 gMC->Gsatt("TPG1","SEEN",1);
944 gMC->Gsatt("TPG2","SEEN",1);
945 gMC->Gsatt("TPWC","SEEN",1);
946 gMC->Gsatt("TPSI","SEEN",1);
947 gMC->Gsatt("TPSO","SEEN",1);
948 gMC->Gsatt("TPCO","SEEN",1);
949 gMC->Gsatt("TPOV","SEEN",1);
950 gMC->Gsatt("TPVD","SEEN",1);
952 gMC->Gdopt("hide", "on");
953 gMC->Gdopt("shad", "on");
954 gMC->Gsatt("*", "fill", 7);
955 gMC->SetClipBox(".");
956 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
958 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
959 gMC->Gdhead(1111, "Time Projection Chamber");
960 gMC->Gdman(18, 4, "MAN");
961 gMC->Gdopt("hide","off");
964 //_____________________________________________________________________________
965 void AliTPCv2::CreateMaterials()
968 // Define materials for version 2 of the Time Projection Chamber
972 // Increase maximum number of steps
973 gMC->SetMaxNStep(30000);
975 AliTPC::CreateMaterials();
978 //_____________________________________________________________________________
979 void AliTPCv2::Init()
982 // Initialises version 2 of the TPC after that it has been built
984 Int_t *idtmed = fIdtmed->GetArray()-399;
986 fIdSens1=gMC->VolId("TLGA"); // L-sector
987 fIdSens2=gMC->VolId("TSGA"); // S-sector
988 fIdSens3=gMC->VolId("TSST"); // strip - S-sector (not always used)
989 fIdSens4=gMC->VolId("TLST"); // strip - S-sector (not always used)
991 gMC->SetMaxNStep(30000); // max. number of steps increased
993 gMC->Gstpar(idtmed[403],"LOSS",5);
995 printf("*** TPC version 2 initialized ***\n");
996 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
1002 //_____________________________________________________________________________
1003 void AliTPCv2::StepManager()
1006 // Called for every step in the Time Projection Chamber
1010 // parameters used for the energy loss calculations
1012 const Float_t prim = 14.35; // number of primary collisions per 1 cm
1013 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
1014 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
1016 // const Float_t prim = 17.65;
1017 // const Float_t poti = 19.02e-9;
1018 // const Float_t w_ion = 33.06e-9;
1021 const Float_t big = 1.e10;
1026 TClonesArray &lhits = *fHits;
1029 AliTPCParam *fTPCParam = &(fDigParam->GetParam());
1035 gMC->SetMaxStep(big);
1037 if(!gMC->IsTrackAlive()) return; // particle has disappeared
1039 Float_t charge = gMC->TrackCharge();
1041 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1044 id=gMC->CurrentVolID(copy);
1046 // Check the sensitive volume
1050 vol[0] = copy + fTPCParam->GetNInnerSector()-1; // L-sector number
1052 else if(id == fIdSens2)
1054 vol[0] = copy-1; // S-sector number
1056 else if(id == fIdSens3 && gMC->IsTrackEntering())
1058 vol[1] = copy-1; // row number
1059 id = gMC->CurrentVolOffID(1,copy);
1060 vol[0] = copy-1; // sector number (S-sector)
1062 gMC->TrackPosition(pos);
1066 hits[3]=0.; // this hit has no energy loss
1067 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1069 else if(id == fIdSens4 && gMC->IsTrackEntering())
1071 vol[1] = copy-1; // row number
1072 id = gMC->CurrentVolOffID(1,copy);
1073 vol[0] = copy+fTPCParam->GetNInnerSector()-1; // sector number (L-sector)
1075 gMC->TrackPosition(pos);
1079 hits[3]=0.; // this hit has no energy loss
1080 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1085 // charged particle is in the sensitive volume
1088 if(gMC->TrackStep() > 0) {
1090 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
1091 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
1093 gMC->TrackPosition(pos);
1097 hits[3]=(Float_t)nel;
1101 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1105 // Stemax calculation for the next step
1109 gMC->TrackMomentum(mom);
1110 Float_t ptot=mom.Rho();
1111 Float_t beta_gamma = ptot/gMC->TrackMass();
1113 if(gMC->IdFromPDG(gMC->TrackPid()) <= 3 && ptot > 0.002)
1115 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
1119 pp=prim*BetheBloch(beta_gamma);
1120 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1124 gMC->Rndm(random,1); // good, old GRNDM from Geant3
1126 Double_t rnd = (Double_t)random[0];
1128 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1132 //_____________________________________________________________________________
1133 Float_t AliTPCv2::BetheBloch(Float_t bg)
1136 // Bethe-Bloch energy loss formula
1138 const Double_t p1=0.76176e-1;
1139 const Double_t p2=10.632;
1140 const Double_t p3=0.13279e-4;
1141 const Double_t p4=1.8631;
1142 const Double_t p5=1.9479;
1144 Double_t dbg = (Double_t) bg;
1146 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1148 Double_t aa = TMath::Power(beta,p4);
1149 Double_t bb = TMath::Power(1./dbg,p5);
1151 bb=TMath::Log(p3+bb);
1153 return ((Float_t)((p2-aa-bb)*p1/aa));