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