]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFv2.cxx
Adding new TOF
[u/mrichter/AliRoot.git] / TOF / AliTOFv2.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Time Of Flight: design of P.Fonte                                        //
4 //  This class contains the functions for version 2 of the Time Of Flight    //
5 //  detector.                                                                //
6 //                                                                           //
7 //Begin_Html
8 /*
9 <img src="picts/AliTOFv2Class.gif">
10 */
11 //End_Html
12 //                                                                           //
13 ///////////////////////////////////////////////////////////////////////////////
14
15 #include "AliTOFv2.h"
16 #include "AliRun.h"
17 #include "AliConst.h"
18  
19 ClassImp(AliTOFv2)
20  
21 //_____________________________________________________________________________
22 AliTOFv2::AliTOFv2()
23 {
24   //
25   // Default constructor
26   //
27 }
28  
29 //_____________________________________________________________________________
30 AliTOFv2::AliTOFv2(const char *name, const char *title)
31        : AliTOF(name,title)
32 {
33   //
34   // Standard constructor
35   //
36 }
37  
38 //_____________________________________________________________________________
39 void AliTOFv2::CreateGeometry()
40 {
41   //
42   // Create geometry for Time Of Flight version 0
43   //
44   //Begin_Html
45   /*
46     <img src="picts/AliTOFv2.gif">
47   */
48   //End_Html
49   //
50   //
51   // Create common geometry
52   //
53   AliTOF::CreateGeometry();
54 }
55  
56 //_____________________________________________________________________________
57 void AliTOFv2::TOFpc(Float_t xm, Float_t ym, Float_t zm0,
58                      Float_t zm1, Float_t zm2)
59 {
60   //
61   // Definition of the Time Of Fligh Resistive Plate Chambers
62   // xm, ym, zm - sizes of TOF modules (large)
63   
64   Int_t inum;
65   Float_t xcor, ycor, zcor, ycoor;
66   Float_t zazor, dx, dy, dz, xp, yp, zp, ywidth;
67   Int_t ink;
68   Float_t par[10];
69   Int_t inz, nxp, npx, npz;
70   Float_t xsz, ysz, zsz;
71   Int_t nzp0, nzp1, nzp2;
72   
73   Int_t *idtmed = fIdtmed->GetArray()-499;
74   
75   // X size of small RPC plate G10 
76   xsz = 60.;
77   // Y size (thickness) of large && small RPC plate G10 
78   ysz = .26;
79   // Z size of small RPC plate G10
80   zsz = 50.;
81   // Width of CO2 box with RPC
82   ywidth = 4.;
83   // Frame width along X,Y and Z axis of RPC chambers 
84   dx = 0.;
85   dy = .3; //this is 1mm(ceramic) + 1mm(Al) + 1mm(polyethelene) 
86   dz = 0.;
87   // gap in RPC chamber 
88   zazor = .03;
89   // Sizes of RPC chamber 
90   xp = 3.06; //small pixel
91 //xp = 3.9; //large pixel 
92   yp = zazor + dy * 2; //=0.83cm total thickness of RPC
93   zp = 3.06; //small pixel
94 //zp = 4.1; //large pixel
95   // Large not sensitive volumes with CO2 
96   par[0] = xm / 2.;
97   par[1] = ywidth / 2.;
98   par[2] = zm0 / 2.;
99   gMC->Gsvolu("FBT1", "BOX ", idtmed[506], par, 3); // CO2
100   gMC->Gspos("FBT1", 0, "FTO1", 0., 0., 0., 0, "ONLY");
101   par[2] = zm1 / 2.;
102   gMC->Gsvolu("FBT2", "BOX ", idtmed[506], par, 3); // CO2
103   gMC->Gspos("FBT2", 1, "FTO2", 0., 0., 0., 0, "ONLY");
104   par[2] = zm2 / 2.;
105   gMC->Gsvolu("FBT3", "BOX ", idtmed[506], par, 3); // CO2
106   gMC->Gspos("FBT3", 2, "FTO3", 0., 0., 0., 0, "ONLY");
107   // Large electronic plate (G10) after
108   par[0] = xm / 2.;
109   par[1] = ysz / 2.;
110   par[2] = zm0 / 2.;
111   ycoor = yp + par[1];
112   gMC->Gsvolu("FPE1", "BOX ", idtmed[504], par, 3); // G10
113   gMC->Gspos("FPE1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
114   par[2] = zm1 / 2.;
115   gMC->Gsvolu("FPE2", "BOX ", idtmed[504], par, 3); // G10
116   gMC->Gspos("FPE2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
117   par[2] = zm2 / 2.;
118   gMC->Gsvolu("FPE3", "BOX ", idtmed[504], par, 3); // G10
119   gMC->Gspos("FPE3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
120   // Electronics (5cm thick) after
121   //first - Cu (0.02574cm thick - 1.8% X0)
122   par[0] = xm / 2.;
123   par[1] = 0.02574 / 2.;
124   par[2] = zm0 / 2.;
125   ycoor = yp + ysz + 5/2 - par[1];
126   gMC->Gsvolu("FEC1", "BOX ", idtmed[501], par, 3); // Cu
127   gMC->Gspos("FEC1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
128   par[2] = zm1 / 2.;
129   gMC->Gsvolu("FEC2", "BOX ", idtmed[501], par, 3); // Cu
130   gMC->Gspos("FEC2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
131   par[2] = zm2 / 2.;
132   gMC->Gsvolu("FEC3", "BOX ", idtmed[501], par, 3); // Cu
133   gMC->Gspos("FEC3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
134   //second - G10 (0.2328cm thick - 1.2% X0)
135   par[0] = xm / 2.;
136   par[1] = 0.2328 / 2.;
137   par[2] = zm0 / 2.;
138   ycoor = yp + ysz + 5/2 + par[1];
139   gMC->Gsvolu("FEG1", "BOX ", idtmed[504], par, 3); // G10
140   gMC->Gspos("FEG1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
141   par[2] = zm1 / 2.;
142   gMC->Gsvolu("FEG2", "BOX ", idtmed[504], par, 3); // G10
143   gMC->Gspos("FEG2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
144   par[2] = zm2 / 2.;
145   gMC->Gsvolu("FEG3", "BOX ", idtmed[504], par, 3); // G10
146   gMC->Gspos("FEG3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
147   // Al support (5mm thick) after
148   par[0] = xm / 2.;
149   par[1] = 0.5 / 2.;
150   par[2] = zm0 / 2.;
151   ycoor = yp + ysz + par[1];
152   gMC->Gsvolu("FSP1", "BOX ", idtmed[508], par, 3); // Al
153   gMC->Gspos("FSP1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
154   par[2] = zm1 / 2.;
155   gMC->Gsvolu("FSP2", "BOX ", idtmed[508], par, 3); // Al
156   gMC->Gspos("FSP2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
157   par[2] = zm2 / 2.;
158   gMC->Gsvolu("FSP3", "BOX ", idtmed[508], par, 3); // Al
159   gMC->Gspos("FSP3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
160   // Mylar layer in front 0.5mm thick at 5mm from detector
161   par[0] = xm / 2.;
162   par[1] = 0.05 / 2;
163   par[2] = zm0 / 2.;
164   ycoor = -yp - 0.5 - par[1];
165   gMC->Gsvolu("FMY1", "BOX ", idtmed[511], par, 3); // G10
166   gMC->Gspos("FMY1", 0, "FBT1", 0., ycoor, 0., 0, "ONLY");
167   par[2] = zm1 / 2.;
168   gMC->Gsvolu("FMY2", "BOX ", idtmed[511], par, 3); // G10
169   gMC->Gspos("FMY2", 0, "FBT2", 0., ycoor, 0., 0, "ONLY");
170   par[2] = zm2 / 2.;
171   gMC->Gsvolu("FMY3", "BOX ", idtmed[511], par, 3); // G10
172   gMC->Gspos("FMY3", 0, "FBT3", 0., ycoor, 0., 0, "ONLY");
173   //  insensitive volumes - large box for RPCs 
174   par[1] = yp; // two times thicker than RPC
175   par[2] = zm0 / 2.;
176   gMC->Gsvolu("FLT1", "BOX ", idtmed[512], par, 3); //Freon not senc.
177   gMC->Gspos("FLT1", 0, "FBT1", 0., 0., 0., 0, "ONLY");
178   par[2] = zm1 / 2.;
179   gMC->Gsvolu("FLT2", "BOX ", idtmed[512], par, 3); //Freon not senc.
180   gMC->Gspos("FLT2", 0, "FBT2", 0., 0., 0., 0, "ONLY");
181   par[2] = zm2 / 2.;
182   gMC->Gsvolu("FLT3", "BOX ", idtmed[512], par, 3); //Freon not senc.
183   gMC->Gspos("FLT3", 0, "FBT3", 0., 0., 0., 0, "ONLY");
184   // RPC box (small plate) number along X axis 
185   nxp = Int_t (xm / xsz);
186   // RPC box (small plate) number along Z axis 
187   nzp0 = Int_t (zm0 / zsz);
188   nzp1 = Int_t (zm1 / zsz);
189   nzp2 = Int_t (zm2 / zsz);
190   // (small) box (plate) for RPC size with insencitive Freon
191   par[0] = xm * .5 / nxp;
192   par[1] = yp; // two times thicker than RPC
193   par[2] = zm0 * .5 / nzp0;
194   gMC->Gsvolu("FLK0", "BOX ", idtmed[512], par, 3); //Freon not sencitive
195   // Position of (small) RPC boxes 
196   inum = 0;
197   for (ink = 1; ink <= nxp; ++ink) {
198     xcor = xm * .5 * ((ink * 2 - 1) / (Float_t) nxp -  1.);
199     for (inz = 1; inz <= nzp0; ++inz) {
200       zcor = zm0 * .5 * ((inz * 2 - 1) / (Float_t) nzp0 - 1.);
201       ++inum;
202       gMC->Gspos("FLK0", inum, "FLT1", xcor, 0., zcor, 0, "ONLY");
203     }
204     for (inz = 1; inz <= nzp1; ++inz) {
205       zcor = zm1 * .5 * ((inz * 2 - 1) / (Float_t) nzp1 - 1.);
206       ++inum;
207       gMC->Gspos("FLK0", inum, "FLT2", xcor, 0., zcor, 0, "ONLY");
208     }
209     for (inz = 1; inz <= nzp2; ++inz) {
210       zcor = zm2 * .5 * ((inz * 2 - 1) / (Float_t) nzp2 - 1.);
211       ++inum;
212       gMC->Gspos("FLK0", inum, "FLT3", xcor, 0., zcor, 0, "ONLY");
213     }
214   }
215   // Polyethilene boxes for RPC cell
216   npx = 19; //number of small pixels along X
217   npz = 16; //number of small pixels along Z
218   //  npx = 15; //large pixel
219   //  npz = 12; //large pixel
220   par[0] = xsz * .5 / npx;
221   par[1] = yp/2; 
222   par[2] = zsz * .5 / npz;
223   gMC->Gsvolu("FPP0", "BOX ", idtmed[503], par, 3); // Polyethilene
224   inum = 0;
225   for (ink = 1; ink <= npx; ++ink) {
226     xcor = xsz * .5 * ((ink * 2 - 1) / (Float_t) npx - 1.);
227     if (ink%2 != 0) ycor=yp/2; else ycor=-yp/2;
228     for (inz = 1; inz <= npz; ++inz) {
229       zcor = zsz * .5 * ((inz * 2 - 1) / (Float_t) npz - 1.);
230       ++inum;
231       gMC->Gspos("FPP0", inum, "FLK0", xcor, ycor, zcor, 0, "ONLY");
232       ycor=-ycor;
233     }
234   }
235   //Al RPC geometry 
236   par[0] = xp / 2.;
237   par[1] = yp / 2. - 0.1; //minus 1mm of poliethelene
238   par[2] = zp / 2.;
239   gMC->Gsvolu("FPA0", "BOX ", idtmed[508], par, 3);// Al
240   gMC->Gspos("FPA0", inum, "FPP0", 0., 0., 0., 0, "ONLY");
241   //Ceramic RPC geometry 
242   par[0] = xp / 2.;
243   par[1] = par[1] - 0.1; //minus 1mm of Al
244   par[2] = zp / 2.;
245   gMC->Gsvolu("FPC0", "BOX ", idtmed[507], par, 3);// Ceramic
246   gMC->Gspos("FPC0", inum, "FPA0", 0., 0., 0., 0, "ONLY");
247   // Freon gas sencitive volume
248   par[0] = xp / 2. - dx;
249   par[1] = yp / 2. - dy;
250   par[2] = zp / 2. - dz;
251   gMC->Gsvolu("FPG0", "BOX ", idtmed[513], par, 3);// Freon 
252   gMC->Gspos("FPG0", 0, "FPC0", 0., 0., 0., 0, "ONLY");
253 }
254
255 //_____________________________________________________________________________
256 void AliTOFv2::DrawModule()
257 {
258   //
259   // Draw a shaded view of the Time Of Flight version 2
260   //
261   // Set everything unseen
262   gMC->Gsatt("*", "seen", -1);
263   // 
264   // Set ALIC mother transparent
265   gMC->Gsatt("ALIC","SEEN",0);
266   //
267   // Set the volumes visible
268   gMC->Gsatt("ALIC","SEEN",0);
269   gMC->Gsatt("FBAR","SEEN",0);
270   gMC->Gsatt("FTO1","SEEN",0);
271   gMC->Gsatt("FTO2","SEEN",0);
272   gMC->Gsatt("FTO3","SEEN",0);
273   gMC->Gsatt("FBT1","SEEN",0);
274   gMC->Gsatt("FBT2","SEEN",0);
275   gMC->Gsatt("FBT3","SEEN",0);
276   gMC->Gsatt("FLT1","SEEN",0);
277   gMC->Gsatt("FLT2","SEEN",0);
278   gMC->Gsatt("FLT3","SEEN",0);
279   gMC->Gsatt("FLK0","SEEN",1);
280   //
281   gMC->Gdopt("hide", "on");
282   gMC->Gdopt("shad", "on");
283   gMC->Gsatt("*", "fill", 7);
284   gMC->SetClipBox(".");
285   gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
286   gMC->DefaultRange();
287   gMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
288   gMC->Gdhead(1111, "Time Of Flight");
289   gMC->Gdman(18, 4, "MAN");
290   gMC->Gdopt("hide","off");
291 }
292
293 //_____________________________________________________________________________
294 void AliTOFv2::CreateMaterials()
295 {
296   //
297   // Define materials for the Time Of Flight
298   //
299   AliTOF::CreateMaterials();
300 }
301  
302 //_____________________________________________________________________________
303 void AliTOFv2::Init()
304 {
305   //
306   // Initialise the detector after the geometry has been defined
307   //
308   AliTOF::Init();
309   fIdFTO2=gMC->VolId("FTO2");
310   fIdFTO3=gMC->VolId("FTO3");
311   fIdFLT1=gMC->VolId("FLT1");
312   fIdFLT2=gMC->VolId("FLT2");
313   fIdFLT3=gMC->VolId("FLT3");
314 }
315  
316 //_____________________________________________________________________________
317 void AliTOFv2::StepManager()
318 {
319   //
320   // Procedure called at each step in the Time Of Flight
321   //
322   TLorentzVector mom, pos;
323   Float_t hits[8];
324   Int_t vol[3];
325   Int_t copy, id, i;
326   Int_t *idtmed = fIdtmed->GetArray()-499;
327   if(gMC->GetMedium()==idtmed[514-1] && 
328      gMC->IsTrackEntering() && gMC->TrackCharge()
329      && gMC->CurrentVolID(copy)==fIdSens) {
330     TClonesArray &lhits = *fHits;
331     //
332     // Record only charged tracks at entrance
333     gMC->CurrentVolOffID(1,copy);
334     vol[2]=copy;
335     gMC->CurrentVolOffID(3,copy);
336     vol[1]=copy;
337     id=gMC->CurrentVolOffID(6,copy);
338     vol[0]=copy;
339     if(id==fIdFTO3) {
340       vol[0]+=22;
341       id=gMC->CurrentVolOffID(4,copy);
342       if(id==fIdFLT3) vol[1]+=4;
343     } else if (id==fIdFTO2) {
344       vol[0]+=20;
345       id=gMC->CurrentVolOffID(4,copy);
346       if(id==fIdFLT2) vol[1]+=8;
347     } else {
348       id=gMC->CurrentVolOffID(4,copy);
349       if(id==fIdFLT1) vol[1]+=14;
350     }
351     gMC->TrackPosition(pos);
352     gMC->TrackMomentum(mom);
353     //
354     Double_t ptot=mom.Rho();
355     Double_t norm=1/ptot;
356     for(i=0;i<3;++i) {
357       hits[i]=pos[i];
358       hits[i+3]=mom[i]*norm;
359     }
360     hits[6]=ptot;
361     hits[7]=pos[3];
362     new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
363   }
364 }