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