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.17 1999/10/08 06:27:23 fca
19 Corrected bug in the HV degrader geometry, thanks to G.Tabary
21 Revision 1.16 1999/10/04 13:39:54 fca
22 Correct array index problem
24 Revision 1.15 1999/09/29 09:24:34 fca
25 Introduction of the Copyright and cvs Log
29 ///////////////////////////////////////////////////////////////////////////////
31 // Time Projection Chamber version 2 -- detailed TPC and slow simulation //
35 <img src="picts/AliTPCv2Class.gif">
40 ///////////////////////////////////////////////////////////////////////////////
53 //_____________________________________________________________________________
54 AliTPCv2::AliTPCv2(const char *name, const char *title) :
58 // Standard constructor for Time Projection Chamber version 2
62 SetBufferSize(128000);
65 //_____________________________________________________________________________
66 void AliTPCv2::CreateGeometry()
69 // Create the geometry of Time Projection Chamber version 2
73 <img src="picts/AliTPCv2.gif">
78 <img src="picts/AliTPCv2Tree.gif">
82 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
84 Int_t *idtmed = fIdtmed->GetArray();
93 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
94 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
96 // ---------------------------------------------------
97 // sector specification check
98 // ---------------------------------------------------
102 for (i = 0; i < 6; ++i) {
103 if (fSecLows[i] >= 0 && fSecLows[i] < 2*nInnerSector) {
105 printf("*** SECTOR %d selected\n",fSecLows[i]);
110 printf("*** ALL LOWER SECTORS SELECTED ***\n");
117 for (i = 0; i < 12; ++i) {
118 if (fSecUps[i] > 2*nInnerSector-1 &&
119 fSecUps[i] < 2*(nInnerSector+nOuterSector)) {
121 printf("*** SECTOR %d selected\n",fSecUps[i]);
126 printf("*** ALL UPPER SECTORS SELECTED ***\n");
130 if (ifl1 == 0 && ifl2 == 0) {
131 printf("*** ERROR: AT LEAST ONE SECTOR MUST BE SPECIFIED ***\n");
132 printf("!!! PROGRAM STOPPED !!!\n");
136 if ((fSecAL < 0 || fSecAU < 0) && fSens >= 0) {
137 printf("** ERROR: STRIPS CANNOT BE SPECIFIED FOR ALL SECTORS **\n");
138 printf("!!! PROGRAM STOPPED !!!\n");
142 // ----------------------------------------------------
143 // FIELD CAGE WITH ENDCAPS - G10
144 // THIS IS ALSO A TPC MOTHER VOLUME
145 // ----------------------------------------------------
151 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
153 //-----------------------------------------------------
154 // Endcap cover c-fibre 0.86% X0
155 //-----------------------------------------------------
161 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
163 //-----------------------------------------------------
164 // Drift gas , leave 2 cm at the outer radius
166 //-----------------------------------------------------
172 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
174 //------------------------------------------------------
175 // membrane holder - carbon fiber
176 //------------------------------------------------------
179 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
185 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
191 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
193 //----------------------------------------------------------
194 // HV membrane - 25 microns of mylar
195 //----------------------------------------------------------
201 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
203 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
205 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
207 //----------------------------------------------------------
208 // "side" gas volume, the same as the drift gas
209 // the readout chambers are placed there.
210 //----------------------------------------------------------
214 dm[2] = 0.5*(275. - 250.);
216 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
218 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
220 //-----------------------------------------------------------
221 // Readout chambers , 25% of X0, I use Al as the material
222 //-----------------------------------------------------------
224 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
225 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
227 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
228 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
230 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
231 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
233 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
234 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
237 Float_t SecThick = 2.225; // Al
239 Float_t edge = fTPCParam->GetEdge();
243 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
244 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
245 dm[2] = 0.5*SecThick;
246 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
248 Float_t xCenterS = InSecLowEdge+dm[3];
250 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
254 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
255 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
256 dm[2] = 0.5*SecThick;
257 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
259 Float_t xCenterL = OuSecLowEdge+dm[3];
261 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
263 Float_t z1 = -z_side + SecThick*0.5;
265 //------------------------------------------------------------------
266 // S sectors - "gas sectors" (TRD1)
267 //------------------------------------------------------------------
269 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
270 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
271 dm[2] = 0.5*(250. - 0.001);
272 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
274 gMC->Gsvolu("TSGA", "TRD1", idtmed[4], dm, 4); // sensitive
276 // -------------------------------------------------------------
277 // Only for the debugging purpose and resolution calculation
278 // Sensitive strips at the pad-row center
279 // -------------------------------------------------------------
287 Float_t StripThick = 0.01; // 100 microns
288 Float_t dead = fTPCParam->GetDeadZone();
290 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
292 dm[2] = 0.5*(250. - 0.002);
293 dm[3] = 0.5 * StripThick;
296 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
298 r1 = fTPCParam->GetPadRowRadiiLow(ns);
299 r2 = r1 + StripThick;
300 dm[0] = r1 * TMath::Tan(0.5*InnerOpenAngle) - dead;
301 dm[1] = r2 * TMath::Tan(0.5*InnerOpenAngle) - dead;
303 zz = -InSecLowEdge -0.5*(InSecUpEdge-InSecLowEdge);
307 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
312 gMC->Gsord("TSGA", 3);
314 } // if strips selected
317 //-----------------------------------------------------------------
318 // L sectors - "gas sectors" (PGON to avoid overlaps)
319 //-----------------------------------------------------------------
321 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
323 dm[0] = (Float_t)TMath::Nint(dm[0]);
325 dm[1] = OuterOpenAngle*kRaddeg;
326 dm[1] = (Float_t)TMath::Nint(dm[1]);
332 dm[5] = OuSecLowEdge;
333 dm[6] = 252.*TMath::Cos(0.5*OuterOpenAngle)-0.002;
340 dm[11] = OuSecLowEdge;
341 dm[12] = OuSecUpEdge;
347 gMC->Gsvolu("TLGA","PGON",idtmed[4],dm,16);
351 Float_t rmax = dm[6];
353 Float_t dead = fTPCParam->GetDeadZone();
355 Float_t StripThick = 0.01; // 100 microns
357 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
359 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
361 dm[0] = (Float_t)TMath::Nint(dm[0]);
363 dm[1] = OuterOpenAngle*kRaddeg;
364 dm[1] = (Float_t)TMath::Nint(dm[1]);
371 Float_t xx = dead/TMath::Tan(0.5*OuterOpenAngle);
373 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
375 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
376 r2 = r1 + StripThick;
391 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
395 gMC->Gsord("TLGA", 4);
397 } // if strips selected
399 //------------------------------------------------------------------
400 // Positioning of the S-sector readout chambers
401 //------------------------------------------------------------------
403 Float_t zs = 0.5*(250.+0.002);
405 Float_t theta1,theta2,theta3;
406 Float_t phi1,phi2,phi3;
410 for(ns=0;ns<nInnerSector;ns++){
412 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
413 phi1 *= kRaddeg; // in degrees
415 phi1 = (Float_t)TMath::Nint(phi1);
417 if (phi1 > 360.) phi1 -= 360.;
422 phi3 = ns * InnerOpenAngle + InnerAngleShift;
423 phi3 *= kRaddeg; // in degrees
425 phi3 = (Float_t)TMath::Nint(phi3);
427 if(phi3 > 360.) phi3 -= 360.;
431 alpha = phi3*kDegrad;
433 x = xCenterS * TMath::Cos(alpha);
434 y = xCenterS * TMath::Sin(alpha);
436 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
438 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
442 //---------------------------------------------------------------
443 // position all sectors
444 //---------------------------------------------------------------
446 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
447 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
452 //---------------------------------------------------------------
453 // position selected sectors
454 //---------------------------------------------------------------
456 for(Int_t sel=0;sel<6;sel++){
458 if(fSecLows[sel] == ns){
459 gMC->Gspos("TSGA", ns+1, "TGAS", x, y, zs, idrotm[nRotMat], "ONLY");
461 else if(fSecLows[sel] == ns+nInnerSector){
463 Gspos("TSGA",ns+1+nInnerSector,"TGAS", x, y,-zs,idrotm[nRotMat],"ONLY");
472 //-------------------------------------------------------------------
473 // Positioning of the L-sectors readout chambers
474 //-------------------------------------------------------------------
476 for(ns=0;ns<nOuterSector;ns++){
477 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
478 phi1 *= kRaddeg; // in degrees
480 phi1 = (Float_t)TMath::Nint(phi1);
483 if (phi1 > 360.) phi1 -= 360.;
488 phi3 = ns * OuterOpenAngle+OuterAngleShift;
489 phi3 *= kRaddeg; // in degrees
491 phi3 = (Float_t)TMath::Nint(phi3);
494 if(phi3 > 360.) phi3 -= 360.;
498 alpha = phi3*kDegrad;
500 x = xCenterL * TMath::Cos(alpha);
501 y = xCenterL * TMath::Sin(alpha);
503 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
506 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
512 //-------------------------------------------------------------------
513 // Positioning of the L-sectors (gas sectors)
514 //-------------------------------------------------------------------
516 for(ns=0;ns<nOuterSector;ns++){
518 phi1 = ns*OuterOpenAngle + OuterAngleShift;
521 phi1 = (Float_t)TMath::Nint(phi1);
522 if(phi1>360.) phi1 -= 360.;
527 if(phi2>360.) phi2 -= 360.;
536 //--------------------------------------------------------------
537 // position all sectors
538 //--------------------------------------------------------------
540 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
542 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
551 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
553 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
560 //---------------------------------------------------------------
561 // position selected sectors
562 //---------------------------------------------------------------
564 for(Int_t sel=0;sel<12;sel++){
566 if(fSecUps[sel] == ns+2*nInnerSector){
568 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
569 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
573 else if(fSecUps[sel] == ns+2*nInnerSector+nOuterSector){
580 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
582 Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
593 Float_t z0 = z_side - 0.95;
595 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
597 // ==========================================================
599 // ==========================================================
602 // auxilary structures
606 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
608 // ----------------------------------------------------------
609 // Large wheel -> positioned in the TPC
610 // ----------------------------------------------------------
613 z0 = 263.5; // TPC length - 1/2 spoke wheel width
619 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
625 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
627 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
628 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
631 // Outer vessel + CO2 HV degrader
638 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
643 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
645 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
654 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
655 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
656 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
658 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
661 //----------------------------------------------------------
662 // Small wheel -> positioned in "side gas
663 //----------------------------------------------------------
669 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
675 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
677 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
679 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
681 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
690 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
694 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
696 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
700 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
701 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
709 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
713 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
714 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
717 //---------------------------------------------------------
718 // central wheel 6 (radial direction) x 4 (along z) cm2
719 //---------------------------------------------------------
725 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
731 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
733 z0 = z_side - 1.9 - 2.;
735 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
739 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
742 //---------------------------------------------------------
743 // inner spokes (nSectorInner)
744 //---------------------------------------------------------
746 dm[0] = 0.5*(139.9-82.1);
750 Float_t x1 = dm[0]+82.;
752 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
757 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
759 for(ns=0;ns<nInnerSector;ns++){
761 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
765 phi1 = (Float_t)TMath::Nint(phi1);
766 if(phi1>360.) phi1 -= 360.;
769 if(phi2>360.) phi2 -= 360.;
774 alpha = phi1 * kDegrad;
775 x = x1 * TMath::Cos(alpha);
776 y = x1 * TMath::Sin(alpha);
778 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
780 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
786 //-------------------------------------------------------------
787 // outer spokes (nSectorOuter)
788 //-------------------------------------------------------------
790 dm[0] = 0.5*(257.9-146.1);
796 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
801 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
803 for(ns=0;ns<nOuterSector;ns++){
805 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
809 phi1 = (Float_t)TMath::Nint(phi1);
810 if(phi1>360.) phi1 -= 360.;
813 if(phi2>360.) phi2 -= 360.;
818 alpha = phi1 * kDegrad;
819 x = x1 * TMath::Cos(alpha);
820 y = x1 * TMath::Sin(alpha);
822 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
824 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
832 // --------------------------------------------------------
833 // put the readout chambers into the TPC
834 // --------------------------------------------------------
843 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
847 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
848 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
850 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
852 //----------------------------------------------------
853 // Inner vessel and HV degrader
854 //----------------------------------------------------
876 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
893 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
895 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
896 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
904 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
906 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
908 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
911 // ---------------------------------------------------
913 // ---------------------------------------------------
915 gMC->Gsord("TGAS", 6);
916 gMC->Gsord("TPSG", 6);
922 //_____________________________________________________________________________
923 void AliTPCv2::DrawDetector()
926 // Draw a shaded view of the Time Projection Chamber version 1
929 // Set everything unseen
930 gMC->Gsatt("*", "seen", -1);
932 // Set ALIC mother transparent
933 gMC->Gsatt("ALIC","SEEN",0);
935 // Set the volumes visible
936 gMC->Gsatt("TPC","SEEN",0);
937 gMC->Gsatt("TGAS","SEEN",0);
938 gMC->Gsatt("TPSG","SEEN",0);
939 gMC->Gsatt("TPHV","SEEN",1);
940 gMC->Gsatt("TPMH","SEEN",1);
941 gMC->Gsatt("TPEC","SEEN",0);
942 gMC->Gsatt("TRCS","SEEN",1);
943 gMC->Gsatt("TRCL","SEEN",1);
944 gMC->Gsatt("TPWL","SEEN",1);
945 gMC->Gsatt("TPWI","SEEN",1);
946 gMC->Gsatt("TPWS","SEEN",1);
947 gMC->Gsatt("TPW1","SEEN",1);
948 gMC->Gsatt("TPS1","SEEN",1);
949 gMC->Gsatt("TPS2","SEEN",1);
950 gMC->Gsatt("TPG1","SEEN",1);
951 gMC->Gsatt("TPG2","SEEN",1);
952 gMC->Gsatt("TPWC","SEEN",1);
953 gMC->Gsatt("TPSI","SEEN",1);
954 gMC->Gsatt("TPSO","SEEN",1);
955 gMC->Gsatt("TPCO","SEEN",1);
956 gMC->Gsatt("TPOV","SEEN",1);
957 gMC->Gsatt("TPVD","SEEN",1);
959 gMC->Gdopt("hide", "on");
960 gMC->Gdopt("shad", "on");
961 gMC->Gsatt("*", "fill", 7);
962 gMC->SetClipBox(".");
963 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
965 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
966 gMC->Gdhead(1111, "Time Projection Chamber");
967 gMC->Gdman(18, 4, "MAN");
968 gMC->Gdopt("hide","off");
971 //_____________________________________________________________________________
972 void AliTPCv2::CreateMaterials()
975 // Define materials for version 2 of the Time Projection Chamber
979 // Increase maximum number of steps
980 gMC->SetMaxNStep(30000);
982 AliTPC::CreateMaterials();
985 //_____________________________________________________________________________
986 void AliTPCv2::Init()
989 // Initialises version 2 of the TPC after that it has been built
991 Int_t *idtmed = fIdtmed->GetArray()-399;
993 fIdSens1=gMC->VolId("TLGA"); // L-sector
994 fIdSens2=gMC->VolId("TSGA"); // S-sector
995 fIdSens3=gMC->VolId("TSST"); // strip - S-sector (not always used)
996 fIdSens4=gMC->VolId("TLST"); // strip - S-sector (not always used)
998 gMC->SetMaxNStep(30000); // max. number of steps increased
1000 gMC->Gstpar(idtmed[403],"LOSS",5);
1002 printf("*** TPC version 2 initialized ***\n");
1003 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
1009 //_____________________________________________________________________________
1010 void AliTPCv2::StepManager()
1013 // Called for every step in the Time Projection Chamber
1017 // parameters used for the energy loss calculations
1019 const Float_t prim = 14.35; // number of primary collisions per 1 cm
1020 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
1021 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
1023 // const Float_t prim = 17.65;
1024 // const Float_t poti = 19.02e-9;
1025 // const Float_t w_ion = 33.06e-9;
1028 const Float_t big = 1.e10;
1033 TClonesArray &lhits = *fHits;
1036 AliTPCParam *fTPCParam = &(fDigParam->GetParam());
1042 gMC->SetMaxStep(big);
1044 if(!gMC->IsTrackAlive()) return; // particle has disappeared
1046 Float_t charge = gMC->TrackCharge();
1048 if(TMath::Abs(charge)<=0.) return; // take only charged particles
1051 id=gMC->CurrentVolID(copy);
1053 // Check the sensitive volume
1057 vol[0] = copy + fTPCParam->GetNInnerSector()-1; // L-sector number
1059 else if(id == fIdSens2)
1061 vol[0] = copy-1; // S-sector number
1063 else if(id == fIdSens3 && gMC->IsTrackEntering())
1065 vol[1] = copy-1; // row number
1066 id = gMC->CurrentVolOffID(1,copy);
1067 vol[0] = copy-1; // sector number (S-sector)
1069 gMC->TrackPosition(pos);
1073 hits[3]=0.; // this hit has no energy loss
1074 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1076 else if(id == fIdSens4 && gMC->IsTrackEntering())
1078 vol[1] = copy-1; // row number
1079 id = gMC->CurrentVolOffID(1,copy);
1080 vol[0] = copy+fTPCParam->GetNInnerSector()-1; // sector number (L-sector)
1082 gMC->TrackPosition(pos);
1086 hits[3]=0.; // this hit has no energy loss
1087 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1092 // charged particle is in the sensitive volume
1095 if(gMC->TrackStep() > 0) {
1097 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
1098 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
1100 gMC->TrackPosition(pos);
1104 hits[3]=(Float_t)nel;
1108 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
1112 // Stemax calculation for the next step
1116 gMC->TrackMomentum(mom);
1117 Float_t ptot=mom.Rho();
1118 Float_t beta_gamma = ptot/gMC->TrackMass();
1120 Int_t pid=gMC->TrackPid();
1121 if((pid==kElectron || pid==kPositron || pid==kGamma) && ptot > 0.002)
1123 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
1127 pp=prim*BetheBloch(beta_gamma);
1128 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
1132 gMC->Rndm(random,1); // good, old GRNDM from Geant3
1134 Double_t rnd = (Double_t)random[0];
1136 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
1140 //_____________________________________________________________________________
1141 Float_t AliTPCv2::BetheBloch(Float_t bg)
1144 // Bethe-Bloch energy loss formula
1146 const Double_t p1=0.76176e-1;
1147 const Double_t p2=10.632;
1148 const Double_t p3=0.13279e-4;
1149 const Double_t p4=1.8631;
1150 const Double_t p5=1.9479;
1152 Double_t dbg = (Double_t) bg;
1154 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
1156 Double_t aa = TMath::Power(beta,p4);
1157 Double_t bb = TMath::Power(1./dbg,p5);
1159 bb=TMath::Log(p3+bb);
1161 return ((Float_t)((p2-aa-bb)*p1/aa));