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