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.13.2.4 2000/06/26 07:39:42 kowal2
19 Changes to obey the coding rules
21 Revision 1.13.2.3 2000/06/25 08:38:41 kowal2
22 Splitted from AliTPCtracking
24 Revision 1.13.2.2 2000/06/16 12:58:13 kowal2
25 Changed parameter settings
27 Revision 1.13.2.1 2000/06/09 07:15:07 kowal2
29 Defaults loaded automatically (hard-wired)
30 Optional parameters can be set via macro called in the constructor
32 Revision 1.13 2000/05/15 10:00:30 kowal2
33 Corrected bug in the TPC geometry, thanks to Ivana Hrivnacova
35 Revision 1.12 2000/04/17 09:37:33 kowal2
36 removed obsolete AliTPCDigitsDisplay.C
38 Revision 1.11.8.2 2000/04/10 08:36:12 kowal2
40 Updated readout chambers
41 Some modifications to StepManager by M. Kowalski
43 Revision 1.11.8.1 2000/04/10 07:56:53 kowal2
44 Not used anymore - removed
46 Revision 1.11 1999/11/04 17:28:07 fca
47 Correct barrel part of HV Degrader
49 Revision 1.10 1999/10/14 16:52:08 fca
50 Only use PDG codes and not GEANT ones
52 Revision 1.9 1999/10/08 06:27:23 fca
53 Corrected bug in the HV degrader geometry, thanks to G.Tabary
55 Revision 1.8 1999/10/04 13:39:55 fca
56 Correct array index problem
58 Revision 1.7 1999/09/29 09:24:34 fca
59 Introduction of the Copyright and cvs Log
64 ///////////////////////////////////////////////////////////////////////////////
66 // Time Projection Chamber version 3 -- detailed TPC and slow simulation //
70 <img src="picts/AliTPCv3Class.gif">
75 ///////////////////////////////////////////////////////////////////////////////
82 #include "AliTPCDigitsArray.h"
83 #include"AliTPCParam.h"
84 #include"AliTPCParamSR.h"
86 #include <TInterpreter.h>
90 //_____________________________________________________________________________
91 AliTPCv3::AliTPCv3(const char *name, const char *title) :
95 // Standard constructor for Time Projection Chamber version 3
98 SetBufferSize(128000);
100 SetGasMixt(2,20,10,-1,0.9,0.1,0.);
103 fTPCParam->Write(fTPCParam->GetTitle());
106 //_____________________________________________________________________________
107 void AliTPCv3::CreateGeometry()
110 // Creation of the TPC coarse geometry (version 3)
111 // Origin Marek Kowalski Cracow
115 <img src="picts/AliTPCv0.gif">
120 <img src="picts/AliTPCv0Tree.gif">
124 Int_t *idtmed = fIdtmed->GetArray();
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[4], dm, 3);
165 //------------------------------------------------------
166 // membrane holder - carbon fiber
167 //------------------------------------------------------
170 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
176 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
182 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
184 //----------------------------------------------------------
185 // HV membrane - 25 microns of mylar
186 //----------------------------------------------------------
192 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
194 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
196 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
198 //----------------------------------------------------------
199 // "side" gas volume, the same as the drift gas
200 // the readout chambers are placed there.
201 //----------------------------------------------------------
205 dm[2] = 0.5*(275. - 250.);
207 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
209 Float_t zSide = dm[2]; // 1/2 of the side gas thickness
211 //-----------------------------------------------------------
212 // Readout chambers , 25% of X0, I use Al as the material
213 //-----------------------------------------------------------
215 Float_t innerOpenAngle = fTPCParam->GetInnerAngle();
216 Float_t outerOpenAngle = fTPCParam->GetOuterAngle();
218 Float_t innerAngleShift = fTPCParam->GetInnerAngleShift();
219 Float_t outerAngleShift = fTPCParam->GetOuterAngleShift();
222 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
223 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
226 Float_t inSecLowEdge = fTPCParam->GetInnerRadiusLow();
227 Float_t inSecUpEdge = fTPCParam->GetInnerRadiusUp();
229 Float_t ouSecLowEdge = fTPCParam->GetOuterRadiusLow();
230 Float_t ouSecUpEdge = fTPCParam->GetOuterRadiusUp();
232 Float_t secThick = 2.225; // Al
234 Float_t lowEdge = fTPCParam->GetInnerFrameSpace();
238 dm[0] = inSecLowEdge*TMath::Tan(0.5*innerOpenAngle)-lowEdge;
239 dm[1] = inSecUpEdge*TMath::Tan(0.5*innerOpenAngle)-lowEdge;
241 dm[3] = 0.5*(inSecUpEdge-inSecLowEdge);
243 Float_t xCenterS = inSecLowEdge+dm[3];
245 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
249 Float_t upEdge = fTPCParam->GetOuterFrameSpace();
251 dm[0] = ouSecLowEdge*TMath::Tan(0.5*outerOpenAngle)-upEdge;
252 dm[1] = ouSecUpEdge*TMath::Tan(0.5*outerOpenAngle)-upEdge;
254 dm[3] = 0.5*(ouSecUpEdge-ouSecLowEdge);
256 Float_t xCenterL = ouSecLowEdge+dm[3];
258 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
260 Float_t z1 = -zSide + secThick*0.5;
262 //------------------------------------------------------------------
263 // Positioning of the S-sector readout chambers
264 //------------------------------------------------------------------
267 Float_t theta1,theta2,theta3;
268 Float_t phi1,phi2,phi3;
272 for(ns=0;ns<nInnerSector;ns++){
274 phi1 = ns * innerOpenAngle + 270.*kDegrad + innerAngleShift;
275 phi1 *= kRaddeg; // in degrees
277 phi1 = (Float_t)TMath::Nint(phi1);
279 if (phi1 > 360.) phi1 -= 360.;
284 phi3 = ns * innerOpenAngle + innerAngleShift;
285 phi3 *= kRaddeg; // in degrees
287 phi3 = (Float_t)TMath::Nint(phi3);
289 if(phi3 > 360.) phi3 -= 360.;
293 alpha = phi3*kDegrad;
295 x = xCenterS * TMath::Cos(alpha);
296 y = xCenterS * TMath::Sin(alpha);
298 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
300 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
306 //-------------------------------------------------------------------
307 // Positioning of the L-sectors readout chambers
308 //-------------------------------------------------------------------
310 for(ns=0;ns<nOuterSector;ns++){
311 phi1 = ns * outerOpenAngle + 270.*kDegrad + outerAngleShift;
312 phi1 *= kRaddeg; // in degrees
314 phi1 = (Float_t)TMath::Nint(phi1);
317 if (phi1 > 360.) phi1 -= 360.;
322 phi3 = ns * outerOpenAngle+outerAngleShift;
323 phi3 *= kRaddeg; // in degrees
325 phi3 = (Float_t)TMath::Nint(phi3);
328 if(phi3 > 360.) phi3 -= 360.;
332 alpha = phi3*kDegrad;
334 x = xCenterL * TMath::Cos(alpha);
335 y = xCenterL * TMath::Sin(alpha);
337 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
340 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
346 Float_t z0 = zSide - 0.95;
348 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
350 // ==========================================================
352 // ==========================================================
355 // auxilary structures
359 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
361 // ----------------------------------------------------------
362 // Large wheel -> positioned in the TPC
363 // ----------------------------------------------------------
366 z0 = 263.5; // TPC length - 1/2 spoke wheel width
372 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
378 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
380 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
381 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
384 // Outer vessel + CO2 HV degrader
391 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
396 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
398 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
402 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
405 //----------------------------------------------------------
406 // Small wheel -> positioned in "side gas
407 //----------------------------------------------------------
413 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
419 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
421 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
423 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
425 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
434 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
438 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
440 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
444 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
445 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
453 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
457 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
458 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
461 //---------------------------------------------------------
462 // central wheel 6 (radial direction) x 4 (along z) cm2
463 //---------------------------------------------------------
469 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
475 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
477 z0 = zSide - 1.9 - 2.;
479 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
483 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
486 //---------------------------------------------------------
487 // inner spokes (nSectorInner)
488 //---------------------------------------------------------
490 dm[0] = 0.5*(139.9-82.1);
494 Float_t x1 = dm[0]+82.;
496 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
501 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
503 for(ns=0;ns<nInnerSector;ns++){
505 phi1 = 0.5*innerOpenAngle + ns*innerOpenAngle + innerAngleShift;
509 phi1 = (Float_t)TMath::Nint(phi1);
512 if(phi2>360.) phi2 -= 360.;
517 alpha = phi1 * kDegrad;
518 x = x1 * TMath::Cos(alpha);
519 y = x1 * TMath::Sin(alpha);
521 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
523 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
529 //-------------------------------------------------------------
530 // outer spokes (nSectorOuter)
531 //-------------------------------------------------------------
533 dm[0] = 0.5*(257.9-146.1);
539 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
544 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
546 for(ns=0;ns<nOuterSector;ns++){
548 phi1 = 0.5*outerOpenAngle + ns*outerOpenAngle + outerAngleShift;
552 phi1 = (Float_t)TMath::Nint(phi1);
555 if(phi2>360.) phi2 -= 360.;
560 alpha = phi1 * kDegrad;
561 x = x1 * TMath::Cos(alpha);
562 y = x1 * TMath::Sin(alpha);
564 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
566 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
574 // --------------------------------------------------------
575 // put the readout chambers into the TPC
576 // --------------------------------------------------------
585 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
589 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
590 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
592 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
594 //----------------------------------------------------
595 // Inner vessel and HV degrader
596 //----------------------------------------------------
618 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
635 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
637 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
638 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
646 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
648 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
650 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
656 // ---------------------------------------------------
658 // ---------------------------------------------------
659 gMC->Gsord("TPSG", 6);
665 //_____________________________________________________________________________
666 void AliTPCv3::DrawDetector()
669 // Draw a shaded view of the Time Projection Chamber version 1
673 // Set everything unseen
674 gMC->Gsatt("*", "seen", -1);
676 // Set ALIC mother transparent
677 gMC->Gsatt("ALIC","SEEN",0);
679 // Set the volumes visible
680 gMC->Gsatt("TPC","SEEN",0);
681 gMC->Gsatt("TGAS","SEEN",0);
682 gMC->Gsatt("TPSG","SEEN",0);
683 gMC->Gsatt("TPHV","SEEN",1);
684 gMC->Gsatt("TPMH","SEEN",1);
685 gMC->Gsatt("TPEC","SEEN",0);
686 gMC->Gsatt("TRCS","SEEN",1);
687 gMC->Gsatt("TRCL","SEEN",1);
688 gMC->Gsatt("TPWL","SEEN",1);
689 gMC->Gsatt("TPWI","SEEN",1);
690 gMC->Gsatt("TPWS","SEEN",1);
691 gMC->Gsatt("TPW1","SEEN",1);
692 gMC->Gsatt("TPS1","SEEN",1);
693 gMC->Gsatt("TPS2","SEEN",1);
694 gMC->Gsatt("TPG1","SEEN",1);
695 gMC->Gsatt("TPG2","SEEN",1);
696 gMC->Gsatt("TPWC","SEEN",1);
697 gMC->Gsatt("TPSI","SEEN",1);
698 gMC->Gsatt("TPSO","SEEN",1);
699 gMC->Gsatt("TPCO","SEEN",1);
700 gMC->Gsatt("TPOV","SEEN",1);
701 gMC->Gsatt("TPVD","SEEN",1);
703 gMC->Gdopt("hide", "on");
704 gMC->Gdopt("shad", "on");
705 gMC->Gsatt("*", "fill", 7);
706 gMC->SetClipBox(".");
707 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
709 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
710 gMC->Gdhead(1111, "Time Projection Chamber");
711 gMC->Gdman(18, 4, "MAN");
712 gMC->Gdopt("hide","off");
715 //_____________________________________________________________________________
716 void AliTPCv3::CreateMaterials()
719 // Define materials for version 2 of the Time Projection Chamber
724 // Increase maximum number of steps
725 gMC->SetMaxNStep(30000);
727 AliTPC::CreateMaterials();
730 //_____________________________________________________________________________
731 void AliTPCv3::Init()
734 // Initialises version 3 of the TPC after that it has been built
736 Int_t *idtmed = fIdtmed->GetArray()-399;
740 fIdSens1=gMC->VolId("TGAS"); // drift gas as a sensitive volume
742 gMC->SetMaxNStep(30000); // max. number of steps increased
744 gMC->Gstpar(idtmed[403],"LOSS",5);
746 printf("*** TPC version 3 initialized ***\n");
747 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
753 //_____________________________________________________________________________
754 void AliTPCv3::StepManager()
757 // Called for every step in the Time Projection Chamber
761 // parameters used for the energy loss calculations
763 const Float_t kprim = 14.35; // number of primary collisions per 1 cm
764 const Float_t kpoti = 20.77e-9; // first ionization potential for Ne/CO2
765 const Float_t kwIon = 35.97e-9; // energy for the ion-electron pair creation
768 const Float_t kbig = 1.e10;
774 TClonesArray &lhits = *fHits;
781 gMC->SetMaxStep(kbig);
783 if(!gMC->IsTrackAlive()) return; // particle has disappeared
785 Float_t charge = gMC->TrackCharge();
787 if(TMath::Abs(charge)<=0.) return; // take only charged particles
790 id=gMC->CurrentVolID(copy);
792 // Check the sensitive volume
794 if (id != fIdSens1) return;
797 // charged particle is in the sensitive volume
800 if(gMC->TrackStep() > 0) {
803 Int_t nel = (Int_t)(((gMC->Edep())-kpoti)/kwIon) + 1;
804 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
806 gMC->TrackPosition(pos);
812 // check the selected side of the TPC
815 if(fSide && fSide*hits[2]<=0.) return;
817 hits[3]=(Float_t)nel;
821 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
825 // Stemax calculation for the next step
829 gMC->TrackMomentum(mom);
830 Float_t ptot=mom.Rho();
831 Float_t betaGamma = ptot/gMC->TrackMass();
833 Int_t pid=gMC->TrackPid();
834 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
836 pp = kprim*1.58; // electrons above 20 MeV/c are on the plateau!
840 pp=kprim*BetheBloch(betaGamma);
841 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
845 gMC->Rndm(random,1); // good, old GRNDM from Geant3
847 Double_t rnd = (Double_t)random[0];
849 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
853 //_____________________________________________________________________________
854 Float_t AliTPCv3::BetheBloch(Float_t bg)
857 // Bethe-Bloch energy loss formula
859 const Double_t kp1=0.76176e-1;
860 const Double_t kp2=10.632;
861 const Double_t kp3=0.13279e-4;
862 const Double_t kp4=1.8631;
863 const Double_t kp5=1.9479;
865 Double_t dbg = (Double_t) bg;
867 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
869 Double_t aa = TMath::Power(beta,kp4);
870 Double_t bb = TMath::Power(1./dbg,kp5);
872 bb=TMath::Log(kp3+bb);
874 return ((Float_t)((kp2-aa-bb)*kp1/aa));