]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALv0.cxx
fgMCEvGen changed to fMCEvGen.
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALv0.cxx
CommitLineData
2012850d 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 **************************************************************************/
2012850d 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
ffa6d63b 21// This class places a Geometry of the EMCAL in the ALICE Detector as defined in AliEMCALGeometry.cxx
2012850d 22//*-- Author: Yves Schutz (SUBATECH)
b13bbe81 23//*-- and : Sahal Yacoob (LBL / UCT)
2012850d 24
09641ef5 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
2012850d 31// --- ROOT system ---
a1469a24 32
b13bbe81 33#include "TPGON.h"
2012850d 34#include "TTUBS.h"
35#include "TNode.h"
36#include "TRandom.h"
37#include "TGeometry.h"
a1469a24 38
2012850d 39// --- Standard library ---
40
b13bbe81 41#include <stdio.h>
42#include <string.h>
43#include <stdlib.h>
70479d0e 44#include <Rstrstream.h>
45#include <Riostream.h>
2012850d 46
47// --- AliRoot header files ---
48
49#include "AliEMCALv0.h"
50#include "AliEMCALGeometry.h"
b13bbe81 51#include "AliConst.h"
2012850d 52#include "AliRun.h"
2012850d 53
54ClassImp(AliEMCALv0)
55
b13bbe81 56//______________________________________________________________________
2012850d 57AliEMCALv0::AliEMCALv0(const char *name, const char *title):
05a92d59 58 AliEMCAL(name,title)
59{
60 // ctor : title is used to identify the layout
61 GetGeometry() ;
a1469a24 62
2012850d 63}
a1469a24 64
b13bbe81 65//______________________________________________________________________
05a92d59 66void AliEMCALv0::BuildGeometry()
67{
b13bbe81 68 // Display Geometry for display.C
2012850d 69
b13bbe81 70 const Int_t kColorArm1 = kBlue ;
91e9918b 71
05a92d59 72 AliEMCALGeometry * geom = GetGeometry() ;
a1469a24 73
05a92d59 74 // Define the shape of the Calorimeter
5502a765 75 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
b13bbe81 76 new TTUBS("Envelop1", "Tubs that contains arm 1", "void",
05a92d59 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
b13bbe81 82 );
a1469a24 83
ffa6d63b 84 // Place the Node
5502a765 85 top->cd();
5502a765 86 TNode * envelop1node = new TNode("Envelop1", "Arm1 Envelop", "Envelop1"
87 ,0., 0., 0., "") ;
b13bbe81 88 envelop1node->SetLineColor(kColorArm1) ;
89 fNodes->Add(envelop1node) ;
2012850d 90}
a1469a24 91
b13bbe81 92//______________________________________________________________________
05a92d59 93void AliEMCALv0::CreateGeometry()
94{
f590bb15 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 //| ------------------------------------------------- |
ca148d5b 107 //| | XU0 : XPST (PreShower e = GetPRScintThick() )| |
f590bb15 108 //| ------------------------------------------------- |
ca148d5b 109 //| | XU0 : XPBX (PreShower e = GetPRPbRadThick() )| |
f590bb15 110 //| ------------------------------------------------- |
ca148d5b 111 //| | XU0 : XPST (PreShower e = GetPEScintThick() )| |
f590bb15 112 //| ------------------------------------------------- |
ca148d5b 113 //| | XU0 : XPBX (PreShower e = GetPRPbRadThick() )| |
f590bb15 114 //| ------------------------------------------------- |
ca148d5b 115 //| etc ..... GetNPRLayers() times |
f590bb15 116 //| ------------------------------------------------- |
ca148d5b 117 //| | XU1 : XPST (ECAL e = GetECScintThick() ) | |
f590bb15 118 //| ------------------------------------------------- |
ca148d5b 119 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
f590bb15 120 //| ------------------------------------------------- |
ca148d5b 121 //| | XU1 : XPST (ECAL e = GetECScintThick() | |
f590bb15 122 //| ------------------------------------------------- |
ca148d5b 123 //| | XU1 : XPBX (ECAL e = GetECPbRadThick() ) | |
f590bb15 124 //| ------------------------------------------------- |
ca148d5b 125 //| etc ..... GetNECLayers() times |
126 //| ------------------------------------------------- |
127 //| | XU1 : XPST (ECAL e = GetHCScintThick() ) | |
128 //| ------------------------------------------------- |
129 //| | XU1 : XPBX (ECAL e = GetHCPbRadThick() ) | |
130 //| ------------------------------------------------- |
131 //| | XU1 : XPST (ECAL e = GetHCScintThick() | |
132 //| ------------------------------------------------- |
133 //| | XU1 : XPBX (ECAL e = GetHCPbRadThick() ) | |
134 //| ------------------------------------------------- |
135 //| etc ..... GetNHCLayers() times |
136 //| ------------------------------------------------- |
137 //| | XU10 : XPST (HCAL e = GetHCScintThick() ) | |
f590bb15 138 //|-----------------------------------------------------|
139
a1469a24 140 Float_t etamin,etamax;
3ca04a8a 141 Float_t *dum=0;
142
05a92d59 143 AliEMCALGeometry * geom = GetGeometry() ;
a1469a24 144
05a92d59 145 if(!(geom->IsInitialized())){
a1469a24 146 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
b13bbe81 147 } // end if
a1469a24 148
b13bbe81 149 // Get pointer to the array containing media indices
150 Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
e13bd4f0 151
09641ef5 152 Int_t idrotm = 1;
153 AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
154
a1469a24 155
c27ad3fb 156
c13b5a7c 157 // Create the EMCAL Mother Volume (a polygone) within which to place the Detector and named XEN1
158
159 Float_t envelopA[10];
160 envelopA[0] = geom->GetArm1PhiMin(); // minimum phi angle
161 envelopA[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin(); // angular range in phi
162 envelopA[2] = geom->GetNPhi(); // number of sections in phi
163 envelopA[3] = 2; // 2 z coordinates
c27ad3fb 164 envelopA[4] = geom->ZFromEtaR(geom->GetEnvelop(1),
c13b5a7c 165 geom->GetArm1EtaMin()); // z coordinate 1
166 envelopA[5] = geom->GetEnvelop(0) ; // rmin at z1
167 envelopA[6] = geom->GetEnvelop(1) ; // rmax at z1
c27ad3fb 168 envelopA[7] = geom->ZFromEtaR(geom->GetEnvelop(1),
c13b5a7c 169 geom->GetArm1EtaMax()); // z coordinate 2
170 envelopA[8] = envelopA[5] ; // radii are the same.
171 envelopA[9] = envelopA[6] ; // radii are the same.
172
173 gMC->Gsvolu("XEN1", "PGON ", idtmed[1599], envelopA, 10) ; // Polygone filled with air
09641ef5 174
c13b5a7c 175 // Position the EMCAL Mother Volume (XEN1) in Alice (ALIC)
09641ef5 176
c13b5a7c 177 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
178
c27ad3fb 179 if (gDebug==2)
c13b5a7c 180 Info("CreateGeometry","rXEN1 = %f, %f\n", envelopA[5], envelopA[6]);
a1469a24 181
a63e0d5e 182 // Create mini-envelopes which will contain the PreShower scintillator-Lead-scintillator-lead
c13b5a7c 183
c27ad3fb 184 if (gDebug==2)
a63e0d5e 185 Info("CreateGeometry","XU0 = %f, %f\n", envelopA[5], envelopA[6]);
c13b5a7c 186
a63e0d5e 187 // Create mini-envelopes which will contain the Tower scintillator-radiator-scintillator-radiator
c13b5a7c 188
a63e0d5e 189 TString label ;
190
191 envelopA[5] = envelopA[5] + geom->GetGap2Active() // we are at the first scintllator
192 + geom->GetAlFrontThickness(); // rmin at z1
193 envelopA[6] = envelopA[5] ;
194
c27ad3fb 195
f590bb15 196 Int_t i ;
a63e0d5e 197
198 Int_t nLayers = geom->GetNPRLayers() + geom->GetNECLayers() + geom->GetNHCLayers() ;
199
200 for (i = 0; i < nLayers/2 ; i++ ){
a1469a24 201 label = "XU" ;
a1469a24 202 label += i ;
a63e0d5e 203 Float_t tseg ;
204 if (i == 0 )
ca148d5b 205 tseg = 2 *(geom->GetPRScintThick()+geom->GetPRPbRadThick()); // thickness of 2 * scintillator+Pb in pre shower
a63e0d5e 206 else if ( i <= geom->GetNECLayers()/2)
ca148d5b 207 tseg = 2* (geom->GetECScintThick()+geom->GetECPbRadThick()); // thickness of 2 * scintillator+Pb in E Cal
a63e0d5e 208 else
ca148d5b 209 tseg = 2* (geom->GetHCScintThick()+geom->GetHCCuRadThick()); // thickness of 2 * scintillator+Cu in H Cal
c13b5a7c 210 envelopA[5] = envelopA[6] ; // rmin at z1
c27ad3fb 211 envelopA[4] = geom->ZFromEtaR(envelopA[5] + tseg,
c13b5a7c 212 geom->GetArm1EtaMin()); // z coordinate 1
c27ad3fb 213 envelopA[7] = geom->ZFromEtaR(envelopA[5] + tseg,
c13b5a7c 214 geom->GetArm1EtaMax()); // z coordinate 2
a63e0d5e 215 envelopA[6] = envelopA[5] + tseg ; // rmax at z1
c13b5a7c 216 envelopA[8] = envelopA[5] ; // radii are the same.
217 envelopA[9] = envelopA[6] ; // radii are the same.
218
219 gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10);// Polygone filled with air
a1469a24 220
c13b5a7c 221 // Position XUi in XEN1
222
a1469a24 223 gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
c13b5a7c 224
c27ad3fb 225 if (gDebug == 2)
226 Info("CreateGeometry","XU%d = %f, %f\n", i, envelopA[5], envelopA[6]);
c13b5a7c 227
a1469a24 228 } // end i
f590bb15 229
c13b5a7c 230
231 // Create one mini-envelope which will contain the last Tower scintillator (XU(nlayers-1)/2)
232
f590bb15 233 label = "XU" ;
234 label += i ;
c13b5a7c 235 envelopA[5] = envelopA[6] ; // rmin at z1
236 envelopA[4] = geom->ZFromEtaR(envelopA[5],
237 geom->GetArm1EtaMin()); // z coordinate 1
238 envelopA[7] = geom->ZFromEtaR(envelopA[5],
239 geom->GetArm1EtaMax()); // z coordinate 2
ca148d5b 240 if (geom->GetNHCLayers() == 0) // last scintillator is in ECAL
241 envelopA[6] = envelopA[5] + geom->GetECScintThick() ; // rmax at z1
242 else // last scintillator is in HCAL
243 envelopA[6] = envelopA[5] + geom->GetECScintThick() ; // rmax at z1
c13b5a7c 244 envelopA[8] = envelopA[5] ; // radii are the same.
245 envelopA[9] = envelopA[6] ; // radii are the same.
246
247 gMC->Gsvolu(label.Data(), "PGON", idtmed[1599], envelopA, 10); // Polygone filled with air
248
a63e0d5e 249 // Position the last minienvelope in XEN1
c13b5a7c 250
f590bb15 251 gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
252
c27ad3fb 253 if(gDebug == 2)
254 Info("CreateGeometry","XEN%d = %f, %f\n", i, envelopA[5], envelopA[6]);
f590bb15 255
a1469a24 256 // Create the shapes of active material (LEAD/Aluminium/Scintillator)
a1469a24 257 // to be placed
ffa6d63b 258 Float_t envelopB[10]; // First Layer of Aluminium
259 Float_t envelopC[10]; // Scintillator Layers
a1469a24 260 Float_t envelopD[10]; // Lead Layers
261
c13b5a7c 262 envelopC[0] = envelopD[0] = envelopB[0] = envelopA[0] ; // starting position in Phi
263 envelopC[1] = envelopD[1] = envelopB[1] = envelopA[1] ; // angular range in phi
264 envelopC[2] = envelopD[2] = envelopB[2] = envelopA[2] ; // number of sections in Phi
265 envelopD[3] = envelopC[3] = envelopB[3] = envelopA[3] ; // 2 z coordinates
a1469a24 266
c27ad3fb 267 Float_t dist = geom->GetEnvelop(0) + geom->GetAlFrontThickness() + geom->GetGap2Active() ;
268 envelopB[4] = geom->ZFromEtaR(dist,
c13b5a7c 269 geom->GetArm1EtaMin()); // z co-ordinate 1
270 envelopB[5] = geom->GetEnvelop(0) ; // rmin at z1
271 envelopB[6] = envelopB[5] + geom->GetAlFrontThickness();// rmax at z1
c27ad3fb 272 envelopB[7] = geom->ZFromEtaR(dist,
c13b5a7c 273 geom->GetArm1EtaMax()); // z co-ordinate 2
274 envelopB[8] = envelopB[5] ; // radii are the same.
275 envelopB[9] = envelopB[6] ; // radii are the same.
ffa6d63b 276
c13b5a7c 277 // Define active volumes completely
278
279 gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10); // PGON filled with Al
280
281 gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ; // Position Aluminium Layer in XEN1
a1469a24 282
c13b5a7c 283 gMC->Gsvolu("XPST", "PGON", idtmed[1601], dum, 0); // PGON filled with Scintillator (shape to be defined by GSPOSP)
284
285 gMC->Gsvolu("XPBX", "PGON", idtmed[1600], dum, 0); // PGON filled with Lead (shape to be defined by GSPOSP)
286
a63e0d5e 287 gMC->Gsvolu("XCUX", "PGON", idtmed[1603], dum, 0); // PGON filled with Copper (shape to be defined by GSPOSP)
288
c13b5a7c 289 gMC->Gsdvn("XPHI", "XPST", geom->GetNPhi(), 2); // Divide eta section of scintillators into phi segments.
290
291 // Position alternatively scintillator and Lead Layers in XUi.
a1469a24 292
c13b5a7c 293 envelopD[6] = envelopB[6] + geom->GetGap2Active() ;// gap between Al layer and XU0
a63e0d5e 294
295 for (int i = 0; i < nLayers; i++ ){
296 label = "XU" ;
297 label += static_cast<Int_t> (i/2) ; // we will place two layers (i = one layer) in each mini envelope)
298
299 Float_t scthick ; // scintillator thickness
300 if ( i < geom->GetNPRLayers() ) // its a preshower
ca148d5b 301 scthick = geom->GetPRScintThick() ;
a63e0d5e 302 else if( i < geom->GetNPRLayers() + geom->GetNECLayers() ) // its an EMCAL section
ca148d5b 303 scthick = geom->GetECScintThick() ;
a63e0d5e 304 else // its an HCAL section
ca148d5b 305 scthick = geom->GetHCScintThick() ;
a63e0d5e 306
307 envelopC[5] = envelopD[6] ; //rmin
308 envelopC[6] = envelopC[5] + scthick ; //rmax
309 envelopC[8] = envelopC[5] ; //rmin
310 envelopC[9] = envelopC[6] ; //rmax
311
312
313 // envelopC[6] = envelopD[6] + ((i > 1) ? geom->GetFullSintThick() : geom->GetPreSintThick());//rmax larger for first two layers (preshower)
314 // envelopC[9] = envelopD[6] + ((i > 1 ) ? geom->GetFullSintThick() :geom->GetPreSintThick());//rmax larger for first two layers (preshower)
315
c27ad3fb 316 if(gDebug == 2 )
317 Info("CreateGeometry", "volume = %s, name = XPST thickness = %f deb = %f/%f fin = %f/%f", label.Data(), scthick, envelopC[5], envelopC[8], envelopC[6], envelopC[9]) ;
a63e0d5e 318
319 for (int j =0; j < (geom->GetNEta()) ; j++){
320 etamin = geom->GetArm1EtaMin()+
321 (j*geom->GetDeltaEta());
322 etamax = geom->GetArm1EtaMin()+
323 ((j+1)*geom->GetDeltaEta());
324 envelopC[4] = geom->ZFromEtaR(envelopC[5],etamin); //z begin
325 envelopC[7] = geom->ZFromEtaR(envelopC[5],etamax);// z end
326
327 gMC->Gsposp("XPST",1+j+i*(geom->GetNEta()), label.Data(),
328 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
329 } // end for j
330
331 if (i < nLayers){
332 Float_t radthick ; // radiator thickness
333 TString radname ; // radiator name
334 if ( i <= 1 ) { // its a preshower
ca148d5b 335 radthick = geom->GetPRPbRadThick();
a63e0d5e 336 radname = "XPBX" ;
337 }
338 else if( i <= geom->GetNECLayers()) {// its an EMCAL section
ca148d5b 339 radthick = geom->GetECPbRadThick();
a63e0d5e 340 radname = "XPBX" ;
341 }
342 else { // its an HCAL section
ca148d5b 343 radthick = geom->GetHCCuRadThick();
a63e0d5e 344 radname = "XCUX" ;
345 }
346
347 if ( i < nLayers -1 ) { // except for the last XU which contains only one scintillator layer
348
349 envelopD[5] = envelopC[6] ; //rmin
350 envelopD[8] = envelopD[5] ; //rmin
351 envelopD[6] = envelopD[5] + radthick ; // rmax
352 // envelopD[6] = envelopC[6] + geom->GetPbRadThick(); //rmax
353 envelopD[9] = envelopD[6] ; //rmax
354 // envelopD[9] = envelopC[6] + geom->GetPbRadThick(); //rmax
c27ad3fb 355
356 if(gDebug == 2 )
357 Info("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]) ;
a63e0d5e 358
359 for (int j =0; j < (geom->GetNEta()) ; j++){
05a92d59 360 etamin = geom->GetArm1EtaMin()+
a63e0d5e 361 (j*geom->GetDeltaEta());
05a92d59 362 etamax = geom->GetArm1EtaMin()+
a63e0d5e 363 ((j+1)*geom->GetDeltaEta());
364 envelopD[4] = geom->ZFromEtaR(envelopD[5],etamin);//z begin
365 envelopD[7] = geom->ZFromEtaR(envelopD[5],etamax);// z end
366
367 // Position and Define Layer
368
369 gMC->Gsposp(radname.Data(),1+j+i*(geom->GetNEta()), label.Data(),
370 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10);
371 } // end for j
372 } // if not last layer
373 } // end if i
61e0abb5 374 } // for i
2012850d 375}
a1469a24 376
b13bbe81 377//______________________________________________________________________
05a92d59 378void AliEMCALv0::Init(void)
379{
b13bbe81 380 // Just prints an information message
9859bfc0 381
382 if(fDebug) {
383 TString message("\n") ;
c27ad3fb 384 message += "*****************************************\n" ;
05a92d59 385
b13bbe81 386 // Here the EMCAL initialisation code (if any!)
9859bfc0 387
05a92d59 388 AliEMCALGeometry * geom = GetGeometry() ;
9859bfc0 389
390 if (geom!=0) {
391 message += "AliEMCAL " ;
392 message += Version() ;
c27ad3fb 393 message += "EMCAL geometry initialized for " ;
9859bfc0 394 message += geom->GetName() ;
395 }
396 else {
397 message += "AliEMCAL " ;
398 message += Version() ;
399 message += "EMCAL geometry initialization failed !" ;
05a92d59 400 }
c27ad3fb 401 message += "\n*****************************************" ;
9859bfc0 402 Info("Init", message.Data() ) ;
403 }
2012850d 404}