]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCALv0.cxx
switch on special cuts process
[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"
53#include "AliMC.h"
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{
b13bbe81 96 // Create the EMCAL geometry for Geant
2012850d 97
a1469a24 98 Float_t etamin,etamax;
3ca04a8a 99 Float_t *dum=0;
100
05a92d59 101 AliEMCALGeometry * geom = GetGeometry() ;
a1469a24 102
05a92d59 103 if(!(geom->IsInitialized())){
a1469a24 104 Error("CreateGeometry","EMCAL Geometry class has not been set up.");
b13bbe81 105 } // end if
a1469a24 106
b13bbe81 107 // Get pointer to the array containing media indices
108 Int_t *idtmed = fIdtmed->GetArray() - 1599 ;
e13bd4f0 109
ffa6d63b 110 // Create an Envelope within which to place the Detector
a1469a24 111 Float_t envelopA[5];
05a92d59 112 envelopA[0] = geom->GetEnvelop(0); // rmin
113 envelopA[1] = geom->GetEnvelop(1); // rmax
114 envelopA[2] = geom->GetEnvelop(2)/2.0; // dz
115 envelopA[3] = geom->GetArm1PhiMin(); // minimun phi angle
116 envelopA[4] = geom->GetArm1PhiMax(); // maximun phi angle
a1469a24 117
118 // create XEN1
b13bbe81 119 gMC->Gsvolu("XEN1", "TUBS ", idtmed[1599], envelopA, 5) ; //filled with air
09641ef5 120 Int_t idrotm = 1;
121 AliMatrix(idrotm, 90.0, 0., 90.0, 90.0, 0.0, 0.0) ;
122
a1469a24 123 // Position the EMCAL Mother Volume in Alice
71d7e6ad 124 gMC->Gspos("XEN1", 1, "ALIC", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
a1469a24 125
a1469a24 126 //
09641ef5 127 TString label = "XU0";
128
a1469a24 129 //rmin Start mini envelopes after the aluminium layer
05a92d59 130 envelopA[0] = geom->GetEnvelop(0) + geom->GetGap2Active() +
131 geom->GetAlFrontThickness();
09641ef5 132
a1469a24 133 //rmax larger for first two layers (preshower);
05a92d59 134 Float_t tseg = geom->GetPreSintThick()+geom->GetPbRadThick();
a1469a24 135 envelopA[1] = envelopA[0] + 2.0*tseg;
05a92d59 136 envelopA[2] = geom->GetEnvelop(2)/2.0; // dz
137 envelopA[3] = geom->GetArm1PhiMin(); // minimun phi angle
138 envelopA[4] = geom->GetArm1PhiMax(); // maximun phi angle
a1469a24 139
140 //filled with air
a1469a24 141 gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
142
143 // Place XU0 in to XEN1
a1469a24 144 gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY");
145
05a92d59 146 tseg = geom->GetFullSintThick()+geom->GetPbRadThick();
147 for (int i = 1; i < ((geom->GetNLayers()-1)/2) + 1 ; i++ ){
a1469a24 148 label = "XU" ;
a1469a24 149 label += i ;
a1469a24 150 envelopA[0] = envelopA[1]; //rmin
a1469a24 151 envelopA[1] = envelopA[0] + 2.0*tseg; //rmax
152
05a92d59 153 //filled with air
a1469a24 154 gMC->Gsvolu(label.Data(), "TUBS ", idtmed[1599], envelopA, 5);
a1469a24 155 gMC->Gspos(label.Data(), 1, "XEN1", 0.0, 0.0, 0.0, idrotm, "ONLY") ;
a1469a24 156 } // end i
157
a1469a24 158 // Create the shapes of active material (LEAD/Aluminium/Scintillator)
a1469a24 159 // to be placed
ffa6d63b 160 Float_t envelopB[10]; // First Layer of Aluminium
161 Float_t envelopC[10]; // Scintillator Layers
a1469a24 162 Float_t envelopD[10]; // Lead Layers
163
164 //starting position in Phi
05a92d59 165 envelopC[0] = envelopD[0] = envelopB[0] = geom->GetArm1PhiMin();
a1469a24 166
167 // Angular size of the Detector in Phi
05a92d59 168 envelopB[1] = geom->GetArm1PhiMax() - geom->GetArm1PhiMin();
a1469a24 169 envelopC[1] = envelopD[1] = envelopB[1];
170
171 // Number of Section in Phi
05a92d59 172 envelopC[2] = envelopD[2] = envelopB[2] = geom->GetNPhi();
a1469a24 173
174 // each section will be passed 2 z coordinates
a1469a24 175 envelopD[3] = envelopC[3] = envelopB[3] = 2;
05a92d59 176 envelopB[4] = geom->ZFromEtaR(geom->GetEnvelop(0)+geom->GetGap2Active(),
177 geom->GetArm1EtaMin());// z co-ordinate 1
178 envelopB[5] = geom->GetEnvelop(0) + geom->GetGap2Active(); //rmin at z1
179 envelopB[6] = envelopB[5] + geom->GetAlFrontThickness();//rmax at z1
a1469a24 180 envelopD[6] = envelopB[6];
05a92d59 181 envelopB[7] = geom->ZFromEtaR(geom->GetEnvelop(0)+geom->GetGap2Active(),
182 geom->GetArm1EtaMax()); // z co-ordinate 2
ffa6d63b 183 envelopB[8] = envelopB[5] ; //
184 envelopB[9] = envelopB[6] ; // radii are the same.
185
186 // filled shapes wit hactive material
a1469a24 187
188 // Define Aluminium volume completely
a1469a24 189 gMC->Gsvolu("XALU", "PGON", idtmed[1602], envelopB, 10);
190
191 // The polystyrene layers will be defined when placed
3ca04a8a 192 gMC->Gsvolu("XPST", "PGON", idtmed[1601], dum, 0);
3ca04a8a 193 gMC->Gsvolu("XPBX", "PGON", idtmed[1600], dum, 0);// as will the lead layers
a1469a24 194
195 // Dividind eta polystyrene divisions into phi segments.
05a92d59 196 gMC->Gsdvn("XPHI", "XPST", geom->GetNPhi(), 2);
a1469a24 197
ffa6d63b 198 // Position Aluminium Layer in the Envelope
61e0abb5 199 gMC->Gspos("XALU", 1, "XEN1", 0.0, 0.0, 0.0 , idrotm, "ONLY") ;
b13bbe81 200
a1469a24 201 // The loop below places the scintillator in Lead Layers alternately.
05a92d59 202 for (int i = 0; i < geom->GetNLayers() ; i++ ){
a1469a24 203 label = "XU" ;
09641ef5 204 label += (int) i/2 ; // we will place two layers (i = one layer) in each mini envelope)
205 envelopC[5] = envelopD[6] ; //rmin
05a92d59 206 envelopC[6] = envelopD[6] + ((i > 1) ? geom->GetFullSintThick() :
207 geom->GetPreSintThick());//rmax larger for first two layers (preshower)
b13bbe81 208 envelopC[8] = envelopD[6] ; //rmin
05a92d59 209 envelopC[9] = envelopD[6] + ((i > 1 ) ? geom->GetFullSintThick() :
210 geom->GetPreSintThick());//rmax larger for first two layers (preshower)
211 for (int j =0; j < (geom->GetNEta()) ; j++){
212 etamin = geom->GetArm1EtaMin()+
213 (j*geom->GetDeltaEta());
214 etamax = geom->GetArm1EtaMin()+
215 ((j+1)*geom->GetDeltaEta());
216 envelopC[4] = geom->ZFromEtaR(envelopD[6],etamin); //z begin
217 envelopC[7] = geom->ZFromEtaR(envelopD[6],etamax);// z end
218 gMC->Gsposp("XPST",1+j+i*(geom->GetNEta()), label.Data(), // should be used but there's a weird crash above i = 18,
ffa6d63b 219 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopC, 10); // Position and define layer
b13bbe81 220 } // end for j
a1469a24 221
05a92d59 222 if (i < (geom->GetNLayers()-1)){
a1469a24 223 envelopD[5] = envelopC[6] ; //rmin
05a92d59 224 envelopD[6] = envelopC[6] + geom->GetPbRadThick(); //rmax
b13bbe81 225 envelopD[8] = envelopC[6] ; //rmin
05a92d59 226 envelopD[9] = envelopC[6] + geom->GetPbRadThick(); //rmax
227 for (int j =0; j < (geom->GetNEta()) ; j++){
228 etamin = geom->GetArm1EtaMin()+
229 (j*geom->GetDeltaEta());
230 etamax = geom->GetArm1EtaMin()+
231 ((j+1)*geom->GetDeltaEta());
232 envelopD[4] = geom->ZFromEtaR(envelopC[6],etamin);//z begin
233 envelopD[7] = geom->ZFromEtaR(envelopC[6],etamax);// z end
a1469a24 234
235 // Position and Define Layer
05a92d59 236 gMC->Gsposp("XPBX",1+ j+i*(geom->GetNEta()), label.Data(),
a1469a24 237 0.0, 0.0, 0.0 , idrotm, "ONLY", envelopD, 10);
b13bbe81 238 } // end for j
239 } // end if i
61e0abb5 240 } // for i
2012850d 241}
a1469a24 242
b13bbe81 243//______________________________________________________________________
05a92d59 244void AliEMCALv0::Init(void)
245{
b13bbe81 246 // Just prints an information message
9859bfc0 247
248 if(fDebug) {
249 TString message("\n") ;
250 message += "*****************************************" ;
05a92d59 251
b13bbe81 252 // Here the EMCAL initialisation code (if any!)
9859bfc0 253
05a92d59 254 AliEMCALGeometry * geom = GetGeometry() ;
9859bfc0 255
256 if (geom!=0) {
257 message += "AliEMCAL " ;
258 message += Version() ;
259 message += "EMCAL geometry intialized for " ;
260 message += geom->GetName() ;
261 }
262 else {
263 message += "AliEMCAL " ;
264 message += Version() ;
265 message += "EMCAL geometry initialization failed !" ;
05a92d59 266 }
9859bfc0 267 message += "*****************************************" ;
268 Info("Init", message.Data() ) ;
269 }
2012850d 270}