updating
[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$ */
17
18//_________________________________________________________________________
19// Base Class for EMCAL description:
ffa6d63b 20// This class contains material definitions
21// for the EMCAL - It does not place the detector in Alice
2012850d 22//*-- Author: Yves Schutz (SUBATECH)
b13bbe81 23//
24//*-- Additional Contributions: Sahal Yacoob (LBNL/UCT)
25//
2012850d 26//////////////////////////////////////////////////////////////////////////////
27
2012850d 28// --- ROOT system ---
b13bbe81 29class TFile;
88cb7938 30#include <TFolder.h>
88cb7938 31#include <TTree.h>
32#include <TVirtualMC.h>
2012850d 33
05a92d59 34// --- Standard library ---
2012850d 35
05a92d59 36// --- AliRoot header files ---
2012850d 37#include "AliMagF.h"
8367ce9a 38#include "AliESDCaloTrack.h"
39#include "AliESD.h"
88cb7938 40#include "AliEMCAL.h"
8367ce9a 41#include "AliEMCALGetter.h"
85a5290f 42#include "AliRun.h"
43#include "AliEMCALSDigitizer.h"
44#include "AliEMCALDigitizer.h"
8367ce9a 45#include "AliEMCALReconstructioner.h"
2012850d 46
47ClassImp(AliEMCAL)
2012850d 48//____________________________________________________________________________
49AliEMCAL::AliEMCAL():AliDetector()
50{
05a92d59 51 // Default ctor
52 fName="EMCAL";
1d7b3dd6 53 fGeom = 0 ;
2012850d 54}
05a92d59 55
2012850d 56//____________________________________________________________________________
05a92d59 57AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title)
58{
59 // ctor : title is used to identify the layout
1fe0f889 60 fGeom = 0;
2012850d 61}
05a92d59 62
2012850d 63//____________________________________________________________________________
05a92d59 64AliEMCAL::~AliEMCAL()
65{
66
2012850d 67}
68
69//____________________________________________________________________________
8367ce9a 70void AliEMCAL::Copy(AliEMCAL & emcal)
71{
72 TObject::Copy(emcal) ;
73}
74
75//____________________________________________________________________________
76AliDigitizer* AliEMCAL::CreateDigitizer(AliRunDigitizer* manager) const
77{
78 return new AliEMCALDigitizer(manager);
79}
80
81//____________________________________________________________________________
05a92d59 82void AliEMCAL::CreateMaterials()
83{
2012850d 84 // Definitions of materials to build EMCAL and associated tracking media.
85 // media number in idtmed are 1599 to 1698.
86
87 // --- Air ---
88 AliMaterial(0, "Air$", 14.61, 7.3, 0.001205, 30420., 67500., 0, 0) ;
89
b13bbe81 90
2012850d 91 // --- Lead ---
92 AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
93
b13bbe81 94
95 // --- The polysterene scintillator (CH) ---
96 Float_t aP[2] = {12.011, 1.00794} ;
97 Float_t zP[2] = {6.0, 1.0} ;
98 Float_t wP[2] = {1.0, 1.0} ;
99 Float_t dP = 1.032 ;
100
101 AliMixture(2, "Polystyrene$", aP, zP, dP, -2, wP) ;
102
103 // --- Aluminium ---
104 AliMaterial(3, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
105 // --- Absorption length is ignored ^
106
2012850d 107 // DEFINITION OF THE TRACKING MEDIA
108
109 // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
110 Int_t * idtmed = fIdtmed->GetArray() - 1599 ;
111 Int_t isxfld = gAlice->Field()->Integ() ;
112 Float_t sxmgmx = gAlice->Field()->Max() ;
b13bbe81 113
114
2012850d 115
116 // Air -> idtmed[1599]
117 AliMedium(0, "Air $", 0, 0,
118 isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
119
a63e0d5e 120 // The Lead -> idtmed[1600]
2012850d 121
122 AliMedium(1, "Lead $", 1, 0,
123 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
124
b13bbe81 125 // The scintillator of the CPV made of Polystyrene scintillator -> idtmed[1601]
126 AliMedium(2, "CPV scint. $", 2, 1,
61e0abb5 127 isxfld, sxmgmx, 10.0, 0.001, 0.1, 0.001, 0.001, 0, 0) ;
b13bbe81 128
a63e0d5e 129 // Various Aluminium parts made of Al -> idtmed[1602]
b13bbe81 130 AliMedium(3, "Al parts $", 3, 0,
131 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
132
2012850d 133
b13bbe81 134// --- Set decent energy thresholds for gamma and electron tracking
2012850d 135
136 // Tracking threshold for photons and electrons in Lead
ffa6d63b 137 gMC->Gstpar(idtmed[1600],"CUTGAM",0.00008) ;
138 gMC->Gstpar(idtmed[1600],"CUTELE",0.001) ;
139 gMC->Gstpar(idtmed[1600],"BCUTE",0.0001) ;
2012850d 140
141 // --- Generate explicitly delta rays in Lead ---
142 gMC->Gstpar(idtmed[1600], "LOSS",3.) ;
143 gMC->Gstpar(idtmed[1600], "DRAY",1.) ;
05a92d59 144 gMC->Gstpar(idtmed[1600], "DCUTE",0.00001) ;
145 gMC->Gstpar(idtmed[1600], "DCUTM",0.00001) ;
146
a63e0d5e 147// --- in aluminium parts ---
b13bbe81 148 gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
149 gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
05a92d59 150 gMC->Gstpar(idtmed[1602], "DCUTE",0.00001) ;
151 gMC->Gstpar(idtmed[1602], "DCUTM",0.00001) ;
b13bbe81 152
ffa6d63b 153// --- and finally thresholds for photons and electrons in the scintillator ---
61e0abb5 154 gMC->Gstpar(idtmed[1601],"CUTGAM",0.00008) ;
155 gMC->Gstpar(idtmed[1601],"CUTELE",0.001) ;
156 gMC->Gstpar(idtmed[1601],"BCUTE",0.0001) ;
157
2012850d 158}
05a92d59 159
160//____________________________________________________________________________
8367ce9a 161void AliEMCAL::FillESD(AliESD* esd) const
162{
163 // Fill the ESD with all RecParticles
164 AliEMCALGetter *gime = AliEMCALGetter::Instance( (fLoader->GetRunLoader()->GetFileName()).Data() );
165 gime->Event(gime->EventNumber(), "P") ;
166 TClonesArray *recParticles = gime->RecParticles();
167 Int_t nOfRecParticles = recParticles->GetEntries();
168 for (Int_t recpart=0; recpart<nOfRecParticles; recpart++) {
169 AliESDCaloTrack *ct = new AliESDCaloTrack((AliEMCALRecParticle*)recParticles->At(recpart));
170 esd->AddCaloTrack(ct);
171 }
172 Info("FillESD", "Added %d RecParticles to ESD", nOfRecParticles) ;
173}
174
175
176//____________________________________________________________________________
177void AliEMCAL::Hits2SDigits()
178{
179// create summable digits
180
181 AliEMCALSDigitizer* emcalDigitizer =
182 new AliEMCALSDigitizer(fLoader->GetRunLoader()->GetFileName().Data());
183 emcalDigitizer->ExecuteTask();
184}
185
186//____________________________________________________________________________
187AliLoader* AliEMCAL::MakeLoader(const char* topfoldername)
188{
189//different behaviour than standard (singleton getter)
190// --> to be discussed and made eventually coherent
191 fLoader = new AliEMCALLoader(GetName(),topfoldername);
192 return fLoader;
193}
194
195//____________________________________________________________________________
196void AliEMCAL::Reconstruct() const
197{
198 AliEMCALReconstructioner rec((AliRunLoader::GetRunLoader()->GetFileName()).Data()) ;
199 rec.ExecuteTask() ;
05a92d59 200}
201
2012850d 202//____________________________________________________________________________
203void AliEMCAL::SetTreeAddress()
204{
d64c959b 205 // Linking Hits in Tree to Hits array
2012850d 206 TBranch *branch;
207 char branchname[20];
208 sprintf(branchname,"%s",GetName());
209
210 // Branch address for hit tree
88cb7938 211 TTree *treeH = TreeH();
212 if (treeH) {
2012850d 213 branch = treeH->GetBranch(branchname);
88cb7938 214 if (branch)
215 {
d64c959b 216 if (fHits == 0x0)
217 fHits= new TClonesArray("AliEMCALHit",1000);
88cb7938 218 branch->SetAddress(&fHits);
219 }
220 else
221 {
222 Warning("SetTreeAddress","<%s> Failed",GetName());
223 }
2012850d 224 }
2012850d 225}
2012850d 226
85a5290f 227
85a5290f 228
85a5290f 229
8367ce9a 230