]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALv0.cxx
Comments
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.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 /* $Id$ */
16
17 //_________________________________________________________________________
18 // Implementation version v0 of EMCAL Manager class 
19 // An object of this class does not produce hits nor digits
20 // It is the one to use if you do not want to produce outputs in TREEH or TREED
21 // This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx                 
22 //*-- Author: Yves Schutz (SUBATECH)
23 //*-- and   : Sahal Yacoob (LBL / UCT)
24
25 // This Version of AliEMCALv0 reduces the number of volumes placed in XEN1 (the envelope) to less than five hundred
26 // The Envelope is Placed in Alice, And the Aluminium layer. Mini envelopes (XU) are then placed in XEN1.
27 // Each mini envelope contains 1 scintillator, and 1 lead layer, except the last one which contains just one scintillator layer.
28 // At the moment I cannot place the 36 and above layers in the mini envelopes so all layers are still placed in XEN1
29
30
31 // --- ROOT system ---
32
33 //#include "TPGON.h"
34 #include "TTUBS.h"
35 #include "TNode.h"
36 #include "TGeometry.h"
37 #include "TVirtualMC.h"
38 #include "TArrayI.h"
39
40 // --- Standard library ---
41
42 //#include <stdio.h>
43
44 // --- AliRoot header files ---
45
46 #include "AliEMCALv0.h"
47 #include "AliEMCALGeometry.h"
48 #include "AliRun.h"
49
50 ClassImp(AliEMCALv0)
51
52 //______________________________________________________________________
53 AliEMCALv0::AliEMCALv0(const char *name, const char *title):
54   AliEMCAL(name,title)
55 {
56   // ctor : title is used to identify the layout
57   GetGeometry() ; 
58
59 }
60
61 //______________________________________________________________________
62 void AliEMCALv0::BuildGeometry()
63 {
64     // Display Geometry for display.C
65
66     const Int_t kColorArm1   = kBlue ;
67
68     AliEMCALGeometry * geom = GetGeometry() ; 
69
70     // Define the shape of the Calorimeter 
71     TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
72     new TTUBS("Envelop1", "Tubs that contains arm 1", "void", 
73               geom->GetEnvelop(0),     // rmin 
74               geom->GetEnvelop(1) +30 ,// rmax
75               geom->GetEnvelop(2)/2.0, // half length in Z
76               geom->GetArm1PhiMin(),   // minimum phi angle
77               geom->GetArm1PhiMax()    // maximum phi angle
78         );
79
80     // Place the Node
81     top->cd();
82     TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1"
83                                      ,0., 0., 0., "") ;
84     envelop1node->SetLineColor(kColorArm1) ;
85     fNodes->Add(envelop1node) ;
86 }
87
88 //______________________________________________________________________
89 void AliEMCALv0::CreateGeometry()
90 {
91   // Create the EMCAL geometry for Geant
92   // Geometry of a tower
93   //|-----------------------------------------------------| XEN1
94   //| |                                                 | |
95   //| |    Al thickness = GetAlFrontThickness()         | |
96   //| |                                                 | |
97   //| |                                                 | |
98   //| |                                                 | |
99   //|  -------------------------------------------------  |
100   //| |    Air Gap = GetGap2Active()                    | |
101   //| |                                                 | |
102   //|  -------------------------------------------------  |
103   //| |    XU1 : XPST (ECAL e = GetECScintThick() )     | |
104   //|  -------------------------------------------------  |
105   //| |    XU1 : XPBX (ECAL e = GetECPbRadThick() )     | |
106   //|  -------------------------------------------------  |
107   //| |    XU1 : XPST (ECAL e = GetECScintThick()       | |
108   //|  -------------------------------------------------  |
109   //| |    XU1 : XPBX (ECAL e = GetECPbRadThick() )     | |
110   //|  -------------------------------------------------  |
111   //|    etc ..... GetNECLayers() - 1 times               |
112   //|  -------------------------------------------------  |
113   //| |    XUNLayer : XPST (ECAL e = GetECScintThick()  | |
114   //|  -------------------------------------------------  |
115
116     Float_t etamin,etamax;
117     Float_t *dum=0;
118
119     AliEMCALGeometry * geom = GetGeometry() ; 
120
121     if(!(geom->IsInitialized())){
122         Error("CreateGeometry","EMCAL Geometry class has not been set up.");
123     } // end if
124
125     // Get pointer to the array containing media indices
126     Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
127
128     Int_t idrotm = 1;
129     AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
130
131     // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1 
132
133     Float_t envelopA[10];
134     envelopA[0] = geom->GetArm1PhiMin();                         // minimum phi angle
135     envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
136     envelopA[2] = geom->GetNPhi();                               // number of sections in phi
137     envelopA[3] = 2;                                             // 2 z coordinates
138     envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
139                                    geom->GetArm1EtaMin());       // z coordinate 1
140     //add some padding for mother volume
141     envelopA[5] = geom->GetEnvelop(0) ;                          // rmin at z1
142     envelopA[6] = geom->GetEnvelop(1) ;                          // rmax at z1
143     envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
144                                   geom->GetArm1EtaMax());        // z coordinate 2
145     envelopA[8] = envelopA[5] ;                                  // radii are the same.
146     envelopA[9] = envelopA[6] ;                                  // radii are the same.
147
148     gMC->Gsvolu("XEN1", "PGON ", idtmed[1599], envelopA, 10) ;   // Polygone filled with air 
149
150     // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)  
151
152     gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
153     
154     if (gDebug==2) {
155       printf("CreateGeometry: XEN1 = %f, %f\n", envelopA[5], envelopA[6]); 
156       printf("CreateGeometry: XU0 = %f, %f\n", envelopA[5], envelopA[6]); 
157     }
158     // Create mini-envelopes which will contain the Tower scintillator-radiator
159     
160     TString label ;
161     
162     envelopA[5] = envelopA[5] + geom->GetGap2Active() // we are at the first scintllator
163       + geom->GetAlFrontThickness();                  // rmin at z1
164     envelopA[6] = envelopA[5] ;
165
166
167     Int_t i ; 
168
169     Int_t nLayers = geom->GetNECLayers();
170
171     for (i = 0; i < (nLayers-1); i++ ){
172         label = "XU" ;
173         label += i ;
174         Float_t tseg ; 
175         tseg = geom->GetECScintThick()+geom->GetECPbRadThick();       // thickness of scintillator+Pb in E Cal
176         envelopA[5] = envelopA[6] ;                                   // rmin at z1
177         envelopA[4] = geom->ZFromEtaR(envelopA[5] + tseg,
178                                       geom->GetArm1EtaMin());         // z coordinate 1
179         envelopA[7] = geom->ZFromEtaR(envelopA[5] + tseg,
180                                       geom->GetArm1EtaMax());         // z coordinate 2
181         envelopA[6] = envelopA[5] + tseg ;                            // rmax at z1
182         envelopA[8] = envelopA[5] ;                                   // radii are the same.
183         envelopA[9] = envelopA[6] ;                                   // radii are the same.
184  
185         gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10);// Polygone filled with air 
186
187         // Position XUi in XEN1
188         
189         gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
190
191         if (gDebug == 2)
192           printf("CreateGeometry: XU%d = %f, %f\n", i, envelopA[5], envelopA[6]); 
193
194     } // end  i
195  
196   
197     // Create one mini-envelope which will contain the last scintillator XU(nlayers-1) because there is one more scintillator than Pb layer XU(nlayers-1)
198
199     label = "XU" ;
200     label += i ;
201     envelopA[5] = envelopA[6] ;                                   // rmin at z1
202     envelopA[4] = geom->ZFromEtaR(envelopA[5] + geom->GetECScintThick(),
203                                   geom->GetArm1EtaMin());         // z coordinate 1
204     envelopA[7] = geom->ZFromEtaR(envelopA[5] + geom->GetECScintThick(),
205                                   geom->GetArm1EtaMax());         // z coordinate 2
206     envelopA[6] = envelopA[5] + geom->GetECScintThick() ;         // rmax at z1
207     envelopA[8] = envelopA[5] ;                                   // radii are the same.
208     envelopA[9] = envelopA[6] ;                                   // radii are the same.
209
210     gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10); // Polygone filled with air
211
212     // Position the last minienvelope in XEN1
213   
214     gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
215     
216     if(gDebug == 2) 
217     printf("CreateGeometry: XEN%d = %f, %f\n", i, envelopA[5], envelopA[6]);
218   
219     // Create the shapes of active material (LEAD/Aluminium/Scintillator)
220     // to be placed
221     Float_t envelopB[10]; // First Layer of Aluminium
222     Float_t envelopC[10]; // Scintillator Layers
223     Float_t envelopD[10]; // Lead Layers
224
225     envelopC[0] = envelopD[0] = envelopB[0] = envelopA[0] ;  // starting position in Phi
226     envelopC[1] = envelopD[1] = envelopB[1] = envelopA[1] ;  // angular range in phi          
227     envelopC[2] = envelopD[2] = envelopB[2] = envelopA[2] ;  // number of sections in Phi
228     envelopC[3] = envelopD[3] = envelopB[3] = envelopA[3] ;  // 2 z coordinates
229
230     Float_t dist = geom->GetEnvelop(0) + geom->GetAlFrontThickness() + geom->GetGap2Active() ; 
231     envelopB[4] = geom->ZFromEtaR(dist,
232                                   geom->GetArm1EtaMin());   // z co-ordinate 1
233     envelopB[5] = geom->GetEnvelop(0) ;                     // rmin at z1
234     envelopB[6] = envelopB[5] + geom->GetAlFrontThickness();// rmax at z1
235     envelopB[7] = geom->ZFromEtaR(dist,
236                                   geom->GetArm1EtaMax());   // z co-ordinate 2
237     envelopB[8] = envelopB[5] ;                             // radii are the same.
238     envelopB[9] = envelopB[6] ;                             // radii are the same.
239
240     // Define active volumes completely
241     
242     gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10); // PGON filled with Al
243     
244     gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ; // Position Aluminium Layer in XEN1
245
246     gMC->Gsvolu("XPST", "PGON", idtmed[1601], dum, 0);      // PGON filled with Scintillator (shape to be defined by GSPOSP)
247   
248     gMC->Gsvolu("XPBX", "PGON", idtmed[1600], dum, 0);      // PGON filled with Lead (shape to be defined by GSPOSP)
249   
250     //gMC->Gsvolu("XCUX", "PGON", idtmed[1603], dum, 0);      // PGON filled with Copper (shape to be defined by GSPOSP)
251
252     gMC->Gsdvn("XPHI", "XPST", geom->GetNPhi(), 2);         // Divide eta section of scintillators into phi segments.
253  
254     // Position alternatively scintillator and  Lead Layers in XUi.
255
256     envelopD[6] = envelopB[6] + geom->GetGap2Active() ;// gap between Al layer and XU0
257     
258     for (int i = 0; i < nLayers; i++ ){
259       label = "XU" ;
260       label += i  ; // we will place one layer in each mini envelope)   
261
262       Float_t scthick ; // scintillator thickness 
263       scthick = geom->GetECScintThick() ;
264
265       envelopC[5] = envelopD[6] ;           //rmin
266       envelopC[6] = envelopC[5] + scthick ; //rmax
267       envelopC[8] = envelopC[5] ;           //rmin
268       envelopC[9] = envelopC[6] ;           //rmax
269
270       if(gDebug == 2 ) 
271         printf("CreateGeometry: volume = %s, name = XPST thickness = %f deb = %f/%f fin = %f/%f", label.Data(), scthick, envelopC[5], envelopC[8], envelopC[6], envelopC[9]) ; 
272
273       for (int j =0; j < (geom->GetNEta()) ; j++){
274         etamin = geom->GetArm1EtaMin()+
275           (j*geom->GetDeltaEta());
276         etamax = geom->GetArm1EtaMin()+
277           ((j+1)*geom->GetDeltaEta());
278         envelopC[4] = geom->ZFromEtaR(envelopC[5],etamin); //z begin  
279         envelopC[7] = geom->ZFromEtaR(envelopC[5],etamax);// z end 
280         
281         gMC->Gsposp("XPST",1+j+i*(geom->GetNEta()), label.Data(), 
282                     0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
283       } // end for j
284       
285         Float_t radthick ; // radiator thickness 
286         TString radname ;  // radiator name
287         radthick = geom->GetECPbRadThick();
288         radname  =  "XPBX" ; 
289
290         if ( i < nLayers -1 ) { // except for the last XU which contains only one scintillator layer 
291
292           envelopD[5] = envelopC[6] ; //rmin
293           envelopD[8] = envelopD[5] ; //rmin
294           envelopD[6] = envelopD[5] + radthick ; // rmax
295           envelopD[9] = envelopD[6] ; //rmax
296           
297           if(gDebug == 2 ) 
298             printf("CreateGeometry: volume = %s, name = %s thickness = %f deb = %f/%f fin = %f/%f", label.Data(), radname.Data(), radthick, envelopD[5], envelopD[8], envelopD[6], envelopD[9]) ; 
299
300           for (int j =0; j < (geom->GetNEta()) ; j++){
301             etamin = geom->GetArm1EtaMin()+
302               (j*geom->GetDeltaEta());
303             etamax = geom->GetArm1EtaMin()+
304               ((j+1)*geom->GetDeltaEta());
305             envelopD[4] = geom->ZFromEtaR(envelopD[5],etamin);//z begin  
306             envelopD[7] = geom->ZFromEtaR(envelopD[5],etamax);// z end
307             
308             // Position and Define Layer
309             
310             gMC->Gsposp(radname.Data(),1+j+i*(geom->GetNEta()), label.Data(), 
311                         0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10);
312              } // end for j
313           } // if not last layer
314     }  // for i
315 }
316
317 //______________________________________________________________________
318 void AliEMCALv0::Init(void)
319 {
320     // Just prints an information message
321   
322   if(fDebug) { 
323     TString message("\n") ; 
324     message += "*****************************************\n" ;
325     
326     // Here the EMCAL initialisation code (if any!)
327     
328     AliEMCALGeometry * geom = GetGeometry() ; 
329     
330     if (geom!=0) {   
331       message += "AliEMCAL " ; 
332       message += Version() ; 
333       message += "EMCAL geometry initialized for " ; 
334       message += geom->GetName()  ;
335     }
336     else {
337       message += "AliEMCAL " ; 
338       message += Version() ;  
339       message += "EMCAL geometry initialization failed !" ; 
340     }
341     message += "\n*****************************************" ;
342     printf(message.Data() ) ; 
343   }
344 }