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.8 1999/10/04 13:39:55 fca
19 Correct array index problem
21 Revision 1.7 1999/09/29 09:24:34 fca
22 Introduction of the Copyright and cvs Log
26 ///////////////////////////////////////////////////////////////////////////////
28 // Time Projection Chamber version 3 -- detailed TPC and slow simulation //
32 <img src="picts/AliTPCv3Class.gif">
37 ///////////////////////////////////////////////////////////////////////////////
46 #include "AliTPCParam.h"
50 //_____________________________________________________________________________
51 AliTPCv3::AliTPCv3(const char *name, const char *title) :
55 // Standard constructor for Time Projection Chamber version 2
58 SetBufferSize(128000);
61 //_____________________________________________________________________________
62 void AliTPCv3::CreateGeometry()
65 // Creation of the TPC coarse geometry (version 0)
66 // Origin Marek Kowalski Crakow
70 <img src="picts/AliTPCv0.gif">
75 <img src="picts/AliTPCv0Tree.gif">
79 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
81 Int_t *idtmed = fIdtmed->GetArray();
89 // ----------------------------------------------------
90 // FIELD CAGE WITH ENDCAPS - G10
91 // THIS IS ALSO A TPC MOTHER VOLUME
92 // ----------------------------------------------------
98 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
100 //-----------------------------------------------------
101 // Endcap cover c-fibre 0.86% X0
102 //-----------------------------------------------------
108 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
110 //-----------------------------------------------------
111 // Drift gas , leave 2 cm at the outer radius
113 //-----------------------------------------------------
119 gMC->Gsvolu("TGAS", "TUBE", idtmed[4], dm, 3);
122 //------------------------------------------------------
123 // membrane holder - carbon fiber
124 //------------------------------------------------------
127 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
133 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
139 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
141 //----------------------------------------------------------
142 // HV membrane - 25 microns of mylar
143 //----------------------------------------------------------
149 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
151 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
153 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
155 //----------------------------------------------------------
156 // "side" gas volume, the same as the drift gas
157 // the readout chambers are placed there.
158 //----------------------------------------------------------
162 dm[2] = 0.5*(275. - 250.);
164 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
166 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
168 //-----------------------------------------------------------
169 // Readout chambers , 25% of X0, I use Al as the material
170 //-----------------------------------------------------------
172 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
173 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
175 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
176 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
179 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
180 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
183 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
184 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
186 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
187 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
189 Float_t SecThick = 2.225; // Al
191 Float_t edge = fTPCParam->GetEdge();
195 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
196 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
198 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
200 Float_t xCenterS = InSecLowEdge+dm[3];
202 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
206 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
207 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
209 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
211 Float_t xCenterL = OuSecLowEdge+dm[3];
213 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
215 Float_t z1 = -z_side + SecThick*0.5;
217 //------------------------------------------------------------------
218 // Positioning of the S-sector readout chambers
219 //------------------------------------------------------------------
222 Float_t theta1,theta2,theta3;
223 Float_t phi1,phi2,phi3;
227 for(ns=0;ns<nInnerSector;ns++){
229 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
230 phi1 *= kRaddeg; // in degrees
232 phi1 = (Float_t)TMath::Nint(phi1);
234 if (phi1 > 360.) phi1 -= 360.;
239 phi3 = ns * InnerOpenAngle + InnerAngleShift;
240 phi3 *= kRaddeg; // in degrees
242 phi3 = (Float_t)TMath::Nint(phi3);
244 if(phi3 > 360.) phi3 -= 360.;
248 alpha = phi3*kDegrad;
250 x = xCenterS * TMath::Cos(alpha);
251 y = xCenterS * TMath::Sin(alpha);
253 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
255 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
261 //-------------------------------------------------------------------
262 // Positioning of the L-sectors readout chambers
263 //-------------------------------------------------------------------
265 for(ns=0;ns<nOuterSector;ns++){
266 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
267 phi1 *= kRaddeg; // in degrees
269 phi1 = (Float_t)TMath::Nint(phi1);
272 if (phi1 > 360.) phi1 -= 360.;
277 phi3 = ns * OuterOpenAngle+OuterAngleShift;
278 phi3 *= kRaddeg; // in degrees
280 phi3 = (Float_t)TMath::Nint(phi3);
283 if(phi3 > 360.) phi3 -= 360.;
287 alpha = phi3*kDegrad;
289 x = xCenterL * TMath::Cos(alpha);
290 y = xCenterL * TMath::Sin(alpha);
292 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
295 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
301 Float_t z0 = z_side - 0.95;
303 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
305 // ==========================================================
307 // ==========================================================
310 // auxilary structures
314 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
316 // ----------------------------------------------------------
317 // Large wheel -> positioned in the TPC
318 // ----------------------------------------------------------
321 z0 = 263.5; // TPC length - 1/2 spoke wheel width
327 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
333 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
335 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
336 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
339 // Outer vessel + CO2 HV degrader
346 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
351 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
353 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
362 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
363 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
364 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
366 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
369 //----------------------------------------------------------
370 // Small wheel -> positioned in "side gas
371 //----------------------------------------------------------
377 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
383 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
385 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
387 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
389 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
398 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
402 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
404 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
408 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
409 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
417 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
421 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
422 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
425 //---------------------------------------------------------
426 // central wheel 6 (radial direction) x 4 (along z) cm2
427 //---------------------------------------------------------
433 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
439 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
441 z0 = z_side - 1.9 - 2.;
443 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
447 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
450 //---------------------------------------------------------
451 // inner spokes (nSectorInner)
452 //---------------------------------------------------------
454 dm[0] = 0.5*(139.9-82.1);
458 Float_t x1 = dm[0]+82.;
460 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
465 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
467 for(ns=0;ns<nInnerSector;ns++){
469 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
473 phi1 = (Float_t)TMath::Nint(phi1);
476 if(phi2>360.) phi2 -= 360.;
481 alpha = phi1 * kDegrad;
482 x = x1 * TMath::Cos(alpha);
483 y = x1 * TMath::Sin(alpha);
485 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
487 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
493 //-------------------------------------------------------------
494 // outer spokes (nSectorOuter)
495 //-------------------------------------------------------------
497 dm[0] = 0.5*(257.9-146.1);
503 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
508 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
510 for(ns=0;ns<nOuterSector;ns++){
512 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
516 phi1 = (Float_t)TMath::Nint(phi1);
519 if(phi2>360.) phi2 -= 360.;
524 alpha = phi1 * kDegrad;
525 x = x1 * TMath::Cos(alpha);
526 y = x1 * TMath::Sin(alpha);
528 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
530 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
538 // --------------------------------------------------------
539 // put the readout chambers into the TPC
540 // --------------------------------------------------------
549 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
553 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
554 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
556 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
558 //----------------------------------------------------
559 // Inner vessel and HV degrader
560 //----------------------------------------------------
582 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
599 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
601 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
602 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
610 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
612 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
614 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
620 // ---------------------------------------------------
622 // ---------------------------------------------------
623 gMC->Gsord("TPSG", 6);
629 //_____________________________________________________________________________
630 void AliTPCv3::DrawDetector()
633 // Draw a shaded view of the Time Projection Chamber version 1
637 // Set everything unseen
638 gMC->Gsatt("*", "seen", -1);
640 // Set ALIC mother transparent
641 gMC->Gsatt("ALIC","SEEN",0);
643 // Set the volumes visible
644 gMC->Gsatt("TPC","SEEN",0);
645 gMC->Gsatt("TGAS","SEEN",0);
646 gMC->Gsatt("TPSG","SEEN",0);
647 gMC->Gsatt("TPHV","SEEN",1);
648 gMC->Gsatt("TPMH","SEEN",1);
649 gMC->Gsatt("TPEC","SEEN",0);
650 gMC->Gsatt("TRCS","SEEN",1);
651 gMC->Gsatt("TRCL","SEEN",1);
652 gMC->Gsatt("TPWL","SEEN",1);
653 gMC->Gsatt("TPWI","SEEN",1);
654 gMC->Gsatt("TPWS","SEEN",1);
655 gMC->Gsatt("TPW1","SEEN",1);
656 gMC->Gsatt("TPS1","SEEN",1);
657 gMC->Gsatt("TPS2","SEEN",1);
658 gMC->Gsatt("TPG1","SEEN",1);
659 gMC->Gsatt("TPG2","SEEN",1);
660 gMC->Gsatt("TPWC","SEEN",1);
661 gMC->Gsatt("TPSI","SEEN",1);
662 gMC->Gsatt("TPSO","SEEN",1);
663 gMC->Gsatt("TPCO","SEEN",1);
664 gMC->Gsatt("TPOV","SEEN",1);
665 gMC->Gsatt("TPVD","SEEN",1);
667 gMC->Gdopt("hide", "on");
668 gMC->Gdopt("shad", "on");
669 gMC->Gsatt("*", "fill", 7);
670 gMC->SetClipBox(".");
671 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
673 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
674 gMC->Gdhead(1111, "Time Projection Chamber");
675 gMC->Gdman(18, 4, "MAN");
676 gMC->Gdopt("hide","off");
679 //_____________________________________________________________________________
680 void AliTPCv3::CreateMaterials()
683 // Define materials for version 2 of the Time Projection Chamber
688 // Increase maximum number of steps
689 gMC->SetMaxNStep(30000);
691 AliTPC::CreateMaterials();
694 //_____________________________________________________________________________
695 void AliTPCv3::Init()
698 // Initialises version 3 of the TPC after that it has been built
700 Int_t *idtmed = fIdtmed->GetArray()-399;
704 fIdSens1=gMC->VolId("TGAS"); // drift gas as a sensitive volume
706 gMC->SetMaxNStep(30000); // max. number of steps increased
708 gMC->Gstpar(idtmed[403],"LOSS",5);
710 printf("*** TPC version 3 initialized ***\n");
711 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
717 //_____________________________________________________________________________
718 void AliTPCv3::StepManager()
721 // Called for every step in the Time Projection Chamber
725 // parameters used for the energy loss calculations
727 const Float_t prim = 14.35; // number of primary collisions per 1 cm
728 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
729 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
732 const Float_t big = 1.e10;
738 TClonesArray &lhits = *fHits;
745 gMC->SetMaxStep(big);
747 if(!gMC->IsTrackAlive()) return; // particle has disappeared
749 Float_t charge = gMC->TrackCharge();
751 if(TMath::Abs(charge)<=0.) return; // take only charged particles
754 id=gMC->CurrentVolID(copy);
756 // Check the sensitive volume
758 if (id != fIdSens1) return;
761 // charged particle is in the sensitive volume
764 if(gMC->TrackStep() > 0) {
767 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
768 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
770 gMC->TrackPosition(pos);
776 // check the selected side of the TPC
779 if(fSide && fSide*hits[2]<=0.) return;
781 hits[3]=(Float_t)nel;
785 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
789 // Stemax calculation for the next step
793 gMC->TrackMomentum(mom);
794 Float_t ptot=mom.Rho();
795 Float_t beta_gamma = ptot/gMC->TrackMass();
797 if(gMC->IdFromPDG(gMC->TrackPid()) <= 3 && ptot > 0.002)
799 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
803 pp=prim*BetheBloch(beta_gamma);
804 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
808 gMC->Rndm(random,1); // good, old GRNDM from Geant3
810 Double_t rnd = (Double_t)random[0];
812 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
816 //_____________________________________________________________________________
817 Float_t AliTPCv3::BetheBloch(Float_t bg)
820 // Bethe-Bloch energy loss formula
822 const Double_t p1=0.76176e-1;
823 const Double_t p2=10.632;
824 const Double_t p3=0.13279e-4;
825 const Double_t p4=1.8631;
826 const Double_t p5=1.9479;
828 Double_t dbg = (Double_t) bg;
830 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
832 Double_t aa = TMath::Power(beta,p4);
833 Double_t bb = TMath::Power(1./dbg,p5);
835 bb=TMath::Log(p3+bb);
837 return ((Float_t)((p2-aa-bb)*p1/aa));