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.10 1999/10/14 16:52:08 fca
19 Only use PDG codes and not GEANT ones
21 Revision 1.9 1999/10/08 06:27:23 fca
22 Corrected bug in the HV degrader geometry, thanks to G.Tabary
24 Revision 1.8 1999/10/04 13:39:55 fca
25 Correct array index problem
27 Revision 1.7 1999/09/29 09:24:34 fca
28 Introduction of the Copyright and cvs Log
32 ///////////////////////////////////////////////////////////////////////////////
34 // Time Projection Chamber version 3 -- detailed TPC and slow simulation //
38 <img src="picts/AliTPCv3Class.gif">
43 ///////////////////////////////////////////////////////////////////////////////
52 #include "AliTPCParam.h"
57 //_____________________________________________________________________________
58 AliTPCv3::AliTPCv3(const char *name, const char *title) :
62 // Standard constructor for Time Projection Chamber version 2
65 SetBufferSize(128000);
68 //_____________________________________________________________________________
69 void AliTPCv3::CreateGeometry()
72 // Creation of the TPC coarse geometry (version 0)
73 // Origin Marek Kowalski Crakow
77 <img src="picts/AliTPCv0.gif">
82 <img src="picts/AliTPCv0Tree.gif">
86 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
88 Int_t *idtmed = fIdtmed->GetArray();
96 // ----------------------------------------------------
97 // FIELD CAGE WITH ENDCAPS - G10
98 // THIS IS ALSO A TPC MOTHER VOLUME
99 // ----------------------------------------------------
105 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
107 //-----------------------------------------------------
108 // Endcap cover c-fibre 0.86% X0
109 //-----------------------------------------------------
115 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
117 //-----------------------------------------------------
118 // Drift gas , leave 2 cm at the outer radius
120 //-----------------------------------------------------
126 gMC->Gsvolu("TGAS", "TUBE", idtmed[4], dm, 3);
129 //------------------------------------------------------
130 // membrane holder - carbon fiber
131 //------------------------------------------------------
134 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
140 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
146 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
148 //----------------------------------------------------------
149 // HV membrane - 25 microns of mylar
150 //----------------------------------------------------------
156 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
158 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
160 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
162 //----------------------------------------------------------
163 // "side" gas volume, the same as the drift gas
164 // the readout chambers are placed there.
165 //----------------------------------------------------------
169 dm[2] = 0.5*(275. - 250.);
171 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
173 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
175 //-----------------------------------------------------------
176 // Readout chambers , 25% of X0, I use Al as the material
177 //-----------------------------------------------------------
179 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
180 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
182 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
183 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
186 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
187 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
190 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
191 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
193 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
194 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
196 Float_t SecThick = 2.225; // Al
198 Float_t edge = fTPCParam->GetEdge();
202 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
203 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
205 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
207 Float_t xCenterS = InSecLowEdge+dm[3];
209 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
213 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
214 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
216 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
218 Float_t xCenterL = OuSecLowEdge+dm[3];
220 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
222 Float_t z1 = -z_side + SecThick*0.5;
224 //------------------------------------------------------------------
225 // Positioning of the S-sector readout chambers
226 //------------------------------------------------------------------
229 Float_t theta1,theta2,theta3;
230 Float_t phi1,phi2,phi3;
234 for(ns=0;ns<nInnerSector;ns++){
236 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
237 phi1 *= kRaddeg; // in degrees
239 phi1 = (Float_t)TMath::Nint(phi1);
241 if (phi1 > 360.) phi1 -= 360.;
246 phi3 = ns * InnerOpenAngle + InnerAngleShift;
247 phi3 *= kRaddeg; // in degrees
249 phi3 = (Float_t)TMath::Nint(phi3);
251 if(phi3 > 360.) phi3 -= 360.;
255 alpha = phi3*kDegrad;
257 x = xCenterS * TMath::Cos(alpha);
258 y = xCenterS * TMath::Sin(alpha);
260 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
262 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
268 //-------------------------------------------------------------------
269 // Positioning of the L-sectors readout chambers
270 //-------------------------------------------------------------------
272 for(ns=0;ns<nOuterSector;ns++){
273 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
274 phi1 *= kRaddeg; // in degrees
276 phi1 = (Float_t)TMath::Nint(phi1);
279 if (phi1 > 360.) phi1 -= 360.;
284 phi3 = ns * OuterOpenAngle+OuterAngleShift;
285 phi3 *= kRaddeg; // in degrees
287 phi3 = (Float_t)TMath::Nint(phi3);
290 if(phi3 > 360.) phi3 -= 360.;
294 alpha = phi3*kDegrad;
296 x = xCenterL * TMath::Cos(alpha);
297 y = xCenterL * TMath::Sin(alpha);
299 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
302 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
308 Float_t z0 = z_side - 0.95;
310 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
312 // ==========================================================
314 // ==========================================================
317 // auxilary structures
321 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
323 // ----------------------------------------------------------
324 // Large wheel -> positioned in the TPC
325 // ----------------------------------------------------------
328 z0 = 263.5; // TPC length - 1/2 spoke wheel width
334 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
340 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
342 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
343 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
346 // Outer vessel + CO2 HV degrader
353 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
358 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
360 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
369 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
370 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
371 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
373 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
376 //----------------------------------------------------------
377 // Small wheel -> positioned in "side gas
378 //----------------------------------------------------------
384 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
390 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
392 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
394 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
396 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
405 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
409 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
411 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
415 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
416 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
424 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
428 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
429 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
432 //---------------------------------------------------------
433 // central wheel 6 (radial direction) x 4 (along z) cm2
434 //---------------------------------------------------------
440 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
446 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
448 z0 = z_side - 1.9 - 2.;
450 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
454 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
457 //---------------------------------------------------------
458 // inner spokes (nSectorInner)
459 //---------------------------------------------------------
461 dm[0] = 0.5*(139.9-82.1);
465 Float_t x1 = dm[0]+82.;
467 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
472 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
474 for(ns=0;ns<nInnerSector;ns++){
476 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
480 phi1 = (Float_t)TMath::Nint(phi1);
483 if(phi2>360.) phi2 -= 360.;
488 alpha = phi1 * kDegrad;
489 x = x1 * TMath::Cos(alpha);
490 y = x1 * TMath::Sin(alpha);
492 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
494 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
500 //-------------------------------------------------------------
501 // outer spokes (nSectorOuter)
502 //-------------------------------------------------------------
504 dm[0] = 0.5*(257.9-146.1);
510 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
515 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
517 for(ns=0;ns<nOuterSector;ns++){
519 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
523 phi1 = (Float_t)TMath::Nint(phi1);
526 if(phi2>360.) phi2 -= 360.;
531 alpha = phi1 * kDegrad;
532 x = x1 * TMath::Cos(alpha);
533 y = x1 * TMath::Sin(alpha);
535 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
537 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
545 // --------------------------------------------------------
546 // put the readout chambers into the TPC
547 // --------------------------------------------------------
556 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
560 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
561 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
563 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
565 //----------------------------------------------------
566 // Inner vessel and HV degrader
567 //----------------------------------------------------
589 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
606 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
608 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
609 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
617 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
619 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
621 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
627 // ---------------------------------------------------
629 // ---------------------------------------------------
630 gMC->Gsord("TPSG", 6);
636 //_____________________________________________________________________________
637 void AliTPCv3::DrawDetector()
640 // Draw a shaded view of the Time Projection Chamber version 1
644 // Set everything unseen
645 gMC->Gsatt("*", "seen", -1);
647 // Set ALIC mother transparent
648 gMC->Gsatt("ALIC","SEEN",0);
650 // Set the volumes visible
651 gMC->Gsatt("TPC","SEEN",0);
652 gMC->Gsatt("TGAS","SEEN",0);
653 gMC->Gsatt("TPSG","SEEN",0);
654 gMC->Gsatt("TPHV","SEEN",1);
655 gMC->Gsatt("TPMH","SEEN",1);
656 gMC->Gsatt("TPEC","SEEN",0);
657 gMC->Gsatt("TRCS","SEEN",1);
658 gMC->Gsatt("TRCL","SEEN",1);
659 gMC->Gsatt("TPWL","SEEN",1);
660 gMC->Gsatt("TPWI","SEEN",1);
661 gMC->Gsatt("TPWS","SEEN",1);
662 gMC->Gsatt("TPW1","SEEN",1);
663 gMC->Gsatt("TPS1","SEEN",1);
664 gMC->Gsatt("TPS2","SEEN",1);
665 gMC->Gsatt("TPG1","SEEN",1);
666 gMC->Gsatt("TPG2","SEEN",1);
667 gMC->Gsatt("TPWC","SEEN",1);
668 gMC->Gsatt("TPSI","SEEN",1);
669 gMC->Gsatt("TPSO","SEEN",1);
670 gMC->Gsatt("TPCO","SEEN",1);
671 gMC->Gsatt("TPOV","SEEN",1);
672 gMC->Gsatt("TPVD","SEEN",1);
674 gMC->Gdopt("hide", "on");
675 gMC->Gdopt("shad", "on");
676 gMC->Gsatt("*", "fill", 7);
677 gMC->SetClipBox(".");
678 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
680 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
681 gMC->Gdhead(1111, "Time Projection Chamber");
682 gMC->Gdman(18, 4, "MAN");
683 gMC->Gdopt("hide","off");
686 //_____________________________________________________________________________
687 void AliTPCv3::CreateMaterials()
690 // Define materials for version 2 of the Time Projection Chamber
695 // Increase maximum number of steps
696 gMC->SetMaxNStep(30000);
698 AliTPC::CreateMaterials();
701 //_____________________________________________________________________________
702 void AliTPCv3::Init()
705 // Initialises version 3 of the TPC after that it has been built
707 Int_t *idtmed = fIdtmed->GetArray()-399;
711 fIdSens1=gMC->VolId("TGAS"); // drift gas as a sensitive volume
713 gMC->SetMaxNStep(30000); // max. number of steps increased
715 gMC->Gstpar(idtmed[403],"LOSS",5);
717 printf("*** TPC version 3 initialized ***\n");
718 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
724 //_____________________________________________________________________________
725 void AliTPCv3::StepManager()
728 // Called for every step in the Time Projection Chamber
732 // parameters used for the energy loss calculations
734 const Float_t prim = 14.35; // number of primary collisions per 1 cm
735 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
736 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
739 const Float_t big = 1.e10;
745 TClonesArray &lhits = *fHits;
752 gMC->SetMaxStep(big);
754 if(!gMC->IsTrackAlive()) return; // particle has disappeared
756 Float_t charge = gMC->TrackCharge();
758 if(TMath::Abs(charge)<=0.) return; // take only charged particles
761 id=gMC->CurrentVolID(copy);
763 // Check the sensitive volume
765 if (id != fIdSens1) return;
768 // charged particle is in the sensitive volume
771 if(gMC->TrackStep() > 0) {
774 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
775 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
777 gMC->TrackPosition(pos);
783 // check the selected side of the TPC
786 if(fSide && fSide*hits[2]<=0.) return;
788 hits[3]=(Float_t)nel;
792 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
796 // Stemax calculation for the next step
800 gMC->TrackMomentum(mom);
801 Float_t ptot=mom.Rho();
802 Float_t beta_gamma = ptot/gMC->TrackMass();
804 Int_t pid=gMC->TrackPid();
805 if((pid==kElectron || pid==kPositron || pid==kGamma) && ptot > 0.002)
807 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
811 pp=prim*BetheBloch(beta_gamma);
812 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
816 gMC->Rndm(random,1); // good, old GRNDM from Geant3
818 Double_t rnd = (Double_t)random[0];
820 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
824 //_____________________________________________________________________________
825 Float_t AliTPCv3::BetheBloch(Float_t bg)
828 // Bethe-Bloch energy loss formula
830 const Double_t p1=0.76176e-1;
831 const Double_t p2=10.632;
832 const Double_t p3=0.13279e-4;
833 const Double_t p4=1.8631;
834 const Double_t p5=1.9479;
836 Double_t dbg = (Double_t) bg;
838 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
840 Double_t aa = TMath::Power(beta,p4);
841 Double_t bb = TMath::Power(1./dbg,p5);
843 bb=TMath::Log(p3+bb);
845 return ((Float_t)((p2-aa-bb)*p1/aa));