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