]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCAL.cxx
Fixed sprintf, so that the pointer address is printed correctly
[u/mrichter/AliRoot.git] / EMCAL / AliEMCAL.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 **************************************************************************/
15
16/* $Id$ */
2012850d 17//_________________________________________________________________________
18// Base Class for EMCAL description:
ffa6d63b 19// This class contains material definitions
20// for the EMCAL - It does not place the detector in Alice
2012850d 21//*-- Author: Yves Schutz (SUBATECH)
b13bbe81 22//
23//*-- Additional Contributions: Sahal Yacoob (LBNL/UCT)
24//
2012850d 25//////////////////////////////////////////////////////////////////////////////
26
2012850d 27// --- ROOT system ---
b13bbe81 28class TFile;
88cb7938 29#include <TFolder.h>
f7a1cc68 30#include <TGeoGlobalMagField.h>
31#include <TGraph.h>
046ae904 32#include <TH1F.h>
046ae904 33#include <TRandom.h>
f7a1cc68 34#include <TTree.h>
35#include <TVirtualMC.h>
2012850d 36
05a92d59 37// --- Standard library ---
2012850d 38
05a92d59 39// --- AliRoot header files ---
2012850d 40#include "AliMagF.h"
88cb7938 41#include "AliEMCAL.h"
85a5290f 42#include "AliRun.h"
5dee926e 43#include "AliEMCALLoader.h"
85a5290f 44#include "AliEMCALSDigitizer.h"
45#include "AliEMCALDigitizer.h"
5dee926e 46#include "AliEMCALDigit.h"
ee299369 47#include "AliEMCALRawUtils.h"
3294dade 48#include "AliCDBManager.h"
49#include "AliCDBEntry.h"
50
2012850d 51ClassImp(AliEMCAL)
4884333f 52
2012850d 53//____________________________________________________________________________
18a21c7c 54AliEMCAL::AliEMCAL()
55 : AliDetector(),
56 fBirkC0(0),
57 fBirkC1(0.),
58 fBirkC2(0.),
23ef18ac 59 fGeometry(0)
2012850d 60{
05a92d59 61 // Default ctor
046ae904 62 fName = "EMCAL" ;
7235aed2 63 InitConstants();
65bdc82f 64
23ef18ac 65 // Should call AliEMCALGeometry::GetInstance(EMCAL->GetTitle(),"") for getting EMCAL geometry
2012850d 66}
05a92d59 67
2012850d 68//____________________________________________________________________________
18a21c7c 69AliEMCAL::AliEMCAL(const char* name, const char* title)
70 : AliDetector(name,title),
71 fBirkC0(0),
72 fBirkC1(0.),
73 fBirkC2(0.),
23ef18ac 74 fGeometry(0)
05a92d59 75{
76 // ctor : title is used to identify the layout
7235aed2 77 InitConstants();
0a4cb131 78}
79
2012850d 80//____________________________________________________________________________
05a92d59 81AliEMCAL::~AliEMCAL()
82{
14ce0a6e 83 //dtor
2012850d 84}
85
0a4cb131 86//____________________________________________________________________________
7235aed2 87void AliEMCAL::InitConstants()
0a4cb131 88{
89 //initialize EMCAL values
90 fBirkC0 = 1;
91 fBirkC1 = 0.013/1.032;
92 fBirkC2 = 9.6e-6/(1.032 * 1.032);
ee299369 93 }
0a4cb131 94
b8a520ff 95//Not needed, modify $ALICE_ROOT/data/galice.cuts instead.
96//Load the modified one in the configuration file with SetTransPar
97// //____________________________________________________________________________
98// void AliEMCAL::DefineMediumParameters()
99// {
100// //
101// // EMCAL cuts (Geant3)
102// //
103// Int_t * idtmed = fIdtmed->GetArray() - 1599 ;
104// // --- Set decent energy thresholds for gamma and electron tracking
105
106// // Tracking threshold for photons and electrons in Lead
107// Float_t cutgam=10.e-5; // 100 kev;
108// Float_t cutele=10.e-5; // 100 kev;
109// TString ntmp(GetTitle());
110// ntmp.ToUpper();
111// if(ntmp.Contains("10KEV")) {
112// cutele = cutgam = 1.e-5;
113// } else if(ntmp.Contains("50KEV")) {
114// cutele = cutgam = 5.e-5;
115// } else if(ntmp.Contains("100KEV")) {
116// cutele = cutgam = 1.e-4;
117// } else if(ntmp.Contains("200KEV")) {
118// cutele = cutgam = 2.e-4;
119// } else if(ntmp.Contains("500KEV")) {
120// cutele = cutgam = 5.e-4;
121// }
122
123// gMC->Gstpar(idtmed[1600],"CUTGAM", cutgam);
124// gMC->Gstpar(idtmed[1600],"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
125// gMC->Gstpar(idtmed[1600],"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
126// gMC->Gstpar(idtmed[1600],"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
127// // --- Generate explicitly delta rays in Lead ---
128// gMC->Gstpar(idtmed[1600], "LOSS", 3) ;
129// gMC->Gstpar(idtmed[1600], "DRAY", 1) ;
130// gMC->Gstpar(idtmed[1600], "DCUTE", cutele) ;
131// gMC->Gstpar(idtmed[1600], "DCUTM", cutele) ;
132
133// // --- in aluminium parts ---
134// gMC->Gstpar(idtmed[1602],"CUTGAM", cutgam) ;
135// gMC->Gstpar(idtmed[1602],"CUTELE", cutele) ;
136// gMC->Gstpar(idtmed[1602],"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
137// gMC->Gstpar(idtmed[1602],"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
138// gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
139// gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
140// gMC->Gstpar(idtmed[1602], "DCUTE", cutele) ;
141// gMC->Gstpar(idtmed[1602], "DCUTM", cutele) ;
142
143// // --- and finally thresholds for photons and electrons in the scintillator ---
144// gMC->Gstpar(idtmed[1601],"CUTGAM", cutgam) ;
145// gMC->Gstpar(idtmed[1601],"CUTELE", cutele) ;// 1MEV -> 0.1MEV; 15-aug-05
146// gMC->Gstpar(idtmed[1601],"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
147// gMC->Gstpar(idtmed[1601],"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
148// gMC->Gstpar(idtmed[1601], "LOSS",3) ; // generate delta rays
149// gMC->Gstpar(idtmed[1601], "DRAY",1) ;
150// gMC->Gstpar(idtmed[1601], "DCUTE", cutele) ;
151// gMC->Gstpar(idtmed[1601], "DCUTM", cutele) ;
152
153// // S steel -
154// gMC->Gstpar(idtmed[1603],"CUTGAM", cutgam);
155// gMC->Gstpar(idtmed[1603],"CUTELE", cutele);
156// gMC->Gstpar(idtmed[1603],"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
157// gMC->Gstpar(idtmed[1603],"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
158// // --- Generate explicitly delta rays
159// gMC->Gstpar(idtmed[1603], "LOSS",3);
160// gMC->Gstpar(idtmed[1603], "DRAY",1);
161// gMC->Gstpar(idtmed[1603], "DCUTE", cutele) ;
162// gMC->Gstpar(idtmed[1603], "DCUTM", cutele) ;
163
164// AliEMCALGeometry* geom = GetGeometry();
165// if(geom->GetILOSS()>=0) {
166// for(int i=1600; i<=1603; i++) gMC->Gstpar(idtmed[i], "LOSS", geom->GetILOSS()) ;
167// }
168// if(geom->GetIHADR()>=0) {
169// for(int i=1600; i<=1603; i++) gMC->Gstpar(idtmed[i], "HADR", geom->GetIHADR()) ;
170// }
171// }
7235aed2 172
173//____________________________________________________________________________
174AliDigitizer* AliEMCAL::CreateDigitizer(AliRunDigitizer* manager) const
175{
176 //create and return the digitizer
177 return new AliEMCALDigitizer(manager);
178}
179
180//____________________________________________________________________________
181void AliEMCAL::CreateMaterials()
182{
183 // Definitions of materials to build EMCAL and associated tracking media.
184 // media number in idtmed are 1599 to 1698.
185 // --- Air ---
186 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
187 Float_t zAir[4]={6.,7.,8.,18.};
188 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
189 Float_t dAir = 1.20479E-3;
190 AliMixture(0, "Air$", aAir, zAir, dAir, 4, wAir) ;
191
192 // --- Lead ---
193 AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
194
195
196 // --- The polysterene scintillator (CH) ---
197 Float_t aP[2] = {12.011, 1.00794} ;
198 Float_t zP[2] = {6.0, 1.0} ;
199 Float_t wP[2] = {1.0, 1.0} ;
200 Float_t dP = 1.032 ;
201
202 AliMixture(2, "Polystyrene$", aP, zP, dP, -2, wP) ;
203
204 // --- Aluminium ---
205 AliMaterial(3, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
206 // --- Absorption length is ignored ^
207
208 // 25-aug-04 by PAI - see PMD/AliPMDv0.cxx for STEEL definition
209 Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
210 Float_t zsteel[4] = { 26.,24.,28.,14. };
211 Float_t wsteel[4] = { .715,.18,.1,.005 };
212 AliMixture(4, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
213
214 // DEFINITION OF THE TRACKING MEDIA
215
216 // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
f7a1cc68 217 Int_t isxfld = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ() ;
218 Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max() ;
7235aed2 219
220 // Air -> idtmed[1599]
221 AliMedium(0, "Air$", 0, 0,
222 isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
223
224 // The Lead -> idtmed[1600]
225
226 AliMedium(1, "Lead$", 1, 0,
227 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
228
229 // The scintillator of the CPV made of Polystyrene scintillator -> idtmed[1601]
ee299369 230 float deemax = 0.1; // maximum fractional energy loss in one step (0 < DEEMAX < deemax )
7235aed2 231 AliMedium(2, "Scintillator$", 2, 1,
232 isxfld, sxmgmx, 10.0, 0.001, deemax, 0.001, 0.001, 0, 0) ;
233
234 // Various Aluminium parts made of Al -> idtmed[1602]
235 AliMedium(3, "Al$", 3, 0,
236 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
237
238 // 25-aug-04 by PAI : see PMD/AliPMDv0.cxx for STEEL definition -> idtmed[1603]
239 AliMedium(4, "S steel$", 4, 0,
240 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
241
89557f6d 242
ab37d09c 243 //set constants for Birk's Law implentation
244 fBirkC0 = 1;
245 fBirkC1 = 0.013/dP;
246 fBirkC2 = 9.6e-6/(dP * dP);
247
2012850d 248}
dde0a601 249
250//____________________________________________________________________________
251void AliEMCAL::Init()
b8a520ff 252{
253 // Init
254 //Not needed, modify $ALICE_ROOT/data/galice.cuts instead.
255 //Load the modified one in the configuration file with SetTransPar
256 //DefineMediumParameters();
dde0a601 257}
258
2d5d9e60 259//____________________________________________________________________________
ee299369 260void AliEMCAL::Digits2Raw() {
65bdc82f 261
262 static AliEMCALRawUtils rawUtils;
263 rawUtils.Digits2Raw();
264
2d5d9e60 265}
8367ce9a 266//____________________________________________________________________________
267void AliEMCAL::Hits2SDigits()
268{
269// create summable digits
270
ddca522a 271 GetGeometry();
4d33c797 272 AliEMCALSDigitizer emcalDigitizer(fLoader->GetRunLoader()->GetFileName().Data()) ;
273 emcalDigitizer.SetEventRange(0, -1) ; // do all the events
274 emcalDigitizer.ExecuteTask() ;
da480a28 275}
276
8367ce9a 277//____________________________________________________________________________
5dee926e 278
8367ce9a 279AliLoader* AliEMCAL::MakeLoader(const char* topfoldername)
280{
281//different behaviour than standard (singleton getter)
282// --> to be discussed and made eventually coherent
283 fLoader = new AliEMCALLoader(GetName(),topfoldername);
284 return fLoader;
285}