]>
Commit | Line | Data |
---|---|---|
4c039060 | 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 | **************************************************************************/ | |
b2a60966 | 15 | /* $Id$ */ |
16 | ||
d15a28e7 | 17 | //_________________________________________________________________________ |
b2a60966 | 18 | // Base Class for PHOS description: |
19 | // PHOS consists of a PbWO4 calorimeter (EMCA) and a gazeous charged | |
20 | // particles detector (CPV or PPSD). | |
21 | // The only provided method here is CreateMaterials, | |
22 | // which defines the materials common to all PHOS versions. | |
23 | // | |
24 | //*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH) | |
d15a28e7 | 25 | ////////////////////////////////////////////////////////////////////////////// |
e84be1eb | 26 | |
fdeead01 | 27 | |
fe4da5cc | 28 | // --- ROOT system --- |
2ab0c725 | 29 | class TFile; |
88cb7938 | 30 | #include <TFolder.h> |
88cb7938 | 31 | #include <TTree.h> |
32 | #include <TVirtualMC.h> | |
e9a5efdf | 33 | #include <TRandom.h> |
fe4da5cc | 34 | |
35 | // --- Standard library --- | |
d15a28e7 | 36 | |
548f0134 | 37 | // --- AliRoot header files --- |
94de3818 | 38 | #include "AliMagF.h" |
88cb7938 | 39 | #include "AliPHOS.h" |
e9a5efdf | 40 | #include "AliPHOSGetter.h" |
85a5290f | 41 | #include "AliRun.h" |
42 | #include "AliPHOSDigitizer.h" | |
43 | #include "AliPHOSSDigitizer.h" | |
65792ca0 | 44 | #include "AliPHOSDigit.h" |
45 | #include "AliAltroBuffer.h" | |
7f78a025 | 46 | |
fe4da5cc | 47 | ClassImp(AliPHOS) |
0ce0b56f | 48 | //____________________________________________________________________________ |
6b87d0dd | 49 | AliPHOS:: AliPHOS() : AliDetector() |
50 | { | |
a532e9d8 | 51 | // Default ctor |
6b87d0dd | 52 | fName="PHOS"; |
2685bf00 | 53 | fQATask = 0; |
54 | fTreeQA = 0; | |
3d60069b | 55 | fDebug = 0; |
e9a5efdf | 56 | fRan = new TRandom(123456) ; |
6b87d0dd | 57 | } |
fa7cce36 | 58 | |
6b87d0dd | 59 | //____________________________________________________________________________ |
fa7cce36 | 60 | AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title) |
6b87d0dd | 61 | { |
a532e9d8 | 62 | // ctor : title is used to identify the layout |
63 | ||
2685bf00 | 64 | fQATask = 0; |
65 | fTreeQA = 0; | |
e9a5efdf | 66 | fDebug = 0; |
67 | fRan = new TRandom(123456) ; | |
6b87d0dd | 68 | } |
fa7cce36 | 69 | |
0ce0b56f | 70 | //____________________________________________________________________________ |
7b326aac | 71 | AliPHOS::~AliPHOS() |
72 | { | |
e9a5efdf | 73 | delete fRan ; |
0ce0b56f | 74 | } |
75 | ||
780fda6d | 76 | //____________________________________________________________________________ |
77 | void AliPHOS::Copy(AliPHOS & phos) | |
78 | { | |
7f78a025 | 79 | // copy method to be used byy the cpy ctor |
780fda6d | 80 | TObject::Copy(phos) ; |
81 | // fQATask = AliPHOSQAChecker::Copy(*(phos.fQATask)) ; | |
82 | phos.fTreeQA = fTreeQA->CloneTree() ; | |
83 | } | |
84 | ||
487d23e3 | 85 | //____________________________________________________________________________ |
86 | AliDigitizer* AliPHOS::CreateDigitizer(AliRunDigitizer* manager) const | |
87 | { | |
88 | return new AliPHOSDigitizer(manager); | |
89 | } | |
90 | ||
d15a28e7 | 91 | //____________________________________________________________________________ |
fe4da5cc | 92 | void AliPHOS::CreateMaterials() |
93 | { | |
b2a60966 | 94 | // Definitions of materials to build PHOS and associated tracking media. |
95 | // media number in idtmed are 699 to 798. | |
fe4da5cc | 96 | |
d15a28e7 | 97 | // --- The PbWO4 crystals --- |
92862013 | 98 | Float_t aX[3] = {207.19, 183.85, 16.0} ; |
99 | Float_t zX[3] = {82.0, 74.0, 8.0} ; | |
100 | Float_t wX[3] = {1.0, 1.0, 4.0} ; | |
101 | Float_t dX = 8.28 ; | |
fe4da5cc | 102 | |
92862013 | 103 | AliMixture(0, "PbWO4$", aX, zX, dX, -3, wX) ; |
fe4da5cc | 104 | |
fe4da5cc | 105 | |
d15a28e7 | 106 | // --- The polysterene scintillator (CH) --- |
92862013 | 107 | Float_t aP[2] = {12.011, 1.00794} ; |
108 | Float_t zP[2] = {6.0, 1.0} ; | |
109 | Float_t wP[2] = {1.0, 1.0} ; | |
110 | Float_t dP = 1.032 ; | |
fe4da5cc | 111 | |
92862013 | 112 | AliMixture(1, "Polystyrene$", aP, zP, dP, -2, wP) ; |
fe4da5cc | 113 | |
d15a28e7 | 114 | // --- Aluminium --- |
115 | AliMaterial(2, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ; | |
116 | // --- Absorption length is ignored ^ | |
fe4da5cc | 117 | |
d15a28e7 | 118 | // --- Tyvek (CnH2n) --- |
92862013 | 119 | Float_t aT[2] = {12.011, 1.00794} ; |
120 | Float_t zT[2] = {6.0, 1.0} ; | |
121 | Float_t wT[2] = {1.0, 2.0} ; | |
122 | Float_t dT = 0.331 ; | |
fe4da5cc | 123 | |
92862013 | 124 | AliMixture(3, "Tyvek$", aT, zT, dT, -2, wT) ; |
fe4da5cc | 125 | |
d15a28e7 | 126 | // --- Polystyrene foam --- |
92862013 | 127 | Float_t aF[2] = {12.011, 1.00794} ; |
128 | Float_t zF[2] = {6.0, 1.0} ; | |
129 | Float_t wF[2] = {1.0, 1.0} ; | |
130 | Float_t dF = 0.12 ; | |
fe4da5cc | 131 | |
92862013 | 132 | AliMixture(4, "Foam$", aF, zF, dF, -2, wF) ; |
fe4da5cc | 133 | |
d15a28e7 | 134 | // --- Titanium --- |
92862013 | 135 | Float_t aTIT[3] = {47.88, 26.98, 54.94} ; |
136 | Float_t zTIT[3] = {22.0, 13.0, 25.0} ; | |
137 | Float_t wTIT[3] = {69.0, 6.0, 1.0} ; | |
138 | Float_t dTIT = 4.5 ; | |
fe4da5cc | 139 | |
92862013 | 140 | AliMixture(5, "Titanium$", aTIT, zTIT, dTIT, -3, wTIT); |
fe4da5cc | 141 | |
d15a28e7 | 142 | // --- Silicon --- |
143 | AliMaterial(6, "Si$", 28.0855, 14., 2.33, 9.36, 42.3, 0, 0) ; | |
fe4da5cc | 144 | |
fe4da5cc | 145 | |
fe4da5cc | 146 | |
d15a28e7 | 147 | // --- Foam thermo insulation --- |
92862013 | 148 | Float_t aTI[2] = {12.011, 1.00794} ; |
149 | Float_t zTI[2] = {6.0, 1.0} ; | |
150 | Float_t wTI[2] = {1.0, 1.0} ; | |
85218d13 | 151 | Float_t dTI = 0.04 ; |
fe4da5cc | 152 | |
92862013 | 153 | AliMixture(7, "Thermo Insul.$", aTI, zTI, dTI, -2, wTI) ; |
fe4da5cc | 154 | |
d15a28e7 | 155 | // --- Textolitn --- |
92862013 | 156 | Float_t aTX[4] = {16.0, 28.09, 12.011, 1.00794} ; |
157 | Float_t zTX[4] = {8.0, 14.0, 6.0, 1.0} ; | |
158 | Float_t wTX[4] = {292.0, 68.0, 462.0, 736.0} ; | |
159 | Float_t dTX = 1.75 ; | |
fe4da5cc | 160 | |
92862013 | 161 | AliMixture(8, "Textolit$", aTX, zTX, dTX, -4, wTX) ; |
fe4da5cc | 162 | |
d15a28e7 | 163 | //--- FR4 --- |
92862013 | 164 | Float_t aFR[3] = {28.0855, 15.9994, 17.749} ; |
165 | Float_t zFR[3] = {14., 8., 8.875} ; | |
166 | Float_t wFR[3] = {.28, .32, .4} ; | |
167 | Float_t dFR = 1.8 ; | |
fe4da5cc | 168 | |
92862013 | 169 | AliMixture(9, "FR4$", aFR, zFR, dFR, -3, wFR) ; |
fe4da5cc | 170 | |
d15a28e7 | 171 | // --- The Composite Material for micromegas (so far polyetylene) --- |
92862013 | 172 | Float_t aCM[2] = {12.01, 1.} ; |
173 | Float_t zCM[2] = {6., 1.} ; | |
174 | Float_t wCM[2] = {1., 2.} ; | |
175 | Float_t dCM = 0.935 ; | |
fe4da5cc | 176 | |
92862013 | 177 | AliMixture(10, "Compo Mat$", aCM, zCM, dCM, -2, wCM) ; |
fe4da5cc | 178 | |
d15a28e7 | 179 | // --- Copper --- |
180 | AliMaterial(11, "Cu$", 63.546, 29, 8.96, 1.43, 14.8, 0, 0) ; | |
181 | ||
182 | // --- G10 : Printed Circuit material --- | |
92862013 | 183 | Float_t aG10[4] = { 12., 1., 16., 28.} ; |
184 | Float_t zG10[4] = { 6., 1., 8., 14.} ; | |
185 | Float_t wG10[4] = { .259, .288, .248, .205} ; | |
186 | Float_t dG10 = 1.7 ; | |
d15a28e7 | 187 | |
92862013 | 188 | AliMixture(12, "G10$", aG10, zG10, dG10, -4, wG10); |
fe4da5cc | 189 | |
d15a28e7 | 190 | // --- Lead --- |
191 | AliMaterial(13, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ; | |
fe4da5cc | 192 | |
d15a28e7 | 193 | // --- The gas mixture --- |
194 | // Co2 | |
92862013 | 195 | Float_t aCO[2] = {12.0, 16.0} ; |
196 | Float_t zCO[2] = {6.0, 8.0} ; | |
197 | Float_t wCO[2] = {1.0, 2.0} ; | |
198 | Float_t dCO = 0.001977 ; | |
fe4da5cc | 199 | |
92862013 | 200 | AliMixture(14, "CO2$", aCO, zCO, dCO, -2, wCO); |
fe4da5cc | 201 | |
d15a28e7 | 202 | // Ar |
92862013 | 203 | Float_t dAr = 0.001782 ; |
204 | AliMaterial(15, "Ar$", 39.948, 18.0, dAr, 14.0, 0., 0, 0) ; | |
d15a28e7 | 205 | |
206 | // ArCo2 | |
00d6d986 | 207 | Char_t namate[21]=""; |
92862013 | 208 | Float_t aGM[2] ; |
209 | Float_t zGM[2] ; | |
210 | Float_t wGM[2] ; | |
211 | Float_t dGM ; | |
fe4da5cc | 212 | |
92862013 | 213 | Float_t absL, radL, density ; |
d15a28e7 | 214 | Float_t buf[1] ; |
215 | Int_t nbuf ; | |
bc9ab547 | 216 | |
92862013 | 217 | gMC->Gfmate((*fIdmate)[15], namate, aGM[0], zGM[0], density, radL, absL, buf, nbuf) ; // Get properties of Ar |
218 | gMC->Gfmate((*fIdmate)[14], namate, aGM[1], zGM[1], density, radL, absL, buf, nbuf) ; // Get properties of CO2 | |
bc9ab547 | 219 | |
fe4da5cc | 220 | |
d15a28e7 | 221 | // Create gas mixture |
fe4da5cc | 222 | |
92862013 | 223 | Float_t arContent = 0.80 ; // Ar-content of the Ar/CO2-mixture (80% / 20%) |
d15a28e7 | 224 | |
92862013 | 225 | wGM[0] = arContent; |
226 | wGM[1] = 1. - arContent ; | |
227 | dGM = wGM[0] * dAr + wGM[1] * dCO; | |
fe4da5cc | 228 | |
a7262d8e | 229 | |
92862013 | 230 | AliMixture(16, "ArCO2$", aGM, zGM, dGM, 2, wGM) ; |
fe4da5cc | 231 | |
a530ba0a | 232 | // --- Stainless steel (let it be pure iron) --- |
233 | AliMaterial(17, "Steel$", 55.845, 26, 7.87, 1.76, 0., 0, 0) ; | |
85218d13 | 234 | |
235 | ||
236 | // --- Fiberglass --- | |
237 | Float_t aFG[4] = {16.0, 28.09, 12.011, 1.00794} ; | |
238 | Float_t zFG[4] = {8.0, 14.0, 6.0, 1.0} ; | |
239 | Float_t wFG[4] = {292.0, 68.0, 462.0, 736.0} ; | |
240 | Float_t dFG = 1.9 ; | |
241 | ||
242 | AliMixture(18, "Fibergla$", aFG, zFG, dFG, -4, wFG) ; | |
243 | ||
244 | // --- Cables in Air box --- | |
245 | // SERVICES | |
246 | ||
247 | Float_t aCA[4] = { 1.,12.,55.8,63.5 }; | |
248 | Float_t zCA[4] = { 1.,6.,26.,29. }; | |
249 | Float_t wCA[4] = { .014,.086,.42,.48 }; | |
250 | Float_t dCA = 0.8 ; //this density is raw estimation, if you know better - correct | |
251 | ||
252 | AliMixture(19, "Cables $", aCA, zCA, dCA, -4, wCA) ; | |
253 | ||
254 | ||
d15a28e7 | 255 | // --- Air --- |
a7262d8e | 256 | Float_t aAir[4]={12.0107,14.0067,15.9994,39.948}; |
257 | Float_t zAir[4]={6.,7.,8.,18.}; | |
258 | Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827}; | |
259 | Float_t dAir = 1.20479E-3; | |
d15a28e7 | 260 | |
a7262d8e | 261 | AliMixture(99, "Air$", aAir, zAir, dAir, 4, wAir) ; |
262 | ||
d15a28e7 | 263 | // DEFINITION OF THE TRACKING MEDIA |
fe4da5cc | 264 | |
d15a28e7 | 265 | // for PHOS: idtmed[699->798] equivalent to fIdtmed[0->100] |
266 | Int_t * idtmed = fIdtmed->GetArray() - 699 ; | |
92862013 | 267 | Int_t isxfld = gAlice->Field()->Integ() ; |
268 | Float_t sxmgmx = gAlice->Field()->Max() ; | |
fe4da5cc | 269 | |
d15a28e7 | 270 | // The scintillator of the calorimeter made of PBW04 -> idtmed[699] |
271 | AliMedium(0, "PHOS Xtal $", 0, 1, | |
92862013 | 272 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; |
fe4da5cc | 273 | |
d15a28e7 | 274 | // The scintillator of the CPV made of Polystyrene scintillator -> idtmed[700] |
275 | AliMedium(1, "CPV scint. $", 1, 1, | |
92862013 | 276 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; |
fe4da5cc | 277 | |
d15a28e7 | 278 | // Various Aluminium parts made of Al -> idtmed[701] |
279 | AliMedium(2, "Al parts $", 2, 0, | |
92862013 | 280 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ; |
fe4da5cc | 281 | |
d15a28e7 | 282 | // The Tywek which wraps the calorimeter crystals -> idtmed[702] |
283 | AliMedium(3, "Tyvek wrapper$", 3, 0, | |
92862013 | 284 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ; |
fe4da5cc | 285 | |
d15a28e7 | 286 | // The Polystyrene foam around the calorimeter module -> idtmed[703] |
287 | AliMedium(4, "Polyst. foam $", 4, 0, | |
92862013 | 288 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; |
fe4da5cc | 289 | |
d15a28e7 | 290 | // The Titanium around the calorimeter crystal -> idtmed[704] |
291 | AliMedium(5, "Titan. cover $", 5, 0, | |
92862013 | 292 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.0001, 0.0001, 0, 0) ; |
fe4da5cc | 293 | |
d15a28e7 | 294 | // The Silicon of the pin diode to read out the calorimeter crystal -> idtmed[705] |
295 | AliMedium(6, "Si PIN $", 6, 0, | |
7b326aac | 296 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.01, 0.01, 0, 0) ; |
fe4da5cc | 297 | |
d15a28e7 | 298 | // The thermo insulating material of the box which contains the calorimeter module -> idtmed[706] |
299 | AliMedium(7, "Thermo Insul.$", 7, 0, | |
92862013 | 300 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; |
fe4da5cc | 301 | |
d15a28e7 | 302 | // The Textolit which makes up the box which contains the calorimeter module -> idtmed[707] |
303 | AliMedium(8, "Textolit $", 8, 0, | |
92862013 | 304 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; |
fe4da5cc | 305 | |
d15a28e7 | 306 | // FR4: The Plastic which makes up the frame of micromegas -> idtmed[708] |
307 | AliMedium(9, "FR4 $", 9, 0, | |
92862013 | 308 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 0, 0) ; |
fe4da5cc | 309 | |
fe4da5cc | 310 | |
d15a28e7 | 311 | // The Composite Material for micromegas -> idtmed[709] |
312 | AliMedium(10, "CompoMat $", 10, 0, | |
92862013 | 313 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; |
fe4da5cc | 314 | |
d15a28e7 | 315 | // Copper -> idtmed[710] |
316 | AliMedium(11, "Copper $", 11, 0, | |
92862013 | 317 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 0, 0) ; |
fe4da5cc | 318 | |
d15a28e7 | 319 | // G10: Printed Circuit material -> idtmed[711] |
320 | ||
321 | AliMedium(12, "G10 $", 12, 0, | |
92862013 | 322 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.01, 0, 0) ; |
fe4da5cc | 323 | |
d15a28e7 | 324 | // The Lead -> idtmed[712] |
325 | ||
326 | AliMedium(13, "Lead $", 13, 0, | |
92862013 | 327 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; |
fe4da5cc | 328 | |
d15a28e7 | 329 | // The gas mixture: ArCo2 -> idtmed[715] |
330 | ||
331 | AliMedium(16, "ArCo2 $", 16, 1, | |
92862013 | 332 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.01, 0, 0) ; |
d15a28e7 | 333 | |
a530ba0a | 334 | // Stainless steel -> idtmed[716] |
335 | AliMedium(17, "Steel $", 17, 0, | |
336 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 0, 0) ; | |
337 | ||
85218d13 | 338 | // Fibergalss -> idtmed[717] |
339 | AliMedium(18, "Fiberglass$", 18, 0, | |
340 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; | |
341 | ||
342 | // Cables in air -> idtmed[718] | |
343 | AliMedium(19, "Cables $", 19, 0, | |
344 | isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ; | |
345 | ||
d15a28e7 | 346 | // Air -> idtmed[798] |
347 | AliMedium(99, "Air $", 99, 0, | |
92862013 | 348 | isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ; |
fe4da5cc | 349 | |
d15a28e7 | 350 | // --- Set decent energy thresholds for gamma and electron tracking |
fe4da5cc | 351 | |
d15a28e7 | 352 | // Tracking threshold for photons and electrons in the scintillator crystal |
353 | gMC->Gstpar(idtmed[699], "CUTGAM",0.5E-4) ; | |
354 | gMC->Gstpar(idtmed[699], "CUTELE",1.0E-4) ; | |
9f616d61 | 355 | |
d15a28e7 | 356 | // --- Generate explicitly delta rays in the titan cover --- |
357 | gMC->Gstpar(idtmed[704], "LOSS",3.) ; | |
358 | gMC->Gstpar(idtmed[704], "DRAY",1.) ; | |
d15a28e7 | 359 | // --- and in aluminium parts --- |
360 | gMC->Gstpar(idtmed[701], "LOSS",3.) ; | |
361 | gMC->Gstpar(idtmed[701], "DRAY",1.) ; | |
92862013 | 362 | // --- and in PIN diode |
363 | gMC->Gstpar(idtmed[705], "LOSS",3) ; | |
364 | gMC->Gstpar(idtmed[705], "DRAY",1) ; | |
365 | // --- and in the passive convertor | |
366 | gMC->Gstpar(idtmed[712], "LOSS",3) ; | |
367 | gMC->Gstpar(idtmed[712], "DRAY",1) ; | |
368 | // Tracking threshold for photons and electrons in the gas ArC02 | |
b7101219 | 369 | gMC->Gstpar(idtmed[715], "CUTGAM",1.E-5) ; |
370 | gMC->Gstpar(idtmed[715], "CUTELE",1.E-5) ; | |
371 | gMC->Gstpar(idtmed[715], "CUTNEU",1.E-5) ; | |
372 | gMC->Gstpar(idtmed[715], "CUTHAD",1.E-5) ; | |
373 | gMC->Gstpar(idtmed[715], "CUTMUO",1.E-5) ; | |
374 | gMC->Gstpar(idtmed[715], "BCUTE",1.E-5) ; | |
375 | gMC->Gstpar(idtmed[715], "BCUTM",1.E-5) ; | |
376 | gMC->Gstpar(idtmed[715], "DCUTE",1.E-5) ; | |
377 | gMC->Gstpar(idtmed[715], "DCUTM",1.E-5) ; | |
378 | gMC->Gstpar(idtmed[715], "PPCUTM",1.E-5) ; | |
9f616d61 | 379 | gMC->Gstpar(idtmed[715], "LOSS",2.) ; |
380 | gMC->Gstpar(idtmed[715], "DRAY",0.) ; | |
381 | gMC->Gstpar(idtmed[715], "STRA",2.) ; | |
382 | ||
0c409cb2 | 383 | } |
a532e9d8 | 384 | |
65792ca0 | 385 | //____________________________________________________________________________ |
386 | void AliPHOS::Digits2Raw() | |
387 | { | |
388 | // convert digits of the current event to raw data | |
389 | ||
390 | // get the digits | |
e9a5efdf | 391 | AliPHOSGetter * gime = AliPHOSGetter::Instance(AliRunLoader::GetGAliceName()) ; |
392 | if (!gime) { | |
393 | Error("Digits2Raw", "PHOS Getter not instantiated") ; | |
394 | return ; | |
395 | } | |
396 | gime->Event(gime->EventNumber(), "D") ; | |
397 | TClonesArray* digits = gime->Digits() ; | |
398 | ||
65792ca0 | 399 | if (!digits) { |
e9a5efdf | 400 | Error("Digits2Raw", "no digits found !"); |
65792ca0 | 401 | return; |
402 | } | |
403 | ||
404 | // get the geometry | |
e9a5efdf | 405 | AliPHOSGeometry* geom = gime->PHOSGeometry(); |
65792ca0 | 406 | if (!geom) { |
e9a5efdf | 407 | Error("Digits2Raw", "no geometry found !"); |
65792ca0 | 408 | return; |
409 | } | |
410 | ||
411 | // some digitization constants | |
412 | const Int_t kDDLOffset = 0x600; | |
413 | const Double_t kTimeMax = 1.28E-5; | |
414 | const Int_t kTimeBins = 256; | |
415 | const Double_t kTimePeak = 2.0E-6; | |
416 | const Double_t kTimeRes = 1.5E-6; | |
417 | const Int_t kThreshold = 3; | |
418 | const Int_t kHighGainFactor = 40; | |
419 | const Int_t kHighGainOffset = 0x200; | |
420 | ||
421 | AliAltroBuffer* buffer = NULL; | |
422 | Int_t prevDDL = -1; | |
423 | Int_t adcValuesLow[kTimeBins]; | |
424 | Int_t adcValuesHigh[kTimeBins]; | |
425 | ||
426 | // loop over digits (assume ordered digits) | |
427 | for (Int_t iDigit = 0; iDigit < digits->GetEntries(); iDigit++) { | |
e9a5efdf | 428 | AliPHOSDigit* digit = gime->Digit(iDigit); |
429 | if (digit->GetAmp() < kThreshold) | |
430 | continue; | |
65792ca0 | 431 | Int_t relId[4]; |
432 | geom->AbsToRelNumbering(digit->GetId(), relId); | |
433 | Int_t module = relId[0]; | |
e9a5efdf | 434 | |
435 | // Begin FIXME | |
436 | if (relId[1] != 0) | |
437 | continue; // ignore digits from CPV | |
438 | // End FIXME | |
439 | ||
440 | // PHOS EMCA has 4 DDL per module. Splitting is done based on the row number | |
65792ca0 | 441 | Int_t iDDL = 4 * (module - 1) + (4 * (relId[2] - 1)) / geom->GetNPhi(); |
442 | ||
443 | // new DDL | |
444 | if (iDDL != prevDDL) { | |
445 | // write real header and close previous file | |
446 | if (buffer) { | |
447 | buffer->Flush(); | |
448 | buffer->WriteDataHeader(kFALSE, kFALSE); | |
449 | delete buffer; | |
450 | } | |
451 | ||
452 | // open new file and write dummy header | |
e9a5efdf | 453 | TString fileName("PHOS_") ; |
454 | fileName += (iDDL + kDDLOffset) ; | |
455 | fileName += ".ddl" ; | |
456 | buffer = new AliAltroBuffer(fileName.Data(), 1); | |
65792ca0 | 457 | buffer->WriteDataHeader(kTRUE, kFALSE); //Dummy; |
458 | ||
459 | prevDDL = iDDL; | |
460 | } | |
461 | ||
462 | // out of time range signal (?) | |
463 | if (digit->GetTime() > kTimeMax) { | |
464 | buffer->FillBuffer(digit->GetAmp()); | |
465 | buffer->FillBuffer(kTimeBins); // time bin | |
466 | buffer->FillBuffer(3); // bunch length | |
467 | buffer->WriteTrailer(3, relId[3], relId[2], module); // trailer | |
468 | ||
469 | // simulate linear rise and gaussian decay of signal | |
470 | } else { | |
471 | Bool_t highGain = kFALSE; | |
472 | ||
e9a5efdf | 473 | // fill time bin values : |
474 | // 1. the signal starts at the time given by the digit | |
475 | // 2. the rise is linear and the maximum is reached kTimePeak after start | |
476 | // 3. the decay is gaussian with a sigma of kTimeRes | |
477 | // 4. the signal is binned into kTimeBins bins | |
65792ca0 | 478 | for (Int_t iTime = 0; iTime < kTimeBins; iTime++) { |
479 | Double_t time = iTime * kTimeMax/kTimeBins; | |
480 | Int_t signal = 0; | |
e9a5efdf | 481 | if (time < digit->GetTime() + kTimePeak) { // signal is rising |
482 | signal = static_cast<Int_t>(fRan->Rndm() + digit->GetAmp() * | |
65792ca0 | 483 | (time - digit->GetTime()) / kTimePeak); |
e9a5efdf | 484 | } else { // signal is decaying |
485 | signal = static_cast<Int_t>(fRan->Rndm() + digit->GetAmp() * | |
65792ca0 | 486 | TMath::Gaus(time, digit->GetTime() + kTimePeak, kTimeRes)); |
487 | } | |
e9a5efdf | 488 | if (signal < 0) |
489 | signal = 0; | |
65792ca0 | 490 | adcValuesLow[iTime] = signal; |
e9a5efdf | 491 | if (signal > 0x3FF) // larger than 10 bits |
492 | adcValuesLow[iTime] = 0x3FF; | |
65792ca0 | 493 | adcValuesHigh[iTime] = signal / kHighGainFactor; |
e9a5efdf | 494 | if (adcValuesHigh[iTime] > 0) |
495 | highGain = kTRUE; | |
65792ca0 | 496 | } |
497 | ||
498 | // write low and eventually high gain channel | |
499 | buffer->WriteChannel(relId[3], relId[2], module, | |
500 | kTimeBins, adcValuesLow, kThreshold); | |
501 | if (highGain) { | |
502 | buffer->WriteChannel(relId[3], relId[2], module + kHighGainOffset, | |
503 | kTimeBins, adcValuesHigh, 1); | |
504 | } | |
505 | } | |
506 | } | |
507 | ||
508 | // write real header and close last file | |
509 | if (buffer) { | |
510 | buffer->Flush(); | |
511 | buffer->WriteDataHeader(kFALSE, kFALSE); | |
512 | delete buffer; | |
513 | } | |
514 | ||
e9a5efdf | 515 | gime->PhosLoader()->UnloadDigits(); |
516 | } | |
517 | ||
518 | //____________________________________________________________________________ | |
519 | void AliPHOS::Hits2SDigits() | |
520 | { | |
521 | // create summable digits | |
522 | ||
523 | AliPHOSSDigitizer* phosDigitizer = | |
524 | new AliPHOSSDigitizer(fLoader->GetRunLoader()->GetFileName().Data()) ; | |
525 | phosDigitizer->SetEventRange(0, -1) ; // do all the events | |
526 | phosDigitizer->ExecuteTask("all") ; | |
527 | } | |
528 | ||
529 | //____________________________________________________________________________ | |
530 | AliLoader* AliPHOS::MakeLoader(const char* topfoldername) | |
531 | { | |
532 | //different behaviour than standard (singleton getter) | |
533 | // --> to be discussed and made eventually coherent | |
534 | fLoader = new AliPHOSLoader(GetName(),topfoldername); | |
535 | return fLoader; | |
536 | } | |
537 | ||
538 | //____________________________________________________________________________ | |
539 | void AliPHOS::SetTreeAddress() | |
540 | { | |
541 | // Links Hits in the Tree to Hits array | |
542 | TBranch *branch; | |
543 | char branchname[20]; | |
544 | sprintf(branchname,"%s",GetName()); | |
545 | ||
546 | // Branch address for hit tree | |
547 | TTree *treeH = TreeH(); | |
548 | if (treeH) { | |
549 | branch = treeH->GetBranch(branchname); | |
550 | if (branch) | |
551 | { | |
552 | if (fHits == 0x0) fHits= new TClonesArray("AliPHOSHit",1000); | |
553 | //Info("SetTreeAddress","<%s> Setting Hits Address",GetName()); | |
554 | branch->SetAddress(&fHits); | |
555 | } | |
556 | } | |
557 | } | |
558 | ||
559 | //____________________________________________________________________________ | |
560 | void AliPHOS::WriteQA() | |
561 | { | |
562 | ||
563 | // Make TreeQA in the output file. | |
564 | ||
565 | if(fTreeQA == 0) | |
566 | fTreeQA = new TTree("TreeQA", "QA Alarms") ; | |
567 | // Create Alarms branches | |
568 | Int_t bufferSize = 32000 ; | |
569 | Int_t splitlevel = 0 ; | |
570 | ||
571 | TFolder* topfold = GetLoader()->GetTopFolder(); //get top aliroot folder; skowron | |
572 | TString phosqafn(AliConfig::Instance()->GetQAFolderName()+"/"); //get name of QAaut folder relative to top event; skowron | |
573 | phosqafn+=GetName(); //hard wired string!!! add the detector name to the pathname; skowron | |
574 | TFolder * alarmsF = (TFolder*)topfold->FindObjectAny(phosqafn); //get the folder | |
575 | ||
576 | if (alarmsF == 0x0) | |
577 | { | |
578 | Error("WriteQA","Can not find folder with qa alarms"); | |
579 | return; | |
580 | } | |
581 | TString branchName(alarmsF->GetName()); | |
582 | TBranch * alarmsBranch = fTreeQA->Branch(branchName,"TFolder", &alarmsF, bufferSize, splitlevel); | |
583 | TString branchTitle = branchName + " QA alarms" ; | |
584 | alarmsBranch->SetTitle(branchTitle); | |
585 | alarmsBranch->Fill() ; | |
586 | ||
587 | //fTreeQA->Fill() ; | |
65792ca0 | 588 | } |
589 |