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 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////////
22 // Time Projection Chamber version 3 -- detailed TPC and slow simulation //
26 <img src="picts/AliTPCv3Class.gif">
31 ///////////////////////////////////////////////////////////////////////////////
40 #include "AliTPCParam.h"
44 //_____________________________________________________________________________
45 AliTPCv3::AliTPCv3(const char *name, const char *title) :
49 // Standard constructor for Time Projection Chamber version 2
52 SetBufferSize(128000);
55 //_____________________________________________________________________________
56 void AliTPCv3::CreateGeometry()
59 // Creation of the TPC coarse geometry (version 0)
60 // Origin Marek Kowalski Crakow
64 <img src="picts/AliTPCv0.gif">
69 <img src="picts/AliTPCv0Tree.gif">
73 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
75 Int_t *idtmed = fIdtmed->GetArray();
83 // ----------------------------------------------------
84 // FIELD CAGE WITH ENDCAPS - G10
85 // THIS IS ALSO A TPC MOTHER VOLUME
86 // ----------------------------------------------------
92 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
94 //-----------------------------------------------------
95 // Endcap cover c-fibre 0.86% X0
96 //-----------------------------------------------------
102 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
104 //-----------------------------------------------------
105 // Drift gas , leave 2 cm at the outer radius
107 //-----------------------------------------------------
113 gMC->Gsvolu("TGAS", "TUBE", idtmed[4], dm, 3);
116 //------------------------------------------------------
117 // membrane holder - carbon fiber
118 //------------------------------------------------------
121 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
127 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
133 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
135 //----------------------------------------------------------
136 // HV membrane - 25 microns of mylar
137 //----------------------------------------------------------
143 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
145 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
147 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
149 //----------------------------------------------------------
150 // "side" gas volume, the same as the drift gas
151 // the readout chambers are placed there.
152 //----------------------------------------------------------
156 dm[2] = 0.5*(275. - 250.);
158 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
160 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
162 //-----------------------------------------------------------
163 // Readout chambers , 25% of X0, I use Al as the material
164 //-----------------------------------------------------------
166 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
167 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
169 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
170 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
173 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
174 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
177 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
178 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
180 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
181 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
183 Float_t SecThick = 2.225; // Al
185 Float_t edge = fTPCParam->GetEdge();
189 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
190 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
192 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
194 Float_t xCenterS = InSecLowEdge+dm[3];
196 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
200 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
201 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
203 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
205 Float_t xCenterL = OuSecLowEdge+dm[3];
207 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
209 Float_t z1 = -z_side + SecThick*0.5;
211 //------------------------------------------------------------------
212 // Positioning of the S-sector readout chambers
213 //------------------------------------------------------------------
216 Float_t theta1,theta2,theta3;
217 Float_t phi1,phi2,phi3;
221 for(ns=0;ns<nInnerSector;ns++){
223 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
224 phi1 *= kRaddeg; // in degrees
226 phi1 = (Float_t)TMath::Nint(phi1);
228 if (phi1 > 360.) phi1 -= 360.;
233 phi3 = ns * InnerOpenAngle + InnerAngleShift;
234 phi3 *= kRaddeg; // in degrees
236 phi3 = (Float_t)TMath::Nint(phi3);
238 if(phi3 > 360.) phi3 -= 360.;
242 alpha = phi3*kDegrad;
244 x = xCenterS * TMath::Cos(alpha);
245 y = xCenterS * TMath::Sin(alpha);
247 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
249 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
255 //-------------------------------------------------------------------
256 // Positioning of the L-sectors readout chambers
257 //-------------------------------------------------------------------
259 for(ns=0;ns<nOuterSector;ns++){
260 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
261 phi1 *= kRaddeg; // in degrees
263 phi1 = (Float_t)TMath::Nint(phi1);
266 if (phi1 > 360.) phi1 -= 360.;
271 phi3 = ns * OuterOpenAngle+OuterAngleShift;
272 phi3 *= kRaddeg; // in degrees
274 phi3 = (Float_t)TMath::Nint(phi3);
277 if(phi3 > 360.) phi3 -= 360.;
281 alpha = phi3*kDegrad;
283 x = xCenterL * TMath::Cos(alpha);
284 y = xCenterL * TMath::Sin(alpha);
286 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
289 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
295 Float_t z0 = z_side - 0.95;
297 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
299 // ==========================================================
301 // ==========================================================
304 // auxilary structures
308 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
310 // ----------------------------------------------------------
311 // Large wheel -> positioned in the TPC
312 // ----------------------------------------------------------
315 z0 = 263.5; // TPC length - 1/2 spoke wheel width
321 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
327 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
329 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
330 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
333 // Outer vessel + CO2 HV degrader
340 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
345 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
347 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
356 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
357 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
358 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
360 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
363 //----------------------------------------------------------
364 // Small wheel -> positioned in "side gas
365 //----------------------------------------------------------
371 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
377 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
379 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
381 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
383 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
392 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
396 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
398 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
402 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
403 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
411 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
415 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
416 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
419 //---------------------------------------------------------
420 // central wheel 6 (radial direction) x 4 (along z) cm2
421 //---------------------------------------------------------
427 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
433 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
435 z0 = z_side - 1.9 - 2.;
437 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
441 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
444 //---------------------------------------------------------
445 // inner spokes (nSectorInner)
446 //---------------------------------------------------------
448 dm[0] = 0.5*(139.9-82.1);
452 Float_t x1 = dm[0]+82.;
454 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
459 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
461 for(ns=0;ns<nInnerSector;ns++){
463 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
467 phi1 = (Float_t)TMath::Nint(phi1);
470 if(phi2>360.) phi2 -= 360.;
475 alpha = phi1 * kDegrad;
476 x = x1 * TMath::Cos(alpha);
477 y = x1 * TMath::Sin(alpha);
479 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
481 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
487 //-------------------------------------------------------------
488 // outer spokes (nSectorOuter)
489 //-------------------------------------------------------------
491 dm[0] = 0.5*(257.9-146.1);
497 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
502 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
504 for(ns=0;ns<nOuterSector;ns++){
506 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
510 phi1 = (Float_t)TMath::Nint(phi1);
513 if(phi2>360.) phi2 -= 360.;
518 alpha = phi1 * kDegrad;
519 x = x1 * TMath::Cos(alpha);
520 y = x1 * TMath::Sin(alpha);
522 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
524 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
532 // --------------------------------------------------------
533 // put the readout chambers into the TPC
534 // --------------------------------------------------------
543 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
547 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
548 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
550 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
552 //----------------------------------------------------
553 // Inner vessel and HV degrader
554 //----------------------------------------------------
576 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
593 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
595 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
596 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
604 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
606 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
608 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
614 // ---------------------------------------------------
616 // ---------------------------------------------------
617 gMC->Gsord("TPSG", 6);
623 //_____________________________________________________________________________
624 void AliTPCv3::DrawDetector()
627 // Draw a shaded view of the Time Projection Chamber version 1
631 // Set everything unseen
632 gMC->Gsatt("*", "seen", -1);
634 // Set ALIC mother transparent
635 gMC->Gsatt("ALIC","SEEN",0);
637 // Set the volumes visible
638 gMC->Gsatt("TPC","SEEN",0);
639 gMC->Gsatt("TGAS","SEEN",0);
640 gMC->Gsatt("TPSG","SEEN",0);
641 gMC->Gsatt("TPHV","SEEN",1);
642 gMC->Gsatt("TPMH","SEEN",1);
643 gMC->Gsatt("TPEC","SEEN",0);
644 gMC->Gsatt("TRCS","SEEN",1);
645 gMC->Gsatt("TRCL","SEEN",1);
646 gMC->Gsatt("TPWL","SEEN",1);
647 gMC->Gsatt("TPWI","SEEN",1);
648 gMC->Gsatt("TPWS","SEEN",1);
649 gMC->Gsatt("TPW1","SEEN",1);
650 gMC->Gsatt("TPS1","SEEN",1);
651 gMC->Gsatt("TPS2","SEEN",1);
652 gMC->Gsatt("TPG1","SEEN",1);
653 gMC->Gsatt("TPG2","SEEN",1);
654 gMC->Gsatt("TPWC","SEEN",1);
655 gMC->Gsatt("TPSI","SEEN",1);
656 gMC->Gsatt("TPSO","SEEN",1);
657 gMC->Gsatt("TPCO","SEEN",1);
658 gMC->Gsatt("TPOV","SEEN",1);
659 gMC->Gsatt("TPVD","SEEN",1);
661 gMC->Gdopt("hide", "on");
662 gMC->Gdopt("shad", "on");
663 gMC->Gsatt("*", "fill", 7);
664 gMC->SetClipBox(".");
665 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
667 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
668 gMC->Gdhead(1111, "Time Projection Chamber");
669 gMC->Gdman(18, 4, "MAN");
670 gMC->Gdopt("hide","off");
673 //_____________________________________________________________________________
674 void AliTPCv3::CreateMaterials()
677 // Define materials for version 2 of the Time Projection Chamber
682 // Increase maximum number of steps
683 gMC->SetMaxNStep(30000);
685 AliTPC::CreateMaterials();
688 //_____________________________________________________________________________
689 void AliTPCv3::Init()
692 // Initialises version 3 of the TPC after that it has been built
694 Int_t *idtmed = fIdtmed->GetArray()-399;
698 fIdSens1=gMC->VolId("TGAS"); // drift gas as a sensitive volume
700 gMC->SetMaxNStep(30000); // max. number of steps increased
702 gMC->Gstpar(idtmed[403],"LOSS",5);
704 printf("*** TPC version 3 initialized ***\n");
705 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
711 //_____________________________________________________________________________
712 void AliTPCv3::StepManager()
715 // Called for every step in the Time Projection Chamber
719 // parameters used for the energy loss calculations
721 const Float_t prim = 14.35; // number of primary collisions per 1 cm
722 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
723 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
726 const Float_t big = 1.e10;
732 TClonesArray &lhits = *fHits;
739 gMC->SetMaxStep(big);
741 if(!gMC->IsTrackAlive()) return; // particle has disappeared
743 Float_t charge = gMC->TrackCharge();
745 if(TMath::Abs(charge)<=0.) return; // take only charged particles
748 id=gMC->CurrentVolID(copy);
750 // Check the sensitive volume
752 if (id != fIdSens1) return;
755 // charged particle is in the sensitive volume
758 if(gMC->TrackStep() > 0) {
761 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
762 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
764 gMC->TrackPosition(pos);
770 // check the selected side of the TPC
773 if(fSide && fSide*hits[2]<=0.) return;
775 hits[3]=(Float_t)nel;
779 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
783 // Stemax calculation for the next step
787 gMC->TrackMomentum(mom);
788 Float_t ptot=mom.Rho();
789 Float_t beta_gamma = ptot/gMC->TrackMass();
791 if(gMC->IdFromPDG(gMC->TrackPid()) <= 3 && ptot > 0.002)
793 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
797 pp=prim*BetheBloch(beta_gamma);
798 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
802 gMC->Rndm(random,1); // good, old GRNDM from Geant3
804 Double_t rnd = (Double_t)random[0];
806 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
810 //_____________________________________________________________________________
811 Float_t AliTPCv3::BetheBloch(Float_t bg)
814 // Bethe-Bloch energy loss formula
816 const Double_t p1=0.76176e-1;
817 const Double_t p2=10.632;
818 const Double_t p3=0.13279e-4;
819 const Double_t p4=1.8631;
820 const Double_t p5=1.9479;
822 Double_t dbg = (Double_t) bg;
824 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
826 Double_t aa = TMath::Power(beta,p4);
827 Double_t bb = TMath::Power(1./dbg,p5);
829 bb=TMath::Log(p3+bb);
831 return ((Float_t)((p2-aa-bb)*p1/aa));