Introducing Copyright include file
[u/mrichter/AliRoot.git] / TOF / AliTOFv0.cxx
CommitLineData
fe4da5cc 1///////////////////////////////////////////////////////////////////////////////
2// //
3fe3a833 3// Time Of Flight: as for version 1 but not sensitive //
fe4da5cc 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"
3fe3a833 18
fe4da5cc 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 //
3fe3a833 34 // Standard constructor
fe4da5cc 35 //
36}
37
38//_____________________________________________________________________________
39void AliTOFv0::CreateGeometry()
40{
41 //
3fe3a833 42 // Create geometry for Time Of Flight version 0
43 //
fe4da5cc 44 //Begin_Html
45 /*
1439f98e 46 <img src="picts/AliTOFv0.gif">
fe4da5cc 47 */
48 //End_Html
49 //
fe4da5cc 50 //
3fe3a833 51 // Create common geometry
fe4da5cc 52 //
3fe3a833 53 AliTOF::CreateGeometry();
fe4da5cc 54}
55
56//_____________________________________________________________________________
3fe3a833 57void AliTOFv0::TOFpc(Float_t xm, Float_t ym, Float_t zm0,
58 Float_t zm1, Float_t zm2)
fe4da5cc 59{
60 //
3fe3a833 61 // Definition of the Time Of Fligh Resistive Plate Chambers
62 // xm, ym, zm - sizes of TOF modules (large)
63
64 Float_t ycoor;
65 Float_t zazor, xp, yp, zp;
66 Float_t par[10];
67
68 Int_t *idtmed = fIdtmed->GetArray()-499;
69
70 // gap in RPC chamber
71 zazor = .03;
72 // Sizes of RPC chamber
73 xp = 3.0; //small pixel
74//xp = 3.9; //large pixel
75 yp = 12.3*0.05; // 5% X0 of glass
76 zp = 3.0; //small pixel
77//zp = 4.1; //large pixel
78 // Large not sensitive volumes with CO2
79 par[0] = xm/2;
80 par[1] = ym/2;
81 par[2] = zm0/2;
82 gMC->Gsvolu("FBT1", "BOX ", idtmed[506], par, 3); // CO2
83 gMC->Gspos("FBT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
84 gMC->Gsdvn("FDT1", "FBT1", 2, 3); // 2 large modules along Z
85 par[2] = zm1 / 2;
86 gMC->Gsvolu("FBT2", "BOX ", idtmed[506], par, 3); // CO2
87 gMC->Gspos("FBT2", 1, "FTO2", 0., 0., 0., 0, "ONLY");
88 gMC->Gsdvn("FDT2", "FBT2", 2, 3); // 2 (PHOS) modules along Z
89 par[2] = zm2 / 2;
90 gMC->Gsvolu("FBT3", "BOX ", idtmed[506], par, 3); // CO2
91 gMC->Gspos("FBT3", 2, "FTO3", 0., 0., 0., 0, "ONLY");
92 gMC->Gsdvn("FDT3", "FBT3", 1, 3); // 1 (RICH) module along Z
93 //
94 // subtraction of dead boundaries in X=2 cm and Z=7/2 cm
95 par[0] = par[0]-2.;
96 Int_t nz0, nz1, nz2, nx; //- numbers of pixels
97 nx = Int_t (par[0]*2/xp);
98 cout <<"************************* TOF geometry **************************"<<endl;
99 cout<< "nx = "<< nx << " x size = "<< par[0]*2/nx << endl;
100 par[1] = -1;
101 par[2] = (zm0 / 2.)/2.; //this is half size of module after division by 2
102 par[2]=par[2]-7/2.;
103 nz0 = Int_t (par[2]*2/zp);
104cout<< "nz0 = "<< nz0 << " z0 size = "<< par[2]*2/nz0 << endl;
105 gMC->Gsvolu("FLT1", "BOX ", idtmed[506], par, 3); // CO2
106 gMC->Gspos("FLT1", 0, "FDT1", 0., 0., 0., 0, "ONLY");
107 par[2] = (zm1 / 2.)/2.; //this is half size of module after division by 2
108 par[2]=par[2]-7/2.;
109 nz1 = Int_t (par[2]*2/zp);
110cout<< "nz1 = "<< nz1 << " z1 size = "<< par[2]*2/nz1 << endl;
111 gMC->Gsvolu("FLT2", "BOX ", idtmed[506], par, 3); // CO2
112 gMC->Gspos("FLT2", 0, "FDT2", 0., 0., 0., 0, "ONLY");
113 par[2] = (zm2 / 2.); //this is half size of module after division by 1
114 par[2]=par[2]-7/2.;
115 nz2 = Int_t (par[2]*2/zp);
116cout<< "nz2 = "<< nz2 << " z2 size = "<< par[2]*2/nz2 << endl;
117 gMC->Gsvolu("FLT3", "BOX ", idtmed[506], par, 3); // CO2
118 gMC->Gspos("FLT3", 0, "FDT3", 0., 0., 0., 0, "ONLY");
119 //
120////////// Layers before detector ////////////////////
121// Mylar layer in front 0.5mm thick at the beginning
122 par[0] = -1;
123 par[1] = 0.05 / 2;
124 par[2] = -1;
125 ycoor = -ym/2 + par[1];
126 gMC->Gsvolu("FMY1", "BOX ", idtmed[511], par, 3); // Mylar
127 gMC->Gspos("FMY1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
128 gMC->Gsvolu("FMY2", "BOX ", idtmed[511], par, 3); // Mylar
129 gMC->Gspos("FMY2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
130 gMC->Gsvolu("FMY3", "BOX ", idtmed[511], par, 3); // Mylar
131 gMC->Gspos("FMY3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
132// Honeycomb layer (1cm of special!!! polyethilene)
133 ycoor = ycoor + par[1];
134 par[0] = -1;
135 par[1] = 1. / 2;
136 par[2] = -1;
137 ycoor = ycoor + par[1];
138 gMC->Gsvolu("FPL1", "BOX ", idtmed[503], par, 3); // Hony
139 gMC->Gspos("FPL1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
140 gMC->Gsvolu("FPL2", "BOX ", idtmed[503], par, 3); // Hony
141 gMC->Gspos("FPL2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
142 gMC->Gsvolu("FPL3", "BOX ", idtmed[503], par, 3); // Hony
143 gMC->Gspos("FPL3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
fe4da5cc 144 //
3fe3a833 145///////////////// Detector itself //////////////////////
146 par[0] = -1;
147 par[1] = yp/2; // 5 %X0 thick of glass
148 par[2] = -1;
149 ycoor = -ym/2 + 2;
150 gMC->Gsvolu("FLD1", "BOX ", idtmed[514], par, 3); // Glass
151 gMC->Gspos("FLD1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
152 gMC->Gsvolu("FLD2", "BOX ", idtmed[514], par, 3); // Glass
153 gMC->Gspos("FLD2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
154 gMC->Gsvolu("FLD3", "BOX ", idtmed[514], par, 3); // Glass
155 gMC->Gspos("FLD3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
156 //
157 gMC->Gsdvn("FLZ1", "FLD1", nz0, 3); //pixel size xp=zp=3
158 gMC->Gsdvn("FLZ2", "FLD2", nz1, 3);
159 gMC->Gsdvn("FLZ3", "FLD3", nz2, 3);
160 gMC->Gsdvn("FLX1", "FLZ1", nx, 1);
161 gMC->Gsdvn("FLX2", "FLZ2", nx, 1);
162 gMC->Gsdvn("FLX3", "FLZ3", nx, 1);
163 // RPC pixel itself
164 par[0] = -1;//xp/2;
165 par[1] = -1;//yp/2; // 5 %X0 thick of glass
166 par[2] = -1;//zp/2;
167 gMC->Gsvolu("FPA0", "BOX ", idtmed[514], par, 3);// Glass
168 gMC->Gspos("FPA0", 1, "FLX1", 0., 0., 0., 0, "ONLY");
169 gMC->Gspos("FPA0", 2, "FLX2", 0., 0., 0., 0, "ONLY");
170 gMC->Gspos("FPA0", 3, "FLX3", 0., 0., 0., 0, "ONLY");
171 // Freon gas sencitive volume
172 par[0] = -1;
173 par[1] = zazor/2;
174 par[2] = -1;
175 gMC->Gsvolu("FPG0", "BOX ", idtmed[513], par, 3);// Freon
176 gMC->Gspos("FPG0", 0, "FPA0", 0., 0., 0., 0, "ONLY");
177 //
178////////// Layers after detector ////////////////////
179 // Honeycomb layer after (3cm)
180 par[0] = -1;
181 par[1] = 1.2 / 2.;
182 par[2] = -1;
183 ycoor = -ym/2 + 6. - par[1];
184 gMC->Gsvolu("FPE1", "BOX ", idtmed[503], par, 3); // Hony
185 gMC->Gspos("FPE1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
186 gMC->Gsvolu("FPE2", "BOX ", idtmed[503], par, 3); // Hony
187 gMC->Gspos("FPE2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
188 gMC->Gsvolu("FPE3", "BOX ", idtmed[503], par, 3); // Hony
189 gMC->Gspos("FPE3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
190 // Electronics (Cu) after
191 par[0] = -1;
192 par[1] = 1.43*0.05 / 2.; // 5% of X0
193 par[2] = -1;
194 ycoor = -ym/2 + 6.+par[1];
195 gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
196 gMC->Gspos("FEC1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
197 gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
198 gMC->Gspos("FEC2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
199 gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
200 gMC->Gspos("FEC3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
201 // Cooling water after
202 ycoor = ycoor+par[1];
203 par[0] = -1;
204 par[1] = 36.1*0.02 / 2.; // 2% of X0
205 par[2] = -1;
206 ycoor = ycoor+par[1];
207 gMC->Gsvolu("FWA1", "BOX ", idtmed[515], par, 3); // Water
208 gMC->Gspos("FWA1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
209 gMC->Gsvolu("FWA2", "BOX ", idtmed[515], par, 3); // Water
210 gMC->Gspos("FWA2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
211 gMC->Gsvolu("FWA3", "BOX ", idtmed[515], par, 3); // Water
212 gMC->Gspos("FWA3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
213 //back plate honycomb (2cm)
214 par[0] = -1;
215 par[1] = 2 / 2.;
216 par[2] = -1;
217 ycoor = ym/2 - par[1];
218 gMC->Gsvolu("FEG1", "BOX ", idtmed[503], par, 3); // Hony
219 gMC->Gspos("FEG1", 0, "FLT1", 0., ycoor, 0., 0, "ONLY");
220 gMC->Gsvolu("FEG2", "BOX ", idtmed[503], par, 3); // Hony
221 gMC->Gspos("FEG2", 0, "FLT2", 0., ycoor, 0., 0, "ONLY");
222 gMC->Gsvolu("FEG3", "BOX ", idtmed[503], par, 3); // Hony
223 gMC->Gspos("FEG3", 0, "FLT3", 0., ycoor, 0., 0, "ONLY");
224}
fe4da5cc 225
3fe3a833 226//_____________________________________________________________________________
227void AliTOFv0::DrawModule()
228{
229 //
230 // Draw a shaded view of the Time Of Flight version 0
231 //
fe4da5cc 232 // Set everything unseen
cfce8870 233 gMC->Gsatt("*", "seen", -1);
fe4da5cc 234 //
235 // Set ALIC mother transparent
cfce8870 236 gMC->Gsatt("ALIC","SEEN",0);
fe4da5cc 237 //
238 // Set the volumes visible
3fe3a833 239 gMC->Gsatt("ALIC","SEEN",0);
240 gMC->Gsatt("FBAR","SEEN",1);
241 gMC->Gsatt("FTO1","SEEN",1);
242 gMC->Gsatt("FTO2","SEEN",1);
243 gMC->Gsatt("FTO3","SEEN",1);
cfce8870 244 gMC->Gsatt("FBT1","SEEN",1);
245 gMC->Gsatt("FBT2","SEEN",1);
246 gMC->Gsatt("FBT3","SEEN",1);
3fe3a833 247 gMC->Gsatt("FDT1","SEEN",1);
248 gMC->Gsatt("FDT2","SEEN",1);
249 gMC->Gsatt("FDT3","SEEN",1);
250 gMC->Gsatt("FLT1","SEEN",1);
251 gMC->Gsatt("FLT2","SEEN",1);
252 gMC->Gsatt("FLT3","SEEN",1);
cfce8870 253 //
254 gMC->Gdopt("hide", "on");
255 gMC->Gdopt("shad", "on");
256 gMC->Gsatt("*", "fill", 7);
cfce8870 257 gMC->SetClipBox(".");
258 gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
259 gMC->DefaultRange();
260 gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
261 gMC->Gdhead(1111, "Time Of Flight");
262 gMC->Gdman(18, 4, "MAN");
263 gMC->Gdopt("hide","off");
fe4da5cc 264}
265
266//_____________________________________________________________________________
267void AliTOFv0::CreateMaterials()
268{
269 //
270 // Define materials for the Time Of Flight
271 //
272 AliTOF::CreateMaterials();
273}
274
275//_____________________________________________________________________________
276void AliTOFv0::Init()
277{
278 //
3fe3a833 279 // Initialise the detector after the geometry has been defined
fe4da5cc 280 //
fe4da5cc 281 AliTOF::Init();
3fe3a833 282 fIdFTO2=gMC->VolId("FTO2");
283 fIdFTO3=gMC->VolId("FTO3");
284 fIdFLT1=gMC->VolId("FLT1");
285 fIdFLT2=gMC->VolId("FLT2");
286 fIdFLT3=gMC->VolId("FLT3");
fe4da5cc 287}
288
289//_____________________________________________________________________________
290void AliTOFv0::StepManager()
291{
292 //
293 // Procedure called at each step in the Time Of Flight
3fe3a833 294 //
295 TLorentzVector mom, pos;
fe4da5cc 296 Float_t hits[8];
297 Int_t vol[3];
0a6d8768 298 Int_t copy, id, i;
ad51aeb0 299 Int_t *idtmed = fIdtmed->GetArray()-499;
3fe3a833 300 if(gMC->GetMedium()==idtmed[514-1] &&
0a6d8768 301 gMC->IsTrackEntering() && gMC->TrackCharge()
3fe3a833 302 && gMC->CurrentVolID(copy)==fIdSens) {
fe4da5cc 303 TClonesArray &lhits = *fHits;
304 //
305 // Record only charged tracks at entrance
3fe3a833 306 gMC->CurrentVolOffID(1,copy);
fe4da5cc 307 vol[2]=copy;
3fe3a833 308 gMC->CurrentVolOffID(3,copy);
309 vol[1]=copy;
310 id=gMC->CurrentVolOffID(8,copy);
311 vol[0]=copy;
312 if(id==fIdFTO3) {
313 vol[0]+=22;
314 id=gMC->CurrentVolOffID(5,copy);
315 if(id==fIdFLT3) vol[1]+=6;
316 } else if (id==fIdFTO2) {
317 vol[0]+=20;
318 id=gMC->CurrentVolOffID(5,copy);
319 if(id==fIdFLT2) vol[1]+=8;
320 } else {
321 id=gMC->CurrentVolOffID(5,copy);
322 if(id==fIdFLT1) vol[1]+=14;
323 }
0a6d8768 324 gMC->TrackPosition(pos);
325 gMC->TrackMomentum(mom);
3fe3a833 326 //
0a6d8768 327 Double_t ptot=mom.Rho();
328 Double_t norm=1/ptot;
329 for(i=0;i<3;++i) {
330 hits[i]=pos[i];
331 hits[i+3]=mom[i]*norm;
332 }
333 hits[6]=ptot;
334 hits[7]=pos[3];
fe4da5cc 335 new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
336 }
337}