]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALv0.cxx
positionned differently (correctly ?)the Al layer
[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 2 scintillator, and 2 lead layers, 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 "TRandom.h"
37 #include "TGeometry.h"
38
39 // --- Standard library ---
40
41 #include <stdio.h>
42 #include <string.h>
43 #include <stdlib.h>
44 #include <Rstrstream.h>
45 #include <Riostream.h>
46
47 // --- AliRoot header files ---
48
49 #include "AliEMCALv0.h"
50 #include "AliEMCALGeometry.h"
51 #include "AliConst.h"
52 #include "AliRun.h"
53
54 ClassImp(AliEMCALv0)
55
56 //______________________________________________________________________
57 AliEMCALv0::AliEMCALv0(const char *name, const char *title):
58   AliEMCAL(name,title)
59 {
60   // ctor : title is used to identify the layout
61   GetGeometry() ; 
62
63 }
64
65 //______________________________________________________________________
66 void AliEMCALv0::BuildGeometry()
67 {
68     // Display Geometry for display.C
69
70     const Int_t kColorArm1   = kBlue ;
71
72     AliEMCALGeometry * geom = GetGeometry() ; 
73
74     // Define the shape of the Calorimeter 
75     TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
76     new TTUBS("Envelop1", "Tubs that contains arm 1", "void", 
77               geom->GetEnvelop(0),     // rmin 
78               geom->GetEnvelop(1) +30 ,     // rmax
79               geom->GetEnvelop(2)/2.0, // half length in Z
80               geom->GetArm1PhiMin(),   // minimun phi angle
81               geom->GetArm1PhiMax()    // maximun phi angle
82         );
83
84     // Place the Node
85     top->cd();
86     TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1"
87                                      ,0., 0., 0., "") ;
88     envelop1node->SetLineColor(kColorArm1) ;
89     fNodes->Add(envelop1node) ;
90 }
91
92 //______________________________________________________________________
93 void AliEMCALv0::CreateGeometry()
94 {
95   // Create the EMCAL geometry for Geant
96   // Geometry of a tower
97   //|-----------------------------------------------------| XEN1
98   //| |                                                 | |
99   //| |    Al thickness = GetAlFrontThickness()         | |
100   //| |                                                 | |
101   //| |                                                 | |
102   //| |                                                 | |
103   //|  -------------------------------------------------  |
104   //| |    Air Gap = GetGap2Active()                    | |
105   //| |                                                 | |
106   //|  -------------------------------------------------  |
107   //| |    XU0 : XPST (PreShower e = GetPreSintThick() )| |
108   //|  -------------------------------------------------  |
109   //| |    XU0 : XPBX (PreShower e = GetPbRadThick() )  | |
110   //|  -------------------------------------------------  |
111   //| |    XU0 : XPST (PreShower e = GetPreSintThick() )| |
112   //|  -------------------------------------------------  |
113   //| |    XU0 : XPBX (PreShower e = GetPbRadThick() )  | |
114   //|  -------------------------------------------------  |
115   //| |    XU1 : XPST (Tower e = GetFullSintThick() )   | |
116   //|  -------------------------------------------------  |
117   //| |    XU1 : XPBX (Tower e = GetPbRadThick() )      | |
118   //|  -------------------------------------------------  |
119   //| |    XU1 : XPST (Tower e = GetFullSintThick()     | |
120   //|  -------------------------------------------------  |
121   //| |    XU1 : XPBX (Tower e = GetPbRadThick() )      | |
122   //|  -------------------------------------------------  |
123   //|    etc .....                                        |
124   //|  -------------------------------------------------  |
125   //| |    XU10 : XPST (Tower e = GetFullSintThick() )  | |
126   //|-----------------------------------------------------|
127  
128     Float_t etamin,etamax;
129     Float_t *dum=0;
130
131     AliEMCALGeometry * geom = GetGeometry() ; 
132
133     if(!(geom->IsInitialized())){
134         Error("CreateGeometry","EMCAL Geometry class has not been set up.");
135     } // end if
136
137     // Get pointer to the array containing media indices
138     Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
139
140     // Create an Envelope within which to place the Detector 
141     Float_t envelopA[5];
142     envelopA[0] = geom->GetEnvelop(0);     // rmin
143     envelopA[1] = geom->GetEnvelop(1);     // rmax
144     envelopA[2] = geom->GetEnvelop(2)/2.0; // dz
145     envelopA[3] = geom->GetArm1PhiMin();   // minimun phi angle
146     envelopA[4] = geom->GetArm1PhiMax();   // maximun phi angle
147
148     // create XEN1
149     gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
150     Int_t idrotm = 1;
151     AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
152
153     // Position the EMCAL Mother Volume in Alice  
154     gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
155
156     //  
157     TString label = "XU0";
158
159     //rmin Start mini envelopes after the aluminium layer
160     envelopA[0] = geom->GetEnvelop(0) + geom->GetGap2Active() + 
161                   geom->GetAlFrontThickness();
162
163     //rmax larger for first two layers (preshower);
164     Float_t tseg = geom->GetPreSintThick()+geom->GetPbRadThick();
165     envelopA[1] = envelopA[0] + 2.0*tseg;
166     envelopA[2] = geom->GetEnvelop(2)/2.0; // dz
167     envelopA[3] = geom->GetArm1PhiMin();   // minimun phi angle
168     envelopA[4] = geom->GetArm1PhiMax();   // maximun phi angle
169
170     //filled with air
171     gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
172
173     // Place XU0 in to XEN1
174     gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY");
175
176     tseg = geom->GetFullSintThick()+geom->GetPbRadThick();
177     Int_t i ; 
178     for (i = 1; i < ((geom->GetNLayers()-2)/2) + 1 ; i++ ){
179         label = "XU" ;
180         label += i ;
181         envelopA[0] = envelopA[1]; //rmin
182         envelopA[1] = envelopA[0] + 2.0*tseg;  //rmax
183
184         //filled with air
185         gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
186         gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
187     } // end  i
188  
189     tseg = geom->GetFullSintThick() ;
190     label = "XU" ;
191     label += i ;
192     envelopA[0] = envelopA[1]; //rmin
193     envelopA[1] = envelopA[0] + tseg;  //rmax
194     
195     //filled with air
196     gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
197     gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
198   
199   
200     // Create the shapes of active material (LEAD/Aluminium/Scintillator)
201     // to be placed
202     Float_t envelopB[10]; // First Layer of Aluminium
203     Float_t envelopC[10]; // Scintillator Layers
204     Float_t envelopD[10]; // Lead Layers
205
206     //starting position in Phi
207     envelopC[0] = envelopD[0] =  envelopB[0] = geom->GetArm1PhiMin();
208
209     // Angular size of the Detector in Phi
210     envelopB[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin();
211     envelopC[1] = envelopD[1] = envelopB[1];
212
213     // Number of Section in Phi
214     envelopC[2] = envelopD[2] = envelopB[2] = geom->GetNPhi();
215
216     // each section will be passed 2 z coordinates    
217     envelopD[3] = envelopC[3] = envelopB[3] = 2;
218     envelopB[4] = geom->ZFromEtaR(geom->GetEnvelop(0),
219                                    geom->GetArm1EtaMin());// z co-ordinate 1
220     envelopB[5] = geom->GetEnvelop(0) ; //rmin at z1
221     envelopB[6] = envelopB[5] + geom->GetAlFrontThickness();//rmax at z1
222     envelopB[7] = geom->ZFromEtaR(geom->GetEnvelop(0),
223                                   geom->GetArm1EtaMax()); // z co-ordinate 2
224     envelopB[8] = envelopB[5] ; //
225     envelopB[9] = envelopB[6] ; // radii are the same.
226
227     // filled shapes with active material 
228
229     // Define Aluminium volume completely
230     gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10);
231
232     // The polystyrene layers will be defined when placed 
233     gMC->Gsvolu("XPST", "PGON", idtmed[1601], dum, 0);
234     gMC->Gsvolu("XPBX", "PGON", idtmed[1600], dum, 0);//  as will the lead layers
235
236     //  Dividind eta polystyrene divisions into phi segments.
237     gMC->Gsdvn("XPHI", "XPST", geom->GetNPhi(), 2);
238
239     // Position Aluminium Layer in the Envelope 
240     gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ; 
241
242     // The loop below places the scintillator in Lead Layers alternately.
243     envelopD[6] = envelopB[6] + geom->GetGap2Active() ;
244     for (int i = 0; i < geom->GetNLayers() ; i++ ){
245         label = "XU" ;
246         label += static_cast<Int_t> (i/2)  ; // we will place two layers (i = one layer) in each mini envelope) 
247         envelopC[5] = envelopD[6] ; //rmin
248         envelopC[6] = envelopD[6] + ((i > 1)  ? geom->GetFullSintThick() : 
249                                      geom->GetPreSintThick());//rmax larger for first two layers (preshower)
250         envelopC[8] = envelopD[6] ; //rmin
251         envelopC[9] = envelopD[6] + ((i > 1 ) ? geom->GetFullSintThick() :
252                                      geom->GetPreSintThick());//rmax larger for first two layers (preshower)
253         for (int j =0; j < (geom->GetNEta()) ; j++){
254             etamin = geom->GetArm1EtaMin()+
255                 (j*geom->GetDeltaEta());
256             etamax = geom->GetArm1EtaMin()+
257                 ((j+1)*geom->GetDeltaEta());
258             envelopC[4] = geom->ZFromEtaR(envelopD[6],etamin); //z begin  
259             envelopC[7] = geom->ZFromEtaR(envelopD[6],etamax);// z end 
260
261             gMC->Gsposp("XPST",1+j+i*(geom->GetNEta()), label.Data(), 
262                         0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
263         } // end for j
264
265         if (i < (geom->GetNLayers()-1)){
266             envelopD[5] = envelopC[6] ; //rmin
267             envelopD[6] = envelopC[6] + geom->GetPbRadThick();  //rmax
268             envelopD[8] = envelopC[6] ; //rmin
269             envelopD[9] = envelopC[6] + geom->GetPbRadThick();  //rmax
270             for (int j =0; j < (geom->GetNEta()) ; j++){
271                 etamin = geom->GetArm1EtaMin()+
272                     (j*geom->GetDeltaEta());
273                 etamax = geom->GetArm1EtaMin()+
274                     ((j+1)*geom->GetDeltaEta());
275                 envelopD[4] = geom->ZFromEtaR(envelopC[6],etamin);//z begin  
276                 envelopD[7] = geom->ZFromEtaR(envelopC[6],etamax);// z end
277
278                 // Position and Define Layer
279
280                 gMC->Gsposp("XPBX",1+j+i*(geom->GetNEta()), label.Data(), 
281                             0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10);
282             } // end for j
283         } // end if i
284     }  // for i
285 }
286
287 //______________________________________________________________________
288 void AliEMCALv0::Init(void)
289 {
290     // Just prints an information message
291   
292   if(fDebug) { 
293     TString message("\n") ; 
294     message += "*****************************************" ;
295     
296     // Here the EMCAL initialisation code (if any!)
297     
298     AliEMCALGeometry * geom = GetGeometry() ; 
299     
300     if (geom!=0) {   
301       message += "AliEMCAL " ; 
302       message += Version() ; 
303       message += "EMCAL geometry intialized for " ; 
304       message += geom->GetName()  ;
305     }
306     else {
307       message += "AliEMCAL " ; 
308       message += Version() ;  
309       message += "EMCAL geometry initialization failed !" ; 
310     }
311     message += "*****************************************" ;
312     Info("Init", message.Data() ) ; 
313   }
314 }