Use gMC and not pMC everywhere
[u/mrichter/AliRoot.git] / TOF / AliTOFv0.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3// Time Of Flight //
4// This class contains the functions for version 0 of the Time Of Flight //
5// detector. //
6// //
7//Begin_Html
8/*
1439f98e 9<img src="picts/AliTOFv0Class.gif">
fe4da5cc 10*/
11//End_Html
12// //
13///////////////////////////////////////////////////////////////////////////////
14
15#include "AliTOFv0.h"
16#include "AliRun.h"
fe4da5cc 17#include "AliConst.h"
18
19ClassImp(AliTOFv0)
20
21//_____________________________________________________________________________
151e057e 22AliTOFv0::AliTOFv0()
fe4da5cc 23{
24 //
25 // Default constructor
26 //
27}
28
29//_____________________________________________________________________________
30AliTOFv0::AliTOFv0(const char *name, const char *title)
31 : AliTOF(name,title)
32{
33 //
34 // Standard constructor for version 0 of the Time Of Flight
35 //
36}
37
38//_____________________________________________________________________________
39void AliTOFv0::CreateGeometry()
40{
41 //
42 // Definition of Geometry
43 // Authors : Maxim Martemianov, Boris Zagreev (ITEP) 18/09/98
44 //Begin_Html
45 /*
1439f98e 46 <img src="picts/AliTOFv0.gif">
fe4da5cc 47 */
48 //End_Html
49 //
50
fe4da5cc 51 Float_t fil_rich;
52 Int_t lmax;
53 Float_t phos_phi, zcor2, zcor3, ztof0, ztof1, ztof2;
54 Float_t zl, phos_r;
55 Int_t idrotm[101];
56 Float_t phos_x;
57 Float_t rp1, rp2;
58 Float_t par[10], fil_min, fil_max, ysz, fil0;
59 //
ad51aeb0 60 Int_t *idtmed = fIdtmed->GetArray()-499;
fe4da5cc 61 //
62 // barrel size along Z axis
151e057e 63 // rp1 = 360.;
64 // rp2 = 372.;
65 rp1 = 370;
66 rp2 = rp1 + 12;
fe4da5cc 67 zl = 720.;
68 //
69 // TOF width along radius of barrel
70 //xtof = rp2 - rp1;
71 ztof0 = 350.;
72 ztof1 = 200.;
73 ztof2 = 150.;
74 //
75 // Plate width
76 ysz = .6;
77 // PHOS and RICH angles
78 phos_x = 214.6;
79 phos_r = 467.;
80 //phos_z = 260.;
81 //rich_z = 472.5;
82 fil_rich = 30.;
83 lmax = 19;
84 zcor2 = ztof0 - ztof1 / 2.;
85 zcor3 = ztof0 - ztof2 / 2.;
86 phos_phi = TMath::ATan(phos_x / (phos_r * 2.));
87 fil_min = (kPI - phos_phi * 4.) * kRaddeg - 180. / lmax;
88 fil_max = (phos_phi * 4. + kPI) * kRaddeg + 180. / lmax;
89 // barrel radius in ALIC
90 par[0] = rp1;
91 par[1] = rp2;
92 par[2] = zl / 2.;
cfce8870 93 gMC->Gsvolu("FBAR", "TUBE", idtmed[500], par, 3);
94 gMC->Gspos("FBAR", 1, "ALIC", 0., 0., 0., 0, "ONLY");
95 gMC->Gsatt("FBAR", "SEEN", 0);
fe4da5cc 96 // First Block
97 par[0] = (rp1+rp2-ysz)/2.;
98 par[1] = (rp1+rp2+ysz)/2.;
99 par[2] = ztof0;
100 par[3] = 90. - fil_min;
101 par[4] = 90. - fil_rich;
102 fil0 = 180. - (par[3] + par[4]);
cfce8870 103 gMC->Gsvolu("FBT1", "TUBS", idtmed[507], par, 5);
fe4da5cc 104 AliMatrix(idrotm[1], 90., fil0, 90., fil0 + 90., 0., 0.);
cfce8870 105 gMC->Gspos("FBT1", 0, "FBAR", 0., 0., 0., 0, "ONLY");
106 gMC->Gspos("FBT1", 1, "FBAR", 0., 0., 0., idrotm[1], "ONLY");
fe4da5cc 107 // --- Second block
108 par[2] = ztof1 / 2.;
109 par[3] = 90. - fil_max;
110 par[4] = 90. - fil_min;
cfce8870 111 gMC->Gsvolu("FBT2", "TUBS", idtmed[507], par, 5);
112 gMC->Gspos("FBT2", 0, "FBAR", 0., 0., zcor2, 0, "ONLY");
113 gMC->Gspos("FBT2", 1, "FBAR", 0., 0.,-zcor2, 0, "ONLY");
fe4da5cc 114 // --- Third block
115 par[2] = ztof2 / 2.;
116 par[3] = 90. - fil_rich;
117 par[4] = fil_rich + 90.;
cfce8870 118 gMC->Gsvolu("FBT3", "TUBS", idtmed[507], par, 5);
119 gMC->Gspos("FBT3", 0, "FBAR", 0., 0., zcor3, 0, "ONLY");
120 gMC->Gspos("FBT3", 1, "FBAR", 0., 0., -zcor3, 0, "ONLY");
fe4da5cc 121}
122
123//_____________________________________________________________________________
8f72dc0c 124void AliTOFv0::DrawModule()
fe4da5cc 125{
126 //
127 // Draw a shaded view of the common part of the TOF geometry
128 // for versions 2 and 3
129 //
130
fe4da5cc 131 // Set everything unseen
cfce8870 132 gMC->Gsatt("*", "seen", -1);
fe4da5cc 133 //
134 // Set ALIC mother transparent
cfce8870 135 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 136 //
137 // Set the volumes visible
cfce8870 138 gMC->Gsatt("FBAR","SEEN",0);
139 gMC->Gsatt("FBT1","SEEN",1);
140 gMC->Gsatt("FBT2","SEEN",1);
141 gMC->Gsatt("FBT3","SEEN",1);
142 //
143 gMC->Gdopt("hide", "on");
144 gMC->Gdopt("shad", "on");
145 gMC->Gsatt("*", "fill", 7);
146 //
147 gMC->SetClipBox(".");
148 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
149 gMC->DefaultRange();
150 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
151 gMC->Gdhead(1111, "Time Of Flight");
152 gMC->Gdman(18, 4, "MAN");
153 gMC->Gdopt("hide","off");
fe4da5cc 154}
155
156//_____________________________________________________________________________
157void AliTOFv0::CreateMaterials()
158{
159 //
160 // Define materials for the Time Of Flight
161 //
162 AliTOF::CreateMaterials();
163}
164
165//_____________________________________________________________________________
166void AliTOFv0::Init()
167{
168 //
169 // Initialise detector after that it has been built
170 //
171
fe4da5cc 172 AliTOF::Init();
cfce8870 173 fIdFBT2=gMC->VolId("FBT2");
174 fIdFBT3=gMC->VolId("FBT3");
fe4da5cc 175}
176
177//_____________________________________________________________________________
178void AliTOFv0::StepManager()
179{
180 //
181 // Procedure called at each step in the Time Of Flight
182 Float_t hits[8];
183 Int_t vol[3];
184 Int_t copy, id;
185 //
186 // Get the pointer to the MonteCarlo
ad51aeb0 187 Int_t *idtmed = fIdtmed->GetArray()-499;
cfce8870 188 if(gMC->GetMedium()==idtmed[510-1] &&
189 gMC->TrackEntering() && gMC->TrackCharge()
190 && (id=gMC->CurrentVol(0,copy))==fIdSens) {
fe4da5cc 191 TClonesArray &lhits = *fHits;
192 //
193 // Record only charged tracks at entrance
194 vol[2]=copy;
cfce8870 195 vol[1]=gMC->CurrentVolOff(1,0,copy);
fe4da5cc 196 if(id==fIdFBT2) copy+=2; else
197 if(id==fIdFBT2) copy+=4;
198 vol[0]=1;
cfce8870 199 gMC->TrackPosition(hits);
200 gMC->TrackMomentum(&hits[3]);
201 hits[7]=gMC->TrackTime();
fe4da5cc 202 new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
203 }
204}
205
206