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