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.11.8.2 2000/04/10 08:36:12 kowal2
20 Updated readout chambers
21 Some modifications to StepManager by M. Kowalski
23 Revision 1.11.8.1 2000/04/10 07:56:53 kowal2
24 Not used anymore - removed
26 Revision 1.11 1999/11/04 17:28:07 fca
27 Correct barrel part of HV Degrader
29 Revision 1.10 1999/10/14 16:52:08 fca
30 Only use PDG codes and not GEANT ones
32 Revision 1.9 1999/10/08 06:27:23 fca
33 Corrected bug in the HV degrader geometry, thanks to G.Tabary
35 Revision 1.8 1999/10/04 13:39:55 fca
36 Correct array index problem
38 Revision 1.7 1999/09/29 09:24:34 fca
39 Introduction of the Copyright and cvs Log
43 ///////////////////////////////////////////////////////////////////////////////
45 // Time Projection Chamber version 3 -- detailed TPC and slow simulation //
49 <img src="picts/AliTPCv3Class.gif">
54 ///////////////////////////////////////////////////////////////////////////////
61 #include "AliTPCDigitsArray.h"
62 #include"AliTPCParam.h"
67 //_____________________________________________________________________________
68 AliTPCv3::AliTPCv3(const char *name, const char *title) :
72 // Standard constructor for Time Projection Chamber version 3
75 SetBufferSize(128000);
78 //_____________________________________________________________________________
79 void AliTPCv3::CreateGeometry()
82 // Creation of the TPC coarse geometry (version 3)
83 // Origin Marek Kowalski Cracow
87 <img src="picts/AliTPCv0.gif">
92 <img src="picts/AliTPCv0Tree.gif">
96 Int_t *idtmed = fIdtmed->GetArray();
104 // ----------------------------------------------------
105 // FIELD CAGE WITH ENDCAPS - G10
106 // THIS IS ALSO A TPC MOTHER VOLUME
107 // ----------------------------------------------------
113 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
115 //-----------------------------------------------------
116 // Endcap cover c-fibre 0.86% X0
117 //-----------------------------------------------------
123 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
125 //-----------------------------------------------------
126 // Drift gas , leave 2 cm at the outer radius
128 //-----------------------------------------------------
134 gMC->Gsvolu("TGAS", "TUBE", idtmed[4], dm, 3);
137 //------------------------------------------------------
138 // membrane holder - carbon fiber
139 //------------------------------------------------------
142 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
148 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
154 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
156 //----------------------------------------------------------
157 // HV membrane - 25 microns of mylar
158 //----------------------------------------------------------
164 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
166 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
168 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
170 //----------------------------------------------------------
171 // "side" gas volume, the same as the drift gas
172 // the readout chambers are placed there.
173 //----------------------------------------------------------
177 dm[2] = 0.5*(275. - 250.);
179 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
181 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
183 //-----------------------------------------------------------
184 // Readout chambers , 25% of X0, I use Al as the material
185 //-----------------------------------------------------------
187 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
188 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
190 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
191 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
194 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
195 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
198 Float_t InSecLowEdge = fTPCParam->GetInnerRadiusLow();
199 Float_t InSecUpEdge = fTPCParam->GetInnerRadiusUp();
201 Float_t OuSecLowEdge = fTPCParam->GetOuterRadiusLow();
202 Float_t OuSecUpEdge = fTPCParam->GetOuterRadiusUp();
204 Float_t SecThick = 2.225; // Al
206 Float_t LowEdge = fTPCParam->GetInnerFrameSpace();
210 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-LowEdge;
211 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-LowEdge;
213 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
215 Float_t xCenterS = InSecLowEdge+dm[3];
217 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
221 Float_t UpEdge = fTPCParam->GetOuterFrameSpace();
223 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-UpEdge;
224 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-UpEdge;
226 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
228 Float_t xCenterL = OuSecLowEdge+dm[3];
230 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
232 Float_t z1 = -z_side + SecThick*0.5;
234 //------------------------------------------------------------------
235 // Positioning of the S-sector readout chambers
236 //------------------------------------------------------------------
239 Float_t theta1,theta2,theta3;
240 Float_t phi1,phi2,phi3;
244 for(ns=0;ns<nInnerSector;ns++){
246 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
247 phi1 *= kRaddeg; // in degrees
249 phi1 = (Float_t)TMath::Nint(phi1);
251 if (phi1 > 360.) phi1 -= 360.;
256 phi3 = ns * InnerOpenAngle + InnerAngleShift;
257 phi3 *= kRaddeg; // in degrees
259 phi3 = (Float_t)TMath::Nint(phi3);
261 if(phi3 > 360.) phi3 -= 360.;
265 alpha = phi3*kDegrad;
267 x = xCenterS * TMath::Cos(alpha);
268 y = xCenterS * TMath::Sin(alpha);
270 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
272 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
278 //-------------------------------------------------------------------
279 // Positioning of the L-sectors readout chambers
280 //-------------------------------------------------------------------
282 for(ns=0;ns<nOuterSector;ns++){
283 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
284 phi1 *= kRaddeg; // in degrees
286 phi1 = (Float_t)TMath::Nint(phi1);
289 if (phi1 > 360.) phi1 -= 360.;
294 phi3 = ns * OuterOpenAngle+OuterAngleShift;
295 phi3 *= kRaddeg; // in degrees
297 phi3 = (Float_t)TMath::Nint(phi3);
300 if(phi3 > 360.) phi3 -= 360.;
304 alpha = phi3*kDegrad;
306 x = xCenterL * TMath::Cos(alpha);
307 y = xCenterL * TMath::Sin(alpha);
309 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
312 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
318 Float_t z0 = z_side - 0.95;
320 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
322 // ==========================================================
324 // ==========================================================
327 // auxilary structures
331 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
333 // ----------------------------------------------------------
334 // Large wheel -> positioned in the TPC
335 // ----------------------------------------------------------
338 z0 = 263.5; // TPC length - 1/2 spoke wheel width
344 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
350 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
352 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
353 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
356 // Outer vessel + CO2 HV degrader
363 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
368 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
370 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
379 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
380 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
381 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
383 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
386 //----------------------------------------------------------
387 // Small wheel -> positioned in "side gas
388 //----------------------------------------------------------
394 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
400 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
402 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
404 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
406 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
415 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
419 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
421 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
425 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
426 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
434 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
438 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
439 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
442 //---------------------------------------------------------
443 // central wheel 6 (radial direction) x 4 (along z) cm2
444 //---------------------------------------------------------
450 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
456 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
458 z0 = z_side - 1.9 - 2.;
460 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
464 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
467 //---------------------------------------------------------
468 // inner spokes (nSectorInner)
469 //---------------------------------------------------------
471 dm[0] = 0.5*(139.9-82.1);
475 Float_t x1 = dm[0]+82.;
477 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
482 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
484 for(ns=0;ns<nInnerSector;ns++){
486 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
490 phi1 = (Float_t)TMath::Nint(phi1);
493 if(phi2>360.) phi2 -= 360.;
498 alpha = phi1 * kDegrad;
499 x = x1 * TMath::Cos(alpha);
500 y = x1 * TMath::Sin(alpha);
502 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
504 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
510 //-------------------------------------------------------------
511 // outer spokes (nSectorOuter)
512 //-------------------------------------------------------------
514 dm[0] = 0.5*(257.9-146.1);
520 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
525 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
527 for(ns=0;ns<nOuterSector;ns++){
529 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
533 phi1 = (Float_t)TMath::Nint(phi1);
536 if(phi2>360.) phi2 -= 360.;
541 alpha = phi1 * kDegrad;
542 x = x1 * TMath::Cos(alpha);
543 y = x1 * TMath::Sin(alpha);
545 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
547 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
555 // --------------------------------------------------------
556 // put the readout chambers into the TPC
557 // --------------------------------------------------------
566 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
570 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
571 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
573 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
575 //----------------------------------------------------
576 // Inner vessel and HV degrader
577 //----------------------------------------------------
599 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
616 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
618 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
619 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
627 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
629 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
631 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
637 // ---------------------------------------------------
639 // ---------------------------------------------------
640 gMC->Gsord("TPSG", 6);
646 //_____________________________________________________________________________
647 void AliTPCv3::DrawDetector()
650 // Draw a shaded view of the Time Projection Chamber version 1
654 // Set everything unseen
655 gMC->Gsatt("*", "seen", -1);
657 // Set ALIC mother transparent
658 gMC->Gsatt("ALIC","SEEN",0);
660 // Set the volumes visible
661 gMC->Gsatt("TPC","SEEN",0);
662 gMC->Gsatt("TGAS","SEEN",0);
663 gMC->Gsatt("TPSG","SEEN",0);
664 gMC->Gsatt("TPHV","SEEN",1);
665 gMC->Gsatt("TPMH","SEEN",1);
666 gMC->Gsatt("TPEC","SEEN",0);
667 gMC->Gsatt("TRCS","SEEN",1);
668 gMC->Gsatt("TRCL","SEEN",1);
669 gMC->Gsatt("TPWL","SEEN",1);
670 gMC->Gsatt("TPWI","SEEN",1);
671 gMC->Gsatt("TPWS","SEEN",1);
672 gMC->Gsatt("TPW1","SEEN",1);
673 gMC->Gsatt("TPS1","SEEN",1);
674 gMC->Gsatt("TPS2","SEEN",1);
675 gMC->Gsatt("TPG1","SEEN",1);
676 gMC->Gsatt("TPG2","SEEN",1);
677 gMC->Gsatt("TPWC","SEEN",1);
678 gMC->Gsatt("TPSI","SEEN",1);
679 gMC->Gsatt("TPSO","SEEN",1);
680 gMC->Gsatt("TPCO","SEEN",1);
681 gMC->Gsatt("TPOV","SEEN",1);
682 gMC->Gsatt("TPVD","SEEN",1);
684 gMC->Gdopt("hide", "on");
685 gMC->Gdopt("shad", "on");
686 gMC->Gsatt("*", "fill", 7);
687 gMC->SetClipBox(".");
688 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
690 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
691 gMC->Gdhead(1111, "Time Projection Chamber");
692 gMC->Gdman(18, 4, "MAN");
693 gMC->Gdopt("hide","off");
696 //_____________________________________________________________________________
697 void AliTPCv3::CreateMaterials()
700 // Define materials for version 2 of the Time Projection Chamber
705 // Increase maximum number of steps
706 gMC->SetMaxNStep(30000);
708 AliTPC::CreateMaterials();
711 //_____________________________________________________________________________
712 void AliTPCv3::Init()
715 // Initialises version 3 of the TPC after that it has been built
717 Int_t *idtmed = fIdtmed->GetArray()-399;
721 fIdSens1=gMC->VolId("TGAS"); // drift gas as a sensitive volume
723 gMC->SetMaxNStep(30000); // max. number of steps increased
725 gMC->Gstpar(idtmed[403],"LOSS",5);
727 printf("*** TPC version 3 initialized ***\n");
728 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
734 //_____________________________________________________________________________
735 void AliTPCv3::StepManager()
738 // Called for every step in the Time Projection Chamber
742 // parameters used for the energy loss calculations
744 const Float_t prim = 14.35; // number of primary collisions per 1 cm
745 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
746 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
749 const Float_t big = 1.e10;
755 TClonesArray &lhits = *fHits;
762 gMC->SetMaxStep(big);
764 if(!gMC->IsTrackAlive()) return; // particle has disappeared
766 Float_t charge = gMC->TrackCharge();
768 if(TMath::Abs(charge)<=0.) return; // take only charged particles
771 id=gMC->CurrentVolID(copy);
773 // Check the sensitive volume
775 if (id != fIdSens1) return;
778 // charged particle is in the sensitive volume
781 if(gMC->TrackStep() > 0) {
784 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
785 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
787 gMC->TrackPosition(pos);
793 // check the selected side of the TPC
796 if(fSide && fSide*hits[2]<=0.) return;
798 hits[3]=(Float_t)nel;
802 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
806 // Stemax calculation for the next step
810 gMC->TrackMomentum(mom);
811 Float_t ptot=mom.Rho();
812 Float_t beta_gamma = ptot/gMC->TrackMass();
814 Int_t pid=gMC->TrackPid();
815 if((pid==kElectron || pid==kPositron) && ptot > 0.002)
817 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
821 pp=prim*BetheBloch(beta_gamma);
822 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
826 gMC->Rndm(random,1); // good, old GRNDM from Geant3
828 Double_t rnd = (Double_t)random[0];
830 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
834 //_____________________________________________________________________________
835 Float_t AliTPCv3::BetheBloch(Float_t bg)
838 // Bethe-Bloch energy loss formula
840 const Double_t p1=0.76176e-1;
841 const Double_t p2=10.632;
842 const Double_t p3=0.13279e-4;
843 const Double_t p4=1.8631;
844 const Double_t p5=1.9479;
846 Double_t dbg = (Double_t) bg;
848 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
850 Double_t aa = TMath::Power(beta,p4);
851 Double_t bb = TMath::Power(1./dbg,p5);
853 bb=TMath::Log(p3+bb);
855 return ((Float_t)((p2-aa-bb)*p1/aa));