]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/AliZDC.cxx
Introduction of the reference to Copyright and cvs Id
[u/mrichter/AliRoot.git] / ZDC / AliZDC.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 */
19
20 ///////////////////////////////////////////////////////////////////////////////
21 //                                                                           //
22 //  Zero Degree Calorimeter                                                  //
23 //  This class contains the basic functions for the Time Of Flight           //
24 //  detector. Functions specific to one particular geometry are              //
25 //  contained in the derived classes                                         //
26 //                                                                           //
27 //Begin_Html
28 /*
29 <img src="picts/AliZDCClass.gif">
30 </pre>
31 <br clear=left>
32 <font size=+2 color=red>
33 <p>The responsible person for this module is
34 <a href="mailto:Eugenio.Scomparin@cern.ch">Eugenio Scomparin</a>.
35 </font>
36 <pre>
37 */
38 //End_Html
39 //                                                                           //
40 //                                                                           //
41 ///////////////////////////////////////////////////////////////////////////////
42
43 #include <TBRIK.h>
44 #include <TNode.h>
45
46 #include "AliZDC.h"
47 #include "AliRun.h"
48 #include "AliCallf77.h"
49 #include "AliConst.h"
50 #include "AliMC.h"
51
52 #ifndef WIN32
53 # define zdc_init       zdc_init_
54 # define zdc_step       zdc_step_
55 # define zdc_setbeam    zdc_setbeam_
56 # define zdc_sethijing  zdc_sethijing_
57 # define zdc_setvenus   zdc_setvenus_
58 # define zdc_setkine    zdc_setkine_
59 #else
60 # define zdc_step       ZDC_STEP
61 # define zdc_setbeam    ZDC_SETBEAM
62 # define zdc_sethijing  ZDC_SETHIJING
63 # define zdc_setvenus   ZDC_SETVENUS
64 # define zdc_setkine    ZDC_SETKINE
65 #endif
66
67 extern "C" void type_of_call zdc_init();
68 extern "C" void type_of_call zdc_step();
69 extern "C" void type_of_call zdc_setbeam(Int_t beam, Float_t fx, Float_t fy,
70                                          Float_t sx, Float_t sy, Float_t div,
71                                          Float_t angle, Int_t cross);
72 extern "C" void type_of_call zdc_sethijing(Int_t hij, Int_t hijf, Int_t hijsp,
73                                            DEFCHARD DEFCHARL);
74 extern "C" void type_of_call zdc_setvenus(Int_t hiv, Int_t hivf, Int_t hivsp,
75                                           DEFCHARD DEFCHARL);
76 extern "C" void type_of_call zdc_setkine(Int_t code, Float_t pmom, Float_t cx,
77                                          Float_t cy, Float_t cz, Int_t type,
78                                          Int_t fermi);
79  
80 ClassImp(AliZDC)
81  
82 //_____________________________________________________________________________
83 AliZDC::AliZDC()
84 {
85   //
86   // Default constructor for the Zero Degree Calorimeter base class
87   //
88   fIshunt   = 0;
89 }
90  
91 //_____________________________________________________________________________
92 AliZDC::AliZDC(const char *name, const char *title)
93   : AliDetector(name,title)
94 {
95   //
96   // Standard constructor for the Zero Degree Calorimeter base class
97   //
98
99   //
100   // Allocate the array of hits
101   fHits   = new TClonesArray("AliZDChit",  405);
102   
103   fIshunt     =  1;
104 }
105  
106 //_____________________________________________________________________________
107 void AliZDC::AddHit(Int_t track, Int_t *vol, Float_t *hits)
108 {
109   //
110   // Add a Zero Degree Calorimeter hit
111   //
112   TClonesArray &lhits = *fHits;
113   new(lhits[fNhits++]) AliZDChit(fIshunt,track,vol,hits);
114 }
115  
116 //_____________________________________________________________________________
117 void AliZDC::BuildGeometry()
118 {
119   //
120   // Build the ROOT TNode geometry for event display 
121   // in the Zero Degree Calorimeter
122   // This routine is dummy for the moment
123   //
124
125   //  TNode *Node, *Top;
126   //  TBRIK *brik;
127   //  const int kColorZDC  = kRed;
128   
129   //
130   // Top=gAlice->GetGeometry()->GetNode("alice");
131   
132   // ZDC
133   /*
134     brik = new TBRIK("S_ZDC","ZDC box","void",300,300,5);
135     Top->cd();
136     Node = new TNode("ZDC","ZDC","S_ZDC",0,0,600,"");
137     Node->SetLineColor(kColorZDC);
138     fNodes->Add(Node);
139   */
140 }
141
142 //_____________________________________________________________________________
143 Int_t AliZDC::DistancetoPrimitive(Int_t , Int_t )
144 {
145   //
146   // Distance from the mouse to the Zero Degree Calorimeter
147   // Dummy routine
148   //
149   return 9999;
150 }
151  
152 //_____________________________________________________________________________
153 void AliZDC::SetBeam(Int_t beam, Float_t fx, Float_t fy, Float_t sx,
154                      Float_t sy, Float_t div, Float_t angle, Int_t cross)
155 {
156   //
157   // Set beam characteristic
158   // This routine has to be revised as it is disconnected from the
159   // actual generation in this version of AliRoot
160   //
161
162   // beam  : 1 = gaussian beam
163   //       : 2 = uniform beam
164   // fx    : x-coordinate of beam offset
165   // fy    : y-coordinate of beam offset
166   // sx    : sigma-x of the beam (gaussian or uniform)
167   // sy    : sigma-y of the beam (gaussian or uniform)
168   // div   : divergency of the beam (32*10**-6 rad for LHC)
169   // angle : beam crossing angle (100*10**-6 rad for LHC)
170   // cross : 1 = horizontal beam crossing
171   //       : 2 = vertical beam crossing
172   zdc_setbeam(beam,fx,fy,sx,sy,div,angle,cross);
173 }
174
175 //_____________________________________________________________________________
176 void AliZDC::SetHijing(Int_t hij, Int_t hijf, Int_t hijsp, const char *file)
177 {
178   //
179   // Set the parameter for the HIJING generation
180   // This routine has to be revised as it is disconnected from the
181   // actual generation in this version of AliRoot
182   //
183
184   // HIJ  : 1 = read HIJING event file
185   //      : 2 =  "     "      "    "    + debug
186   // HIJF : event number of the first event to be read from file
187   // HIJSP: 0 = read all particles
188   //      : 1 = remove spectator nucleons
189   zdc_sethijing(hij,hijf,hijsp, PASSCHARD(file) PASSCHARL(file));
190 }
191
192 //_____________________________________________________________________________
193 void AliZDC::SetVenus(Int_t hiv, Int_t hivf, Int_t hivsp, const char *file)
194 {
195   //
196   // Set the parameter for the VENUS generation
197   // This routine has to be revised as it is disconnected from the
198   // actual generation in this version of AliRoot
199   //
200
201   // HIV  : 1 = read VENUS event file
202   //      : 2 =  "     "      "    "    + debug
203   // HIVF : event number of the first event to be read from file
204   // HIVSP: 0 = read all particles
205   //      : 1 = remove spectator nucleons
206   zdc_setvenus(hiv,hivf,hivsp, PASSCHARD(file) PASSCHARL(file));
207 }
208
209 //_____________________________________________________________________________
210 void AliZDC::SetKine(Int_t code, Float_t pmom, Float_t cx, Float_t cy,
211                      Float_t cz, Int_t type, Int_t fermi)
212 {
213   //
214   // Set the parameter for the event generation
215   // This routine has to be revised as it is disconnected from the
216   // actual generation in this version of AliRoot
217   //
218
219   // code     : GEANT code of the test particle
220   // pmom     : absolute value of particle momentum
221   // cx,cy,cz : director cosines of the track (if type)
222   // type     :  0 = take director cosines from cx,cy,cz
223   //          : <>0 = pseudorapidity of the test particle
224   // fermi    : 0 = no Fermi motion for the spectator nucleons
225   //          : 1 = Fermi motion for the spectator nucleons
226   zdc_setkine(code,pmom,cx,cy,cz,type,fermi);
227 }
228  
229 //_____________________________________________________________________________
230 void AliZDC::StepManager()
231 {
232   //
233   // Routine called at every step in the Zero Degree Calorimeter
234   // This is a simple interface to the FORTRAN routine
235   // A step manager should be written
236   //
237   zdc_step();
238 }
239
240  
241 ClassImp(AliZDCv1)
242  
243
244 ///////////////////////////////////////////////////////////////////////////////
245 //                                                                           //
246 //  Zero Degree Calorimeter version 1                                        //
247 //                                                                           //
248 //Begin_Html
249 /*
250 <img src="picts/AliZDCv1Class.gif">
251 */
252 //End_Html
253 //                                                                           //
254 //                                                                           //
255 ///////////////////////////////////////////////////////////////////////////////
256
257 //_____________________________________________________________________________
258 AliZDCv1::AliZDCv1() : AliZDC()
259 {
260   //
261   // Default constructor for Zero Degree Calorimeter
262   //
263 }
264  
265 //_____________________________________________________________________________
266 AliZDCv1::AliZDCv1(const char *name, const char *title)
267   : AliZDC(name,title)
268 {
269   //
270   // Standard constructor for Zero Degree Calorimeter 
271   //
272 }
273  
274 //_____________________________________________________________________________
275 void AliZDCv1::CreateGeometry()
276 {
277   //
278   // Create the geometry for the Zero Degree Calorimeter version 1
279   // -- Author :    E Scomparin
280   //
281   //Begin_Html
282   /*
283     <img src="picts/AliZDCv1.gif">
284   */
285   //End_Html
286   //Begin_Html
287   /*
288     <img src="picts/AliZDCv1Tree.gif">
289   */
290   //End_Html
291
292   // The following variables were illegaly initialized in zdc_init.
293   // These variables should become data members of this class
294   // once zdc_init has been converted
295   //* Initialize COMMON block ZDC_CGEOM
296   //*
297   
298   const Int_t NZPTX=4;
299   const Int_t NZPTY=1;
300   const Int_t NZNTX=2;
301   const Int_t NZNTY=2;
302   
303   Float_t HDZN[3]  = {4.0,4.0,50.0};
304   Float_t HDZP[3]  = {10.0,6.0,75.0};
305   // Coordinates of the center of the ZDC front face in the MRS
306   Float_t ZNPOS[3] = {-0.5,0.,11613.};
307   Float_t ZPPOS[3] = {-21.0,0.,11563.};
308   Float_t FIZN[3]  = {0.,0.01825,50.0};
309   Float_t FIZP[3]  = {0.,0.01825,75.0};
310   Float_t GRZN[3]  = {0.025,0.025,50.0};
311   Float_t GRZP[3]  = {0.040,0.040,75.0};
312   Int_t NCEN[3]    = {11,11,0};
313   Int_t NCEP[3]    = {10,10,0};
314   
315   Float_t angle;
316   Float_t zq, conpar[9], tubpar[3];
317   Int_t im1, im2;
318   Float_t zd1, zd2;
319   
320   
321   Int_t *idtmed = fIdtmed->GetArray()-799;
322   
323   // -- Mother of the ZDC 
324   conpar[0] = 0.;
325   conpar[1] = 360.;
326   conpar[2] = 2.;
327   conpar[3] = 1920.;
328   conpar[4] = 0.;
329   conpar[5] = 55.;
330   conpar[6] = 13060.;
331   conpar[7] = 0.;
332   conpar[8] = 55.;
333   gMC->Gsvolu("ZDC ", "PCON", idtmed[891], conpar, 9);
334   gMC->Gspos("ZDC ", 1, "ALIC", 0., 0., 0., 0, "ONLY");
335   // -- FIRST SECTION OF THE BEAM PIPE (from compensator dipole to 
336   //    beginning of D1) 
337   
338   zd1 = 1920.;
339   
340   tubpar[0] = 2.3;
341   tubpar[1] = 2.5;
342   tubpar[2] = 1961.75;
343   gMC->Gsvolu("P001", "TUBE", idtmed[851], tubpar, 3);
344   gMC->Gspos("P001", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
345   
346   //-- SECOND SECTION OF THE BEAM PIPE (FROM THE END OF D1 TO THE BEGINNING OF
347   //    D2) 
348   
349   zd1 = 6316.+472.5;
350   
351   tubpar[0] = 7.3/2.;
352   tubpar[1] = 7.7/2.;
353   tubpar[2] = 90.*0.5;
354   gMC->Gsvolu("P002", "TUBE", idtmed[851], tubpar, 3);
355   gMC->Gspos("P002", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
356   
357   zd1 += tubpar[2] * 2.;
358   
359   tubpar[0] = 7.3/2.;
360   tubpar[1] = 7.7/2.;
361   tubpar[2] = 10.*0.5;
362   gMC->Gsvolu("P003", "TUBE", idtmed[851], tubpar, 3);
363   gMC->Gspos("P003", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
364   
365   zd1 += tubpar[2] * 2.;
366   
367   conpar[0] = 3.16/2.;
368   conpar[1] = 7.3/2.;
369   conpar[2] = 7.7/2.;
370   conpar[3] = 9.8/2.;
371   conpar[4] = 10.0/2.;
372   gMC->Gsvolu("P004", "CONE", idtmed[851], conpar, 5);
373   gMC->Gspos("P004", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
374   
375   zd1 += conpar[0] * 2.;
376   
377   tubpar[0] = 9.8/2.;
378   tubpar[1] = 10.0/2;
379   tubpar[2] = 490./2.;
380   gMC->Gsvolu("P005", "TUBE", idtmed[851], tubpar, 3);
381   gMC->Gspos("P005", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
382   
383   zd1 += tubpar[2] * 2.;
384   
385   conpar[0] = 30./2.;
386   conpar[1] = 9.8/2.;
387   conpar[2] = 10.0/2.;
388   conpar[3] = 20.4/2.;
389   conpar[4] = 20.6/2.;
390   gMC->Gsvolu("P006", "CONE", idtmed[851], conpar, 5);
391   gMC->Gspos("P006", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
392   
393   zd1 += conpar[0] * 2.;
394   
395   tubpar[0] = 20.4/2.;
396   tubpar[1] = 20.6/2.;
397   tubpar[2] = 150./2.;
398   gMC->Gsvolu("P007", "TUBE", idtmed[851], tubpar, 3);
399   gMC->Gspos("P007", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
400   
401   zd1 += tubpar[2] * 2.;
402   
403   conpar[0] = 13.6/2.;
404   conpar[1] = 20.4/2.;
405   conpar[2] = 20.6/2.;
406   conpar[3] = 25.2/2.;
407   conpar[4] = 25.4/2.;
408   gMC->Gsvolu("P008", "CONE", idtmed[851], conpar, 5);
409   gMC->Gspos("P008", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
410   
411   zd1 += conpar[0] * 2.;
412   
413   tubpar[0] = 25.2/2.;
414   tubpar[1] = 25.4/2.;
415   tubpar[2] = 205.8/2.;
416   gMC->Gsvolu("P009", "TUBE", idtmed[851], tubpar, 3);
417   gMC->Gspos("P009", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
418   
419   zd1 += tubpar[2] * 2.;
420   
421   tubpar[0] = 43.8/2.;
422   tubpar[1] = 44.0/2.;
423   tubpar[2] = 500./2.;
424   gMC->Gsvolu("P010", "TUBE", idtmed[851], tubpar, 3);
425   gMC->Gspos("P010", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
426   
427   zd1 += tubpar[2] * 2.;
428   
429   tubpar[0] = 31.8/2.;
430   tubpar[1] = 32.0/2.;
431   tubpar[2] = 757.5/2.;
432   gMC->Gsvolu("P011", "TUBE", idtmed[851], tubpar, 3);
433   gMC->Gspos("P011", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
434   
435   zd1 += tubpar[2] * 2.;
436   
437   conpar[0] = 22.7/2.;
438   conpar[1] = 31.8/2.;
439   conpar[2] = 32.0/2.;
440   conpar[3] = 39.8/2.;
441   conpar[4] = 40.0/2.;
442   gMC->Gsvolu("P012", "CONE", idtmed[851], conpar, 5);
443   gMC->Gspos("P012", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
444   
445   zd1 += conpar[0] * 2.;
446   
447   tubpar[0] = 39.8/2.;
448   tubpar[1] = 40.0/2.;
449   tubpar[2] = 100./2.;
450   gMC->Gsvolu("P013", "TUBE", idtmed[851], tubpar, 3);
451   gMC->Gspos("P013", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
452   
453   zd1 += tubpar[2] * 2.;
454   
455   tubpar[0] = 39.8/2.;
456   tubpar[1] = 40.0/2.;
457   tubpar[2] = 600./2.;
458   gMC->Gsvolu("P014", "TUBE", idtmed[851], tubpar, 3);
459   gMC->Gspos("P014", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
460   
461   zd1 += tubpar[2] * 2.;
462   
463   conpar[0] = 28.4/2.;
464   conpar[1] = 39.8/2.;
465   conpar[2] = 40.0/2.;
466   conpar[3] = 49.8/2.;
467   conpar[4] = 50.0/2.;
468   gMC->Gsvolu("P015", "CONE", idtmed[851], conpar, 5);
469   gMC->Gspos("P015", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
470   
471   zd1 += conpar[0] * 2.;
472   
473   tubpar[0] = 49.8/2.;
474   tubpar[1] = 50.0/2.;
475   tubpar[2] = 100./2.;
476   gMC->Gsvolu("P016", "TUBE", idtmed[851], tubpar, 3);
477   gMC->Gspos("P016", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
478   
479   zd1 += tubpar[2] * 2.;
480   
481   tubpar[0] = 49.8/2.;
482   tubpar[1] = 50.0/2.;
483   tubpar[2] = 600./2.;
484   gMC->Gsvolu("P017", "TUBE", idtmed[851], tubpar, 3);
485   gMC->Gspos("P017", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
486   
487   zd1 += tubpar[2] * 2.;
488   
489   conpar[0] = 28.4/2.;
490   conpar[1] = 49.8/2.;
491   conpar[2] = 50.0/2.;
492   conpar[3] = 59.8/2.;
493   conpar[4] = 60.0/2.;
494   gMC->Gsvolu("P018", "CONE", idtmed[851], conpar, 5);
495   gMC->Gspos("P018", 1, "ZDC ", 0., 0., conpar[0] + zd1, 0, "ONLY");
496   
497   zd1 += conpar[0] * 2.;
498   
499   tubpar[0] = 59.8/2.;
500   tubpar[1] = 60.0/2.;
501   tubpar[2] = 50./2.;
502   gMC->Gsvolu("P019", "TUBE", idtmed[851], tubpar, 3);
503   gMC->Gspos("P019", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
504   
505   zd1 += tubpar[2] * 2.;
506   
507   tubpar[0] = 59.8/2.;
508   tubpar[1] = 60.0/2.;
509   tubpar[2] = 800./2.;
510   gMC->Gsvolu("P020", "TUBE", idtmed[851], tubpar, 3);
511   gMC->Gspos("P020", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
512   
513   zd1 += tubpar[2] * 2.;
514   
515   tubpar[0] = 0.;
516   tubpar[1] = 60.0/2.;
517   tubpar[2] = 0.2/2.;
518   gMC->Gsvolu("P021", "TUBE", idtmed[851], tubpar, 3);
519   gMC->Gspos("P021", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
520   
521   zd1 += tubpar[2] * 2.;
522   
523   tubpar[0] = 0.;
524   tubpar[1] = 4.4/2.;
525   tubpar[2] = 0.2/2.;
526   gMC->Gsvolu("Q021", "TUBE", idtmed[889], tubpar, 3);
527   tubpar[0] = 0.;
528   tubpar[1] = 7.0/2.;
529   tubpar[2] = 0.2/2.;
530   gMC->Gsvolu("R021", "TUBE", idtmed[889], tubpar, 3);
531   // -- POSITION Q021 INSIDE P021 
532   gMC->Gspos("Q021", 1, "P021", -7.7, 0., 0., 0, "ONLY");
533   // -- POSITION R020 INSIDE P020 
534   gMC->Gspos("R021", 1, "P021", 7.7, 0., 0., 0, "ONLY");
535   
536   // -- BEAM PIPES BETWEEN END OF CONICAL PIPE AND BEGINNING OF D2 
537   tubpar[0] = 4.0/2.;
538   tubpar[1] = 4.4/2.;
539   tubpar[2] = 645.*0.5;
540   gMC->Gsvolu("P022", "TUBE", idtmed[851], tubpar, 3);
541   tubpar[0] = 7.0/2.;
542   tubpar[1] = 7.4/2.;
543   tubpar[2] = 645.*0.5;
544   gMC->Gsvolu("P023", "TUBE", idtmed[851], tubpar, 3);
545   
546   // -- ROTATE PIPES 
547   AliMatrix(im1, 90.-0.071, 0., 90., 90., .071, 180.);
548   angle = .071*kDegrad;
549   gMC->Gspos("P022", 1, "ZDC ", TMath::Sin(angle) * 322.5 - 9.7 + 
550                TMath::Sin(angle) * 472.5, 0., tubpar[2] + zd1, im1, "ONLY");
551   AliMatrix(im2, 90.+0.071, 0., 90., 90., .071, 0.);
552   gMC->Gspos("P023", 1, "ZDC ", 9.7 - TMath::Sin(angle) * 322.5, 0., 
553                tubpar[2] + zd1, im2, "ONLY");
554   
555   // --  END OF BEAM PIPE VOLUME DEFINITION. MAGNET DEFINITION FOLLOWS 
556   //     (LHC OPTICS 6) 
557   
558   // -- COMPENSATOR DIPOLE (MCBWA) 
559   //     GAP (VACUUM WITH MAGNETIC FIELD) 
560   
561   tubpar[0] = 0.;
562   tubpar[1] = 4.5;
563   tubpar[2] = 190./2.;
564   gMC->Gsvolu("MCBW", "TUBE", idtmed[890], tubpar, 3);
565   gMC->Gspos("MCBW", 1, "ZDC ", 0., 0., tubpar[2] + 1920., 0, "ONLY");
566   
567   // --  YOKE (IRON WITHOUT MAGNETIC FIELD) 
568   
569   tubpar[0] = 4.5;
570   tubpar[1] = 55.;
571   tubpar[2] = 190./2.;
572   gMC->Gsvolu("YMCB", "TUBE", idtmed[851], tubpar, 3);
573   gMC->Gspos("YMCB", 1, "ZDC ", 0., 0., tubpar[2] + 1920., 0, "ONLY");
574   
575   // -- INNER TRIPLET 
576   
577   zq = 2300.;
578   
579   // -- DEFINE MQXL AND MQX QUADRUPOLE ELEMENT 
580   
581   //     MQXL 
582   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
583   
584   tubpar[0] = 0.;
585   tubpar[1] = 3.5;
586   tubpar[2] = 630./2.;
587   gMC->Gsvolu("MQXL", "TUBE", idtmed[890], tubpar, 3);
588   
589   // --  YOKE 
590   
591   tubpar[0] = 3.5;
592   tubpar[1] = 22.;
593   tubpar[2] = 630./2.;
594   gMC->Gsvolu("YMQL", "TUBE", idtmed[851], tubpar, 3);
595   
596   gMC->Gspos("MQXL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
597   gMC->Gspos("YMQL", 1, "ZDC ", 0., 0., tubpar[2] + zq, 0, "ONLY");
598   
599   gMC->Gspos("MQXL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
600   gMC->Gspos("YMQL", 2, "ZDC ", 0., 0., tubpar[2] + zq + 2430., 0, "ONLY");
601   
602   // --  MQX 
603   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
604   
605   tubpar[0] = 0.;
606   tubpar[1] = 3.5;
607   tubpar[2] = 550./2.;
608   gMC->Gsvolu("MQX ", "TUBE", idtmed[890], tubpar, 3);
609   
610   // --  YOKE 
611   
612   tubpar[0] = 3.5;
613   tubpar[1] = 22.;
614   tubpar[2] = 550./2.;
615   gMC->Gsvolu("YMQ ", "TUBE", idtmed[851], tubpar, 3);
616   
617   gMC->Gspos("MQX ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880.,  0, "ONLY");
618   gMC->Gspos("YMQ ", 1, "ZDC ", 0., 0., tubpar[2] + zq + 880.,  0, "ONLY");
619   
620   gMC->Gspos("MQX ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
621   gMC->Gspos("YMQ ", 2, "ZDC ", 0., 0., tubpar[2] + zq + 1530., 0, "ONLY");
622   
623   // -- SEPARATOR DIPOLE D1 
624   
625   zd1 = 5843.5;
626   
627   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
628   
629   tubpar[0] = 0.;
630   tubpar[1] = 4.5;
631   tubpar[2] = 945/2.;
632   gMC->Gsvolu("D1  ", "TUBE", idtmed[890], tubpar, 3);
633   
634   // --  YOKE 
635   
636   tubpar[0] = 0.;
637   tubpar[1] = 55.;
638   tubpar[2] = 945/2.;
639   gMC->Gsvolu("YD1 ", "TUBE", idtmed[851], tubpar, 3);
640   
641   gMC->Gspos("YD1 ", 1, "ZDC ", 0., 0., tubpar[2] + zd1, 0, "ONLY");
642   gMC->Gspos("D1  ", 1, "YD1 ", 0., 0., 0., 0, "ONLY");
643   
644   // -- DIPOLE D2 
645   
646   zd2 = 12113.2;
647   
648   // --  GAP (VACUUM WITH MAGNETIC FIELD) 
649   
650   tubpar[0] = 0.;
651   tubpar[1] = 4.5;
652   tubpar[2] = 945./2.;
653   gMC->Gsvolu("D2  ", "TUBE", idtmed[890], tubpar, 3);
654   
655   // --  YOKE 
656   
657   tubpar[0] = 0.;
658   tubpar[1] = 55.;
659   tubpar[2] = 945./2.;
660   gMC->Gsvolu("YD2 ", "TUBE", idtmed[851], tubpar, 3);
661   
662   gMC->Gspos("YD2 ", 1, "ZDC ", 0., 0., tubpar[2] + zd2, 0, "ONLY");
663   
664   gMC->Gspos("D2  ", 1, "YD2 ", -9.7, 0., 0., 0, "ONLY");
665   gMC->Gspos("D2  ", 2, "YD2 ",  9.7, 0., 0., 0, "ONLY");
666   
667   // -- END OF MAGNET DEFINITION 
668   
669   // ----------------- Hadronic calorimeters -------------------- * 
670   
671   // Neutron calorimeter 
672   
673   gMC->Gsvolu("ZNEU", "BOX ", idtmed[800], HDZN, 3); // Passive material  
674   gMC->Gsvolu("ZNFI", "TUBE", idtmed[802], FIZN, 3); // Active material
675   gMC->Gsvolu("ZNGR", "BOX ", idtmed[889], GRZN, 3); // Empty grooves 
676   
677   // Divide ZNEU in towers 
678   // (for hits purposes) 
679   
680   gMC->Gsdvn("ZNTX", "ZNEU", NZNTX, 1); // x-tower 
681   gMC->Gsdvn("ZN1 ", "ZNTX", NZNTY, 2); // y-tower
682   
683   // Divide ZNEU in minitowers 
684   // (NCEN(1)= NUMBER OF FIBERS PER TOWER ALONG X-AXIS, 
685   //  NCEN(2)= NUMBER OF FIBERS PER TOWER ALONG Y-AXIS) 
686   // (one fiber per minitower) 
687   
688   gMC->Gsdvn("ZNSL", "ZN1 ", NCEN[1], 2); // Slices 
689   gMC->Gsdvn("ZNST", "ZNSL", NCEN[0], 1); // Sticks
690   
691   // --- Position the empty grooves in the sticks 
692   gMC->Gspos("ZNGR", 1, "ZNST", 0., 0., 0., 0, "ONLY");
693   // --- Position the fibers in the grooves 
694   gMC->Gspos("ZNFI", 1, "ZNGR", 0., 0., 0., 0, "ONLY");
695   // --- Position the neutron calorimeter in ZDC 
696   gMC->Gspos("ZNEU", 1, "ZDC ", ZNPOS[0], ZNPOS[1], ZNPOS[2] + HDZN[2], 0, "ONLY");
697   
698   // Proton calorimeter 
699   
700   gMC->Gsvolu("ZPRO", "BOX ", idtmed[801], HDZP, 3); // Passive material
701   gMC->Gsvolu("ZPFI", "TUBE", idtmed[802], FIZP, 3); // Active material 
702   gMC->Gsvolu("ZPGR", "BOX ", idtmed[889], GRZP, 3); // Empty grooves
703   
704   // Divide ZPRO in towers 
705   // (for hits purposes) 
706   
707   gMC->Gsdvn("ZPTX", "ZPRO", NZPTX, 1); // x-tower 
708   gMC->Gsdvn("ZP1 ", "ZPTX", NZPTY, 2); // y-tower
709   
710   
711   // Divide ZPRO in minitowers 
712   // (NCEP[0]= NUMBER OF FIBERS ALONG X-AXIS PER MINITOWER, 
713   //  NCEP[1]= NUMBER OF FIBERS ALONG Y-AXIS PER MINITOWER) 
714   // (one fiber per minitower) 
715   
716   gMC->Gsdvn("ZPSL", "ZP1 ", NCEP[1], 2); // Slices 
717   gMC->Gsdvn("ZPST", "ZPSL", NCEP[0], 1); // Sticks
718   
719   // --- Position the empty grooves in the sticks 
720   gMC->Gspos("ZPGR", 1, "ZPST", 0., 0., 0., 0, "ONLY");
721   // --- Position the fibers in the grooves 
722   gMC->Gspos("ZPFI", 1, "ZPGR", 0., 0., 0., 0, "ONLY");
723   // --- Position the proton calorimeter in ZDC 
724   gMC->Gspos("ZPRO", 1, "ZDC ", ZPPOS[0], ZPPOS[1], ZPPOS[2] + HDZP[2], 0, "ONLY");
725   
726 }
727  
728 //_____________________________________________________________________________
729 void AliZDCv1::DrawModule()
730 {
731   //
732   // Draw a shaded view of the Zero Degree Calorimeter version 1
733   //
734
735   // Set everything unseen
736   gMC->Gsatt("*", "seen", -1);
737   // 
738   // Set ALIC mother transparent
739   gMC->Gsatt("ALIC","SEEN",0);
740   //
741   // Set the volumes visible
742   gMC->Gsatt("ZDC","SEEN",0);
743   gMC->Gsatt("P001","SEEN",1);
744   gMC->Gsatt("P002","SEEN",1);
745   gMC->Gsatt("P003","SEEN",1);
746   gMC->Gsatt("P004","SEEN",1);
747   gMC->Gsatt("P005","SEEN",1);
748   gMC->Gsatt("P006","SEEN",1);
749   gMC->Gsatt("P007","SEEN",1);
750   gMC->Gsatt("P008","SEEN",1);
751   gMC->Gsatt("P009","SEEN",1);
752   gMC->Gsatt("P010","SEEN",1);
753   gMC->Gsatt("P011","SEEN",1);
754   gMC->Gsatt("P012","SEEN",1);
755   gMC->Gsatt("P013","SEEN",1);
756   gMC->Gsatt("P014","SEEN",1);
757   gMC->Gsatt("P015","SEEN",1);
758   gMC->Gsatt("P016","SEEN",1);
759   gMC->Gsatt("P017","SEEN",1);
760   gMC->Gsatt("P018","SEEN",1);
761   gMC->Gsatt("P019","SEEN",1);
762   gMC->Gsatt("P020","SEEN",1);
763   gMC->Gsatt("P021","SEEN",1);
764   gMC->Gsatt("Q021","SEEN",1);
765   gMC->Gsatt("R021","SEEN",1);
766   gMC->Gsatt("P022","SEEN",1);
767   gMC->Gsatt("P023","SEEN",1);
768   gMC->Gsatt("D1  ","SEEN",1);
769   gMC->Gsatt("YD1 ","SEEN",1);
770   gMC->Gsatt("D2  ","SEEN",1);
771   gMC->Gsatt("YD2 ","SEEN",1);
772   gMC->Gsatt("MCBW","SEEN",1);
773   gMC->Gsatt("YMCB","SEEN",1);
774   gMC->Gsatt("MQXL","SEEN",1);
775   gMC->Gsatt("YMQL","SEEN",1);
776   gMC->Gsatt("MQX","SEEN",1);
777   gMC->Gsatt("YMQ","SEEN",1);
778   gMC->Gsatt("D1","SEEN",1);
779   gMC->Gsatt("YD1","SEEN",1);
780   gMC->Gsatt("D2","SEEN",1);
781   gMC->Gsatt("YD2","SEEN",1);
782   gMC->Gsatt("ZNEU","SEEN",0);
783   gMC->Gsatt("ZNFI","SEEN",0);
784   gMC->Gsatt("ZNGR","SEEN",0);
785   gMC->Gsatt("ZNTX","SEEN",0);
786   gMC->Gsatt("ZN1 ","COLO",2); 
787   gMC->Gsatt("ZN1 ","SEEN",1);
788   gMC->Gsatt("ZNSL","SEEN",0);
789   gMC->Gsatt("ZNST","SEEN",0);
790   gMC->Gsatt("ZPRO","SEEN",0);
791   gMC->Gsatt("ZPFI","SEEN",0);
792   gMC->Gsatt("ZPGR","SEEN",0);
793   gMC->Gsatt("ZPTX","SEEN",0);
794   gMC->Gsatt("ZP1 ","SEEN",1);
795   gMC->Gsatt("ZPSL","SEEN",0);
796   gMC->Gsatt("ZPST","SEEN",0);
797   
798   //
799   gMC->Gdopt("hide", "on");
800   gMC->Gdopt("shad", "on");
801   gMC->Gsatt("*", "fill", 7);
802   gMC->SetClipBox(".");
803   gMC->SetClipBox("*", 0, 100, -100, 100, 12000, 16000);
804   gMC->DefaultRange();
805   gMC->Gdraw("alic", 40, 30, 0, 488, 220, .07, .07);
806   gMC->Gdhead(1111, "Zero Degree Calorimeter Version 1");
807   gMC->Gdman(18, 4, "MAN");
808 }
809
810 //_____________________________________________________________________________
811 void AliZDCv1::CreateMaterials()
812 {
813   //
814   // Create Materials for the Zero Degree Calorimeter
815   //
816   // Origin    : E. Scomparin 
817   
818   Int_t *idtmed = fIdtmed->GetArray()-799;
819   
820   Float_t dens, ubuf[1], wmat[2];
821   Int_t isvol_active;
822   Float_t a[2];
823   Int_t i;
824   Float_t z[2], epsil=0.001, stmin=0.01;
825   Int_t isvol;
826   Float_t fieldm = gAlice->Field()->Max();
827   Int_t inofld;
828   Float_t deemax=-1;
829   Float_t tmaxfd=gAlice->Field()->Max();
830   Int_t isxfld = gAlice->Field()->Integ();
831   Float_t stemax;
832   
833   // --- Store in UBUF r0 for nuclear radius calculation R=r0*A**1/3 
834   
835   // --- Tungsten 
836   ubuf[0] = 1.11;
837   AliMaterial(1, "TUNG", 183.85, 74., 19.3, .35, 10.3, ubuf, 1);
838   
839   // --- Brass (CuZn) 
840   dens = 8.48;
841   a[0] = 63.546;
842   a[1] = 65.39;
843   z[0] = 29.;
844   z[1] = 30.;
845   wmat[0] = .63;
846   wmat[1] = .37;
847   AliMixture(2, "BRASS               ", a, z, dens, 2, wmat);
848   
849   // --- SiO2 
850   dens = 2.64;
851   a[0] = 28.086;
852   a[1] = 15.9994;
853   z[0] = 14.;
854   z[1] = 8.;
855   wmat[0] = 1.;
856   wmat[1] = 2.;
857   AliMixture(3, "SIO2                ", a, z, dens, -2, wmat);
858   
859   // --- Lead 
860   ubuf[0] = 1.12;
861   AliMaterial(4, "LEAD", 207.19, 82., 11.35, .56, 18.5, ubuf, 1);
862   
863   // --- Copper 
864   ubuf[0] = 1.1;
865   AliMaterial(5, "COPP", 63.54, 29., 8.96, 1.4, 0., ubuf, 1);
866   
867   // --- Tantalum 
868   ubuf[0] = 1.1;
869   AliMaterial(6, "TANT", 180.95, 73., 16.65, .4, 11.9, ubuf, 1);
870   
871   // Steel still to be added 
872   
873   // --- Iron 
874   ubuf[0] = 1.1;
875   AliMaterial(52, "IRON", 55.85, 26., 7.87, 1.76, 0., ubuf, 1);
876   
877   // --- Vacuum (no magnetic field) 
878   AliMaterial(90, "VOID", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
879   
880   // --- Vacuum (magnetic field) 
881   AliMaterial(91, "VOIM", 1e-16, 1e-16, 1e-16, 1e16, 1e16, ubuf,0);
882   
883   // --- Air non magnetic 
884   AliMaterial(92, "Air    $", 14.61, 7.3, .001205, 30420., 67500., ubuf, 0);
885   
886   // ---  Definition of tracking media: 
887   
888   // --- Tungsten = 801 ; 
889   // --- Brass = 802 ; 
890   // --- Fibers (SiO2) = 803 ; 
891   // --- Lead = 804 ; 
892   // --- Copper = 805 ; 
893   // --- Tantalum = 806 ; 
894   // --- Steel = 851 ; 
895   // --- Iron = 852 ; 
896   // --- Vacuum (no field) = 890 
897   // --- Vacuum (with field) = 891 
898   // --- Air   (no field) = 892 
899   
900   
901   // --- Tracking media parameters 
902   epsil  = .01;
903   stemax = 1.;
904   isvol  = 0;
905   isvol_active = 1;
906   inofld = 0;
907   fieldm = 0.;
908   
909   AliMedium(1, "ZW", 1, isvol_active, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
910   AliMedium(2, "ZBRASS", 2, isvol_active, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
911   AliMedium(3, "ZSIO2", 3, isvol_active, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
912   AliMedium(4, "ZLEAD", 4, isvol_active, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
913   AliMedium(5, "ZCOPP", 5, isvol_active, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
914   AliMedium(6, "ZTANT", 6, isvol_active, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
915   AliMedium(52, "ZIRON", 52, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
916   AliMedium(90, "ZVOID", 90, isvol, inofld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
917   AliMedium(92, "Air", 92, 0, inofld, fieldm, tmaxfd, stemax,deemax, epsil, stmin);
918   
919   fieldm = 45.;
920   //    AliMedium(91, "ZVOIM", 91, isvol, isxfld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
921   AliMedium(91, "ZVOIM", 91, isvol, isxfld, fieldm, tmaxfd, stemax, deemax, epsil, stmin);
922   
923   // Thresholds for showering in the ZDCs 
924   
925   i = 801;
926   gMC->Gstpar(idtmed[i-1], "CUTGAM", .01);
927   gMC->Gstpar(idtmed[i-1], "CUTELE", .01);
928   gMC->Gstpar(idtmed[i-1], "CUTNEU", .1);
929   gMC->Gstpar(idtmed[i-1], "CUTHAD", .1);
930   i = 802;
931   gMC->Gstpar(idtmed[i-1], "CUTGAM", .01);
932   gMC->Gstpar(idtmed[i-1], "CUTELE", .01);
933   gMC->Gstpar(idtmed[i-1], "CUTNEU", .1);
934   gMC->Gstpar(idtmed[i-1], "CUTHAD", .1);
935   
936   // Avoid too detailed showering along the beam line 
937   
938   i = 852;
939   gMC->Gstpar(idtmed[i-1], "CUTGAM", .1);
940   gMC->Gstpar(idtmed[i-1], "CUTELE", .1);
941   gMC->Gstpar(idtmed[i-1], "CUTNEU", 1.);
942   gMC->Gstpar(idtmed[i-1], "CUTHAD", 1.);
943   
944   // Avoid interaction in fibers (only energy loss allowed) 
945   i = 803;
946   gMC->Gstpar(idtmed[i-1], "DCAY", 0.);
947   gMC->Gstpar(idtmed[i-1], "MULS", 0.);
948   gMC->Gstpar(idtmed[i-1], "PFIS", 0.);
949   gMC->Gstpar(idtmed[i-1], "MUNU", 0.);
950   gMC->Gstpar(idtmed[i-1], "LOSS", 1.);
951   gMC->Gstpar(idtmed[i-1], "PHOT", 0.);
952   gMC->Gstpar(idtmed[i-1], "COMP", 0.);
953   gMC->Gstpar(idtmed[i-1], "PAIR", 0.);
954   gMC->Gstpar(idtmed[i-1], "BREM", 0.);
955   gMC->Gstpar(idtmed[i-1], "DRAY", 0.);
956   gMC->Gstpar(idtmed[i-1], "ANNI", 0.);
957   gMC->Gstpar(idtmed[i-1], "HADR", 0.);
958 }
959
960 ClassImp(AliZDChit)
961   
962 //_____________________________________________________________________________
963 AliZDChit::AliZDChit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
964   AliHit(shunt, track)
965 {
966   //
967   // Add a Zero Degree Calorimeter hit
968   //
969   Int_t i;
970   for (i=0;i<4;i++) fVolume[i] = vol[i];
971   fX=hits[0];
972   fY=hits[1];
973   fZ=hits[2];
974   fEnergy=hits[3];
975 }