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