]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCAL.cxx
Cleanup of collisions geometries and headers.
[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 // Base Class for EMCAL description:
19 // This class contains material definitions    
20 // for the EMCAL - It does not place the detector in Alice
21 //*-- Author: Yves Schutz (SUBATECH) 
22 //
23 //*-- Additional Contributions: Sahal Yacoob (LBNL/UCT)
24 //
25 //////////////////////////////////////////////////////////////////////////////
26
27 // --- ROOT system ---
28 class TFile;
29 #include <TFolder.h> 
30 #include <TGeoGlobalMagField.h>
31 #include <TGraph.h> 
32 #include <TH1F.h> 
33 #include <TRandom.h> 
34 #include <TTree.h>
35 #include <TVirtualMC.h> 
36
37 // --- Standard library ---
38
39 // --- AliRoot header files ---
40 #include "AliMagF.h"
41 #include "AliEMCAL.h"
42 #include "AliRun.h"
43 #include "AliEMCALLoader.h"
44 #include "AliEMCALSDigitizer.h"
45 #include "AliEMCALDigitizer.h"
46 #include "AliEMCALDigit.h"
47 #include "AliEMCALRawUtils.h"
48 #include "AliCDBManager.h"
49 #include "AliCDBEntry.h"
50
51 ClassImp(AliEMCAL)
52
53 //____________________________________________________________________________
54 AliEMCAL::AliEMCAL()
55   : AliDetector(),
56     fBirkC0(0),
57     fBirkC1(0.),
58     fBirkC2(0.),
59     fGeometry(0)
60 {
61   // Default ctor 
62   fName = "EMCAL" ;
63   InitConstants();
64
65   // Should call  AliEMCALGeometry::GetInstance(EMCAL->GetTitle(),"") for getting EMCAL geometry
66 }
67
68 //____________________________________________________________________________
69 AliEMCAL::AliEMCAL(const char* name, const char* title)
70   : AliDetector(name,title),
71     fBirkC0(0),
72     fBirkC1(0.),
73     fBirkC2(0.),
74     fGeometry(0)
75 {
76   //   ctor : title is used to identify the layout
77   InitConstants();
78 }
79
80 //____________________________________________________________________________
81 AliEMCAL::~AliEMCAL()
82 {
83   //dtor
84 }
85
86 //____________________________________________________________________________
87 void AliEMCAL::InitConstants()
88 {
89   //initialize EMCAL values
90   fBirkC0 = 1;
91   fBirkC1 = 0.013/1.032;
92   fBirkC2 = 9.6e-6/(1.032 * 1.032);
93   }
94
95 //Not needed, modify $ALICE_ROOT/data/galice.cuts instead.
96 //Load the modified one in the configuration file with SetTransPar
97 // //____________________________________________________________________________
98 // void AliEMCAL::DefineMediumParameters()
99 // {
100 //   //
101 //   // EMCAL cuts (Geant3) 
102 //   // 
103 //   Int_t * idtmed = fIdtmed->GetArray() - 1599 ; 
104 // // --- Set decent energy thresholds for gamma and electron tracking
105
106 //   // Tracking threshold for photons and electrons in Lead 
107 //   Float_t cutgam=10.e-5; // 100 kev;
108 //   Float_t cutele=10.e-5; // 100 kev;
109 //   TString ntmp(GetTitle()); 
110 //   ntmp.ToUpper();
111 //   if(ntmp.Contains("10KEV")) {
112 //     cutele = cutgam = 1.e-5;
113 //   } else if(ntmp.Contains("50KEV")) {
114 //     cutele = cutgam = 5.e-5;
115 //   } else if(ntmp.Contains("100KEV")) {
116 //     cutele = cutgam = 1.e-4;
117 //   } else if(ntmp.Contains("200KEV")) {
118 //     cutele = cutgam = 2.e-4;
119 //   } else if(ntmp.Contains("500KEV")) {
120 //     cutele = cutgam = 5.e-4;
121 //   }
122
123 //   gMC->Gstpar(idtmed[1600],"CUTGAM", cutgam);
124 //   gMC->Gstpar(idtmed[1600],"CUTELE", cutele); // 1MEV -> 0.1MEV; 15-aug-05
125 //   gMC->Gstpar(idtmed[1600],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
126 //   gMC->Gstpar(idtmed[1600],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
127 //   // --- Generate explicitly delta rays in Lead ---
128 //   gMC->Gstpar(idtmed[1600], "LOSS", 3) ;
129 //   gMC->Gstpar(idtmed[1600], "DRAY", 1) ;
130 //   gMC->Gstpar(idtmed[1600], "DCUTE", cutele) ;
131 //   gMC->Gstpar(idtmed[1600], "DCUTM", cutele) ;
132
133 // // --- in aluminium parts ---
134 //   gMC->Gstpar(idtmed[1602],"CUTGAM", cutgam) ;
135 //   gMC->Gstpar(idtmed[1602],"CUTELE", cutele) ;
136 //   gMC->Gstpar(idtmed[1602],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
137 //   gMC->Gstpar(idtmed[1602],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
138 //   gMC->Gstpar(idtmed[1602], "LOSS",3.) ;
139 //   gMC->Gstpar(idtmed[1602], "DRAY",1.) ;
140 //   gMC->Gstpar(idtmed[1602], "DCUTE", cutele) ;
141 //   gMC->Gstpar(idtmed[1602], "DCUTM", cutele) ;
142
143 // // --- and finally thresholds for photons and electrons in the scintillator ---
144 //   gMC->Gstpar(idtmed[1601],"CUTGAM", cutgam) ;
145 //   gMC->Gstpar(idtmed[1601],"CUTELE", cutele) ;// 1MEV -> 0.1MEV; 15-aug-05
146 //   gMC->Gstpar(idtmed[1601],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
147 //   gMC->Gstpar(idtmed[1601],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
148 //   gMC->Gstpar(idtmed[1601], "LOSS",3) ; // generate delta rays 
149 //   gMC->Gstpar(idtmed[1601], "DRAY",1) ;
150 //   gMC->Gstpar(idtmed[1601], "DCUTE", cutele) ;
151 //   gMC->Gstpar(idtmed[1601], "DCUTM", cutele) ;
152
153 //   // S steel - 
154 //   gMC->Gstpar(idtmed[1603],"CUTGAM", cutgam);
155 //   gMC->Gstpar(idtmed[1603],"CUTELE", cutele);
156 //   gMC->Gstpar(idtmed[1603],"BCUTE",  cutgam);  // BCUTE and BCUTM start from GUTGUM
157 //   gMC->Gstpar(idtmed[1603],"BCUTM",  cutgam);  // BCUTE and BCUTM start from GUTGUM
158 //   // --- Generate explicitly delta rays 
159 //   gMC->Gstpar(idtmed[1603], "LOSS",3);
160 //   gMC->Gstpar(idtmed[1603], "DRAY",1);
161 //   gMC->Gstpar(idtmed[1603], "DCUTE", cutele) ;
162 //   gMC->Gstpar(idtmed[1603], "DCUTM", cutele) ;
163
164 //   AliEMCALGeometry* geom = GetGeometry();
165 //   if(geom->GetILOSS()>=0) {
166 //     for(int i=1600; i<=1603; i++) gMC->Gstpar(idtmed[i], "LOSS", geom->GetILOSS()) ; 
167 //   } 
168 //   if(geom->GetIHADR()>=0) {
169 //     for(int i=1600; i<=1603; i++) gMC->Gstpar(idtmed[i], "HADR", geom->GetIHADR()) ; 
170 //   }
171 // }
172
173 //____________________________________________________________________________
174 AliDigitizer* AliEMCAL::CreateDigitizer(AliRunDigitizer* manager) const
175 {
176   //create and return the digitizer
177   return new AliEMCALDigitizer(manager);
178 }
179
180 //____________________________________________________________________________
181 void AliEMCAL::CreateMaterials()
182 {
183   // Definitions of materials to build EMCAL and associated tracking media.
184   // media number in idtmed are 1599 to 1698.
185   // --- Air ---               
186   Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
187   Float_t zAir[4]={6.,7.,8.,18.};
188   Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
189   Float_t dAir = 1.20479E-3;
190   AliMixture(0, "Air$", aAir, zAir, dAir, 4, wAir) ;
191
192   // --- Lead ---                                                                     
193   AliMaterial(1, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
194
195
196   // --- The polysterene scintillator (CH) ---
197   Float_t aP[2] = {12.011, 1.00794} ;
198   Float_t zP[2] = {6.0, 1.0} ;
199   Float_t wP[2] = {1.0, 1.0} ;
200   Float_t dP = 1.032 ;
201
202   AliMixture(2, "Polystyrene$", aP, zP, dP, -2, wP) ;
203
204   // --- Aluminium ---
205   AliMaterial(3, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
206   // ---         Absorption length is ignored ^
207
208   // 25-aug-04 by PAI - see  PMD/AliPMDv0.cxx for STEEL definition
209   Float_t asteel[4] = { 55.847,51.9961,58.6934,28.0855 };
210   Float_t zsteel[4] = { 26.,24.,28.,14. };
211   Float_t wsteel[4] = { .715,.18,.1,.005 };
212   AliMixture(4, "STAINLESS STEEL$", asteel, zsteel, 7.88, 4, wsteel);
213
214   // DEFINITION OF THE TRACKING MEDIA
215
216   // for EMCAL: idtmed[1599->1698] equivalent to fIdtmed[0->100]
217   Int_t   isxfld = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ() ;
218   Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max() ;
219
220   // Air                                                                         -> idtmed[1599]
221  AliMedium(0, "Air$", 0, 0,
222              isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
223
224   // The Lead                                                                      -> idtmed[1600]
225  
226   AliMedium(1, "Lead$", 1, 0,
227              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
228
229  // The scintillator of the CPV made of Polystyrene scintillator                   -> idtmed[1601]
230   float deemax = 0.1; // maximum fractional energy loss in one step (0 < DEEMAX < deemax )
231   AliMedium(2, "Scintillator$", 2, 1,
232             isxfld, sxmgmx, 10.0, 0.001, deemax, 0.001, 0.001, 0, 0) ;
233
234   // Various Aluminium parts made of Al                                            -> idtmed[1602]
235   AliMedium(3, "Al$", 3, 0,
236              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
237
238   // 25-aug-04 by PAI : see  PMD/AliPMDv0.cxx for STEEL definition                 -> idtmed[1603]
239   AliMedium(4, "S steel$", 4, 0, 
240              isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
241
242
243   //set constants for Birk's Law implentation
244   fBirkC0 =  1;
245   fBirkC1 =  0.013/dP;
246   fBirkC2 =  9.6e-6/(dP * dP);
247
248 }
249
250 //____________________________________________________________________________
251 void  AliEMCAL::Init()
252
253   // Init
254   //Not needed, modify $ALICE_ROOT/data/galice.cuts instead.
255   //Load the modified one in the configuration file with SetTransPar
256   //DefineMediumParameters(); 
257 }     
258
259 //____________________________________________________________________________
260 void AliEMCAL::Digits2Raw() {
261
262   static AliEMCALRawUtils rawUtils;
263   rawUtils.Digits2Raw();
264
265 }
266 //____________________________________________________________________________
267 void AliEMCAL::Hits2SDigits()  
268
269 // create summable digits
270
271   GetGeometry();
272   AliEMCALSDigitizer emcalDigitizer(fLoader->GetRunLoader()->GetFileName().Data()) ;
273   emcalDigitizer.SetEventRange(0, -1) ; // do all the events
274   emcalDigitizer.ExecuteTask() ;
275 }
276
277 //____________________________________________________________________________
278
279 AliLoader* AliEMCAL::MakeLoader(const char* topfoldername)
280 {
281 //different behaviour than standard (singleton getter)
282 // --> to be discussed and made eventually coherent
283  fLoader = new AliEMCALLoader(GetName(),topfoldername);
284  return fLoader;
285 }