First attempt to use systemtically TFolders: the geometry object posts itself to...
[u/mrichter/AliRoot.git] / PHOS / AliPHOS.cxx
CommitLineData
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 **************************************************************************/
15
b2a60966 16/* $Id$ */
17
d15a28e7 18//_________________________________________________________________________
b2a60966 19// Base Class for PHOS description:
20// PHOS consists of a PbWO4 calorimeter (EMCA) and a gazeous charged
21// particles detector (CPV or PPSD).
22// The only provided method here is CreateMaterials,
23// which defines the materials common to all PHOS versions.
24//
25//*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH)
d15a28e7 26//////////////////////////////////////////////////////////////////////////////
e84be1eb 27
fdeead01 28
fe4da5cc 29// --- ROOT system ---
2ab0c725 30class TFile;
0ce0b56f 31#include "TROOT.h"
7b326aac 32#include "TTree.h"
33#include "TFolder.h"
fe4da5cc 34
35// --- Standard library ---
fe4da5cc 36
037cc66d 37#include <strstream.h>
d15a28e7 38// --- AliRoot header files ---
39
fe4da5cc 40#include "AliPHOS.h"
d15a28e7 41#include "AliMC.h"
fe4da5cc 42#include "AliRun.h"
94de3818 43#include "AliMagF.h"
0e4b7936 44#include "AliPHOSGeometry.h"
7b326aac 45#include "AliPHOSQAChecker.h"
fe4da5cc 46
fe4da5cc 47ClassImp(AliPHOS)
0ce0b56f 48//____________________________________________________________________________
6b87d0dd 49AliPHOS:: AliPHOS() : AliDetector()
50{
51 // Create folder and task hierarchy
52 fName="PHOS";
53 CreatePHOSFolders();
54}
fa7cce36 55
6b87d0dd 56//____________________________________________________________________________
fa7cce36 57AliPHOS::AliPHOS(const char* name, const char* title): AliDetector(name, title)
6b87d0dd 58{
59 // Create folder and task hierarchy
60 CreatePHOSFolders();
61}
fa7cce36 62
6b87d0dd 63//____________________________________________________________________________
64void AliPHOS::CreatePHOSFolders()
0ce0b56f 65{
7b326aac 66 // create the ALICE TFolder
67 // create the ALICE TTasks
68 // add the Alice QA TTAsks
69 // create the ALICE main TFolder
70 // add the Alice QA Alarms
71 // this should be done of course by AliRun
72
73 TFolder * alice = new TFolder();
74 alice->SetNameTitle("YSAlice", "Alice Folder") ;
75 gROOT->GetListOfBrowsables()->Add(alice) ;
76
77 TFolder * aliceF = alice->AddFolder("folders", "Alice memory Folder") ;
78 // make it the owner of the objects that it contains
79 aliceF->SetOwner() ;
fa7cce36 80 // geometry folder
81 TFolder * geomF = aliceF->AddFolder("Geometry", "Geometry objects") ;
82 // alarms folder
7b326aac 83 TFolder * alarmsF = aliceF->AddFolder("QAAlarms", "Alarms raised by QA check") ;
84 // make it the owner of the objects that it contains
85 alarmsF->SetOwner() ;
86 TFolder * aliceT = alice->AddFolder("tasks", "Alice tasks Folder") ;
87 // make it the owner of the objects that it contains
88 aliceT->SetOwner() ;
89
90 TTask * aliceQA = new TTask("QA", "Alice QA tasks") ;
91 aliceT->Add(aliceQA);
92
93 TTask * aliceDi = new TTask("(S)Digitizer", "Alice SDigitizer & Digitizer") ;
94 aliceT->Add(aliceDi);
95
96 TTask * aliceRe = new TTask("Reconstructioner", "Alice Reconstructioner") ;
97 aliceT->Add(aliceRe);
98
99 char * tempo = new char[80] ;
100
fa7cce36 101 // creates the PHOSQA (QAChecker knows how to add itself in the tasks list)
7b326aac 102 sprintf(tempo, "%sCheckers container",GetName() ) ;
fa7cce36 103 fQATask = new AliPHOSQAChecker(GetName(), tempo);
0ce0b56f 104
7b326aac 105 // creates the PHOS(S)Digitizer and adds it to alice main (S)Digitizer task
106 sprintf(tempo, "%sDigitizers container",GetName() ) ;
fa7cce36 107 fSDTask = new TTask(GetName(), tempo);
7b326aac 108 aliceDi->Add(fSDTask) ;
fa7cce36 109
7b326aac 110 // creates the PHOS reconstructioner and adds it to alice main Reconstructioner task
111 sprintf(tempo, "%sReconstructioner container",GetName() ) ;
fa7cce36 112 fReTask = new TTask(GetName(), tempo);
7b326aac 113 aliceRe->Add(fReTask) ;
114
115 delete tempo ;
116
fa7cce36 117 // creates the PHOS geometry folder
118 geomF->AddFolder("PHOS", "Geometry for PHOS") ;
7b326aac 119 // creates the PHOSQA alarm folder
120 alarmsF->AddFolder("PHOS", "QA alarms from PHOS") ;
121}
0ce0b56f 122//____________________________________________________________________________
7b326aac 123AliPHOS::~AliPHOS()
124{
125 // remove the alice folder and alice QA task that PHOS creates instead of AliRun
126
127 // remove and delete the PHOS QA tasks
128 TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
129 TTask * aliceQA = (TTask*)alice->FindObject("tasks/QA") ;
130 fQATask->GetListOfTasks()->Delete() ;
131 aliceQA->GetListOfTasks()->Remove(fQATask) ;
132 delete fQATask ;
133
134 // remove and delete aliceQA (should be done by AliRun)
0ce0b56f 135}
136
d15a28e7 137//____________________________________________________________________________
fe4da5cc 138void AliPHOS::CreateMaterials()
139{
b2a60966 140 // Definitions of materials to build PHOS and associated tracking media.
141 // media number in idtmed are 699 to 798.
fe4da5cc 142
d15a28e7 143 // --- The PbWO4 crystals ---
92862013 144 Float_t aX[3] = {207.19, 183.85, 16.0} ;
145 Float_t zX[3] = {82.0, 74.0, 8.0} ;
146 Float_t wX[3] = {1.0, 1.0, 4.0} ;
147 Float_t dX = 8.28 ;
fe4da5cc 148
92862013 149 AliMixture(0, "PbWO4$", aX, zX, dX, -3, wX) ;
fe4da5cc 150
fe4da5cc 151
d15a28e7 152 // --- The polysterene scintillator (CH) ---
92862013 153 Float_t aP[2] = {12.011, 1.00794} ;
154 Float_t zP[2] = {6.0, 1.0} ;
155 Float_t wP[2] = {1.0, 1.0} ;
156 Float_t dP = 1.032 ;
fe4da5cc 157
92862013 158 AliMixture(1, "Polystyrene$", aP, zP, dP, -2, wP) ;
fe4da5cc 159
d15a28e7 160 // --- Aluminium ---
161 AliMaterial(2, "Al$", 26.98, 13., 2.7, 8.9, 999., 0, 0) ;
162 // --- Absorption length is ignored ^
fe4da5cc 163
d15a28e7 164 // --- Tyvek (CnH2n) ---
92862013 165 Float_t aT[2] = {12.011, 1.00794} ;
166 Float_t zT[2] = {6.0, 1.0} ;
167 Float_t wT[2] = {1.0, 2.0} ;
168 Float_t dT = 0.331 ;
fe4da5cc 169
92862013 170 AliMixture(3, "Tyvek$", aT, zT, dT, -2, wT) ;
fe4da5cc 171
d15a28e7 172 // --- Polystyrene foam ---
92862013 173 Float_t aF[2] = {12.011, 1.00794} ;
174 Float_t zF[2] = {6.0, 1.0} ;
175 Float_t wF[2] = {1.0, 1.0} ;
176 Float_t dF = 0.12 ;
fe4da5cc 177
92862013 178 AliMixture(4, "Foam$", aF, zF, dF, -2, wF) ;
fe4da5cc 179
d15a28e7 180 // --- Titanium ---
92862013 181 Float_t aTIT[3] = {47.88, 26.98, 54.94} ;
182 Float_t zTIT[3] = {22.0, 13.0, 25.0} ;
183 Float_t wTIT[3] = {69.0, 6.0, 1.0} ;
184 Float_t dTIT = 4.5 ;
fe4da5cc 185
92862013 186 AliMixture(5, "Titanium$", aTIT, zTIT, dTIT, -3, wTIT);
fe4da5cc 187
d15a28e7 188 // --- Silicon ---
189 AliMaterial(6, "Si$", 28.0855, 14., 2.33, 9.36, 42.3, 0, 0) ;
fe4da5cc 190
fe4da5cc 191
fe4da5cc 192
d15a28e7 193 // --- Foam thermo insulation ---
92862013 194 Float_t aTI[2] = {12.011, 1.00794} ;
195 Float_t zTI[2] = {6.0, 1.0} ;
196 Float_t wTI[2] = {1.0, 1.0} ;
197 Float_t dTI = 0.1 ;
fe4da5cc 198
92862013 199 AliMixture(7, "Thermo Insul.$", aTI, zTI, dTI, -2, wTI) ;
fe4da5cc 200
d15a28e7 201 // --- Textolitn ---
92862013 202 Float_t aTX[4] = {16.0, 28.09, 12.011, 1.00794} ;
203 Float_t zTX[4] = {8.0, 14.0, 6.0, 1.0} ;
204 Float_t wTX[4] = {292.0, 68.0, 462.0, 736.0} ;
205 Float_t dTX = 1.75 ;
fe4da5cc 206
92862013 207 AliMixture(8, "Textolit$", aTX, zTX, dTX, -4, wTX) ;
fe4da5cc 208
d15a28e7 209 //--- FR4 ---
92862013 210 Float_t aFR[3] = {28.0855, 15.9994, 17.749} ;
211 Float_t zFR[3] = {14., 8., 8.875} ;
212 Float_t wFR[3] = {.28, .32, .4} ;
213 Float_t dFR = 1.8 ;
fe4da5cc 214
92862013 215 AliMixture(9, "FR4$", aFR, zFR, dFR, -3, wFR) ;
fe4da5cc 216
d15a28e7 217 // --- The Composite Material for micromegas (so far polyetylene) ---
92862013 218 Float_t aCM[2] = {12.01, 1.} ;
219 Float_t zCM[2] = {6., 1.} ;
220 Float_t wCM[2] = {1., 2.} ;
221 Float_t dCM = 0.935 ;
fe4da5cc 222
92862013 223 AliMixture(10, "Compo Mat$", aCM, zCM, dCM, -2, wCM) ;
fe4da5cc 224
d15a28e7 225 // --- Copper ---
226 AliMaterial(11, "Cu$", 63.546, 29, 8.96, 1.43, 14.8, 0, 0) ;
227
228 // --- G10 : Printed Circuit material ---
92862013 229 Float_t aG10[4] = { 12., 1., 16., 28.} ;
230 Float_t zG10[4] = { 6., 1., 8., 14.} ;
231 Float_t wG10[4] = { .259, .288, .248, .205} ;
232 Float_t dG10 = 1.7 ;
d15a28e7 233
92862013 234 AliMixture(12, "G10$", aG10, zG10, dG10, -4, wG10);
fe4da5cc 235
d15a28e7 236 // --- Lead ---
237 AliMaterial(13, "Pb$", 207.2, 82, 11.35, 0.56, 0., 0, 0) ;
fe4da5cc 238
d15a28e7 239 // --- The gas mixture ---
240 // Co2
92862013 241 Float_t aCO[2] = {12.0, 16.0} ;
242 Float_t zCO[2] = {6.0, 8.0} ;
243 Float_t wCO[2] = {1.0, 2.0} ;
244 Float_t dCO = 0.001977 ;
fe4da5cc 245
92862013 246 AliMixture(14, "CO2$", aCO, zCO, dCO, -2, wCO);
fe4da5cc 247
d15a28e7 248 // Ar
92862013 249 Float_t dAr = 0.001782 ;
250 AliMaterial(15, "Ar$", 39.948, 18.0, dAr, 14.0, 0., 0, 0) ;
d15a28e7 251
252 // ArCo2
253 Char_t namate[21];
92862013 254 Float_t aGM[2] ;
255 Float_t zGM[2] ;
256 Float_t wGM[2] ;
257 Float_t dGM ;
fe4da5cc 258
92862013 259 Float_t absL, radL, density ;
d15a28e7 260 Float_t buf[1] ;
261 Int_t nbuf ;
bc9ab547 262
92862013 263 gMC->Gfmate((*fIdmate)[15], namate, aGM[0], zGM[0], density, radL, absL, buf, nbuf) ; // Get properties of Ar
264 gMC->Gfmate((*fIdmate)[14], namate, aGM[1], zGM[1], density, radL, absL, buf, nbuf) ; // Get properties of CO2
bc9ab547 265
fe4da5cc 266
d15a28e7 267 // Create gas mixture
fe4da5cc 268
92862013 269 Float_t arContent = 0.80 ; // Ar-content of the Ar/CO2-mixture (80% / 20%)
d15a28e7 270
92862013 271 wGM[0] = arContent;
272 wGM[1] = 1. - arContent ;
273 dGM = wGM[0] * dAr + wGM[1] * dCO;
fe4da5cc 274
92862013 275 AliMixture(16, "ArCO2$", aGM, zGM, dGM, 2, wGM) ;
fe4da5cc 276
a530ba0a 277 // --- Stainless steel (let it be pure iron) ---
278 AliMaterial(17, "Steel$", 55.845, 26, 7.87, 1.76, 0., 0, 0) ;
d15a28e7 279
280 // --- Air ---
281 AliMaterial(99, "Air$", 14.61, 7.3, 0.001205, 30420., 67500., 0, 0) ;
fe4da5cc 282
d15a28e7 283
284 // DEFINITION OF THE TRACKING MEDIA
fe4da5cc 285
d15a28e7 286 // for PHOS: idtmed[699->798] equivalent to fIdtmed[0->100]
287 Int_t * idtmed = fIdtmed->GetArray() - 699 ;
92862013 288 Int_t isxfld = gAlice->Field()->Integ() ;
289 Float_t sxmgmx = gAlice->Field()->Max() ;
fe4da5cc 290
d15a28e7 291 // The scintillator of the calorimeter made of PBW04 -> idtmed[699]
292 AliMedium(0, "PHOS Xtal $", 0, 1,
92862013 293 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
fe4da5cc 294
d15a28e7 295 // The scintillator of the CPV made of Polystyrene scintillator -> idtmed[700]
296 AliMedium(1, "CPV scint. $", 1, 1,
92862013 297 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
fe4da5cc 298
d15a28e7 299 // Various Aluminium parts made of Al -> idtmed[701]
300 AliMedium(2, "Al parts $", 2, 0,
92862013 301 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
fe4da5cc 302
d15a28e7 303 // The Tywek which wraps the calorimeter crystals -> idtmed[702]
304 AliMedium(3, "Tyvek wrapper$", 3, 0,
92862013 305 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.001, 0.001, 0, 0) ;
fe4da5cc 306
d15a28e7 307 // The Polystyrene foam around the calorimeter module -> idtmed[703]
308 AliMedium(4, "Polyst. foam $", 4, 0,
92862013 309 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
fe4da5cc 310
d15a28e7 311 // The Titanium around the calorimeter crystal -> idtmed[704]
312 AliMedium(5, "Titan. cover $", 5, 0,
92862013 313 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.0001, 0.0001, 0, 0) ;
fe4da5cc 314
d15a28e7 315 // The Silicon of the pin diode to read out the calorimeter crystal -> idtmed[705]
316 AliMedium(6, "Si PIN $", 6, 0,
7b326aac 317 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.01, 0.01, 0, 0) ;
fe4da5cc 318
d15a28e7 319 // The thermo insulating material of the box which contains the calorimeter module -> idtmed[706]
320 AliMedium(7, "Thermo Insul.$", 7, 0,
92862013 321 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
fe4da5cc 322
d15a28e7 323 // The Textolit which makes up the box which contains the calorimeter module -> idtmed[707]
324 AliMedium(8, "Textolit $", 8, 0,
92862013 325 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
fe4da5cc 326
d15a28e7 327 // FR4: The Plastic which makes up the frame of micromegas -> idtmed[708]
328 AliMedium(9, "FR4 $", 9, 0,
92862013 329 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 0, 0) ;
fe4da5cc 330
fe4da5cc 331
d15a28e7 332 // The Composite Material for micromegas -> idtmed[709]
333 AliMedium(10, "CompoMat $", 10, 0,
92862013 334 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
fe4da5cc 335
d15a28e7 336 // Copper -> idtmed[710]
337 AliMedium(11, "Copper $", 11, 0,
92862013 338 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 0, 0) ;
fe4da5cc 339
d15a28e7 340 // G10: Printed Circuit material -> idtmed[711]
341
342 AliMedium(12, "G10 $", 12, 0,
92862013 343 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.01, 0, 0) ;
fe4da5cc 344
d15a28e7 345 // The Lead -> idtmed[712]
346
347 AliMedium(13, "Lead $", 13, 0,
92862013 348 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.1, 0, 0) ;
fe4da5cc 349
d15a28e7 350 // The gas mixture: ArCo2 -> idtmed[715]
351
352 AliMedium(16, "ArCo2 $", 16, 1,
92862013 353 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.01, 0, 0) ;
d15a28e7 354
a530ba0a 355 // Stainless steel -> idtmed[716]
356 AliMedium(17, "Steel $", 17, 0,
357 isxfld, sxmgmx, 10.0, 0.1, 0.1, 0.1, 0.0001, 0, 0) ;
358
d15a28e7 359 // Air -> idtmed[798]
360 AliMedium(99, "Air $", 99, 0,
92862013 361 isxfld, sxmgmx, 10.0, 1.0, 0.1, 0.1, 10.0, 0, 0) ;
fe4da5cc 362
d15a28e7 363 // --- Set decent energy thresholds for gamma and electron tracking
fe4da5cc 364
d15a28e7 365 // Tracking threshold for photons and electrons in the scintillator crystal
366 gMC->Gstpar(idtmed[699], "CUTGAM",0.5E-4) ;
367 gMC->Gstpar(idtmed[699], "CUTELE",1.0E-4) ;
9f616d61 368
d15a28e7 369 // --- Generate explicitly delta rays in the titan cover ---
370 gMC->Gstpar(idtmed[704], "LOSS",3.) ;
371 gMC->Gstpar(idtmed[704], "DRAY",1.) ;
d15a28e7 372 // --- and in aluminium parts ---
373 gMC->Gstpar(idtmed[701], "LOSS",3.) ;
374 gMC->Gstpar(idtmed[701], "DRAY",1.) ;
92862013 375 // --- and in PIN diode
376 gMC->Gstpar(idtmed[705], "LOSS",3) ;
377 gMC->Gstpar(idtmed[705], "DRAY",1) ;
378 // --- and in the passive convertor
379 gMC->Gstpar(idtmed[712], "LOSS",3) ;
380 gMC->Gstpar(idtmed[712], "DRAY",1) ;
381 // Tracking threshold for photons and electrons in the gas ArC02
b7101219 382 gMC->Gstpar(idtmed[715], "CUTGAM",1.E-5) ;
383 gMC->Gstpar(idtmed[715], "CUTELE",1.E-5) ;
384 gMC->Gstpar(idtmed[715], "CUTNEU",1.E-5) ;
385 gMC->Gstpar(idtmed[715], "CUTHAD",1.E-5) ;
386 gMC->Gstpar(idtmed[715], "CUTMUO",1.E-5) ;
387 gMC->Gstpar(idtmed[715], "BCUTE",1.E-5) ;
388 gMC->Gstpar(idtmed[715], "BCUTM",1.E-5) ;
389 gMC->Gstpar(idtmed[715], "DCUTE",1.E-5) ;
390 gMC->Gstpar(idtmed[715], "DCUTM",1.E-5) ;
391 gMC->Gstpar(idtmed[715], "PPCUTM",1.E-5) ;
9f616d61 392 gMC->Gstpar(idtmed[715], "LOSS",2.) ;
393 gMC->Gstpar(idtmed[715], "DRAY",0.) ;
394 gMC->Gstpar(idtmed[715], "STRA",2.) ;
395
0c409cb2 396}
fa7cce36 397//____________________________________________________________________________
398AliPHOSGeometry * AliPHOS::GetGeometry() const
399{
400 // gets the pointer to the AliPHOSGeometry unique instance from the folder
401
402 AliPHOSGeometry * rv ;
403
404 TFolder * alice = (TFolder*)gROOT->GetListOfBrowsables()->FindObject("YSAlice") ;
405 TString path("folders/Geometry/PHOS/") ;
406 path += GetTitle() ;
407 rv = (AliPHOSGeometry*)alice->FindObject(path) ;
408 if ( !rv )
409 rv = fGeom ;
410 return rv ;
411}
412
0c409cb2 413//____________________________________________________________________________
2ea4f4fc 414void AliPHOS::SetTreeAddress()
415{
7b326aac 416
417
07a64e48 418 // TBranch *branch;
ad8cfaf4 419 // AliDetector::SetTreeAddress();
420
421 TBranch *branch;
422 char branchname[20];
423 sprintf(branchname,"%s",GetName());
3247125a 424
ad8cfaf4 425 // Branch address for hit tree
426 TTree *treeH = gAlice->TreeH();
427 if (treeH && fHits) {
428 branch = treeH->GetBranch(branchname);
429 if (branch) branch->SetAddress(&fHits);
430 }
0c409cb2 431}
432
9f616d61 433