Modifications of the TOF to make the inner radius 370 cm. This has still
[u/mrichter/AliRoot.git] / TOF / AliTOFv1.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Time Of Flight                                                           //
4 //  This class contains the functions for version 1 of the Time Of Flight    //
5 //  detector.                                                                //
6 //                                                                           //
7 //Begin_Html
8 /*
9 <img src="gif/AliTOFv1Class.gif">
10 */
11 //End_Html
12 //                                                                           //
13 ///////////////////////////////////////////////////////////////////////////////
14
15 #include "AliTOFv1.h"
16 #include "AliRun.h"
17 #include "AliConst.h"
18  
19 ClassImp(AliTOFv1)
20  
21 //_____________________________________________________________________________
22 AliTOFv1::AliTOFv1()
23 {
24   //
25   // Default constructor
26   //
27 }
28  
29 //_____________________________________________________________________________
30 AliTOFv1::AliTOFv1(const char *name, const char *title)
31        : AliTOF(name,title)
32 {
33   //
34   // Standard constructor for version 1 of Time Of Flight
35   //
36 }
37  
38 //_____________________________________________________________________________
39 void AliTOFv1::CreateGeometry()
40 {
41   //
42   // Create geometry for version 1 of Time Of Flight
43   // Authors :   Maxim Martemianov, Boris Zagreev (ITEP)   18/09/98 
44   //Begin_Html
45   /*
46     <img src="gif/AliTOFv1.gif">
47   */
48   //End_Html
49   //
50
51   AliMC* pMC = AliMC::GetMC();
52   
53   Float_t fil_rich;
54   Int_t lmax;
55   Float_t phos_phi, zcor2, zcor3, ztof0, ztof1, ztof2;
56   Float_t zl, phos_r, zazor;
57   Int_t idrotm[101];
58   Float_t phos_x;
59   Float_t rp1, rp2;
60   Float_t par[10], fil_min, fil_max, ysz, fil0;
61   //
62   Int_t *idtmed = gAlice->Idtmed();
63   //
64   // barrel size along Z axis 
65   //
66   // Temporary fix TOF people should really check this!!
67   //  rp1 = 360.;
68   // rp2 = 372.;
69   rp1 = 370;
70   rp2 = rp1 + 12;
71   zl  = 720.;
72   //
73   // TOF width along radius of barrel 
74   //xtof  = rp2 - rp1;
75   ztof0 = 350.;
76   ztof1 = 200.;
77   ztof2 = 150.;
78   //
79   // Plate width 
80   ysz = .3;
81   //
82   // DME barrel width
83   zazor = 0.03;
84   //
85   // PHOS and RICH angles 
86   phos_x = 214.6;
87   phos_r = 467.;
88   //phos_z = 260.;
89   //rich_z = 472.5;
90   fil_rich = 30.;
91   lmax = 19;
92   zcor2 = ztof0 - ztof1 / 2.;
93   zcor3 = ztof0 - ztof2 / 2.;
94   phos_phi = TMath::ATan(phos_x / (phos_r * 2.));
95   fil_min = (kPI - phos_phi * 4.) * kRaddeg - 180. / lmax;
96   fil_max = (phos_phi * 4. + kPI) * kRaddeg + 180. / lmax;
97   //
98   // barrel radius in ALIC 
99   par[0] = rp1;
100   par[1] = rp2;
101   par[2] = zl / 2.;
102   pMC->Gsvolu("FBAR", "TUBE", idtmed[500], par, 3);
103   pMC->Gspos("FBAR", 1, "ALIC", 0., 0., 0., 0, "ONLY");
104   pMC->Gsatt("FBAR", "SEEN", 0);
105   //
106   // --- First Block
107   par[0] = (rp1+rp2-zazor)/2.;
108   par[1] = (rp1+rp2+zazor)/2.;
109   par[2] = ztof0;
110   par[3] = 90. - fil_min;
111   par[4] = 90. - fil_rich;
112   fil0 = 180. - (par[3] + par[4]);
113   //
114   // --- Sensitive volume 
115   pMC->Gsvolu("FBT1", "TUBS", idtmed[509], par, 5);
116   AliMatrix(idrotm[1], 90., fil0, 90., fil0 + 90., 0., 0.);
117   pMC->Gspos("FBT1", 0, "FBAR", 0., 0., 0., 0, "ONLY");
118   pMC->Gspos("FBT1", 1, "FBAR", 0., 0., 0., idrotm[1], "ONLY");
119   //
120   // ALUMINA
121   par[0] = (rp1+rp2+zazor)/2.;
122   par[1] = (rp1+rp2+zazor)/2.+ysz;
123   pMC->Gsvolu("FPE1","TUBS",idtmed[507], par, 0);
124   pMC->Gsposp("FPE1",2,"FBAR", 0., 0., 0., 0,         "ONLY", par, 5);
125   pMC->Gsposp("FPE1",3,"FBAR", 0., 0., 0., idrotm[1], "ONLY", par, 5);
126   //
127   par[0] = (rp1+rp2-zazor)/2.-ysz;
128   par[1] = (rp1+rp2-zazor)/2.;
129   pMC->Gsposp("FPE1",4,"FBAR", 0., 0., 0., 0,         "ONLY", par, 5);
130   pMC->Gsposp("FPE1",5,"FBAR", 0., 0., 0., idrotm[1], "ONLY", par, 5);
131   // --- Second block 
132   par[0] = (rp1+rp2-zazor)/2.;
133   par[1] = (rp1+rp2+zazor)/2.;
134   par[2] = ztof1 / 2.;
135   par[3] = 90. - fil_max;
136   par[4] = 90. - fil_min;
137   pMC->Gsvolu("FBT2", "TUBS", idtmed[509], par, 5);
138   pMC->Gspos("FBT2", 0, "FBAR", 0., 0., zcor2, 0, "ONLY");
139   pMC->Gspos("FBT2", 1, "FBAR", 0., 0., -zcor2, 0, "ONLY");
140   //
141   par[0]=(rp1+rp2+zazor)/2.;
142   par[1]=(rp1+rp2+zazor)/2.+ysz;
143   pMC->Gsvolu("FPE2","TUBS",idtmed[507], par, 0);
144   pMC->Gsposp("FPE2",2,"FBAR",0.,0.,zcor2,0,"ONLY",par,5);
145   pMC->Gsposp("FPE2",3,"FBAR",0.,0.,-zcor2,0,"ONLY",par,5);
146   //
147   par[0]=(rp1+rp2-zazor)/2.-ysz;
148   par[1]=(rp1+rp2-zazor)/2.;
149   pMC->Gsposp("FPE2",4,"FBAR",0.,0.,zcor2,0,"ONLY",par,5);
150   pMC->Gsposp("FPE2",5,"FBAR",0.,0.,-zcor2,0,"ONLY",par,5);
151   //
152   // --- Third block 
153   par[0] = (rp1+rp2-zazor)/2.;
154   par[1] = (rp1+rp2-zazor)/2.;
155   par[2] = ztof2 / 2.;
156   par[3] = 90. - fil_rich;
157   par[4] = fil_rich + 90.;
158   pMC->Gsvolu("FBT3", "TUBS", idtmed[509], par, 5);
159   pMC->Gspos("FBT3", 0, "FBAR", 0., 0., zcor3, 0, "ONLY");
160   pMC->Gspos("FBT3", 1, "FBAR", 0., 0., -zcor3, 0, "ONLY");
161   //
162   par[0]=(rp1+rp2+zazor)/2.;
163   par[1]=(rp1+rp2+zazor)/2.+ysz;
164   pMC->Gsvolu("FPE3","TUBS",idtmed[507], par, 0);
165   pMC->Gsposp("FPE3",2,"FBAR",0.,0.,zcor3,0,"ONLY",par,5);
166   pMC->Gsposp("FPE3",3,"FBAR",0.,0.,-zcor3,0,"ONLY",par,5);
167   //
168   par[0]=(rp1+rp2-zazor)/2.-ysz;
169   par[1]=(rp1+rp2-zazor)/2.;
170   pMC->Gsposp("FPE3",4,"FBAR",0.,0.,zcor3,0,"ONLY",par,5);
171   pMC->Gsposp("FPE3",5,"FBAR",0.,0.,-zcor3,0,"ONLY",par,5);
172   //
173 }
174  
175 //_____________________________________________________________________________
176 void AliTOFv1::DrawModule()
177 {
178   //
179   // Draw a shaded view of the Time Of Flight version 1
180   //
181
182   AliMC* pMC = AliMC::GetMC();
183   
184   // Set everything unseen
185   pMC->Gsatt("*", "seen", -1);
186   // 
187   // Set ALIC mother transparent
188   pMC->Gsatt("ALIC","SEEN",0);
189   //
190   // Set the volumes visible
191   pMC->Gsatt("FBAR","SEEN",0);
192   pMC->Gsatt("FPE1","SEEN",1);
193   pMC->Gsatt("FPE2","SEEN",1);
194   pMC->Gsatt("FPE3","SEEN",1);
195   //
196   pMC->Gdopt("hide", "on");
197   pMC->Gdopt("shad", "on");
198   pMC->Gsatt("*", "fill", 7);
199   pMC->SetClipBox(".");
200   pMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
201   pMC->DefaultRange();
202   pMC->Gdraw("alic", 40, 30, 0, 12, 9.5, .02, .02);
203   pMC->Gdhead(1111, "Time Of Flight");
204   pMC->Gdman(18, 4, "MAN");
205   pMC->Gdopt("hide","off");
206 }
207
208 //___________________________________________
209 void AliTOFv1::CreateMaterials()
210 {
211   //
212   // Define materials for Time Of Flight
213   //
214   AliTOF::CreateMaterials();
215 }
216  
217 //______________________________________________________________________________
218 void AliTOFv1::Init()
219 {
220   //
221   // Initialise Time Of Flight after it has been built
222
223   AliMC* pMC = AliMC::GetMC();
224   
225   AliTOF::Init();
226   fIdFBT2=pMC->VolId("FBT2");
227   fIdFBT3=pMC->VolId("FBT3");
228 }
229  
230 //______________________________________________________________________________
231 void AliTOFv1::StepManager()
232 {
233   Float_t hits[8];
234   Int_t vol[3];
235   Int_t copy, id;
236   AliMC *pMC= AliMC::GetMC();
237   Int_t *idtmed = gAlice->Idtmed();
238   if(pMC->GetMedium()==idtmed[510-1] && 
239      pMC->TrackEntering() && pMC->TrackCharge()
240      && (id=pMC->CurrentVol(0,copy))==fIdSens) {
241     TClonesArray &lhits = *fHits;
242 //
243 // Record only charged tracks at entrance
244     vol[2]=copy;
245     vol[1]=pMC->CurrentVolOff(1,0,copy);
246     if(id==fIdFBT2) copy+=2; else 
247       if(id==fIdFBT2) copy+=4;
248     vol[0]=1;
249     pMC->TrackPosition(hits);
250     pMC->TrackMomentum(&hits[3]);
251     hits[7]=pMC->TrackTime();
252     new(lhits[fNhits++]) AliTOFhit(fIshunt,gAlice->CurrentTrack(),vol,hits);
253   }
254 }
255