Correct path of images and src
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0.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// Implementation version v0 of PHOS Manager class
20// Layout EMC + PPSD has name GPS2
21//
22//*-- Author: Yves Schutz (SUBATECH)
23
d2cf0e38 24
fe4da5cc 25// --- ROOT system ---
d15a28e7 26
fe4da5cc 27#include "TBRIK.h"
28#include "TNode.h"
0869cea5 29#include "TRandom.h"
fe4da5cc 30
d15a28e7 31// --- Standard library ---
32
9f616d61 33#include <cstdio>
34#include <cstring>
35#include <cstdlib>
36#include <strstream>
37#include <cassert>
d15a28e7 38
39// --- AliRoot header files ---
40
fe4da5cc 41#include "AliPHOSv0.h"
d15a28e7 42#include "AliPHOSHit.h"
43#include "AliPHOSDigit.h"
44#include "AliPHOSReconstructioner.h"
fe4da5cc 45#include "AliRun.h"
d15a28e7 46#include "AliConst.h"
fe4da5cc 47
48ClassImp(AliPHOSv0)
49
d15a28e7 50//____________________________________________________________________________
8c933dd7 51AliPHOSv0::AliPHOSv0()
fe4da5cc 52{
b2a60966 53 // ctor
d15a28e7 54 fNTmpHits = 0 ;
55 fTmpHits = 0 ;
fe4da5cc 56}
d15a28e7 57
58//____________________________________________________________________________
59AliPHOSv0::AliPHOSv0(const char *name, const char *title):
60 AliPHOS(name,title)
61{
b2a60966 62 // ctor : title is used to identify the layout
63 // GPS2 = 5 modules (EMC + PPSD)
d15a28e7 64 // We use 2 arrays of hits :
65 //
66 // - fHits (the "normal" one), which retains the hits associated with
67 // the current primary particle being tracked
68 // (this array is reset after each primary has been tracked).
69 //
70 // - fTmpHits, which retains all the hits of the current event. It
71 // is used for the digitization part.
72
3a6a7952 73 fPinElectronicNoise = 0.010 ;
74 fDigitThreshold = 1. ; // 1 GeV
0869cea5 75
d15a28e7 76 fHits = new TClonesArray("AliPHOSHit",100) ;
6ad0bfa0 77 gAlice->AddHitList(fHits) ;
78
d15a28e7 79 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
80
d15a28e7 81 fNTmpHits = fNhits = 0 ;
82
6ad0bfa0 83 fDigits = new TClonesArray("AliPHOSDigit",100) ;
84
85
d15a28e7 86 fIshunt = 1 ; // All hits are associated with primary particles
fe4da5cc 87
d15a28e7 88 // gets an instance of the geometry parameters class
6ad0bfa0 89
d15a28e7 90 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
91
92 if (fGeom->IsInitialized() )
93 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
94 else
95 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
96}
97//____________________________________________________________________________
6ad0bfa0 98AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
d15a28e7 99 AliPHOS(name,title)
100{
b2a60966 101 // ctor : title is used to identify the layout
102 // GPS2 = 5 modules (EMC + PPSD)
d15a28e7 103 // We use 2 arrays of hits :
104 //
105 // - fHits (the "normal" one), which retains the hits associated with
106 // the current primary particle being tracked
107 // (this array is reset after each primary has been tracked).
108 //
109 // - fTmpHits, which retains all the hits of the current event. It
110 // is used for the digitization part.
b2a60966 111
3a6a7952 112 fPinElectronicNoise = 0.010 ;
d15a28e7 113 fHits = new TClonesArray("AliPHOSHit",100) ;
114 fDigits = new TClonesArray("AliPHOSDigit",100) ;
115 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
116
d15a28e7 117 fNTmpHits = fNhits = 0 ;
118
119 fIshunt = 1 ; // All hits are associated with primary particles
120
121 // gets an instance of the geometry parameters class
122 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
123
124 if (fGeom->IsInitialized() )
125 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
126 else
127 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
128
129 // Defining the PHOS Reconstructioner
130
6ad0bfa0 131 fReconstructioner = Reconstructioner ;
d15a28e7 132}
133
134//____________________________________________________________________________
135AliPHOSv0::~AliPHOSv0()
136{
b2a60966 137 // dtor
138
9f616d61 139 fTmpHits->Delete() ;
d15a28e7 140 delete fTmpHits ;
9f616d61 141 fTmpHits = 0 ;
142
143 fEmcClusters->Delete() ;
144 delete fEmcClusters ;
145 fEmcClusters = 0 ;
146
147 fPpsdClusters->Delete() ;
148 delete fPpsdClusters ;
149 fPpsdClusters = 0 ;
150
151 fTrackSegments->Delete() ;
152 delete fTrackSegments ;
153 fTrackSegments = 0 ;
d15a28e7 154}
155
156//____________________________________________________________________________
ff4c968a 157void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits)
d15a28e7 158{
b2a60966 159 // Add a hit to the hit list.
160 // A PHOS hit is the sum of all hits in a single crystal
161 // or in a single PPSD gas cell
162
d15a28e7 163 Int_t hitCounter ;
92862013 164 TClonesArray &ltmphits = *fTmpHits ;
d15a28e7 165 AliPHOSHit *newHit ;
92862013 166 AliPHOSHit *curHit ;
ff4c968a 167 Bool_t deja = kFALSE ;
d15a28e7 168
169 // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
170
ff4c968a 171 newHit = new AliPHOSHit(primary, Id, hits) ;
d15a28e7 172
92862013 173 for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
d15a28e7 174 curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
175 if( *curHit == *newHit ) {
ff4c968a 176 *curHit = *curHit + *newHit ;
177 deja = kTRUE ;
d15a28e7 178 }
179 }
180
92862013 181 if ( !deja ) {
d15a28e7 182 new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
183 fNTmpHits++ ;
184 }
185
186 // Please note that the fTmpHits array must survive up to the
187 // end of the events, so it does not appear e.g. in ResetHits() (
188 // which is called at the end of each primary).
fe4da5cc 189
d15a28e7 190 // if (IsTreeSelected('H')) {
191 // And, if we really want raw hits tree, have the fHits array filled also
192 // TClonesArray &lhits = *fHits;
193 // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
194 // fNhits++ ;
195 // }
196
ff4c968a 197 delete newHit;
d15a28e7 198
199}
200
201
202//____________________________________________________________________________
203void AliPHOSv0::BuildGeometry()
fe4da5cc 204{
b2a60966 205 // Build the PHOS geometry for the ROOT display
206 //BEGIN_HTML
207 /*
208 <H2>
209 PHOS in ALICE displayed by root
210 </H2>
211 <UL>
212 <LI> All Views
213 <P>
214 <CENTER>
215 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
216 </CENTER></P></LI>
217 <LI> Front View
218 <P>
219 <CENTER>
220 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
221 </CENTER></P></LI>
222 <LI> 3D View 1
223 <P>
224 <CENTER>
225 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
226 </CENTER></P></LI>
227 <LI> 3D View 2
228 <P>
229 <CENTER>
230 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
231 </CENTER></P></LI>
232 </UL>
233 */
234 //END_HTML
d15a28e7 235
236 this->BuildGeometryforPHOS() ;
237 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
238 this->BuildGeometryforPPSD() ;
239 else
240 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
241
fe4da5cc 242}
d15a28e7 243
244//____________________________________________________________________________
245void AliPHOSv0:: BuildGeometryforPHOS(void)
246{
b2a60966 247 // Build the PHOS-EMC geometry for the ROOT display
d15a28e7 248
249 const Int_t kColorPHOS = kRed ;
250 const Int_t kColorXTAL = kBlue ;
251
92862013 252 Double_t const kRADDEG = 180.0 / kPI ;
d15a28e7 253
254 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
255 fGeom->GetOuterBoxSize(1)/2,
256 fGeom->GetOuterBoxSize(2)/2 );
257
258 // Textolit Wall box, position inside PHOS
259
260 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
261 fGeom->GetTextolitBoxSize(1)/2,
262 fGeom->GetTextolitBoxSize(2)/2);
263
264 // Polystyrene Foam Plate
265
266 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
267 fGeom->GetSecondUpperPlateThickness()/2,
268 fGeom->GetTextolitBoxSize(2)/2 ) ;
269
270 // Air Filled Box
fe4da5cc 271
d15a28e7 272 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
273 fGeom->GetAirFilledBoxSize(1)/2,
274 fGeom->GetAirFilledBoxSize(2)/2 );
275
276 // Crystals Box
277
92862013 278 Float_t xtlX = fGeom->GetCrystalSize(0) ;
279 Float_t xtlY = fGeom->GetCrystalSize(1) ;
280 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
d15a28e7 281
92862013 282 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
283 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
d15a28e7 284 + fGeom->GetModuleBoxThickness() / 2.0 ;
92862013 285 Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
d15a28e7 286
92862013 287 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
d15a28e7 288
289// position PHOS into ALICE
290
92862013 291 Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
d15a28e7 292 Int_t number = 988 ;
293 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
92862013 294 pphi *= kRADDEG ;
295 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
d15a28e7 296
297 char * nodename = new char[20] ;
298 char * rotname = new char[20] ;
299
300 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
301 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
302 sprintf(rotname, "%s%d", "rot", number++) ;
303 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
92862013 304 top->cd();
d15a28e7 305 sprintf(nodename,"%s%d", "Module", i) ;
92862013 306 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
307 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
308 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
309 outerboxnode->SetLineColor(kColorPHOS) ;
310 fNodes->Add(outerboxnode) ;
311 outerboxnode->cd() ;
d15a28e7 312 // now inside the outer box the textolit box
92862013 313 y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
d15a28e7 314 sprintf(nodename,"%s%d", "TexBox", i) ;
92862013 315 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
316 textolitboxnode->SetLineColor(kColorPHOS) ;
317 fNodes->Add(textolitboxnode) ;
d15a28e7 318 // upper foam plate inside outre box
92862013 319 outerboxnode->cd() ;
d15a28e7 320 sprintf(nodename, "%s%d", "UFPlate", i) ;
92862013 321 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
322 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
323 upperfoamplatenode->SetLineColor(kColorPHOS) ;
324 fNodes->Add(upperfoamplatenode) ;
d15a28e7 325 // air filled box inside textolit box (not drawn)
92862013 326 textolitboxnode->cd();
327 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
d15a28e7 328 sprintf(nodename, "%s%d", "AFBox", i) ;
92862013 329 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
330 fNodes->Add(airfilledboxnode) ;
d15a28e7 331 // crystals box inside air filled box
92862013 332 airfilledboxnode->cd() ;
333 y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl
d15a28e7 334 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
335 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
336 sprintf(nodename, "%s%d", "XTBox", i) ;
92862013 337 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
338 crystalsboxnode->SetLineColor(kColorXTAL) ;
339 fNodes->Add(crystalsboxnode) ;
d15a28e7 340 }
341}
342
343//____________________________________________________________________________
344void AliPHOSv0:: BuildGeometryforPPSD(void)
fe4da5cc 345{
b2a60966 346 // Build the PHOS-PPSD geometry for the ROOT display
347 //BEGIN_HTML
348 /*
349 <H2>
350 PPSD displayed by root
351 </H2>
352 <UL>
353 <LI> Zoom on PPSD: Front View
354 <P>
355 <CENTER>
356 <IMG Align=BOTTOM ALT="PPSD Front View" SRC="../images/AliPHOSv0PPSDFrontView.gif">
357 </CENTER></P></LI>
358 <LI> Zoom on PPSD: Perspective View
359 <P>
360 <CENTER>
361 <IMG Align=BOTTOM ALT="PPSD Prespective View" SRC="../images/AliPHOSv0PPSDPerspectiveView.gif">
362 </CENTER></P></LI>
363 </UL>
364 */
365 //END_HTML
92862013 366 Double_t const kRADDEG = 180.0 / kPI ;
d15a28e7 367
368 const Int_t kColorPHOS = kRed ;
369 const Int_t kColorPPSD = kGreen ;
370 const Int_t kColorGas = kBlue ;
371 const Int_t kColorAir = kYellow ;
372
373 // Box for a full PHOS module
374
375 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
376 fGeom->GetPPSDBoxSize(1)/2,
377 fGeom->GetPPSDBoxSize(2)/2 );
378
379 // Box containing one micromegas module
380
381 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
382 fGeom->GetPPSDModuleSize(1)/2,
383 fGeom->GetPPSDModuleSize(2)/2 );
384 // top lid
385
386 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
387 fGeom->GetLidThickness()/2,
388 fGeom->GetPPSDModuleSize(2)/2 ) ;
389 // composite panel (top and bottom)
390
391 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
392 fGeom->GetCompositeThickness()/2,
393 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
394
395 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
396 fGeom->GetCompositeThickness()/2,
397 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
398 // gas gap (conversion and avalanche)
399
400 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
401 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
402 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
403
404 // anode and cathode
405
406 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
407 fGeom->GetAnodeThickness()/2,
408 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
409
410 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
411 fGeom->GetCathodeThickness()/2,
412 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
413 // PC
414
415 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
416 fGeom->GetPCThickness()/2,
417 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
418 // Gap between Lead and top micromegas
419
420 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
421 fGeom->GetMicro1ToLeadGap()/2,
422 fGeom->GetPPSDBoxSize(2)/2 ) ;
423
424// Gap between Lead and bottom micromegas
425
426 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
427 fGeom->GetLeadToMicro2Gap()/2,
428 fGeom->GetPPSDBoxSize(2)/2 ) ;
429 // Lead converter
430
431 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
432 fGeom->GetLeadConverterThickness()/2,
433 fGeom->GetPPSDBoxSize(2)/2 ) ;
434
435 // position PPSD into ALICE
436
437 char * nodename = new char[20] ;
438 char * rotname = new char[20] ;
439
92862013 440 Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
d15a28e7 441 Int_t number = 988 ;
92862013 442 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
d15a28e7 443
444 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
445 Float_t angle = fGeom->GetPHOSAngle(i) ;
446 sprintf(rotname, "%s%d", "rotg", number++) ;
447 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
92862013 448 top->cd();
d15a28e7 449 sprintf(nodename, "%s%d", "Moduleg", i) ;
92862013 450 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
451 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
452 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
453 ppsdboxnode->SetLineColor(kColorPPSD) ;
454 fNodes->Add(ppsdboxnode) ;
455 ppsdboxnode->cd() ;
d15a28e7 456 // inside the PPSD box:
457 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
92862013 458 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
d15a28e7 459 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
92862013 460 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
461 TNode * micro1node ;
d15a28e7 462 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
92862013 463 y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
d15a28e7 464 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
92862013 465 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
466 micro1node->SetLineColor(kColorPPSD) ;
467 fNodes->Add(micro1node) ;
d15a28e7 468 // inside top micromegas
92862013 469 micro1node->cd() ;
d15a28e7 470 // a. top lid
92862013 471 y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
d15a28e7 472 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
92862013 473 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
474 toplidnode->SetLineColor(kColorPPSD) ;
475 fNodes->Add(toplidnode) ;
d15a28e7 476 // b. composite panel
92862013 477 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 478 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
92862013 479 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
480 compupnode->SetLineColor(kColorPPSD) ;
481 fNodes->Add(compupnode) ;
d15a28e7 482 // c. anode
92862013 483 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
d15a28e7 484 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
92862013 485 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
486 anodenode->SetLineColor(kColorPHOS) ;
487 fNodes->Add(anodenode) ;
d15a28e7 488 // d. gas
92862013 489 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
d15a28e7 490 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
92862013 491 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
492 ggapnode->SetLineColor(kColorGas) ;
493 fNodes->Add(ggapnode) ;
d15a28e7 494 // f. cathode
92862013 495 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
d15a28e7 496 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
92862013 497 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
498 cathodenode->SetLineColor(kColorPHOS) ;
499 fNodes->Add(cathodenode) ;
d15a28e7 500 // g. printed circuit
92862013 501 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
d15a28e7 502 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
92862013 503 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
504 pcnode->SetLineColor(kColorPPSD) ;
505 fNodes->Add(pcnode) ;
d15a28e7 506 // h. composite panel
92862013 507 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 508 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
92862013 509 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
510 compdownnode->SetLineColor(kColorPPSD) ;
511 fNodes->Add(compdownnode) ;
512 z = z - fGeom->GetPPSDModuleSize(2) ;
513 ppsdboxnode->cd() ;
d15a28e7 514 } // end of Z module loop
92862013 515 x = x - fGeom->GetPPSDModuleSize(0) ;
516 ppsdboxnode->cd() ;
d15a28e7 517 } // end of phi module loop
518 // 2. air gap
92862013 519 ppsdboxnode->cd() ;
520 y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
d15a28e7 521 sprintf(nodename, "%s%d", "GapUp", i) ;
92862013 522 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
523 gapupnode->SetLineColor(kColorAir) ;
524 fNodes->Add(gapupnode) ;
d15a28e7 525 // 3. lead converter
92862013 526 y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
d15a28e7 527 sprintf(nodename, "%s%d", "LeadC", i) ;
92862013 528 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
529 leadcnode->SetLineColor(kColorPPSD) ;
530 fNodes->Add(leadcnode) ;
d15a28e7 531 // 4. air gap
92862013 532 y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
d15a28e7 533 sprintf(nodename, "%s%d", "GapDown", i) ;
92862013 534 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
535 gapdownnode->SetLineColor(kColorAir) ;
536 fNodes->Add(gapdownnode) ;
d15a28e7 537 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
92862013 538 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
d15a28e7 539 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
92862013 540 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
541 TNode * micro2node ;
d15a28e7 542 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
92862013 543 y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
d15a28e7 544 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
92862013 545 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
546 micro2node->SetLineColor(kColorPPSD) ;
547 fNodes->Add(micro2node) ;
d15a28e7 548 // inside bottom micromegas
92862013 549 micro2node->cd() ;
d15a28e7 550 // a. top lid
92862013 551 y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
d15a28e7 552 sprintf(nodename, "%s%d", "Lidb", i) ;
92862013 553 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
554 toplidbnode->SetLineColor(kColorPPSD) ;
555 fNodes->Add(toplidbnode) ;
d15a28e7 556 // b. composite panel
92862013 557 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 558 sprintf(nodename, "%s%d", "CompUb", i) ;
92862013 559 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
560 compupbnode->SetLineColor(kColorPPSD) ;
561 fNodes->Add(compupbnode) ;
d15a28e7 562 // c. anode
92862013 563 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
d15a28e7 564 sprintf(nodename, "%s%d", "Anob", i) ;
92862013 565 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
566 anodebnode->SetLineColor(kColorPPSD) ;
567 fNodes->Add(anodebnode) ;
d15a28e7 568 // d. conversion gas
92862013 569 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
d15a28e7 570 sprintf(nodename, "%s%d", "GGapb", i) ;
92862013 571 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
572 ggapbnode->SetLineColor(kColorGas) ;
573 fNodes->Add(ggapbnode) ;
d15a28e7 574 // f. cathode
92862013 575 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
d15a28e7 576 sprintf(nodename, "%s%d", "Cathodeb", i) ;
92862013 577 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
578 cathodebnode->SetLineColor(kColorPPSD) ;
579 fNodes->Add(cathodebnode) ;
d15a28e7 580 // g. printed circuit
92862013 581 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
d15a28e7 582 sprintf(nodename, "%s%d", "PCb", i) ;
92862013 583 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
584 pcbnode->SetLineColor(kColorPPSD) ;
585 fNodes->Add(pcbnode) ;
d15a28e7 586 // h. composite pane
92862013 587 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 588 sprintf(nodename, "%s%d", "CompDownb", i) ;
92862013 589 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
590 compdownbnode->SetLineColor(kColorPPSD) ;
591 fNodes->Add(compdownbnode) ;
592 z = z - fGeom->GetPPSDModuleSize(2) ;
593 ppsdboxnode->cd() ;
d15a28e7 594 } // end of Z module loop
92862013 595 x = x - fGeom->GetPPSDModuleSize(0) ;
596 ppsdboxnode->cd() ;
d15a28e7 597 } // end of phi module loop
598 } // PHOS modules
599 delete rotname ;
600 delete nodename ;
fe4da5cc 601}
602
d15a28e7 603//____________________________________________________________________________
fe4da5cc 604void AliPHOSv0::CreateGeometry()
605{
b2a60966 606 // Create the PHOS geometry for Geant
d15a28e7 607
92862013 608 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
d15a28e7 609
92862013 610 if ( phostmp == NULL ) {
d15a28e7 611
612 fprintf(stderr, "PHOS detector not found!\n") ;
613 return;
fe4da5cc 614
d15a28e7 615 }
d15a28e7 616 // Get pointer to the array containing media indeces
92862013 617 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 618
92862013 619 Float_t bigbox[3] ;
620 bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
621 bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
622 bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
d15a28e7 623
92862013 624 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
d15a28e7 625
626 this->CreateGeometryforPHOS() ;
627 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
628 this->CreateGeometryforPPSD() ;
629 else
630 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
631
632 // --- Position PHOS mdules in ALICE setup ---
633
92862013 634 Int_t idrotm[99] ;
635 Double_t const kRADDEG = 180.0 / kPI ;
d15a28e7 636
637 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
638
639 Float_t angle = fGeom->GetPHOSAngle(i) ;
92862013 640 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
d15a28e7 641
92862013 642 Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
d15a28e7 643
92862013 644 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
645 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
d15a28e7 646
92862013 647 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
d15a28e7 648
649 } // for GetNModules
650
fe4da5cc 651}
d15a28e7 652
653//____________________________________________________________________________
654void AliPHOSv0::CreateGeometryforPHOS()
655{
b2a60966 656 // Create the PHOS-EMC geometry for GEANT
657 //BEGIN_HTML
658 /*
659 <H2>
660 Geant3 geometry tree of PHOS-EMC in ALICE
661 </H2>
662 <P><CENTER>
663 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
664 </CENTER><P>
665 */
666 //END_HTML
667
668 // Get pointer to the array containing media indexes
92862013 669 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 670
671 // ---
672 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
673 // --- Foam Thermo Insulating outer cover dimensions ---
92862013 674 // --- Put it in bigbox = PHOS
d15a28e7 675
92862013 676 Float_t dphos[3] ;
677 dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
678 dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
679 dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
d15a28e7 680
92862013 681 gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
d15a28e7 682
92862013 683 Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
d15a28e7 684
92862013 685 gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 686
687 // ---
688 // --- Define Textolit Wall box, position inside EMCA ---
689 // --- Textolit Wall box dimentions ---
690
691
92862013 692 Float_t dptxw[3];
693 dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
694 dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
695 dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
d15a28e7 696
92862013 697 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
d15a28e7 698
92862013 699 yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
d15a28e7 700
92862013 701 gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 702
703 // ---
704 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
705 // --- immediately below Foam Thermo Insulation Upper plate ---
706
707 // --- Upper Polystyrene Foam plate thickness ---
708
92862013 709 Float_t dpufp[3] ;
710 dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
711 dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
712 dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
d15a28e7 713
92862013 714 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
d15a28e7 715
92862013 716 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
d15a28e7 717
92862013 718 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 719
720 // ---
721 // --- Define air-filled box, place inside PTXW ---
722 // --- Inner AIR volume dimensions ---
fe4da5cc 723
d15a28e7 724
92862013 725 Float_t dpair[3] ;
726 dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
727 dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
728 dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 729
92862013 730 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
d15a28e7 731
92862013 732 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
d15a28e7 733
92862013 734 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 735
736// --- Dimensions of PbWO4 crystal ---
737
92862013 738 Float_t xtlX = fGeom->GetCrystalSize(0) ;
739 Float_t xtlY = fGeom->GetCrystalSize(1) ;
740 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
d15a28e7 741
92862013 742 Float_t dptcb[3] ;
743 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
744 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
d15a28e7 745 + fGeom->GetModuleBoxThickness() / 2.0 ;
92862013 746 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
d15a28e7 747
92862013 748 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
d15a28e7 749
92862013 750 yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
d15a28e7 751 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
752 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
753
92862013 754 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 755
756 // ---
757 // --- Define Crystal BLock filled with air, position it inside PTCB ---
92862013 758 Float_t dpcbl[3] ;
d15a28e7 759
92862013 760 dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
761 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
762 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
d15a28e7 763
92862013 764 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
d15a28e7 765
766 // --- Divide PCBL in X (phi) and Z directions --
767 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
768 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
769
92862013 770 yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
d15a28e7 771
92862013 772 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 773
774 // ---
775 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
92862013 776 Float_t dpstc[3] ;
d15a28e7 777
92862013 778 dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
779 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
780 dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
d15a28e7 781
92862013 782 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
d15a28e7 783
784 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
785
786 // ---
787 // --- Define Tyvek volume, place inside PSTC ---
92862013 788 Float_t dppap[3] ;
d15a28e7 789
92862013 790 dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
791 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
792 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
d15a28e7 793
92862013 794 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
d15a28e7 795
92862013 796 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
797 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
d15a28e7 798
92862013 799 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 800
801 // ---
802 // --- Define PbWO4 crystal volume, place inside PPAP ---
92862013 803 Float_t dpxtl[3] ;
d15a28e7 804
92862013 805 dpxtl[0] = xtlX / 2.0 ;
806 dpxtl[1] = xtlY / 2.0 ;
807 dpxtl[2] = xtlZ / 2.0 ;
d15a28e7 808
92862013 809 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
d15a28e7 810
92862013 811 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
d15a28e7 812
92862013 813 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 814
815 // ---
816 // --- Define crystal support volume, place inside PPAP ---
92862013 817 Float_t dpsup[3] ;
d15a28e7 818
92862013 819 dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
820 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
821 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
d15a28e7 822
92862013 823 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
d15a28e7 824
92862013 825 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
d15a28e7 826
92862013 827 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 828
829 // ---
830 // --- Define PIN-diode volume and position it inside crystal support ---
831 // --- right behind PbWO4 crystal
832
833 // --- PIN-diode dimensions ---
834
835
92862013 836 Float_t dppin[3] ;
837 dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
838 dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
839 dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
d15a28e7 840
92862013 841 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
d15a28e7 842
92862013 843 yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
d15a28e7 844
92862013 845 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 846
847 // ---
848 // --- Define Upper Cooling Panel, place it on top of PTCB ---
92862013 849 Float_t dpucp[3] ;
d15a28e7 850 // --- Upper Cooling Plate thickness ---
851
92862013 852 dpucp[0] = dptcb[0] ;
853 dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
854 dpucp[2] = dptcb[2] ;
d15a28e7 855
92862013 856 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
d15a28e7 857
92862013 858 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
d15a28e7 859 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
860 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
861
92862013 862 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 863
864 // ---
865 // --- Define Al Support Plate, position it inside PAIR ---
866 // --- right beneath PTCB ---
867 // --- Al Support Plate thickness ---
868
92862013 869 Float_t dpasp[3] ;
870 dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
871 dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
872 dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 873
92862013 874 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
d15a28e7 875
92862013 876 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
d15a28e7 877 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
92862013 878 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
d15a28e7 879
92862013 880 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 881
882 // ---
883 // --- Define Thermo Insulating Plate, position it inside PAIR ---
884 // --- right beneath PASP ---
885 // --- Lower Thermo Insulating Plate thickness ---
886
92862013 887 Float_t dptip[3] ;
888 dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
889 dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
890 dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 891
92862013 892 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
d15a28e7 893
92862013 894 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
d15a28e7 895 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
92862013 896 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
d15a28e7 897
92862013 898 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 899
900 // ---
901 // --- Define Textolit Plate, position it inside PAIR ---
902 // --- right beneath PTIP ---
903 // --- Lower Textolit Plate thickness ---
904
92862013 905 Float_t dptxp[3] ;
906 dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
907 dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
908 dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 909
92862013 910 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
d15a28e7 911
92862013 912 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
d15a28e7 913 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
92862013 914 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness()
d15a28e7 915 + fGeom->GetLowerThermoPlateThickness() ) ;
916
92862013 917 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 918
919}
920
921//____________________________________________________________________________
922void AliPHOSv0::CreateGeometryforPPSD()
fe4da5cc 923{
b2a60966 924 // Create the PHOS-PPSD geometry for GEANT
925
926 //BEGIN_HTML
927 /*
928 <H2>
929 Geant3 geometry tree of PHOS-PPSD in ALICE
930 </H2>
931 <P><CENTER>
932 <IMG Align=BOTTOM ALT="PPSD geant tree" SRC="../images/PPSDinAlice.gif">
933 </CENTER><P>
934 */
935 //END_HTML
936
937 // Get pointer to the array containing media indexes
92862013 938 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 939
92862013 940 // The box containing all ppsd's for one PHOS module filled with air
941 Float_t ppsd[3] ;
942 ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
943 ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
944 ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
fe4da5cc 945
92862013 946 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
d15a28e7 947
92862013 948 Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ;
d15a28e7 949
92862013 950 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 951
952 // Now we build a micromegas module
953 // The box containing the whole module filled with epoxy (FR4)
954
92862013 955 Float_t mppsd[3] ;
956 mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
957 mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
958 mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
d15a28e7 959
92862013 960 gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;
d15a28e7 961
92862013 962 // Inside mppsd :
d15a28e7 963 // 1. The Top Lid made of epoxy (FR4)
964
92862013 965 Float_t tlppsd[3] ;
966 tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
967 tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
968 tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
d15a28e7 969
92862013 970 gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ;
d15a28e7 971
92862013 972 Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
d15a28e7 973
92862013 974 gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 975
976 // 2. the upper panel made of composite material
977
92862013 978 Float_t upppsd[3] ;
979 upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
980 upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
981 upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 982
92862013 983 gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ;
d15a28e7 984
92862013 985 y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 986
92862013 987 gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 988
989 // 3. the anode made of Copper
990
92862013 991 Float_t anppsd[3] ;
992 anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
993 anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ;
994 anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 995
92862013 996 gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ;
d15a28e7 997
92862013 998 y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
d15a28e7 999
92862013 1000 gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1001
1002 // 4. the conversion gap + avalanche gap filled with gas
1003
92862013 1004 Float_t ggppsd[3] ;
1005 ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1006 ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
1007 ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1008
92862013 1009 gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ;
d15a28e7 1010
1011 // --- Divide GGPP in X (phi) and Z directions --
1012 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
1013 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
1014
92862013 1015 y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
d15a28e7 1016
92862013 1017 gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1018
1019
1020 // 6. the cathode made of Copper
1021
92862013 1022 Float_t cappsd[3] ;
1023 cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1024 cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ;
1025 cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1026
92862013 1027 gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ;
d15a28e7 1028
92862013 1029 y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
d15a28e7 1030
92862013 1031 gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1032
1033 // 7. the printed circuit made of G10
1034
92862013 1035 Float_t pcppsd[3] ;
1036 pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
1037 pcppsd[1] = fGeom->GetPCThickness() / 2.0 ;
1038 pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1039
92862013 1040 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
d15a28e7 1041
92862013 1042 y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
d15a28e7 1043
92862013 1044 gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1045
1046 // 8. the lower panel made of composite material
1047
92862013 1048 Float_t lpppsd[3] ;
1049 lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1050 lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
1051 lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1052
92862013 1053 gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ;
d15a28e7 1054
92862013 1055 y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 1056
92862013 1057 gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1058
92862013 1059 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
d15a28e7 1060 // the top and bottom one's (which are assumed identical) :
1061
92862013 1062 Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
1063 Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
d15a28e7 1064
92862013 1065 Int_t copyNumbertop = 0 ;
1066 Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
d15a28e7 1067
92862013 1068 Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
d15a28e7 1069
1070 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
92862013 1071 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
d15a28e7 1072
1073 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
92862013 1074 gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
1075 gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
1076 z = z - fGeom->GetPPSDModuleSize(2) ;
d15a28e7 1077 } // end of Z module loop
92862013 1078 x = x - fGeom->GetPPSDModuleSize(0) ;
d15a28e7 1079 } // end of phi module loop
1080
1081 // The Lead converter between two air gaps
1082 // 1. Upper air gap
1083
92862013 1084 Float_t uappsd[3] ;
1085 uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1086 uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
1087 uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
d15a28e7 1088
92862013 1089 gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ;
d15a28e7 1090
92862013 1091 y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
d15a28e7 1092
92862013 1093 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1094
1095 // 2. Lead converter
1096
92862013 1097 Float_t lcppsd[3] ;
1098 lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1099 lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
1100 lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
d15a28e7 1101
92862013 1102 gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ;
d15a28e7 1103
92862013 1104 y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
d15a28e7 1105
92862013 1106 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1107
1108 // 3. Lower air gap
1109
92862013 1110 Float_t lappsd[3] ;
1111 lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1112 lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
1113 lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
d15a28e7 1114
92862013 1115 gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ;
fe4da5cc 1116
92862013 1117 y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
d15a28e7 1118
92862013 1119 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1120
fe4da5cc 1121}
1122
d15a28e7 1123//___________________________________________________________________________
b2a60966 1124Int_t AliPHOSv0::Digitize(Float_t Energy)
1125{
1126 // Applies the energy calibration
1127
9f616d61 1128 Float_t fB = 100000000. ;
d15a28e7 1129 Float_t fA = 0. ;
1130 Int_t chan = Int_t(fA + Energy*fB ) ;
1131 return chan ;
1132}
1133//___________________________________________________________________________
1134void AliPHOSv0::FinishEvent()
fe4da5cc 1135{
b2a60966 1136 // Makes the digits from the sum of summed hit in a single crystal or PPSD gas cell
1137 // Adds to the energy the electronic noise
1138 // Keeps digits with energy above fDigitThreshold
1139
d15a28e7 1140 Int_t i ;
cf239357 1141 Int_t relid[4];
ff4c968a 1142 Int_t j ;
d15a28e7 1143 TClonesArray &lDigits = *fDigits ;
92862013 1144 AliPHOSHit * hit ;
ff4c968a 1145 AliPHOSDigit * newdigit ;
1146 AliPHOSDigit * curdigit ;
1147 Bool_t deja = kFALSE ;
b2a60966 1148
d15a28e7 1149 for ( i = 0 ; i < fNTmpHits ; i++ ) {
92862013 1150 hit = (AliPHOSHit*)fTmpHits->At(i) ;
ff4c968a 1151 newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
6a72c964 1152 deja =kFALSE ;
ff4c968a 1153 for ( j = 0 ; j < fNdigits ; j++) {
cf239357 1154 curdigit = (AliPHOSDigit*) lDigits[j] ;
ff4c968a 1155 if ( *curdigit == *newdigit) {
cf239357 1156 *curdigit = *curdigit + *newdigit ;
ff4c968a 1157 deja = kTRUE ;
1158 }
1159 }
d1232693 1160 if ( !deja ) {
ff4c968a 1161 new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ;
1162 fNdigits++ ;
1163 }
1164
1165 delete newdigit ;
0869cea5 1166 }
ff4c968a 1167
cf239357 1168 // Noise induced by the PIN diode of the PbWO crystals
26d4b141 1169
0869cea5 1170 Float_t energyandnoise ;
1171 for ( i = 0 ; i < fNdigits ; i++ ) {
ff4c968a 1172 newdigit = (AliPHOSDigit * ) fDigits->At(i) ;
cf239357 1173 fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ;
ae37f159 1174
cf239357 1175 if (relid[1]==0){ // Digits belong to EMC (PbW0_4 crystals)
3a6a7952 1176 energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ;
ae37f159 1177
cf239357 1178 if (energyandnoise < 0 )
1179 energyandnoise = 0 ;
ae37f159 1180
cf239357 1181 newdigit->SetAmp(energyandnoise) ;
ae37f159 1182
1183 if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list
1184 fDigits->RemoveAt(i) ;
cf239357 1185 }
fe4da5cc 1186 }
ae37f159 1187 fDigits->Compress() ;
d15a28e7 1188 fNTmpHits = 0 ;
1189 fTmpHits->Delete();
fe4da5cc 1190}
d15a28e7 1191
1192//____________________________________________________________________________
1193void AliPHOSv0::Init(void)
1194{
b2a60966 1195 // Just prints an information message
1196
d15a28e7 1197 Int_t i;
1198
1199 printf("\n");
1200 for(i=0;i<35;i++) printf("*");
1201 printf(" PHOS_INIT ");
1202 for(i=0;i<35;i++) printf("*");
1203 printf("\n");
1204
1205 // Here the PHOS initialisation code (if any!)
1206
1207 for(i=0;i<80;i++) printf("*");
1208 printf("\n");
1209
1210}
1211
1212//___________________________________________________________________________
1213void AliPHOSv0::MakeBranch(Option_t* opt)
1214{
b2a60966 1215 // Create new branche in the current Root Tree in the digit Tree
1216
d15a28e7 1217 AliDetector::MakeBranch(opt) ;
1218
1219 char branchname[10];
1220 sprintf(branchname,"%s",GetName());
c198e326 1221 char *cdD = strstr(opt,"D");
d15a28e7 1222
c198e326 1223 if (fDigits && gAlice->TreeD() && cdD) {
d15a28e7 1224 gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
c198e326 1225 }
d15a28e7 1226}
d15a28e7 1227
9f616d61 1228//_____________________________________________________________________________
6ad0bfa0 1229void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
d15a28e7 1230{
b2a60966 1231 // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
1232 // 2. Creates a branch in TreeR for each list
1233 // 3. Steers the reconstruction processes
1234 // 4. Saves the 3 lists in TreeR
1235 // 5. Write the Tree to File
1236
6ad0bfa0 1237 fReconstructioner = Reconstructioner ;
b2a60966 1238
1239 char branchname[10] ;
6ad0bfa0 1240
b2a60966 1241 // 1.
1242
9f616d61 1243 if (fEmcClusters) {
1244 fEmcClusters->Delete() ;
1245 delete fEmcClusters ;
1246 fEmcClusters = 0 ;
9f616d61 1247 }
1248 fEmcClusters= new RecPointsList("AliPHOSEmcRecPoint", 100) ;
b2a60966 1249 if ( fEmcClusters && gAlice->TreeR() ) {
1250 sprintf(branchname,"%sERP",GetName()) ;
1251 gAlice->TreeR()->Branch(branchname, &fEmcClusters, fBufferSize);
1252 }
1253
9f616d61 1254 if (fPpsdClusters) {
1255 fPpsdClusters->Delete() ;
1256 delete fPpsdClusters ;
1257 fPpsdClusters = 0 ;
1258 }
1259 fPpsdClusters = new RecPointsList("AliPHOSPpsdRecPoint", 100) ;
b2a60966 1260 if ( fPpsdClusters && gAlice->TreeR() ) {
1261 sprintf(branchname,"%sPRP",GetName()) ;
1262 gAlice->TreeR()->Branch(branchname, &fPpsdClusters, fBufferSize);
1263 }
9f616d61 1264
b2a60966 1265 if (fTrackSegments) {
9f616d61 1266 fTrackSegments->Delete() ;
1267 delete fTrackSegments ;
1268 fTrackSegments = 0 ;
1269 }
b2a60966 1270 fTrackSegments = new TrackSegmentsList("AliPHOSTrackSegment", 100) ;
1271 if ( fTrackSegments && gAlice->TreeR() ) {
1272 sprintf(branchname,"%sTS",GetName()) ;
1273 gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize);
1274 }
1275
6ad0bfa0 1276 if (fRecParticles) {
1277 fRecParticles->Delete() ;
1278 delete fRecParticles ;
1279 fRecParticles = 0 ;
1280 }
1281 fRecParticles = new RecParticlesList("AliPHOSRecParticle", 100) ;
b2a60966 1282 if ( fRecParticles && gAlice->TreeR() ) {
1283 sprintf(branchname,"%sRP",GetName()) ;
1284 gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize);
1285 }
1286
1287 // 3.
6ad0bfa0 1288
1289 fReconstructioner->Make(fDigits, fEmcClusters, fPpsdClusters, fTrackSegments, fRecParticles);
9f616d61 1290
b2a60966 1291 // 4.
1292
1293 gAlice->TreeR()->Fill() ;
1294
1295 // 5.
1296
1297 gAlice->TreeR()->Write() ;
1298
d15a28e7 1299}
1300
1301//____________________________________________________________________________
1302void AliPHOSv0::StepManager(void)
1303{
b2a60966 1304 // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
1305
92862013 1306 Int_t relid[4] ; // (box, layer, row, column) indices
d15a28e7 1307 Float_t xyze[4] ; // position wrt MRS and energy deposited
1308 TLorentzVector pos ;
ff4c968a 1309 Int_t copy ;
d15a28e7 1310
ff4c968a 1311 Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
d15a28e7 1312 TString name = fGeom->GetName() ;
d15a28e7 1313 if ( name == "GPS2" ) { // the CPV is a PPSD
b2a60966 1314 if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell
d15a28e7 1315 {
1316 gMC->TrackPosition(pos) ;
1317 xyze[0] = pos[0] ;
1318 xyze[1] = pos[1] ;
1319 xyze[2] = pos[2] ;
1320 xyze[3] = gMC->Edep() ;
1321
1322 if ( xyze[3] != 0 ) { // there is deposited energy
92862013 1323 gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number
1324 gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
d15a28e7 1325 // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
1326 // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
92862013 1327 gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell
1328 gMC->CurrentVolID(relid[3]) ; // get the column number
d15a28e7 1329
1330 // get the absolute Id number
1331
92862013 1332 Int_t absid ;
ff4c968a 1333 fGeom->RelToAbsNumbering(relid, absid) ;
d15a28e7 1334
1335 // add current hit to the hit list
ff4c968a 1336 AddHit(primary, absid, xyze);
d15a28e7 1337
1338 } // there is deposited energy
1339 } // We are inside the gas of the CPV
1340 } // GPS2 configuration
1341
ff4c968a 1342 if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) // We are inside a PBWO crystal
d15a28e7 1343 {
1344 gMC->TrackPosition(pos) ;
1345 xyze[0] = pos[0] ;
1346 xyze[1] = pos[1] ;
1347 xyze[2] = pos[2] ;
1348 xyze[3] = gMC->Edep() ;
1349
1350 if ( xyze[3] != 0 ) {
92862013 1351 gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
ff4c968a 1352 relid[1] = 0 ; // means PBW04
92862013 1353 gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
1354 gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
d15a28e7 1355
1356 // get the absolute Id number
1357
92862013 1358 Int_t absid ;
1359 fGeom->RelToAbsNumbering(relid, absid) ;
d15a28e7 1360
1361 // add current hit to the hit list
1362
ff4c968a 1363 AddHit(primary, absid, xyze);
d15a28e7 1364
1365 } // there is deposited energy
1366 } // we are inside a PHOS Xtal
1367}
1368