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