corrected a typo in a if statement in Init (why did it compile before ! the granulari...
[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;
2012850d 30#include "TBranch.h"
31#include "TClonesArray.h"
32#include "TTree.h"
33
05a92d59 34// --- Standard library ---
70479d0e 35#include <Rstrstream.h>
2012850d 36
05a92d59 37// --- AliRoot header files ---
2012850d 38#include "AliEMCAL.h"
2012850d 39#include "AliRun.h"
40#include "AliMagF.h"
05a92d59 41#include "AliEMCALGeometry.h"
42//#include "AliEMCALQAChecker.h"
2012850d 43
44ClassImp(AliEMCAL)
2012850d 45//____________________________________________________________________________
46AliEMCAL::AliEMCAL():AliDetector()
47{
05a92d59 48 // Default ctor
49 fName="EMCAL";
50 //fQATask = 0;
51 fTreeQA = 0;
2012850d 52}
05a92d59 53
2012850d 54//____________________________________________________________________________
05a92d59 55AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title)
56{
57 // ctor : title is used to identify the layout
58
59 //fQATask = 0;
60 fTreeQA = 0;
2012850d 61}
05a92d59 62
2012850d 63//____________________________________________________________________________
05a92d59 64AliEMCAL::~AliEMCAL()
65{
66
2012850d 67}
68
69//____________________________________________________________________________
05a92d59 70void AliEMCAL::CreateMaterials()
71{
2012850d 72 // Definitions of materials to build EMCAL and associated tracking media.
73 // media number in idtmed are 1599 to 1698.
74
75 // --- Air ---
76 AliMaterial(0, "Air$", 14.61, 7.3, 0.001205, 30420., 67500., 0, 0) ;
77
b13bbe81 78
2012850d 79 // --- Lead ---
80 AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
81
b13bbe81 82
83 // --- The polysterene scintillator (CH) ---
84 Float_t aP[2] = {12.011, 1.00794} ;
85 Float_t zP[2] = {6.0, 1.0} ;
86 Float_t wP[2] = {1.0, 1.0} ;
87 Float_t dP = 1.032 ;
88
89 AliMixture(2, "Polystyrene$", aP, zP, dP, -2, wP) ;
90
91 // --- Aluminium ---
92 AliMaterial(3, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
93 // --- Absorption length is ignored ^
94
95
2012850d 96
97 // DEFINITION OF THE TRACKING MEDIA
98
99 // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
100 Int_t * idtmed = fIdtmed->GetArray() - 1599 ;
101 Int_t isxfld = gAlice->Field()->Integ() ;
102 Float_t sxmgmx = gAlice->Field()->Max() ;
b13bbe81 103
104
2012850d 105
106 // Air -> idtmed[1599]
107 AliMedium(0, "Air $", 0, 0,
108 isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
109
110 // The Lead -> idtmed[1600]
111
112 AliMedium(1, "Lead $", 1, 0,
113 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
114
b13bbe81 115
116 // The scintillator of the CPV made of Polystyrene scintillator -> idtmed[1601]
117 AliMedium(2, "CPV scint. $", 2, 1,
61e0abb5 118 isxfld, sxmgmx, 10.0, 0.001, 0.1, 0.001, 0.001, 0, 0) ;
b13bbe81 119
120 // Various Aluminium parts made of Al -> idtmed[1602]
121 AliMedium(3, "Al parts $", 3, 0,
122 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
123
124
2012850d 125
2012850d 126
b13bbe81 127// --- Set decent energy thresholds for gamma and electron tracking
2012850d 128
129 // Tracking threshold for photons and electrons in Lead
ffa6d63b 130 gMC->Gstpar(idtmed[1600],"CUTGAM",0.00008) ;
131 gMC->Gstpar(idtmed[1600],"CUTELE",0.001) ;
132 gMC->Gstpar(idtmed[1600],"BCUTE",0.0001) ;
2012850d 133
134 // --- Generate explicitly delta rays in Lead ---
135 gMC->Gstpar(idtmed[1600], "LOSS",3.) ;
136 gMC->Gstpar(idtmed[1600], "DRAY",1.) ;
05a92d59 137 gMC->Gstpar(idtmed[1600], "DCUTE",0.00001) ;
138 gMC->Gstpar(idtmed[1600], "DCUTM",0.00001) ;
139
b13bbe81 140// --- and in aluminium parts ---
141 gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
142 gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
05a92d59 143 gMC->Gstpar(idtmed[1602], "DCUTE",0.00001) ;
144 gMC->Gstpar(idtmed[1602], "DCUTM",0.00001) ;
b13bbe81 145
61e0abb5 146
ffa6d63b 147// --- and finally thresholds for photons and electrons in the scintillator ---
61e0abb5 148 gMC->Gstpar(idtmed[1601],"CUTGAM",0.00008) ;
149 gMC->Gstpar(idtmed[1601],"CUTELE",0.001) ;
150 gMC->Gstpar(idtmed[1601],"BCUTE",0.0001) ;
151
152
2012850d 153}
05a92d59 154
155//____________________________________________________________________________
156AliEMCALGeometry * AliEMCAL::GetGeometry() const
157{
158 // gets the pointer to the AliEMCALGeometry unique instance
159
160 return AliEMCALGeometry::GetInstance(GetTitle(),"") ;
161
162}
163
2012850d 164//____________________________________________________________________________
165void AliEMCAL::SetTreeAddress()
166{
167
168 TBranch *branch;
169 char branchname[20];
170 sprintf(branchname,"%s",GetName());
171
172 // Branch address for hit tree
173 TTree *treeH = gAlice->TreeH();
174 if (treeH && fHits) {
175 branch = treeH->GetBranch(branchname);
176 if (branch) branch->SetAddress(&fHits);
177 }
2012850d 178}
179
05a92d59 180//____________________________________________________________________________
181void AliEMCAL::WriteQA()
182{
183
184 // Make TreeQA in the output file.
185
186 if(fTreeQA == 0)
187 fTreeQA = new TTree("TreeQA", "QA Alarms") ;
188 // Create Alarms branches
189// Int_t bufferSize = 32000 ;
190// Int_t splitlevel = 0 ;
191// TFolder * alarmsF = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS") ;
192// TString branchName(alarmsF->GetName());
193// TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel);
194// TString branchTitle = branchName + " QA alarms" ;
195// alarmsBranch->SetTitle(branchTitle);
196// alarmsBranch->Fill() ;
197
198 //fTreeQA->Fill() ;
199}
2012850d 200