1 ///////////////////////////////////////////////////////////////////////////////
3 // Time Projection Chamber version 3 -- detailed TPC and slow simulation //
7 <img src="picts/AliTPCv3Class.gif">
12 ///////////////////////////////////////////////////////////////////////////////
21 #include"AliTPCParam.h"
25 //_____________________________________________________________________________
26 AliTPCv3::AliTPCv3(const char *name, const char *title) :
30 // Standard constructor for Time Projection Chamber version 2
33 SetBufferSize(128000);
36 //_____________________________________________________________________________
37 void AliTPCv3::CreateGeometry()
40 // Creation of the TPC coarse geometry (version 0)
41 // Origin Marek Kowalski Crakow
45 <img src="picts/AliTPCv0.gif">
50 <img src="picts/AliTPCv0Tree.gif">
54 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
56 Int_t *idtmed = fIdtmed->GetArray();
64 // ----------------------------------------------------
65 // FIELD CAGE WITH ENDCAPS - G10
66 // THIS IS ALSO A TPC MOTHER VOLUME
67 // ----------------------------------------------------
73 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
75 //-----------------------------------------------------
76 // Endcap cover c-fibre 0.86% X0
77 //-----------------------------------------------------
83 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
85 //-----------------------------------------------------
86 // Drift gas , leave 2 cm at the outer radius
88 //-----------------------------------------------------
94 gMC->Gsvolu("TGAS", "TUBE", idtmed[4], dm, 3);
97 //------------------------------------------------------
98 // membrane holder - carbon fiber
99 //------------------------------------------------------
102 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
108 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
114 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
116 //----------------------------------------------------------
117 // HV membrane - 25 microns of mylar
118 //----------------------------------------------------------
124 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
126 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
128 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
130 //----------------------------------------------------------
131 // "side" gas volume, the same as the drift gas
132 // the readout chambers are placed there.
133 //----------------------------------------------------------
137 dm[2] = 0.5*(275. - 250.);
139 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
141 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
143 //-----------------------------------------------------------
144 // Readout chambers , 25% of X0, I use Al as the material
145 //-----------------------------------------------------------
147 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
148 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
150 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
151 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
154 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
155 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
158 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
159 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
161 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
162 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
164 Float_t SecThick = 2.225; // Al
166 Float_t edge = fTPCParam->GetEdge();
170 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
171 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
173 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
175 Float_t xCenterS = InSecLowEdge+dm[3];
177 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
181 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
182 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
184 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
186 Float_t xCenterL = OuSecLowEdge+dm[3];
188 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
190 Float_t z1 = -z_side + SecThick*0.5;
192 //------------------------------------------------------------------
193 // Positioning of the S-sector readout chambers
194 //------------------------------------------------------------------
197 Float_t theta1,theta2,theta3;
198 Float_t phi1,phi2,phi3;
202 for(ns=0;ns<nInnerSector;ns++){
204 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
205 phi1 *= kRaddeg; // in degrees
207 phi1 = (Float_t)TMath::Nint(phi1);
209 if (phi1 > 360.) phi1 -= 360.;
214 phi3 = ns * InnerOpenAngle + InnerAngleShift;
215 phi3 *= kRaddeg; // in degrees
217 phi3 = (Float_t)TMath::Nint(phi3);
219 if(phi3 > 360.) phi3 -= 360.;
223 alpha = phi3*kDegrad;
225 x = xCenterS * TMath::Cos(alpha);
226 y = xCenterS * TMath::Sin(alpha);
228 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
230 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
236 //-------------------------------------------------------------------
237 // Positioning of the L-sectors readout chambers
238 //-------------------------------------------------------------------
240 for(ns=0;ns<nOuterSector;ns++){
241 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
242 phi1 *= kRaddeg; // in degrees
244 phi1 = (Float_t)TMath::Nint(phi1);
247 if (phi1 > 360.) phi1 -= 360.;
252 phi3 = ns * OuterOpenAngle+OuterAngleShift;
253 phi3 *= kRaddeg; // in degrees
255 phi3 = (Float_t)TMath::Nint(phi3);
258 if(phi3 > 360.) phi3 -= 360.;
262 alpha = phi3*kDegrad;
264 x = xCenterL * TMath::Cos(alpha);
265 y = xCenterL * TMath::Sin(alpha);
267 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
270 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
276 Float_t z0 = z_side - 0.95;
278 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
280 // ==========================================================
282 // ==========================================================
285 // auxilary structures
289 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
291 // ----------------------------------------------------------
292 // Large wheel -> positioned in the TPC
293 // ----------------------------------------------------------
296 z0 = 263.5; // TPC length - 1/2 spoke wheel width
302 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
308 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
310 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
311 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
314 // Outer vessel + CO2 HV degrader
321 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
326 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
328 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
337 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
338 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
339 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
341 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
344 //----------------------------------------------------------
345 // Small wheel -> positioned in "side gas
346 //----------------------------------------------------------
352 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
358 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
360 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
362 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
364 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
373 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
377 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
379 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
383 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
384 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
392 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
396 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
397 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
400 //---------------------------------------------------------
401 // central wheel 6 (radial direction) x 4 (along z) cm2
402 //---------------------------------------------------------
408 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
414 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
416 z0 = z_side - 1.9 - 2.;
418 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
422 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
425 //---------------------------------------------------------
426 // inner spokes (nSectorInner)
427 //---------------------------------------------------------
429 dm[0] = 0.5*(139.9-82.1);
433 Float_t x1 = dm[0]+82.;
435 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
440 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
442 for(ns=0;ns<nInnerSector;ns++){
444 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
448 phi1 = (Float_t)TMath::Nint(phi1);
451 if(phi2>360.) phi2 -= 360.;
456 alpha = phi1 * kDegrad;
457 x = x1 * TMath::Cos(alpha);
458 y = x1 * TMath::Sin(alpha);
460 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
462 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
468 //-------------------------------------------------------------
469 // outer spokes (nSectorOuter)
470 //-------------------------------------------------------------
472 dm[0] = 0.5*(257.9-146.1);
478 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
483 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
485 for(ns=0;ns<nOuterSector;ns++){
487 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
491 phi1 = (Float_t)TMath::Nint(phi1);
494 if(phi2>360.) phi2 -= 360.;
499 alpha = phi1 * kDegrad;
500 x = x1 * TMath::Cos(alpha);
501 y = x1 * TMath::Sin(alpha);
503 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
505 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
513 // --------------------------------------------------------
514 // put the readout chambers into the TPC
515 // --------------------------------------------------------
524 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
528 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
529 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
531 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
533 //----------------------------------------------------
534 // Inner vessel and HV degrader
535 //----------------------------------------------------
557 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
574 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
576 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
577 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
585 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
587 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
589 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
595 // ---------------------------------------------------
597 // ---------------------------------------------------
598 gMC->Gsord("TPSG", 6);
604 //_____________________________________________________________________________
605 void AliTPCv3::DrawDetector()
608 // Draw a shaded view of the Time Projection Chamber version 1
612 // Set everything unseen
613 gMC->Gsatt("*", "seen", -1);
615 // Set ALIC mother transparent
616 gMC->Gsatt("ALIC","SEEN",0);
618 // Set the volumes visible
619 gMC->Gsatt("TPC","SEEN",0);
620 gMC->Gsatt("TGAS","SEEN",0);
621 gMC->Gsatt("TPSG","SEEN",0);
622 gMC->Gsatt("TPHV","SEEN",1);
623 gMC->Gsatt("TPMH","SEEN",1);
624 gMC->Gsatt("TPEC","SEEN",0);
625 gMC->Gsatt("TRCS","SEEN",1);
626 gMC->Gsatt("TRCL","SEEN",1);
627 gMC->Gsatt("TPWL","SEEN",1);
628 gMC->Gsatt("TPWI","SEEN",1);
629 gMC->Gsatt("TPWS","SEEN",1);
630 gMC->Gsatt("TPW1","SEEN",1);
631 gMC->Gsatt("TPS1","SEEN",1);
632 gMC->Gsatt("TPS2","SEEN",1);
633 gMC->Gsatt("TPG1","SEEN",1);
634 gMC->Gsatt("TPG2","SEEN",1);
635 gMC->Gsatt("TPWC","SEEN",1);
636 gMC->Gsatt("TPSI","SEEN",1);
637 gMC->Gsatt("TPSO","SEEN",1);
638 gMC->Gsatt("TPCO","SEEN",1);
639 gMC->Gsatt("TPOV","SEEN",1);
640 gMC->Gsatt("TPVD","SEEN",1);
642 gMC->Gdopt("hide", "on");
643 gMC->Gdopt("shad", "on");
644 gMC->Gsatt("*", "fill", 7);
645 gMC->SetClipBox(".");
646 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
648 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
649 gMC->Gdhead(1111, "Time Projection Chamber");
650 gMC->Gdman(18, 4, "MAN");
651 gMC->Gdopt("hide","off");
654 //_____________________________________________________________________________
655 void AliTPCv3::CreateMaterials()
658 // Define materials for version 2 of the Time Projection Chamber
663 // Increase maximum number of steps
664 gMC->SetMaxNStep(30000);
666 AliTPC::CreateMaterials();
669 //_____________________________________________________________________________
670 void AliTPCv3::Init()
673 // Initialises version 3 of the TPC after that it has been built
675 Int_t *idtmed = fIdtmed->GetArray()-399;
679 fIdSens1=gMC->VolId("TGAS"); // drift gas as a sensitive volume
681 gMC->SetMaxNStep(30000); // max. number of steps increased
683 gMC->Gstpar(idtmed[403],"LOSS",5);
685 printf("*** TPC version 3 initialized ***\n");
686 printf("Maximum number of steps = %d\n",gMC->GetMaxNStep());
692 //_____________________________________________________________________________
693 void AliTPCv3::StepManager()
696 // Called for every step in the Time Projection Chamber
700 // parameters used for the energy loss calculations
702 const Float_t prim = 14.35; // number of primary collisions per 1 cm
703 const Float_t poti = 20.77e-9; // first ionization potential for Ne/CO2
704 const Float_t w_ion = 35.97e-9; // energy for the ion-electron pair creation
707 const Float_t big = 1.e10;
713 TClonesArray &lhits = *fHits;
720 gMC->SetMaxStep(big);
722 if(!gMC->IsTrackAlive()) return; // particle has disappeared
724 Float_t charge = gMC->TrackCharge();
726 if(TMath::Abs(charge)<=0.) return; // take only charged particles
729 id=gMC->CurrentVolID(copy);
731 // Check the sensitive volume
733 if (id != fIdSens1) return;
736 // charged particle is in the sensitive volume
739 if(gMC->TrackStep() > 0) {
742 Int_t nel = (Int_t)(((gMC->Edep())-poti)/w_ion) + 1;
743 nel=TMath::Min(nel,300); // 300 electrons corresponds to 10 keV
745 gMC->TrackPosition(pos);
751 // check the selected side of the TPC
754 if(fSide && fSide*hits[2]<=0.) return;
756 hits[3]=(Float_t)nel;
760 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);
764 // Stemax calculation for the next step
768 gMC->TrackMomentum(mom);
769 Float_t ptot=mom.Rho();
770 Float_t beta_gamma = ptot/gMC->TrackMass();
772 if(gMC->IdFromPDG(gMC->TrackPid()) <= 3 && ptot > 0.002)
774 pp = prim*1.58; // electrons above 20 MeV/c are on the plateau!
778 pp=prim*BetheBloch(beta_gamma);
779 if(TMath::Abs(charge) > 1.) pp *= (charge*charge);
783 gMC->Rndm(random,1); // good, old GRNDM from Geant3
785 Double_t rnd = (Double_t)random[0];
787 gMC->SetMaxStep(-TMath::Log(rnd)/pp);
791 //_____________________________________________________________________________
792 Float_t AliTPCv3::BetheBloch(Float_t bg)
795 // Bethe-Bloch energy loss formula
797 const Double_t p1=0.76176e-1;
798 const Double_t p2=10.632;
799 const Double_t p3=0.13279e-4;
800 const Double_t p4=1.8631;
801 const Double_t p5=1.9479;
803 Double_t dbg = (Double_t) bg;
805 Double_t beta = dbg/TMath::Sqrt(1.+dbg*dbg);
807 Double_t aa = TMath::Power(beta,p4);
808 Double_t bb = TMath::Power(1./dbg,p5);
810 bb=TMath::Log(p3+bb);
812 return ((Float_t)((p2-aa-bb)*p1/aa));