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