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 1999/10/04 13:39:54 fca
19 Correct array index problem
21 Revision 1.12 1999/09/29 09:24:34 fca
22 Introduction of the Copyright and cvs Log
26 ///////////////////////////////////////////////////////////////////////////////
28 // Time Projection Chamber version 1 -- detailed TPC and fast simulation //
32 <img src="picts/AliTPCv1Class.gif">
37 ///////////////////////////////////////////////////////////////////////////////
40 #include <TGeometry.h>
52 #include "AliTPCParam.h"
57 //_____________________________________________________________________________
58 AliTPCv1::AliTPCv1(const char *name, const char *title)
59 :AliTPC(name, title) {
61 // Standard constructor for Time Projection Chamber
66 //_____________________________________________________________________________
67 void AliTPCv1::CreateGeometry()
70 // Creates geometry for Time Projection Chamber version 1
71 // Detailed geometry -- Fast simulation
76 <img src="picts/AliTPCv1.gif">
81 <img src="picts/AliTPCv1Tree.gif">
85 AliTPCParam * fTPCParam = &(fDigParam->GetParam());
87 Int_t *idtmed = fIdtmed->GetArray();
95 // ----------------------------------------------------
96 // FIELD CAGE WITH ENDCAPS - G10
97 // THIS IS ALSO A TPC MOTHER VOLUME
98 // ----------------------------------------------------
104 gMC->Gsvolu("TPC ", "TUBE", idtmed[8], dm, 3);
106 //-----------------------------------------------------
107 // Endcap cover c-fibre 0.86% X0
108 //-----------------------------------------------------
114 gMC->Gsvolu("TPEC","TUBE",idtmed[10],dm,3);
116 //-----------------------------------------------------
117 // Drift gas , leave 2 cm at the outer radius
119 //-----------------------------------------------------
125 gMC->Gsvolu("TGAS", "TUBE", idtmed[3], dm, 3);
128 //------------------------------------------------------
129 // membrane holder - carbon fiber
130 //------------------------------------------------------
133 gMC->Gsvolu("TPMH","TUBE",idtmed[6],dm,0);
139 gMC->Gsposp("TPMH",1,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
145 gMC->Gsposp("TPMH",2,"TGAS",0.,0.,0.,0,"ONLY",dm,3);
147 //----------------------------------------------------------
148 // HV membrane - 25 microns of mylar
149 //----------------------------------------------------------
155 gMC->Gsvolu("TPHV","TUBE",idtmed[5],dm,3);
157 gMC->Gspos("TPHV",1,"TGAS",0.,0.,0.,0,"ONLY");
159 gMC->Gspos("TGAS",1,"TPC ",0.,0.,0.,0,"ONLY");
161 //----------------------------------------------------------
162 // "side" gas volume, the same as the drift gas
163 // the readout chambers are placed there.
164 //----------------------------------------------------------
168 dm[2] = 0.5*(275. - 250.);
170 gMC->Gsvolu("TPSG", "TUBE", idtmed[2], dm, 3);
172 Float_t z_side = dm[2]; // 1/2 of the side gas thickness
174 //-----------------------------------------------------------
175 // Readout chambers , 25% of X0, I use Al as the material
176 //-----------------------------------------------------------
178 Float_t InnerOpenAngle = fTPCParam->GetInnerAngle();
179 Float_t OuterOpenAngle = fTPCParam->GetOuterAngle();
181 Float_t InnerAngleShift = fTPCParam->GetInnerAngleShift();
182 Float_t OuterAngleShift = fTPCParam->GetOuterAngleShift();
185 Int_t nInnerSector = fTPCParam->GetNInnerSector()/2;
186 Int_t nOuterSector = fTPCParam->GetNOuterSector()/2;
189 Float_t InSecLowEdge = fTPCParam->GetInSecLowEdge();
190 Float_t InSecUpEdge = fTPCParam->GetInSecUpEdge();
192 Float_t OuSecLowEdge = fTPCParam->GetOuSecLowEdge();
193 Float_t OuSecUpEdge = fTPCParam->GetOuSecUpEdge();
195 Float_t SecThick = 2.225; // Al
197 Float_t edge = fTPCParam->GetEdge();
201 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
202 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-edge;
203 dm[2] = 0.5*SecThick;
204 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
206 Float_t xCenterS = InSecLowEdge+dm[3];
208 gMC->Gsvolu("TRCS", "TRD1", idtmed[0], dm, 4);
212 dm[0] = OuSecLowEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
213 dm[1] = OuSecUpEdge*TMath::Tan(0.5*OuterOpenAngle)-edge;
214 dm[2] = 0.5*SecThick;
215 dm[3] = 0.5*(OuSecUpEdge-OuSecLowEdge);
217 Float_t xCenterL = OuSecLowEdge+dm[3];
219 gMC->Gsvolu("TRCL", "TRD1", idtmed[0], dm, 4);
221 Float_t z1 = -z_side + SecThick*0.5;
223 //------------------------------------------------------------------
224 // S sectors - "gas sectors" (TRD1)
225 //------------------------------------------------------------------
227 dm[0] = InSecLowEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
228 dm[1] = InSecUpEdge*TMath::Tan(0.5*InnerOpenAngle)-0.01;
229 dm[2] = 0.5*(250. - 0.001);
230 dm[3] = 0.5*(InSecUpEdge-InSecLowEdge);
232 gMC->Gsvolu("TSGA", "TRD1", idtmed[3], dm, 4); // nonsensitive
234 //------------------------------------------------------------------
235 // sensitive strips - "pad rows"
236 //------------------------------------------------------------------
241 Float_t StripThick = 0.01; // 100 microns
242 Float_t dead = fTPCParam->GetDeadZone();
244 gMC->Gsvolu("TSST", "TRD1", idtmed[4], dm, 0);
246 dm[2] = 0.5*(250. - 0.002);
247 dm[3] = 0.5 * StripThick;
252 for (ns = 0; ns < fTPCParam->GetNRowLow(); ns++) {
254 r1 = fTPCParam->GetPadRowRadiiLow(ns);
255 r2 = r1 + StripThick;
256 dm[0] = r1 * TMath::Tan(0.5*InnerOpenAngle) - dead;
257 dm[1] = r2 * TMath::Tan(0.5*InnerOpenAngle) - dead;
259 zz = -InSecLowEdge -0.5*(InSecUpEdge-InSecLowEdge);
263 gMC->Gsposp("TSST", ns+1, "TSGA", 0., 0., zz, 0, "ONLY", dm, 4);
268 //-----------------------------------------------------------------
269 // L sectors - "gas sectors" (PGON to avoid overlaps)
270 //-----------------------------------------------------------------
272 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
274 dm[0] = (Float_t)TMath::Nint(dm[0]);
276 dm[1] = OuterOpenAngle*kRaddeg;
277 dm[1] = (Float_t)TMath::Nint(dm[1]);
283 dm[5] = OuSecLowEdge;
284 dm[6] = 252.*TMath::Cos(0.5*OuterOpenAngle)-0.002;
291 dm[11] = OuSecLowEdge;
292 dm[12] = OuSecUpEdge;
298 gMC->Gsvolu("TLGA","PGON",idtmed[3],dm,16);
300 //------------------------------------------------------------------
301 // sensitive strips - "pad rows"
302 //------------------------------------------------------------------
304 Float_t rmax = dm[6];
308 gMC->Gsvolu("TLST", "PGON", idtmed[4], dm, 0);
310 dm[0] = 360.*kDegrad - 0.5*OuterOpenAngle;
312 dm[0] = (Float_t)TMath::Nint(dm[0]);
314 dm[1] = OuterOpenAngle*kRaddeg;
315 dm[1] = (Float_t)TMath::Nint(dm[1]);
322 Float_t xx = dead/TMath::Tan(0.5*OuterOpenAngle);
324 for(ns=0;ns<fTPCParam->GetNRowUp();ns++){
326 r1 = fTPCParam->GetPadRowRadiiUp(ns)-xx;
327 r2 = r1 + StripThick;
342 gMC->Gsposp("TLST",ns+1,"TLGA",xx,0.,0.,0,"ONLY",dm,10);
346 //------------------------------------------------------------------
347 // Positioning of the S-sector readout chambers
348 //------------------------------------------------------------------
350 Float_t zs = 0.5*(250.+0.002);
352 Float_t theta1,theta2,theta3;
353 Float_t phi1,phi2,phi3;
357 for(ns=0;ns<nInnerSector;ns++){
359 phi1 = ns * InnerOpenAngle + 270.*kDegrad + InnerAngleShift;
360 phi1 *= kRaddeg; // in degrees
362 phi1 = (Float_t)TMath::Nint(phi1);
364 if (phi1 > 360.) phi1 -= 360.;
370 phi3 = ns * InnerOpenAngle + InnerAngleShift;
371 phi3 *= kRaddeg; // in degrees
373 phi3 = (Float_t)TMath::Nint(phi3);
375 if(phi3 > 360.) phi3 -= 360.;
379 alpha = phi3*kDegrad;
381 x = xCenterS * TMath::Cos(alpha);
382 y = xCenterS * TMath::Sin(alpha);
384 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
386 gMC->Gspos("TRCS", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
388 gMC->Gspos("TSGA",ns+1,"TGAS",x,y,zs,idrotm[nRotMat], "ONLY");
389 gMC->Gspos("TSGA",ns+1+nInnerSector,"TGAS",x,y,-zs,idrotm[nRotMat], "ONLY");
395 //-------------------------------------------------------------------
396 // Positioning of the L-sectors readout chambers
397 //-------------------------------------------------------------------
399 for(ns=0;ns<nOuterSector;ns++){
400 phi1 = ns * OuterOpenAngle + 270.*kDegrad + OuterAngleShift;
401 phi1 *= kRaddeg; // in degrees
403 phi1 = (Float_t)TMath::Nint(phi1);
406 if (phi1 > 360.) phi1 -= 360.;
411 phi3 = ns * OuterOpenAngle+OuterAngleShift;
412 phi3 *= kRaddeg; // in degrees
414 phi3 = (Float_t)TMath::Nint(phi3);
417 if(phi3 > 360.) phi3 -= 360.;
421 alpha = phi3*kDegrad;
423 x = xCenterL * TMath::Cos(alpha);
424 y = xCenterL * TMath::Sin(alpha);
426 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
429 gMC->Gspos("TRCL", ns+1, "TPSG", x, y, z1, idrotm[nRotMat], "ONLY");
435 //-------------------------------------------------------------------
436 // Positioning of the L-sectors (gas sectors)
437 //-------------------------------------------------------------------
439 for(ns=0;ns<nOuterSector;ns++){
441 phi1 = ns*OuterOpenAngle + OuterAngleShift;
444 phi1 = (Float_t)TMath::Nint(phi1);
445 if(phi1>360.) phi1 -= 360.;
450 if(phi2>360.) phi2 -= 360.;
457 alpha = phi1*kDegrad;
460 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
463 gMC->Gspos("TLGA",ns+1,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
472 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
474 gMC->Gspos("TLGA",ns+1+nOuterSector,"TGAS" ,0.,0.,0.,idrotm[nRotMat],"ONLY");
479 Float_t z0 = z_side - 0.95;
481 gMC->Gspos("TPEC",1,"TPSG",0.,0.,z0,0,"ONLY");
483 // ==========================================================
485 // ==========================================================
488 // auxilary structures
492 gMC->Gsvolu("TPWI","TUBE",idtmed[24],dm,0); // "air"
494 // ----------------------------------------------------------
495 // Large wheel -> positioned in the TPC
496 // ----------------------------------------------------------
499 z0 = 263.5; // TPC length - 1/2 spoke wheel width
505 gMC->Gsvolu("TPWL", "TUBE", idtmed[0], dm, 3);
511 gMC->Gsposp("TPWI",1,"TPWL",0.,0.,0.,0,"ONLY",dm,3);
513 gMC->Gspos("TPWL", 1, "TPC ", 0, 0, z0, 0, "ONLY");
514 gMC->Gspos("TPWL", 2, "TPC ", 0, 0, -z0, 0, "ONLY");
517 // Outer vessel + CO2 HV degrader
524 gMC->Gsvolu("TPCO","TUBE",idtmed[12],dm,3);
529 gMC->Gsvolu("TPOV","TUBE",idtmed[10],dm,3);
531 gMC->Gspos("TPOV",1,"TPCO",0.,0.,0.,0,"ONLY");
540 gMC->Gsvolu("TPG1","TUBE",idtmed[8],dm,3);
541 gMC->Gspos("TPG1",1,"TPCO",0.,0.,251.,0,"ONLY");
542 gMC->Gspos("TPG1",2,"TPCO",0.,0.,-251.,0,"ONLY");
544 gMC->Gspos("TPCO",1,"TPC ",0.,0.,0.,0,"ONLY");
547 //----------------------------------------------------------
548 // Small wheel -> positioned in "side gas
549 //----------------------------------------------------------
555 gMC->Gsvolu("TPWS", "TUBE", idtmed[0], dm, 3);
561 gMC->Gsvolu("TPW1", "TUBE", idtmed[2], dm, 3);
563 gMC->Gspos("TPW1", 1, "TPWS", 0., 0., 0., 0, "ONLY");
565 z0 = 1.; // spoke wheel is shifted w.r.t. center of the "side gas"
567 gMC->Gspos("TPWS", 1, "TPSG", 0, 0, z0, 0, "ONLY");
576 gMC->Gsvolu("TPS1","TUBE",idtmed[0],dm,3);
580 gMC->Gsvolu("TPS2","TUBE",idtmed[24],dm,3);
582 gMC->Gspos("TPS2",1,"TPS1",0.,0.,0.,0,"ONLY");
586 gMC->Gspos("TPS1",1,"TPC ",0.,0.,z0,0,"ONLY");
587 gMC->Gspos("TPS1",2,"TPC ",0.,0.,-z0,0,"ONLY");
595 gMC->Gsvolu("TPG2","TUBE",idtmed[8],dm,3);
599 gMC->Gspos("TPG2",1,"TPC ",0.,0.,z0,0,"ONLY");
600 gMC->Gspos("TPG2",2,"TPC ",0.,0.,-z0,0,"ONLY");
603 //---------------------------------------------------------
604 // central wheel 6 (radial direction) x 4 (along z) cm2
605 //---------------------------------------------------------
611 gMC->Gsvolu("TPWC","TUBE",idtmed[0],dm,3);
617 gMC->Gsposp("TPWI",2,"TPWC",0.,0.,0.,0,"ONLY",dm,3);
619 z0 = z_side - 1.9 - 2.;
621 gMC->Gspos("TPWC",1,"TPSG",0.,0.,z0,0,"ONLY");
625 gMC->Gsvolu("TPSE","BOX ",idtmed[24],dm,0); // "empty" part of the spoke
628 //---------------------------------------------------------
629 // inner spokes (nSectorInner)
630 //---------------------------------------------------------
632 dm[0] = 0.5*(139.9-82.1);
636 Float_t x1 = dm[0]+82.;
638 gMC->Gsvolu("TPSI","BOX",idtmed[0],dm,3);
643 gMC->Gsposp("TPSE",1,"TPSI",0.,0.,0.,0,"ONLY",dm,3);
645 for(ns=0;ns<nInnerSector;ns++){
647 phi1 = 0.5*InnerOpenAngle + ns*InnerOpenAngle + InnerAngleShift;
651 phi1 = (Float_t)TMath::Nint(phi1);
652 if(phi1>360.) phi1 -= 360.;
655 if(phi2>360.) phi2 -= 360.;
660 alpha = phi1 * kDegrad;
661 x = x1 * TMath::Cos(alpha);
662 y = x1 * TMath::Sin(alpha);
664 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
666 gMC->Gspos("TPSI",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
672 //-------------------------------------------------------------
673 // outer spokes (nSectorOuter)
674 //-------------------------------------------------------------
676 dm[0] = 0.5*(257.9-146.1);
682 gMC->Gsvolu("TPSO","BOX ",idtmed[0],dm,3);
687 gMC->Gsposp("TPSE",2,"TPSO",0.,0.,0.,0,"ONLY",dm,3);
689 for(ns=0;ns<nOuterSector;ns++){
691 phi1 = 0.5*OuterOpenAngle + ns*OuterOpenAngle + OuterAngleShift;
695 phi1 = (Float_t)TMath::Nint(phi1);
696 if(phi1>360.) phi1 -= 360.;
699 if(phi2>360.) phi2 -= 360.;
704 alpha = phi1 * kDegrad;
705 x = x1 * TMath::Cos(alpha);
706 y = x1 * TMath::Sin(alpha);
708 AliMatrix(idrotm[nRotMat],theta1,phi1,theta2,phi2,theta3,phi3);
710 gMC->Gspos("TPSO",ns+1,"TPSG",x,y,z0,idrotm[nRotMat],"ONLY");
718 // --------------------------------------------------------
719 // put the readout chambers into the TPC
720 // --------------------------------------------------------
729 AliMatrix(idrotm[nRotMat], theta1, phi1, theta2, phi2, theta3, phi3);
733 gMC->Gspos("TPSG", 1, "TPC ", 0, 0, z0, 0, "ONLY");
734 gMC->Gspos("TPSG", 2, "TPC ", 0, 0, -z0, idrotm[nRotMat], "ONLY");
736 gMC->Gspos("TPC ", 1, "ALIC", 0, 0, 0, 0, "ONLY");
738 //----------------------------------------------------
739 // Inner vessel and HV degrader
740 //----------------------------------------------------
762 gMC->Gsvolu("TPVD", "PCON", idtmed[12], dm, 15); // CO2
779 gMC->Gsvolu("TIVC","PCON",idtmed[11],dm,9); // C-fibre
781 gMC->Gspos("TIVC",1,"TPVD",0.,0.,0.,0,"ONLY");
782 gMC->Gspos("TIVC",2,"TPVD",0.,0.,0.,idrotm[nRotMat],"ONLY");
790 gMC->Gsvolu("TIVB","TUBE",idtmed[9],dm,3);
792 gMC->Gspos("TIVB",1,"TPVD",0.,0.,0.,0,"ONLY");
794 gMC->Gspos("TPVD",1,"ALIC",0.,0.,0.,0,"ONLY");
800 // ---------------------------------------------------
802 // ---------------------------------------------------
803 gMC->Gsord("TGAS", 6);
804 gMC->Gsord("TPSG", 6);
805 gMC->Gsord("TSGA", 3);
806 gMC->Gsord("TLGA", 4);
811 //_____________________________________________________________________________
812 void AliTPCv1::DrawDetector()
815 // Draw a shaded view of the Time Projection Chamber version 1
818 // Set everything unseen
819 gMC->Gsatt("*", "seen", -1);
821 // Set ALIC mother transparent
822 gMC->Gsatt("ALIC","SEEN",0);
824 // Set the volumes visible
825 gMC->Gsatt("TPC","SEEN",0);
826 gMC->Gsatt("TGAS","SEEN",0);
827 gMC->Gsatt("TPSG","SEEN",0);
828 gMC->Gsatt("TPHV","SEEN",1);
829 gMC->Gsatt("TPMH","SEEN",1);
830 gMC->Gsatt("TPEC","SEEN",0);
831 gMC->Gsatt("TRCS","SEEN",1);
832 gMC->Gsatt("TRCL","SEEN",1);
833 gMC->Gsatt("TPWL","SEEN",1);
834 gMC->Gsatt("TPWI","SEEN",1);
835 gMC->Gsatt("TPWS","SEEN",1);
836 gMC->Gsatt("TPW1","SEEN",1);
837 gMC->Gsatt("TPS1","SEEN",1);
838 gMC->Gsatt("TPS2","SEEN",1);
839 gMC->Gsatt("TPG1","SEEN",1);
840 gMC->Gsatt("TPG2","SEEN",1);
841 gMC->Gsatt("TPWC","SEEN",1);
842 gMC->Gsatt("TPSI","SEEN",1);
843 gMC->Gsatt("TPSO","SEEN",1);
844 gMC->Gsatt("TPCO","SEEN",1);
845 gMC->Gsatt("TPOV","SEEN",1);
846 gMC->Gsatt("TPVD","SEEN",1);
848 gMC->Gdopt("hide", "on");
849 gMC->Gdopt("shad", "on");
850 gMC->Gsatt("*", "fill", 7);
851 gMC->SetClipBox(".");
852 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
854 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .025, .025);
855 gMC->Gdhead(1111, "Time Projection Chamber");
856 gMC->Gdman(18, 4, "MAN");
857 gMC->Gdopt("hide","off");
860 //_____________________________________________________________________________
861 void AliTPCv1::CreateMaterials()
864 // Define materials for Time Projection Chamber
866 AliTPC::CreateMaterials();
869 //_____________________________________________________________________________
870 void AliTPCv1::Init()
873 // Initialises TPC detector after it has been created
876 fIdSens1=gMC->VolId("TLST"); // L-sector
877 fIdSens2=gMC->VolId("TSST"); // S-sector
879 printf("TPC version 1 initialized\n");
882 //_____________________________________________________________________________
883 void AliTPCv1::StepManager()
886 // Called at every step in the Time Projection Chamber
892 TClonesArray &lhits = *fHits;
894 AliTPCParam *fTPCParam = &(fDigParam->GetParam());
898 if(gMC->TrackCharge() && gMC->IsTrackEntering()) {
900 // Only entering charged tracks
902 if((id=gMC->CurrentVolID(copy))==fIdSens1) {
906 vol[1]=copy-1; // row
907 id=gMC->CurrentVolOffID(1,copy);
908 vol[0]=copy+fTPCParam->GetNInnerSector()-1; // sector
909 } else if(id==fIdSens2) {
913 vol[1]=copy-1; // row
914 id=gMC->CurrentVolOffID(1,copy); // sector
918 gMC->TrackPosition(p);
919 for(i=0;i<3;++i) hits[i]=p[i];
921 new(lhits[fNhits++]) AliTPChit(fIshunt,gAlice->CurrentTrack(),vol,hits);