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 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////////
22 // Time Projection Chamber version 2 -- detailed TPC and slow simulation //
26 <img src="picts/AliTPCv2Class.gif">
31 ///////////////////////////////////////////////////////////////////////////////
43 //_____________________________________________________________________________
44 AliTPCv2::AliTPCv2(const char *name, const char *title) :
48 // Standard constructor for Time Projection Chamber version 2
52 SetBufferSize(128000);
55 //_____________________________________________________________________________
56 void AliTPCv2::CreateGeometry()
59 // Create the geometry of Time Projection Chamber version 2
63 <img src="picts/AliTPCv2.gif">
68 <img src="picts/AliTPCv2Tree.gif">
72 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
74 Int_t *idtmed = fIdtmed->GetArray();
83 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
84 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
86 // ---------------------------------------------------
87 // sector specification check
88 // ---------------------------------------------------
92 for (i = 0; i < 6; ++i) {
93 if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
95 printf("*** SECTOR %d selected\n",fSecLows[i]);
100 printf("*** ALL LOWER SECTORS SELECTED ***\n");
107 for (i = 0; i < 12; ++i) {
108 if (fSecUps[i] > 2*nInnerSector-1 &&
109 fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
111 printf("*** SECTOR %d selected\n",fSecUps[i]);
116 printf("*** ALL UPPER SECTORS SELECTED ***\n");
120 if (ifl1 == 0 && ifl2 == 0) {
121 printf("*** ERROR: AT LEAST ONE SECTOR MUST BE SPECIFIED ***\n");
122 printf("!!! PROGRAM STOPPED !!!\n");
126 if ((fSecAL < 0 || fSecAU < 0) && fSens >= 0) {
127 printf("** ERROR: STRIPS CANNOT BE SPECIFIED FOR ALL SECTORS **\n");
128 printf("!!! PROGRAM STOPPED !!!\n");
132 // ----------------------------------------------------
133 // FIELD CAGE WITH ENDCAPS - G10
134 // THIS IS ALSO A TPC MOTHER VOLUME
135 // ----------------------------------------------------
141 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
143 //-----------------------------------------------------
144 // Endcap cover c-fibre 0.86% X0
145 //-----------------------------------------------------
151 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
153 //-----------------------------------------------------
154 // Drift gas , leave 2 cm at the outer radius
156 //-----------------------------------------------------
162 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
164 //------------------------------------------------------
165 // membrane holder - carbon fiber
166 //------------------------------------------------------
169 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
175 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
181 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
183 //----------------------------------------------------------
184 // HV membrane - 25 microns of mylar
185 //----------------------------------------------------------
191 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
193 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
195 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
197 //----------------------------------------------------------
198 // "side" gas volume, the same as the drift gas
199 // the readout chambers are placed there.
200 //----------------------------------------------------------
204 dm[2] = 0.5*(275. - 250.);
206 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
208 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
210 //-----------------------------------------------------------
211 // Readout chambers , 25% of X0, I use Al as the material
212 //-----------------------------------------------------------
214 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
215 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
217 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
218 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
220 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
221 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
223 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
224 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
227 Float_t SecThick = 2.225; // Al
229 Float_t edge = fTPCParam->GetEdge();
233 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
234 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
235 dm[2] = 0.5*SecThick;
236 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
238 Float_t xCenterS = InSecLowEdge+dm[3];
240 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
244 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
245 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
246 dm[2] = 0.5*SecThick;
247 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
249 Float_t xCenterL = OuSecLowEdge+dm[3];
251 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
253 Float_t z1 = -z_side + SecThick*0.5;
255 //------------------------------------------------------------------
256 // S sectors - "gas sectors" (TRD1)
257 //------------------------------------------------------------------
259 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
260 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
261 dm[2] = 0.5*(250. - 0.001);
262 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
264 gMC->Gsvolu("TSGA", "TRD1", idtmed[4], dm, 4); // sensitive
266 // -------------------------------------------------------------
267 // Only for the debugging purpose and resolution calculation
268 // Sensitive strips at the pad-row center
269 // -------------------------------------------------------------
277 Float_t StripThick = 0.01; // 100 microns
278 Float_t dead = fTPCParam->GetDeadZone();
280 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
282 dm[2] = 0.5*(250. - 0.002);
283 dm[3] = 0.5 * StripThick;
286 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
288 r1 = fTPCParam->GetPadRowRadiiLow(ns);
289 r2 = r1 + StripThick;
290 dm[0] = r1 * TMath::Tan(0.5*InnerOpenAngle) - dead;
291 dm[1] = r2 * TMath::Tan(0.5*InnerOpenAngle) - dead;
293 zz = -InSecLowEdge -0.5*(InSecUpEdge-InSecLowEdge);
297 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
302 gMC->Gsord("TSGA", 3);
304 } // if strips selected
307 //-----------------------------------------------------------------
308 // L sectors - "gas sectors" (PGON to avoid overlaps)
309 //-----------------------------------------------------------------
311 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
313 dm[0] = (Float_t)TMath::Nint(dm[0]);
315 dm[1] = OuterOpenAngle*kRaddeg;
316 dm[1] = (Float_t)TMath::Nint(dm[1]);
322 dm[5] = OuSecLowEdge;
323 dm[6] = 252.*TMath::Cos(0.5*OuterOpenAngle)-0.002;
330 dm[11] = OuSecLowEdge;
331 dm[12] = OuSecUpEdge;
337 gMC->Gsvolu("TLGA","PGON",idtmed[4],dm,16);
341 Float_t rmax = dm[6];
343 Float_t dead = fTPCParam->GetDeadZone();
345 Float_t StripThick = 0.01; // 100 microns
347 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
349 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
351 dm[0] = (Float_t)TMath::Nint(dm[0]);
353 dm[1] = OuterOpenAngle*kRaddeg;
354 dm[1] = (Float_t)TMath::Nint(dm[1]);
361 Float_t xx = dead/TMath::Tan(0.5*OuterOpenAngle);
363 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
365 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
366 r2 = r1 + StripThick;
381 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
385 gMC->Gsord("TLGA", 4);
387 } // if strips selected
389 //------------------------------------------------------------------
390 // Positioning of the S-sector readout chambers
391 //------------------------------------------------------------------
393 Float_t zs = 0.5*(250.+0.002);
395 Float_t theta1,theta2,theta3;
396 Float_t phi1,phi2,phi3;
400 for(ns=0;ns<nInnerSector;ns++){
402 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
403 phi1 *= kRaddeg; // in degrees
405 phi1 = (Float_t)TMath::Nint(phi1);
407 if (phi1 > 360.) phi1 -= 360.;
412 phi3 = ns * InnerOpenAngle + InnerAngleShift;
413 phi3 *= kRaddeg; // in degrees
415 phi3 = (Float_t)TMath::Nint(phi3);
417 if(phi3 > 360.) phi3 -= 360.;
421 alpha = phi3*kDegrad;
423 x = xCenterS * TMath::Cos(alpha);
424 y = xCenterS * TMath::Sin(alpha);
426 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
428 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
432 //---------------------------------------------------------------
433 // position all sectors
434 //---------------------------------------------------------------
436 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
437 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
442 //---------------------------------------------------------------
443 // position selected sectors
444 //---------------------------------------------------------------
446 for(Int_t sel=0;sel<6;sel++){
448 if(fSecLows[sel] == ns){
449 gMC->Gspos("TSGA", ns+1, "TGAS", x, y, zs, idrotm[nRotMat], "ONLY");
451 else if(fSecLows[sel] == ns+nInnerSector){
453 Gspos("TSGA",ns+1+nInnerSector,"TGAS", x, y,-zs,idrotm[nRotMat],"ONLY");
462 //-------------------------------------------------------------------
463 // Positioning of the L-sectors readout chambers
464 //-------------------------------------------------------------------
466 for(ns=0;ns<nOuterSector;ns++){
467 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
468 phi1 *= kRaddeg; // in degrees
470 phi1 = (Float_t)TMath::Nint(phi1);
473 if (phi1 > 360.) phi1 -= 360.;
478 phi3 = ns * OuterOpenAngle+OuterAngleShift;
479 phi3 *= kRaddeg; // in degrees
481 phi3 = (Float_t)TMath::Nint(phi3);
484 if(phi3 > 360.) phi3 -= 360.;
488 alpha = phi3*kDegrad;
490 x = xCenterL * TMath::Cos(alpha);
491 y = xCenterL * TMath::Sin(alpha);
493 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
496 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
502 //-------------------------------------------------------------------
503 // Positioning of the L-sectors (gas sectors)
504 //-------------------------------------------------------------------
506 for(ns=0;ns<nOuterSector;ns++){
508 phi1 = ns*OuterOpenAngle + OuterAngleShift;
511 phi1 = (Float_t)TMath::Nint(phi1);
512 if(phi1>360.) phi1 -= 360.;
517 if(phi2>360.) phi2 -= 360.;
526 //--------------------------------------------------------------
527 // position all sectors
528 //--------------------------------------------------------------
530 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
532 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
541 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
543 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
550 //---------------------------------------------------------------
551 // position selected sectors
552 //---------------------------------------------------------------
554 for(Int_t sel=0;sel<12;sel++){
556 if(fSecUps[sel] == ns+2*nInnerSector){
558 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
559 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
563 else if(fSecUps[sel] == ns+2*nInnerSector+nOuterSector){
570 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
572 Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
583 Float_t z0 = z_side - 0.95;
585 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
587 // ==========================================================
589 // ==========================================================
592 // auxilary structures
596 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
598 // ----------------------------------------------------------
599 // Large wheel -> positioned in the TPC
600 // ----------------------------------------------------------
603 z0 = 263.5; // TPC length - 1/2 spoke wheel width
609 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
615 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
617 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
618 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
621 // Outer vessel + CO2 HV degrader
628 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
633 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
635 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
644 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
645 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
646 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
648 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
651 //----------------------------------------------------------
652 // Small wheel -> positioned in "side gas
653 //----------------------------------------------------------
659 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
665 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
667 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
669 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
671 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
680 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
684 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
686 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
690 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
691 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
699 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
703 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
704 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
707 //---------------------------------------------------------
708 // central wheel 6 (radial direction) x 4 (along z) cm2
709 //---------------------------------------------------------
715 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
721 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
723 z0 = z_side - 1.9 - 2.;
725 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
729 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
732 //---------------------------------------------------------
733 // inner spokes (nSectorInner)
734 //---------------------------------------------------------
736 dm[0] = 0.5*(139.9-82.1);
740 Float_t x1 = dm[0]+82.;
742 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
747 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
749 for(ns=0;ns<nInnerSector;ns++){
751 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
755 phi1 = (Float_t)TMath::Nint(phi1);
756 if(phi1>360.) phi1 -= 360.;
759 if(phi2>360.) phi2 -= 360.;
764 alpha = phi1 * kDegrad;
765 x = x1 * TMath::Cos(alpha);
766 y = x1 * TMath::Sin(alpha);
768 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
770 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
776 //-------------------------------------------------------------
777 // outer spokes (nSectorOuter)
778 //-------------------------------------------------------------
780 dm[0] = 0.5*(257.9-146.1);
786 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
791 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
793 for(ns=0;ns<nOuterSector;ns++){
795 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
799 phi1 = (Float_t)TMath::Nint(phi1);
800 if(phi1>360.) phi1 -= 360.;
803 if(phi2>360.) phi2 -= 360.;
808 alpha = phi1 * kDegrad;
809 x = x1 * TMath::Cos(alpha);
810 y = x1 * TMath::Sin(alpha);
812 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
814 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
822 // --------------------------------------------------------
823 // put the readout chambers into the TPC
824 // --------------------------------------------------------
833 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
837 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
838 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
840 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
842 //----------------------------------------------------
843 // Inner vessel and HV degrader
844 //----------------------------------------------------
866 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
883 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
885 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
886 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
894 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
896 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
898 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
901 // ---------------------------------------------------
903 // ---------------------------------------------------
905 gMC->Gsord("TGAS", 6);
906 gMC->Gsord("TPSG", 6);
912 //_____________________________________________________________________________
913 void AliTPCv2::DrawDetector()
916 // Draw a shaded view of the Time Projection Chamber version 1
919 // Set everything unseen
920 gMC->Gsatt("*", "seen", -1);
922 // Set ALIC mother transparent
923 gMC->Gsatt("ALIC","SEEN",0);
925 // Set the volumes visible
926 gMC->Gsatt("TPC","SEEN",0);
927 gMC->Gsatt("TGAS","SEEN",0);
928 gMC->Gsatt("TPSG","SEEN",0);
929 gMC->Gsatt("TPHV","SEEN",1);
930 gMC->Gsatt("TPMH","SEEN",1);
931 gMC->Gsatt("TPEC","SEEN",0);
932 gMC->Gsatt("TRCS","SEEN",1);
933 gMC->Gsatt("TRCL","SEEN",1);
934 gMC->Gsatt("TPWL","SEEN",1);
935 gMC->Gsatt("TPWI","SEEN",1);
936 gMC->Gsatt("TPWS","SEEN",1);
937 gMC->Gsatt("TPW1","SEEN",1);
938 gMC->Gsatt("TPS1","SEEN",1);
939 gMC->Gsatt("TPS2","SEEN",1);
940 gMC->Gsatt("TPG1","SEEN",1);
941 gMC->Gsatt("TPG2","SEEN",1);
942 gMC->Gsatt("TPWC","SEEN",1);
943 gMC->Gsatt("TPSI","SEEN",1);
944 gMC->Gsatt("TPSO","SEEN",1);
945 gMC->Gsatt("TPCO","SEEN",1);
946 gMC->Gsatt("TPOV","SEEN",1);
947 gMC->Gsatt("TPVD","SEEN",1);
949 gMC->Gdopt("hide", "on");
950 gMC->Gdopt("shad", "on");
951 gMC->Gsatt("*", "fill", 7);
952 gMC->SetClipBox(".");
953 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
955 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
956 gMC->Gdhead(1111, "Time Projection Chamber");
957 gMC->Gdman(18, 4, "MAN");
958 gMC->Gdopt("hide","off");
961 //_____________________________________________________________________________
962 void AliTPCv2::CreateMaterials()
965 // Define materials for version 2 of the Time Projection Chamber
969 // Increase maximum number of steps
970 gMC->SetMaxNStep(30000);
972 AliTPC::CreateMaterials();
975 //_____________________________________________________________________________
976 void AliTPCv2::Init()
979 // Initialises version 2 of the TPC after that it has been built
981 Int_t *idtmed = fIdtmed->GetArray()-399;
983 fIdSens1=gMC->VolId("TLGA"); // L-sector
984 fIdSens2=gMC->VolId("TSGA"); // S-sector
985 fIdSens3=gMC->VolId("TSST"); // strip - S-sector (not always used)
986 fIdSens4=gMC->VolId("TLST"); // strip - S-sector (not always used)
988 gMC->SetMaxNStep(30000); // max. number of steps increased
990 gMC->Gstpar(idtmed[403],"LOSS",5);
992 printf("*** TPC version 2 initialized ***\n");
993 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
999 //_____________________________________________________________________________
1000 void AliTPCv2::StepManager()
1003 // Called for every step in the Time Projection Chamber
1007 // parameters used for the energy loss calculations
1009 const Float_t prim = 14.35; // number of primary collisions per 1 cm
1010 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
1011 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
1013 // const Float_t prim = 17.65;
1014 // const Float_t poti = 19.02e-9;
1015 // const Float_t w_ion = 33.06e-9;
1018 const Float_t big = 1.e10;
1023 TClonesArray &lhits = *fHits;
1026 AliTPCParam *fTPCParam = &(fDigParam->GetParam());
1032 gMC->SetMaxStep(big);
1034 if(!gMC->IsTrackAlive()) return; // particle has disappeared
1036 Float_t charge = gMC->TrackCharge();
1038 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1041 id=gMC->CurrentVolID(copy);
1043 // Check the sensitive volume
1047 vol[0] = copy + fTPCParam->GetNInnerSector()-1; // L-sector number
1049 else if(id == fIdSens2)
1051 vol[0] = copy-1; // S-sector number
1053 else if(id == fIdSens3 && gMC->IsTrackEntering())
1055 vol[1] = copy-1; // row number
1056 id = gMC->CurrentVolOffID(1,copy);
1057 vol[0] = copy-1; // sector number (S-sector)
1059 gMC->TrackPosition(pos);
1063 hits[3]=0.; // this hit has no energy loss
1064 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1066 else if(id == fIdSens4 && gMC->IsTrackEntering())
1068 vol[1] = copy-1; // row number
1069 id = gMC->CurrentVolOffID(1,copy);
1070 vol[0] = copy+fTPCParam->GetNInnerSector()-1; // sector number (L-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);
1082 // charged particle is in the sensitive volume
1085 if(gMC->TrackStep() > 0) {
1087 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
1088 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
1090 gMC->TrackPosition(pos);
1094 hits[3]=(Float_t)nel;
1098 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1102 // Stemax calculation for the next step
1106 gMC->TrackMomentum(mom);
1107 Float_t ptot=mom.Rho();
1108 Float_t beta_gamma = ptot/gMC->TrackMass();
1110 if(gMC->IdFromPDG(gMC->TrackPid()) <= 3 && ptot > 0.002)
1112 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
1116 pp=prim*BetheBloch(beta_gamma);
1117 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1121 gMC->Rndm(random,1); // good, old GRNDM from Geant3
1123 Double_t rnd = (Double_t)random[0];
1125 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1129 //_____________________________________________________________________________
1130 Float_t AliTPCv2::BetheBloch(Float_t bg)
1133 // Bethe-Bloch energy loss formula
1135 const Double_t p1=0.76176e-1;
1136 const Double_t p2=10.632;
1137 const Double_t p3=0.13279e-4;
1138 const Double_t p4=1.8631;
1139 const Double_t p5=1.9479;
1141 Double_t dbg = (Double_t) bg;
1143 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1145 Double_t aa = TMath::Power(beta,p4);
1146 Double_t bb = TMath::Power(1./dbg,p5);
1148 bb=TMath::Log(p3+bb);
1150 return ((Float_t)((p2-aa-bb)*p1/aa));