Addition of CPV library as a separate detector from PHOS
[u/mrichter/AliRoot.git] / FMD / AliFMDv0.cxx
1 ///////////////////////////////////////////////////////////////////////////////
2 //                                                                           //
3 //  Forward Multiplicity Detector version 0                                  //
4 //                                                                           //
5 //Begin_Html
6 /*
7 <img src="picts/AliFMDv0Class.gif">
8 </pre>
9 <br clear=left>
10 <font size=+2 color=red>
11 <p>The responsible person for this module is
12 <a href="mailto:Valeri.Kondratiev@cern.ch">Valeri Kondratiev</a>.
13 </font>
14 <pre>
15 */
16 //End_Html
17 //                                                                           //
18 ///////////////////////////////////////////////////////////////////////////////
19
20 #include "AliRun.h"
21 #include "AliFMDv0.h"
22 #include "AliMC.h"
23 #include "stdlib.h"
24  
25 ClassImp(AliFMDv0)
26  
27 //_____________________________________________________________________________
28 AliFMDv0::AliFMDv0()
29 {
30   //
31   // Default constructor for FMD version 0
32   //
33 }
34  
35 //_____________________________________________________________________________
36 AliFMDv0::AliFMDv0(const char *name, const char *title)
37   : AliFMD(name,title)
38 {
39   //
40   // Standard constructor for FMD version 0
41   //
42   AliModule *start = gAlice->GetModule("START");
43   if(start) {
44     Error("ctor","This version of FMD is incompatible with START\n");
45     exit(1);
46   }
47 }
48  
49 //___________________________________________
50 void AliFMDv0::CreateGeometry()
51 {
52   //
53   // Creation of the geometry of the FMD version 0
54   //
55   //Begin_Html
56   /*
57     <img src="picts/AliFMDv0Tree.gif">
58   */
59   //End_Html
60   //Begin_Html
61   /*
62     <img src="picts/AliFMDv0.gif">
63   */
64   //End_Html
65
66   
67   Float_t rout, z;
68   Float_t par[3], rin;
69   
70   Int_t *idtmed = fIdtmed->GetArray()-899;    
71   
72   // ******************************************************** 
73   //       DEFINE RIGHT DISK#3  OF FMD 
74   // ******************************************************** 
75   
76   //       Define parameters 
77   
78   rin  = 4.5;
79   rout = 10.5;
80   z    = 85.;
81   //       Ring #1 
82   par[0] = rin;
83   par[1] = rout;
84   par[2] = 1.5;
85   gMC->Gsvolu("R1R3", "TUBE", idtmed[900], par, 3);
86   gMC->Gspos("R1R3", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
87   //       Ring #2 
88   par[0] = rout;
89   par[1] = rout + .65;
90   par[2] = 1.5;
91   gMC->Gsvolu("R2R3", "TUBE", idtmed[901], par, 3);
92   gMC->Gspos("R2R3", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
93   //       Ring #3 
94   par[0] = rout + .65;
95   par[1] = rout + 5.65;
96   par[2] = .025;
97   gMC->Gsvolu("R3R3", "TUBE", idtmed[902], par, 3);
98   gMC->Gspos("R3R3", 1, "ALIC", 0., 0., z + 1.525, 0, "ONLY");
99   // *********************************************************** 
100   //       DEFINE LEFT DISK#3 OF FMD 
101   // *********************************************************** 
102   
103   //       Define parameters 
104   
105   rin  = 4.5;
106   rout = 10.5;
107   z    = -85.;
108   //       Ring #1 
109   par[0] = rin;
110   par[1] = rout;
111   par[2] = 1.5;
112   gMC->Gsvolu("R1L3", "TUBE", idtmed[900], par, 3);
113   gMC->Gspos("R1L3", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
114   //       Ring #2 
115   par[0] = rout;
116   par[1] = rout + .65;
117   par[2] = 1.5;
118   gMC->Gsvolu("R2L3", "TUBE", idtmed[901], par, 3);
119   gMC->Gspos("R2L3", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
120   //       Ring #3 
121   par[0] = rout + .65;
122   par[1] = rout + 5.65;
123   par[2] = .025;
124   gMC->Gsvolu("R3L3", "TUBE", idtmed[902], par, 3);
125   gMC->Gspos("R3L3", 1, "ALIC", 0., 0., z - 1.525, 0, "ONLY");
126   // ******************************************************** 
127   //       DEFINE RIGHT DISK#2  OF FMD 
128   // ******************************************************** 
129   
130   //       Define parameters 
131   
132   rin  = 8.;
133   rout = 14.;
134   z    = 69.7;
135   //       Ring #1 
136   par[0] = rin;
137   par[1] = rout;
138   par[2] = 1.5;
139   gMC->Gsvolu("R1R2", "TUBE", idtmed[900], par, 3);
140   gMC->Gspos("R1R2", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
141   //       Ring #2 
142   par[0] = rout;
143   par[1] = rout + .65;
144   par[2] = 1.5;
145   gMC->Gsvolu("R2R2", "TUBE", idtmed[901], par, 3);
146   gMC->Gspos("R2R2", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
147   //       Ring #3 
148   par[0] = rout + .65;
149   par[1] = rout + 5.65;
150   par[2] = .025;
151   gMC->Gsvolu("R3R2", "TUBE", idtmed[902], par, 3);
152   gMC->Gspos("R3R2", 1, "ALIC", 0., 0., z + 1.525, 0, "ONLY");
153   // *********************************************************** 
154   //       DEFINE LEFT DISK#2 OF FMD 
155   // *********************************************************** 
156   
157   //       Define parameters 
158   
159   rin  = 8.;
160   rout = 14.;
161   z    = -69.7;
162   //       Ring #1 
163   par[0] = rin;
164   par[1] = rout;
165   par[2] = 1.5;
166   gMC->Gsvolu("R1L2", "TUBE", idtmed[900], par, 3);
167   gMC->Gspos("R1L2", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
168   //       Ring #2 
169   par[0] = rout;
170   par[1] = rout + .65;
171   par[2] = 1.5;
172   gMC->Gsvolu("R2L2", "TUBE", idtmed[901], par, 3);
173   gMC->Gspos("R2L2", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
174   //       Ring #3 
175   par[0] = rout + .65;
176   par[1] = rout + 5.65;
177   par[2] = .025;
178   gMC->Gsvolu("R3L2", "TUBE", idtmed[902], par, 3);
179   gMC->Gspos("R3L2", 1, "ALIC", 0., 0., z - 1.525, 0, "ONLY");
180   // ******************************************************** 
181   //       DEFINE RIGHT DISK#1  OF FMD 
182   // ******************************************************** 
183   
184   //       Define parameters 
185   
186   rin  = 8.;
187   rout = 17.5;
188   z    = 42.5;
189   //       Ring #1 
190   par[0] = rin;
191   par[1] = rout;
192   par[2] = 1.5;
193   gMC->Gsvolu("R1R1", "TUBE", idtmed[900], par, 3);
194   gMC->Gspos("R1R1", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
195   //       Ring #2 
196   par[0] = rout;
197   par[1] = rout + .65;
198   par[2] = 1.5;
199   gMC->Gsvolu("R2R1", "TUBE", idtmed[901], par, 3);
200   gMC->Gspos("R2R1", 1, "ALIC", 0., 0., z + 1.5, 0, "ONLY");
201   //       Ring #3 
202   par[0] = rout + .65;
203   par[1] = rout + 5.65;
204   par[2] = .025;
205   gMC->Gsvolu("R3R1", "TUBE", idtmed[902], par, 3);
206   gMC->Gspos("R3R1", 1, "ALIC", 0., 0., z + 1.525, 0, "ONLY");
207   // *********************************************************** 
208   //       DEFINE LEFT DISK#1 OF FMD 
209   // *********************************************************** 
210   
211   //       Define parameters 
212   
213   rin  = 8.;
214   rout = 17.5;
215   z    = -42.5;
216   //       Ring #1 
217   par[0] = rin;
218   par[1] = rout;
219   par[2] = 1.5;
220   gMC->Gsvolu("R1L1", "TUBE", idtmed[900], par, 3);
221   gMC->Gspos("R1L1", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
222   //       Ring #2 
223   par[0] = rout;
224   par[1] = rout + .65;
225   par[2] = 1.5;
226   gMC->Gsvolu("R2L1", "TUBE", idtmed[901], par, 3);
227   gMC->Gspos("R2L1", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
228   //       Ring #3 
229   par[0] = rout + .65;
230   par[1] = rout + 5.65;
231   par[2] = .025;
232   gMC->Gsvolu("R3L1", "TUBE", idtmed[902], par, 3);
233   gMC->Gspos("R3L1", 1, "ALIC", 0., 0., z - 1.525, 0, "ONLY");
234   // *********************************************************** 
235   //       DEFINE LEFT DISK#4 OF FMD 
236   // *********************************************************** 
237
238   //       Define parameters 
239
240   rin  = 4.2;
241   rout = 13.;
242   z    = -229.5;
243   //       Ring #1 
244   par[0] = rin;
245   par[1] = rout;
246   par[2] = 1.5;
247   gMC->Gsvolu("R1L4", "TUBE", idtmed[900], par, 3);
248   gMC->Gspos("R1L4", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
249   //       Ring #2 
250   par[0] = rout;
251   par[1] = rout + .65;
252   par[2] = 1.5;
253   gMC->Gsvolu("R2L4", "TUBE", idtmed[901], par, 3);
254   gMC->Gspos("R2L4", 1, "ALIC", 0., 0., z - 1.5, 0, "ONLY");
255   //       Ring #3 
256   par[0] = rout + .65;
257   par[1] = rout + 5.65;
258   par[2] = .025;
259   gMC->Gsvolu("R3L4", "TUBE", idtmed[902], par, 3);
260   gMC->Gspos("R3L4", 1, "ALIC", 0., 0., z - 1.525, 0, "ONLY");
261 }
262
263 //_____________________________________________________________________________
264 void AliFMDv0::DrawModule()
265 {
266   //
267   // Draw a shaded view of the FMD version 0
268   //
269
270   // Set everything unseen
271   gMC->Gsatt("*", "seen", -1);
272   // 
273   // Set ALIC mother transparent
274   gMC->Gsatt("ALIC","SEEN",0);
275   //
276   // Set the volumes visible
277   gMC->Gsatt("R1R3","SEEN",1);
278   gMC->Gsatt("R2R3","SEEN",1);
279   gMC->Gsatt("R3R3","SEEN",1);
280   gMC->Gsatt("R1L3","SEEN",1);
281   gMC->Gsatt("R2L3","SEEN",1);
282   gMC->Gsatt("R3L3","SEEN",1);
283   gMC->Gsatt("R1R2","SEEN",1);
284   gMC->Gsatt("R2R2","SEEN",1);
285   gMC->Gsatt("R3R2","SEEN",1);
286   gMC->Gsatt("R1L2","SEEN",1);
287   gMC->Gsatt("R2L2","SEEN",1);
288   gMC->Gsatt("R3L2","SEEN",1);
289   gMC->Gsatt("R1R1","SEEN",1);
290   gMC->Gsatt("R2R1","SEEN",1);
291   gMC->Gsatt("R3R1","SEEN",1);
292   gMC->Gsatt("R1L1","SEEN",1);
293   gMC->Gsatt("R2L1","SEEN",1);
294   gMC->Gsatt("R3L1","SEEN",1);
295   gMC->Gsatt("R1L4","SEEN",1);
296   gMC->Gsatt("R2L4","SEEN",1);
297   gMC->Gsatt("R3L4","SEEN",1);
298   //
299   gMC->Gdopt("hide", "on");
300   gMC->Gdopt("shad", "on");
301   gMC->Gsatt("*", "fill", 7);
302   gMC->SetClipBox(".");
303   gMC->SetClipBox("*", 0, 1000, -1000, 1000, -1000, 1000);
304   gMC->DefaultRange();
305   gMC->Gdraw("alic", 40, 30, 0, 6, 9, .08, .08);
306   gMC->Gdhead(1111, "Forward Multiplicity Detector version 0");
307   gMC->Gdman(13, 9, "MAN");
308 }
309
310 //_____________________________________________________________________________
311 void AliFMDv0::CreateMaterials()
312 {
313   //
314   // Create Materials for version 0 of FMD
315   //
316
317   //     Material for ring #1 
318   Float_t ar1[8] = { 55.8,58.7,52.,47.9,16.,28.,207.2,27. };
319   Float_t zr1[8] = { 26.,28.,24.,22.,8.,14.,82.,13. };
320   Float_t wr1[8] = { .27,.081,.054,.045,.18,.25,.06,.06 };
321   //     Material for ring #2 
322   Float_t ar2[3] = { 55.8,27.,16. };
323   Float_t zr2[3] = { 26.,13.,8. };
324   Float_t wr2[3] = { .35,.34,.31 };
325   //     Material for ring #3 
326   Float_t ar3[3] = { 28.,27.,16. };
327   Float_t zr3[3] = { 14.,13.,8. };
328   Float_t wr3[3] = { .37,.33,.3 };
329   
330   Float_t epsil, stmin, deemax, tmaxfd, stemax;
331   
332   Int_t   ISXFLD = gAlice->Field()->Integ();
333   Float_t SXMGMX = gAlice->Field()->Max();
334   
335   //     Ring #1 
336   
337   AliMixture(1, "FMD_R1$", ar1, zr1, 2.69, 8, wr1);
338   
339   //     Ring #2 
340   
341   AliMixture(2, "FMD_R2$", ar2, zr2, 2.63, 3, wr2);
342   
343   //     Ring #3 
344   
345   AliMixture(3, "FMD_R3$", ar3, zr3, 3.15, 3, wr3);
346   // ******************************************************* 
347   //     Defines tracking media parameters. 
348   // ******************************************************* 
349   epsil  = .001; // Tracking precision, DLS 
350   stemax = -1.;  // Maximum displacement for multiple scattering 
351   tmaxfd = -20.; // Maximum angle due to field deflection 
352   deemax = -.3;  // Maximum fractional energy loss, DLS 
353   stmin  = -.8;
354   // ******************************************************** 
355   AliMedium(1, "FMD_R1_L3        ", 1, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
356   AliMedium(2, "FMD_R2_L3        ", 2, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
357   AliMedium(3, "FMD_R3_L3        ", 3, 0, ISXFLD, SXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
358 }
359
360
361