]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCAL.cxx
revised geometry, fully parametrized and including HCAL possibility
[u/mrichter/AliRoot.git] / EMCAL / AliEMCAL.cxx
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:
20 // This class contains material definitions    
21 // for the EMCAL - It does not place the detector in Alice
22 //*-- Author: Yves Schutz (SUBATECH) 
23 //
24 //*-- Additional Contributions: Sahal Yacoob (LBNL/UCT)
25 //
26 //////////////////////////////////////////////////////////////////////////////
27
28 // --- ROOT system ---
29 class TFile;
30 #include "TBranch.h" 
31 #include "TClonesArray.h" 
32 #include "TTree.h" 
33
34 // --- Standard library ---
35 #include <Rstrstream.h>
36
37 // --- AliRoot header files ---
38 #include "AliEMCAL.h"
39 #include "AliRun.h"
40 #include "AliMagF.h"
41 #include "AliEMCALGeometry.h"
42 //#include "AliEMCALQAChecker.h" 
43
44 ClassImp(AliEMCAL)
45 //____________________________________________________________________________
46 AliEMCAL::AliEMCAL():AliDetector()
47 {
48   // Default ctor 
49   fName="EMCAL";
50   //fQATask = 0;
51   fTreeQA = 0;
52   fGeom = 0 ; 
53 }
54
55 //____________________________________________________________________________
56 AliEMCAL::AliEMCAL(const char* name, const char* title): AliDetector(name,title)
57 {
58   //   ctor : title is used to identify the layout
59   
60   fGeom = AliEMCALGeometry::GetInstance(GetTitle(),"") ; 
61   //fQATask = 0;
62   fTreeQA = 0;
63 }
64
65 //____________________________________________________________________________
66 AliEMCAL::~AliEMCAL()
67 {
68
69 }
70
71 //____________________________________________________________________________
72 void AliEMCAL::CreateMaterials()
73 {
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
80
81   // --- Lead ---                                                                     
82   AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
83
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   // --- Copper ---
98   AliMaterial(4, "Cu$", 63.546, 29, 8.96, 1.43, 14.8, 0, 0) ; 
99   // ---         Absorption length is ignored ^
100
101
102   // DEFINITION OF THE TRACKING MEDIA
103
104   // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
105   Int_t * idtmed = fIdtmed->GetArray() - 1599 ; 
106   Int_t   isxfld = gAlice->Field()->Integ() ;
107   Float_t sxmgmx = gAlice->Field()->Max() ;
108  
109
110
111    // Air                                                                           -> idtmed[1599] 
112   AliMedium(0, "Air          $", 0, 0,
113              isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
114
115   // The Lead                                                                      -> idtmed[1600]
116  
117   AliMedium(1, "Lead      $", 1, 0,
118              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
119
120  
121  // The scintillator of the CPV made of Polystyrene scintillator                   -> idtmed[1601]
122   AliMedium(2, "CPV scint.   $", 2, 1,
123             isxfld, sxmgmx, 10.0, 0.001, 0.1, 0.001, 0.001, 0, 0) ;
124
125   // Various Aluminium parts made of Al                                            -> idtmed[1602]
126   AliMedium(3, "Al parts     $", 3, 0,
127              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
128
129   // Copper for HCal (post shower)                                                 -> idtmed[1603]
130   AliMedium(4, "Copper       $", 4, 0,
131              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
132
133
134
135 // --- Set decent energy thresholds for gamma and electron tracking
136
137   // Tracking threshold for photons and electrons in Lead 
138   gMC->Gstpar(idtmed[1600],"CUTGAM",0.00008) ;
139   gMC->Gstpar(idtmed[1600],"CUTELE",0.001) ;
140   gMC->Gstpar(idtmed[1600],"BCUTE",0.0001) ;
141
142   // --- Generate explicitly delta rays in Lead ---
143   gMC->Gstpar(idtmed[1600], "LOSS",3.) ;
144   gMC->Gstpar(idtmed[1600], "DRAY",1.) ;
145   gMC->Gstpar(idtmed[1600], "DCUTE",0.00001) ;
146   gMC->Gstpar(idtmed[1600], "DCUTM",0.00001) ;
147
148 // --- in aluminium parts ---
149   gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
150   gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
151   gMC->Gstpar(idtmed[1602], "DCUTE",0.00001) ;
152   gMC->Gstpar(idtmed[1602], "DCUTM",0.00001) ;
153
154 // --- in copper parts ---
155   gMC->Gstpar(idtmed[1603], "LOSS",3.) ;
156   gMC->Gstpar(idtmed[1603], "DRAY",1.) ;
157   gMC->Gstpar(idtmed[1603], "DCUTE",0.00001) ;
158   gMC->Gstpar(idtmed[1603], "DCUTM",0.00001) ;
159
160
161
162 // --- and finally thresholds for photons and electrons in the scintillator ---
163   gMC->Gstpar(idtmed[1601],"CUTGAM",0.00008) ;
164   gMC->Gstpar(idtmed[1601],"CUTELE",0.001) ;
165   gMC->Gstpar(idtmed[1601],"BCUTE",0.0001) ;
166
167
168 }
169
170 //____________________________________________________________________________
171 AliEMCALGeometry * AliEMCAL::GetGeometry() const 
172 {  
173   // gets the pointer to the AliEMCALGeometry unique instance 
174
175   if (fGeom) 
176     return fGeom ; 
177   else 
178     return AliEMCALGeometry::GetInstance(GetTitle(),"") ;  
179 }
180
181 //____________________________________________________________________________
182 void AliEMCAL::SetTreeAddress()
183
184
185   TBranch *branch;
186   char branchname[20];
187   sprintf(branchname,"%s",GetName());
188   
189   // Branch address for hit tree
190   TTree *treeH = gAlice->TreeH();
191   if (treeH && fHits) {
192     branch = treeH->GetBranch(branchname);
193     if (branch) branch->SetAddress(&fHits);
194   }
195 }
196
197 //____________________________________________________________________________
198 void AliEMCAL::WriteQA()
199 {
200
201   // Make TreeQA in the output file. 
202
203   if(fTreeQA == 0)
204     fTreeQA = new TTree("TreeQA", "QA Alarms") ;    
205   // Create Alarms branches
206 //   Int_t bufferSize = 32000 ;    
207 //   Int_t splitlevel = 0 ; 
208 //   TFolder * alarmsF = (TFolder*)gROOT->FindObjectAny("Folders/Run/Conditions/QA/PHOS") ; 
209 //   TString branchName(alarmsF->GetName());  
210 //   TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel);
211 //   TString branchTitle = branchName + " QA alarms" ; 
212 //   alarmsBranch->SetTitle(branchTitle);
213 //   alarmsBranch->Fill() ; 
214
215   //fTreeQA->Fill() ; 
216 }
217