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.16 1999/10/04 13:39:54 fca
19 Correct array index problem
21 Revision 1.15 1999/09/29 09:24:34 fca
22 Introduction of the Copyright and cvs Log
26 ///////////////////////////////////////////////////////////////////////////////
28 // Time Projection Chamber version 2 -- detailed TPC and slow simulation //
32 <img src="picts/AliTPCv2Class.gif">
37 ///////////////////////////////////////////////////////////////////////////////
49 //_____________________________________________________________________________
50 AliTPCv2::AliTPCv2(const char *name, const char *title) :
54 // Standard constructor for Time Projection Chamber version 2
58 SetBufferSize(128000);
61 //_____________________________________________________________________________
62 void AliTPCv2::CreateGeometry()
65 // Create the geometry of Time Projection Chamber version 2
69 <img src="picts/AliTPCv2.gif">
74 <img src="picts/AliTPCv2Tree.gif">
78 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
80 Int_t *idtmed = fIdtmed->GetArray();
89 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
90 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
92 // ---------------------------------------------------
93 // sector specification check
94 // ---------------------------------------------------
98 for (i = 0; i < 6; ++i) {
99 if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
101 printf("*** SECTOR %d selected\n",fSecLows[i]);
106 printf("*** ALL LOWER SECTORS SELECTED ***\n");
113 for (i = 0; i < 12; ++i) {
114 if (fSecUps[i] > 2*nInnerSector-1 &&
115 fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
117 printf("*** SECTOR %d selected\n",fSecUps[i]);
122 printf("*** ALL UPPER SECTORS SELECTED ***\n");
126 if (ifl1 == 0 && ifl2 == 0) {
127 printf("*** ERROR: AT LEAST ONE SECTOR MUST BE SPECIFIED ***\n");
128 printf("!!! PROGRAM STOPPED !!!\n");
132 if ((fSecAL < 0 || fSecAU < 0) && fSens >= 0) {
133 printf("** ERROR: STRIPS CANNOT BE SPECIFIED FOR ALL SECTORS **\n");
134 printf("!!! PROGRAM STOPPED !!!\n");
138 // ----------------------------------------------------
139 // FIELD CAGE WITH ENDCAPS - G10
140 // THIS IS ALSO A TPC MOTHER VOLUME
141 // ----------------------------------------------------
147 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
149 //-----------------------------------------------------
150 // Endcap cover c-fibre 0.86% X0
151 //-----------------------------------------------------
157 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
159 //-----------------------------------------------------
160 // Drift gas , leave 2 cm at the outer radius
162 //-----------------------------------------------------
168 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
170 //------------------------------------------------------
171 // membrane holder - carbon fiber
172 //------------------------------------------------------
175 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
181 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
187 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
189 //----------------------------------------------------------
190 // HV membrane - 25 microns of mylar
191 //----------------------------------------------------------
197 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
199 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
201 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
203 //----------------------------------------------------------
204 // "side" gas volume, the same as the drift gas
205 // the readout chambers are placed there.
206 //----------------------------------------------------------
210 dm[2] = 0.5*(275. - 250.);
212 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
214 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
216 //-----------------------------------------------------------
217 // Readout chambers , 25% of X0, I use Al as the material
218 //-----------------------------------------------------------
220 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
221 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
223 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
224 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
226 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
227 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
229 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
230 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
233 Float_t SecThick = 2.225; // Al
235 Float_t edge = fTPCParam->GetEdge();
239 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
240 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
241 dm[2] = 0.5*SecThick;
242 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
244 Float_t xCenterS = InSecLowEdge+dm[3];
246 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
250 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
251 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
252 dm[2] = 0.5*SecThick;
253 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
255 Float_t xCenterL = OuSecLowEdge+dm[3];
257 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
259 Float_t z1 = -z_side + SecThick*0.5;
261 //------------------------------------------------------------------
262 // S sectors - "gas sectors" (TRD1)
263 //------------------------------------------------------------------
265 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
266 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
267 dm[2] = 0.5*(250. - 0.001);
268 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
270 gMC->Gsvolu("TSGA", "TRD1", idtmed[4], dm, 4); // sensitive
272 // -------------------------------------------------------------
273 // Only for the debugging purpose and resolution calculation
274 // Sensitive strips at the pad-row center
275 // -------------------------------------------------------------
283 Float_t StripThick = 0.01; // 100 microns
284 Float_t dead = fTPCParam->GetDeadZone();
286 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
288 dm[2] = 0.5*(250. - 0.002);
289 dm[3] = 0.5 * StripThick;
292 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
294 r1 = fTPCParam->GetPadRowRadiiLow(ns);
295 r2 = r1 + StripThick;
296 dm[0] = r1 * TMath::Tan(0.5*InnerOpenAngle) - dead;
297 dm[1] = r2 * TMath::Tan(0.5*InnerOpenAngle) - dead;
299 zz = -InSecLowEdge -0.5*(InSecUpEdge-InSecLowEdge);
303 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
308 gMC->Gsord("TSGA", 3);
310 } // if strips selected
313 //-----------------------------------------------------------------
314 // L sectors - "gas sectors" (PGON to avoid overlaps)
315 //-----------------------------------------------------------------
317 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
319 dm[0] = (Float_t)TMath::Nint(dm[0]);
321 dm[1] = OuterOpenAngle*kRaddeg;
322 dm[1] = (Float_t)TMath::Nint(dm[1]);
328 dm[5] = OuSecLowEdge;
329 dm[6] = 252.*TMath::Cos(0.5*OuterOpenAngle)-0.002;
336 dm[11] = OuSecLowEdge;
337 dm[12] = OuSecUpEdge;
343 gMC->Gsvolu("TLGA","PGON",idtmed[4],dm,16);
347 Float_t rmax = dm[6];
349 Float_t dead = fTPCParam->GetDeadZone();
351 Float_t StripThick = 0.01; // 100 microns
353 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
355 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
357 dm[0] = (Float_t)TMath::Nint(dm[0]);
359 dm[1] = OuterOpenAngle*kRaddeg;
360 dm[1] = (Float_t)TMath::Nint(dm[1]);
367 Float_t xx = dead/TMath::Tan(0.5*OuterOpenAngle);
369 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
371 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
372 r2 = r1 + StripThick;
387 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
391 gMC->Gsord("TLGA", 4);
393 } // if strips selected
395 //------------------------------------------------------------------
396 // Positioning of the S-sector readout chambers
397 //------------------------------------------------------------------
399 Float_t zs = 0.5*(250.+0.002);
401 Float_t theta1,theta2,theta3;
402 Float_t phi1,phi2,phi3;
406 for(ns=0;ns<nInnerSector;ns++){
408 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
409 phi1 *= kRaddeg; // in degrees
411 phi1 = (Float_t)TMath::Nint(phi1);
413 if (phi1 > 360.) phi1 -= 360.;
418 phi3 = ns * InnerOpenAngle + InnerAngleShift;
419 phi3 *= kRaddeg; // in degrees
421 phi3 = (Float_t)TMath::Nint(phi3);
423 if(phi3 > 360.) phi3 -= 360.;
427 alpha = phi3*kDegrad;
429 x = xCenterS * TMath::Cos(alpha);
430 y = xCenterS * TMath::Sin(alpha);
432 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
434 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
438 //---------------------------------------------------------------
439 // position all sectors
440 //---------------------------------------------------------------
442 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
443 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
448 //---------------------------------------------------------------
449 // position selected sectors
450 //---------------------------------------------------------------
452 for(Int_t sel=0;sel<6;sel++){
454 if(fSecLows[sel] == ns){
455 gMC->Gspos("TSGA", ns+1, "TGAS", x, y, zs, idrotm[nRotMat], "ONLY");
457 else if(fSecLows[sel] == ns+nInnerSector){
459 Gspos("TSGA",ns+1+nInnerSector,"TGAS", x, y,-zs,idrotm[nRotMat],"ONLY");
468 //-------------------------------------------------------------------
469 // Positioning of the L-sectors readout chambers
470 //-------------------------------------------------------------------
472 for(ns=0;ns<nOuterSector;ns++){
473 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
474 phi1 *= kRaddeg; // in degrees
476 phi1 = (Float_t)TMath::Nint(phi1);
479 if (phi1 > 360.) phi1 -= 360.;
484 phi3 = ns * OuterOpenAngle+OuterAngleShift;
485 phi3 *= kRaddeg; // in degrees
487 phi3 = (Float_t)TMath::Nint(phi3);
490 if(phi3 > 360.) phi3 -= 360.;
494 alpha = phi3*kDegrad;
496 x = xCenterL * TMath::Cos(alpha);
497 y = xCenterL * TMath::Sin(alpha);
499 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
502 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
508 //-------------------------------------------------------------------
509 // Positioning of the L-sectors (gas sectors)
510 //-------------------------------------------------------------------
512 for(ns=0;ns<nOuterSector;ns++){
514 phi1 = ns*OuterOpenAngle + OuterAngleShift;
517 phi1 = (Float_t)TMath::Nint(phi1);
518 if(phi1>360.) phi1 -= 360.;
523 if(phi2>360.) phi2 -= 360.;
532 //--------------------------------------------------------------
533 // position all sectors
534 //--------------------------------------------------------------
536 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
538 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
547 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
549 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
556 //---------------------------------------------------------------
557 // position selected sectors
558 //---------------------------------------------------------------
560 for(Int_t sel=0;sel<12;sel++){
562 if(fSecUps[sel] == ns+2*nInnerSector){
564 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
565 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
569 else if(fSecUps[sel] == ns+2*nInnerSector+nOuterSector){
576 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
578 Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
589 Float_t z0 = z_side - 0.95;
591 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
593 // ==========================================================
595 // ==========================================================
598 // auxilary structures
602 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
604 // ----------------------------------------------------------
605 // Large wheel -> positioned in the TPC
606 // ----------------------------------------------------------
609 z0 = 263.5; // TPC length - 1/2 spoke wheel width
615 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
621 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
623 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
624 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
627 // Outer vessel + CO2 HV degrader
634 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
639 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
641 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
650 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
651 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
652 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
654 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
657 //----------------------------------------------------------
658 // Small wheel -> positioned in "side gas
659 //----------------------------------------------------------
665 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
671 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
673 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
675 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
677 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
686 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
690 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
692 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
696 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
697 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
705 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
709 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
710 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
713 //---------------------------------------------------------
714 // central wheel 6 (radial direction) x 4 (along z) cm2
715 //---------------------------------------------------------
721 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
727 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
729 z0 = z_side - 1.9 - 2.;
731 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
735 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
738 //---------------------------------------------------------
739 // inner spokes (nSectorInner)
740 //---------------------------------------------------------
742 dm[0] = 0.5*(139.9-82.1);
746 Float_t x1 = dm[0]+82.;
748 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
753 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
755 for(ns=0;ns<nInnerSector;ns++){
757 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
761 phi1 = (Float_t)TMath::Nint(phi1);
762 if(phi1>360.) phi1 -= 360.;
765 if(phi2>360.) phi2 -= 360.;
770 alpha = phi1 * kDegrad;
771 x = x1 * TMath::Cos(alpha);
772 y = x1 * TMath::Sin(alpha);
774 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
776 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
782 //-------------------------------------------------------------
783 // outer spokes (nSectorOuter)
784 //-------------------------------------------------------------
786 dm[0] = 0.5*(257.9-146.1);
792 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
797 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
799 for(ns=0;ns<nOuterSector;ns++){
801 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
805 phi1 = (Float_t)TMath::Nint(phi1);
806 if(phi1>360.) phi1 -= 360.;
809 if(phi2>360.) phi2 -= 360.;
814 alpha = phi1 * kDegrad;
815 x = x1 * TMath::Cos(alpha);
816 y = x1 * TMath::Sin(alpha);
818 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
820 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
828 // --------------------------------------------------------
829 // put the readout chambers into the TPC
830 // --------------------------------------------------------
839 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
843 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
844 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
846 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
848 //----------------------------------------------------
849 // Inner vessel and HV degrader
850 //----------------------------------------------------
872 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
889 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
891 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
892 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
900 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
902 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
904 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
907 // ---------------------------------------------------
909 // ---------------------------------------------------
911 gMC->Gsord("TGAS", 6);
912 gMC->Gsord("TPSG", 6);
918 //_____________________________________________________________________________
919 void AliTPCv2::DrawDetector()
922 // Draw a shaded view of the Time Projection Chamber version 1
925 // Set everything unseen
926 gMC->Gsatt("*", "seen", -1);
928 // Set ALIC mother transparent
929 gMC->Gsatt("ALIC","SEEN",0);
931 // Set the volumes visible
932 gMC->Gsatt("TPC","SEEN",0);
933 gMC->Gsatt("TGAS","SEEN",0);
934 gMC->Gsatt("TPSG","SEEN",0);
935 gMC->Gsatt("TPHV","SEEN",1);
936 gMC->Gsatt("TPMH","SEEN",1);
937 gMC->Gsatt("TPEC","SEEN",0);
938 gMC->Gsatt("TRCS","SEEN",1);
939 gMC->Gsatt("TRCL","SEEN",1);
940 gMC->Gsatt("TPWL","SEEN",1);
941 gMC->Gsatt("TPWI","SEEN",1);
942 gMC->Gsatt("TPWS","SEEN",1);
943 gMC->Gsatt("TPW1","SEEN",1);
944 gMC->Gsatt("TPS1","SEEN",1);
945 gMC->Gsatt("TPS2","SEEN",1);
946 gMC->Gsatt("TPG1","SEEN",1);
947 gMC->Gsatt("TPG2","SEEN",1);
948 gMC->Gsatt("TPWC","SEEN",1);
949 gMC->Gsatt("TPSI","SEEN",1);
950 gMC->Gsatt("TPSO","SEEN",1);
951 gMC->Gsatt("TPCO","SEEN",1);
952 gMC->Gsatt("TPOV","SEEN",1);
953 gMC->Gsatt("TPVD","SEEN",1);
955 gMC->Gdopt("hide", "on");
956 gMC->Gdopt("shad", "on");
957 gMC->Gsatt("*", "fill", 7);
958 gMC->SetClipBox(".");
959 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
961 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
962 gMC->Gdhead(1111, "Time Projection Chamber");
963 gMC->Gdman(18, 4, "MAN");
964 gMC->Gdopt("hide","off");
967 //_____________________________________________________________________________
968 void AliTPCv2::CreateMaterials()
971 // Define materials for version 2 of the Time Projection Chamber
975 // Increase maximum number of steps
976 gMC->SetMaxNStep(30000);
978 AliTPC::CreateMaterials();
981 //_____________________________________________________________________________
982 void AliTPCv2::Init()
985 // Initialises version 2 of the TPC after that it has been built
987 Int_t *idtmed = fIdtmed->GetArray()-399;
989 fIdSens1=gMC->VolId("TLGA"); // L-sector
990 fIdSens2=gMC->VolId("TSGA"); // S-sector
991 fIdSens3=gMC->VolId("TSST"); // strip - S-sector (not always used)
992 fIdSens4=gMC->VolId("TLST"); // strip - S-sector (not always used)
994 gMC->SetMaxNStep(30000); // max. number of steps increased
996 gMC->Gstpar(idtmed[403],"LOSS",5);
998 printf("*** TPC version 2 initialized ***\n");
999 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
1005 //_____________________________________________________________________________
1006 void AliTPCv2::StepManager()
1009 // Called for every step in the Time Projection Chamber
1013 // parameters used for the energy loss calculations
1015 const Float_t prim = 14.35; // number of primary collisions per 1 cm
1016 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
1017 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
1019 // const Float_t prim = 17.65;
1020 // const Float_t poti = 19.02e-9;
1021 // const Float_t w_ion = 33.06e-9;
1024 const Float_t big = 1.e10;
1029 TClonesArray &lhits = *fHits;
1032 AliTPCParam *fTPCParam = &(fDigParam->GetParam());
1038 gMC->SetMaxStep(big);
1040 if(!gMC->IsTrackAlive()) return; // particle has disappeared
1042 Float_t charge = gMC->TrackCharge();
1044 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1047 id=gMC->CurrentVolID(copy);
1049 // Check the sensitive volume
1053 vol[0] = copy + fTPCParam->GetNInnerSector()-1; // L-sector number
1055 else if(id == fIdSens2)
1057 vol[0] = copy-1; // S-sector number
1059 else if(id == fIdSens3 && gMC->IsTrackEntering())
1061 vol[1] = copy-1; // row number
1062 id = gMC->CurrentVolOffID(1,copy);
1063 vol[0] = copy-1; // sector number (S-sector)
1065 gMC->TrackPosition(pos);
1069 hits[3]=0.; // this hit has no energy loss
1070 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1072 else if(id == fIdSens4 && gMC->IsTrackEntering())
1074 vol[1] = copy-1; // row number
1075 id = gMC->CurrentVolOffID(1,copy);
1076 vol[0] = copy+fTPCParam->GetNInnerSector()-1; // sector number (L-sector)
1078 gMC->TrackPosition(pos);
1082 hits[3]=0.; // this hit has no energy loss
1083 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1088 // charged particle is in the sensitive volume
1091 if(gMC->TrackStep() > 0) {
1093 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
1094 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
1096 gMC->TrackPosition(pos);
1100 hits[3]=(Float_t)nel;
1104 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1108 // Stemax calculation for the next step
1112 gMC->TrackMomentum(mom);
1113 Float_t ptot=mom.Rho();
1114 Float_t beta_gamma = ptot/gMC->TrackMass();
1116 if(gMC->IdFromPDG(gMC->TrackPid()) <= 3 && ptot > 0.002)
1118 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
1122 pp=prim*BetheBloch(beta_gamma);
1123 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1127 gMC->Rndm(random,1); // good, old GRNDM from Geant3
1129 Double_t rnd = (Double_t)random[0];
1131 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1135 //_____________________________________________________________________________
1136 Float_t AliTPCv2::BetheBloch(Float_t bg)
1139 // Bethe-Bloch energy loss formula
1141 const Double_t p1=0.76176e-1;
1142 const Double_t p2=10.632;
1143 const Double_t p3=0.13279e-4;
1144 const Double_t p4=1.8631;
1145 const Double_t p5=1.9479;
1147 Double_t dbg = (Double_t) bg;
1149 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1151 Double_t aa = TMath::Power(beta,p4);
1152 Double_t bb = TMath::Power(1./dbg,p5);
1154 bb=TMath::Log(p3+bb);
1156 return ((Float_t)((p2-aa-bb)*p1/aa));