]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliEMCAL.cxx
Removing .cvsignore files
[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$ */
4884333f 17/* History of cvs commits:
18 *
19 * $Log$
5a6bfeed 20
21 * Revision 1.54 2007/12/06 10:31:13 hristov
22 * Bug fix: using the mapping from CDB
23 *
3294dade 24 * Revision 1.53.10.1 2007/12/06 10:29:59 hristov
25 * Bug fix: using the mapping from CDB
26 *
27 * Revision 1.53 2007/03/17 19:56:38 mvl
28 * Moved signal shape routines from AliEMCAL to separate class AliEMCALRawUtils to streamline raw data reconstruction code.
29 *
ee299369 30 * Revision 1.52 2007/03/10 22:19:01 pavlinov
31 * move one varibels from AliEMCALv2 to AliEMCAL
32 *
23ef18ac 33 * Revision 1.51 2007/02/24 20:42:35 pavlinov
34 * fixed error of Geant3 parameters initialisation
35 *
91e5f344 36 * Revision 1.50 2007/02/05 10:43:25 hristov
37 * Changes for correct initialization of Geant4 (Mihaela)
38 *
7235aed2 39 * Revision 1.49 2007/01/22 17:29:12 pavlinov
40 * EMCAL geometry can be created independently form anything now
41 *
89557f6d 42 * Revision 1.48 2006/12/19 02:34:13 pavlinov
43 * clean up the EMCAL name scheme : super module -> module -> tower (or cell)
44 *
2bb3725c 45 * Revision 1.47 2006/12/05 17:12:03 gustavo
46 * Updated AliEMCAL::Digits2Raw, reads first provisional RCU mapping files to make Raw data with new AliCaloAltroMapping and AliCaloRawStream
47 *
4884333f 48 *
49 */
2012850d 50//_________________________________________________________________________
51// Base Class for EMCAL description:
ffa6d63b 52// This class contains material definitions
53// for the EMCAL - It does not place the detector in Alice
2012850d 54//*-- Author: Yves Schutz (SUBATECH)
b13bbe81 55//
56//*-- Additional Contributions: Sahal Yacoob (LBNL/UCT)
57//
2012850d 58//////////////////////////////////////////////////////////////////////////////
59
2012850d 60// --- ROOT system ---
b13bbe81 61class TFile;
88cb7938 62#include <TFolder.h>
88cb7938 63#include <TTree.h>
64#include <TVirtualMC.h>
046ae904 65#include <TH1F.h>
046ae904 66#include <TRandom.h>
2d5d9e60 67#include <TGraph.h>
2012850d 68
05a92d59 69// --- Standard library ---
2012850d 70
05a92d59 71// --- AliRoot header files ---
2012850d 72#include "AliMagF.h"
88cb7938 73#include "AliEMCAL.h"
85a5290f 74#include "AliRun.h"
5dee926e 75#include "AliEMCALLoader.h"
85a5290f 76#include "AliEMCALSDigitizer.h"
77#include "AliEMCALDigitizer.h"
5dee926e 78#include "AliEMCALDigit.h"
ee299369 79#include "AliEMCALRawUtils.h"
3294dade 80#include "AliCDBManager.h"
81#include "AliCDBEntry.h"
82
2012850d 83
84ClassImp(AliEMCAL)
4884333f 85
2012850d 86//____________________________________________________________________________
18a21c7c 87AliEMCAL::AliEMCAL()
88 : AliDetector(),
89 fBirkC0(0),
90 fBirkC1(0.),
91 fBirkC2(0.),
23ef18ac 92 fGeometry(0)
2012850d 93{
05a92d59 94 // Default ctor
046ae904 95 fName = "EMCAL" ;
7235aed2 96 InitConstants();
23ef18ac 97 // Should call AliEMCALGeometry::GetInstance(EMCAL->GetTitle(),"") for getting EMCAL geometry
2012850d 98}
05a92d59 99
2012850d 100//____________________________________________________________________________
18a21c7c 101AliEMCAL::AliEMCAL(const char* name, const char* title)
102 : AliDetector(name,title),
103 fBirkC0(0),
104 fBirkC1(0.),
105 fBirkC2(0.),
23ef18ac 106 fGeometry(0)
05a92d59 107{
108 // ctor : title is used to identify the layout
7235aed2 109 InitConstants();
0a4cb131 110}
111
2012850d 112//____________________________________________________________________________
05a92d59 113AliEMCAL::~AliEMCAL()
114{
14ce0a6e 115 //dtor
2012850d 116}
117
0a4cb131 118//____________________________________________________________________________
7235aed2 119void AliEMCAL::InitConstants()
0a4cb131 120{
121 //initialize EMCAL values
122 fBirkC0 = 1;
123 fBirkC1 = 0.013/1.032;
124 fBirkC2 = 9.6e-6/(1.032 * 1.032);
ee299369 125 }
0a4cb131 126
8367ce9a 127//____________________________________________________________________________
91e5f344 128void AliEMCAL::DefineMediumParameters()
05a92d59 129{
91e5f344 130 //
131 // EMCAL cuts (Geant3)
132 //
2012850d 133 Int_t * idtmed = fIdtmed->GetArray() - 1599 ;
b13bbe81 134// --- Set decent energy thresholds for gamma and electron tracking
2012850d 135
136 // Tracking threshold for photons and electrons in Lead
905263da 137 Float_t cutgam=10.e-5; // 100 kev;
138 Float_t cutele=10.e-5; // 100 kev;
139 TString ntmp(GetTitle());
140 ntmp.ToUpper();
141 if(ntmp.Contains("10KEV")) {
142 cutele = cutgam = 1.e-5;
143 } else if(ntmp.Contains("50KEV")) {
144 cutele = cutgam = 5.e-5;
145 } else if(ntmp.Contains("100KEV")) {
146 cutele = cutgam = 1.e-4;
147 } else if(ntmp.Contains("200KEV")) {
148 cutele = cutgam = 2.e-4;
149 } else if(ntmp.Contains("500KEV")) {
150 cutele = cutgam = 5.e-4;
151 }
2012850d 152
905263da 153 gMC->Gstpar(idtmed[1600],"CUTGAM", cutgam);
154 gMC->Gstpar(idtmed[1600],"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
155 gMC->Gstpar(idtmed[1600],"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
156 gMC->Gstpar(idtmed[1600],"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
2012850d 157 // --- Generate explicitly delta rays in Lead ---
89557f6d 158 gMC->Gstpar(idtmed[1600], "LOSS", 3) ;
159 gMC->Gstpar(idtmed[1600], "DRAY", 1) ;
905263da 160 gMC->Gstpar(idtmed[1600], "DCUTE", cutele) ;
161 gMC->Gstpar(idtmed[1600], "DCUTM", cutele) ;
05a92d59 162
a63e0d5e 163// --- in aluminium parts ---
905263da 164 gMC->Gstpar(idtmed[1602],"CUTGAM", cutgam) ;
165 gMC->Gstpar(idtmed[1602],"CUTELE", cutele) ;
166 gMC->Gstpar(idtmed[1602],"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
167 gMC->Gstpar(idtmed[1602],"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
b13bbe81 168 gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
169 gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
905263da 170 gMC->Gstpar(idtmed[1602], "DCUTE", cutele) ;
171 gMC->Gstpar(idtmed[1602], "DCUTM", cutele) ;
b13bbe81 172
ffa6d63b 173// --- and finally thresholds for photons and electrons in the scintillator ---
905263da 174 gMC->Gstpar(idtmed[1601],"CUTGAM", cutgam) ;
175 gMC->Gstpar(idtmed[1601],"CUTELE", cutele) ;// 1MEV -> 0.1MEV; 15-aug-05
176 gMC->Gstpar(idtmed[1601],"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
177 gMC->Gstpar(idtmed[1601],"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
89557f6d 178 gMC->Gstpar(idtmed[1601], "LOSS",3) ; // generate delta rays
179 gMC->Gstpar(idtmed[1601], "DRAY",1) ;
905263da 180 gMC->Gstpar(idtmed[1601], "DCUTE", cutele) ;
181 gMC->Gstpar(idtmed[1601], "DCUTM", cutele) ;
182
183 // S steel -
184 gMC->Gstpar(idtmed[1603],"CUTGAM", cutgam);
185 gMC->Gstpar(idtmed[1603],"CUTELE", cutele);
186 gMC->Gstpar(idtmed[1603],"BCUTE", cutgam); // BCUTE and BCUTM start from GUTGUM
187 gMC->Gstpar(idtmed[1603],"BCUTM", cutgam); // BCUTE and BCUTM start from GUTGUM
188 // --- Generate explicitly delta rays
89557f6d 189 gMC->Gstpar(idtmed[1603], "LOSS",3);
190 gMC->Gstpar(idtmed[1603], "DRAY",1);
905263da 191 gMC->Gstpar(idtmed[1603], "DCUTE", cutele) ;
192 gMC->Gstpar(idtmed[1603], "DCUTM", cutele) ;
1963b290 193
7235aed2 194 AliEMCALGeometry* geom = GetGeometry();
89557f6d 195 if(geom->GetILOSS()>=0) {
196 for(int i=1600; i<=1603; i++) gMC->Gstpar(idtmed[i], "LOSS", geom->GetILOSS()) ;
197 }
198 if(geom->GetIHADR()>=0) {
199 for(int i=1600; i<=1603; i++) gMC->Gstpar(idtmed[i], "HADR", geom->GetIHADR()) ;
200 }
7235aed2 201}
202
203//____________________________________________________________________________
204AliDigitizer* AliEMCAL::CreateDigitizer(AliRunDigitizer* manager) const
205{
206 //create and return the digitizer
207 return new AliEMCALDigitizer(manager);
208}
209
210//____________________________________________________________________________
211void AliEMCAL::CreateMaterials()
212{
213 // Definitions of materials to build EMCAL and associated tracking media.
214 // media number in idtmed are 1599 to 1698.
215 // --- Air ---
216 Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
217 Float_t zAir[4]={6.,7.,8.,18.};
218 Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
219 Float_t dAir = 1.20479E-3;
220 AliMixture(0, "Air$", aAir, zAir, dAir, 4, wAir) ;
221
222 // --- Lead ---
223 AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
224
225
226 // --- The polysterene scintillator (CH) ---
227 Float_t aP[2] = {12.011, 1.00794} ;
228 Float_t zP[2] = {6.0, 1.0} ;
229 Float_t wP[2] = {1.0, 1.0} ;
230 Float_t dP = 1.032 ;
231
232 AliMixture(2, "Polystyrene$", aP, zP, dP, -2, wP) ;
233
234 // --- Aluminium ---
235 AliMaterial(3, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
236 // --- Absorption length is ignored ^
237
238 // 25-aug-04 by PAI - see PMD/AliPMDv0.cxx for STEEL definition
239 Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
240 Float_t zsteel[4] = { 26.,24.,28.,14. };
241 Float_t wsteel[4] = { .715,.18,.1,.005 };
242 AliMixture(4, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
243
244 // DEFINITION OF THE TRACKING MEDIA
245
246 // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
247 Int_t isxfld = gAlice->Field()->Integ() ;
248 Float_t sxmgmx = gAlice->Field()->Max() ;
249
250 // Air -> idtmed[1599]
251 AliMedium(0, "Air$", 0, 0,
252 isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
253
254 // The Lead -> idtmed[1600]
255
256 AliMedium(1, "Lead$", 1, 0,
257 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
258
259 // The scintillator of the CPV made of Polystyrene scintillator -> idtmed[1601]
ee299369 260 float deemax = 0.1; // maximum fractional energy loss in one step (0 < DEEMAX < deemax )
7235aed2 261 AliMedium(2, "Scintillator$", 2, 1,
262 isxfld, sxmgmx, 10.0, 0.001, deemax, 0.001, 0.001, 0, 0) ;
263
264 // Various Aluminium parts made of Al -> idtmed[1602]
265 AliMedium(3, "Al$", 3, 0,
266 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
267
268 // 25-aug-04 by PAI : see PMD/AliPMDv0.cxx for STEEL definition -> idtmed[1603]
269 AliMedium(4, "S steel$", 4, 0,
270 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
271
89557f6d 272
ab37d09c 273 //set constants for Birk's Law implentation
274 fBirkC0 = 1;
275 fBirkC1 = 0.013/dP;
276 fBirkC2 = 9.6e-6/(dP * dP);
277
91e5f344 278 // Call just in case of Geant3; What to do in case of Geant4 ?
279 if(gMC->InheritsFrom("TGeant3")) DefineMediumParameters(); // Feb 20, 2007
2012850d 280}
2d5d9e60 281//____________________________________________________________________________
ee299369 282void AliEMCAL::Digits2Raw() {
283 static AliEMCALRawUtils rawUtil;
3294dade 284 //Get Mapping RCU files from the AliEMCALRecParam
5a6bfeed 285 static AliCDBEntry* entry = AliCDBManager::Instance()->Get("EMCAL/Calib/Mapping");
3294dade 286 const TObjArray* maps = 0x0;
287 if(entry)
288 maps = (TObjArray*)entry->GetObject();
289
290 if(!maps) AliFatal("Cannot retrieve ALTRO mappings!!");
291
292 AliAltroMapping * mapping[2] ; // For the moment only 2
293 for(Int_t i = 0; i < 2; i++) {
294 mapping[i] = (AliAltroMapping*)maps->At(i);
295 }
296 rawUtil.Digits2Raw(mapping);
2d5d9e60 297}
8367ce9a 298//____________________________________________________________________________
299void AliEMCAL::Hits2SDigits()
300{
301// create summable digits
302
ddca522a 303 GetGeometry();
4d33c797 304 AliEMCALSDigitizer emcalDigitizer(fLoader->GetRunLoader()->GetFileName().Data()) ;
305 emcalDigitizer.SetEventRange(0, -1) ; // do all the events
306 emcalDigitizer.ExecuteTask() ;
da480a28 307}
308
8367ce9a 309//____________________________________________________________________________
5dee926e 310
8367ce9a 311AliLoader* AliEMCAL::MakeLoader(const char* topfoldername)
312{
313//different behaviour than standard (singleton getter)
314// --> to be discussed and made eventually coherent
315 fLoader = new AliEMCALLoader(GetName(),topfoldername);
316 return fLoader;
317}