1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // Implementation version v0 of PHOS Manager class
20 // Layout EMC + PPSD has name GPS2
22 //*-- Author: Yves Schutz (SUBATECH)
25 // --- ROOT system ---
32 // --- Standard library ---
37 #include <strstream.h>
39 // --- AliRoot header files ---
41 #include "AliPHOSv0.h"
42 #include "AliPHOSHit.h"
43 #include "AliPHOSDigit.h"
44 #include "AliPHOSReconstructioner.h"
50 //____________________________________________________________________________
51 AliPHOSv0::AliPHOSv0()
58 //____________________________________________________________________________
59 AliPHOSv0::AliPHOSv0(const char *name, const char *title):
62 // ctor : title is used to identify the layout
63 // GPS2 = 5 modules (EMC + PPSD)
64 // We use 2 arrays of hits :
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).
70 // - fTmpHits, which retains all the hits of the current event. It
71 // is used for the digitization part.
73 fPinElectronicNoise = 0.010 ;
74 fDigitThreshold = 1. ; // 1 GeV
76 // We do not want to save in TreeH the raw hits
77 // fHits = new TClonesArray("AliPHOSHit",100) ;
78 // gAlice->AddHitList(fHits) ;
80 // But save the cumulated hits instead (need to create the branch myself)
81 // It is put in the Digit Tree because the TreeH is filled after each primary
82 // and the TreeD at the end of the event (branch is set in FinishEvent() ).
84 fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
86 fNTmpHits = fNhits = 0 ;
88 fDigits = new TClonesArray("AliPHOSDigit",1000) ;
91 fIshunt = 1 ; // All hits are associated with primary particles
93 // gets an instance of the geometry parameters class
95 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
97 if (fGeom->IsInitialized() )
98 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
100 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
103 //____________________________________________________________________________
104 AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
107 // ctor : title is used to identify the layout
108 // GPS2 = 5 modules (EMC + PPSD)
109 // We use 2 arrays of hits :
111 // - fHits (the "normal" one), which retains the hits associated with
112 // the current primary particle being tracked
113 // (this array is reset after each primary has been tracked).
115 // - fTmpHits, which retains all the hits of the current event. It
116 // is used for the digitization part.
118 fPinElectronicNoise = 0.010 ;
120 // We do not want to save in TreeH the raw hits
121 //fHits = new TClonesArray("AliPHOSHit",100) ;
123 fDigits = new TClonesArray("AliPHOSDigit",1000) ;
124 fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
126 fNTmpHits = fNhits = 0 ;
128 fIshunt = 1 ; // All hits are associated with primary particles
130 // gets an instance of the geometry parameters class
131 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
133 if (fGeom->IsInitialized() )
134 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
136 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
138 // Defining the PHOS Reconstructioner
140 fReconstructioner = Reconstructioner ;
143 //____________________________________________________________________________
144 AliPHOSv0::~AliPHOSv0()
154 if ( fEmcRecPoints ) {
155 fEmcRecPoints->Delete() ;
156 delete fEmcRecPoints ;
160 if ( fPpsdRecPoints ) {
161 fPpsdRecPoints->Delete() ;
162 delete fPpsdRecPoints ;
166 if ( fTrackSegments ) {
167 fTrackSegments->Delete() ;
168 delete fTrackSegments ;
174 //____________________________________________________________________________
175 void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits)
177 // Add a hit to the hit list.
178 // A PHOS hit is the sum of all hits in a single crystal
179 // or in a single PPSD gas cell
182 TClonesArray <mphits = *fTmpHits ;
185 // AliPHOSHit *curHit2 ;
186 Bool_t deja = kFALSE ;
188 // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
190 newHit = new AliPHOSHit(primary, Id, hits) ;
192 // We do not want to save in TreeH the raw hits
193 // TClonesArray &lhits = *fHits;
195 for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
196 curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
197 if( *curHit == *newHit ) {
198 *curHit = *curHit + *newHit ;
204 new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
208 // We do not want to save in TreeH the raw hits
209 // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
212 // Please note that the fTmpHits array must survive up to the
213 // end of the events, so it does not appear e.g. in ResetHits() (
214 // which is called at the end of each primary).
221 //____________________________________________________________________________
222 void AliPHOSv0::BuildGeometry()
224 // Build the PHOS geometry for the ROOT display
228 PHOS in ALICE displayed by root
234 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
239 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
244 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
249 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
255 this->BuildGeometryforPHOS() ;
256 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
257 this->BuildGeometryforPPSD() ;
259 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
263 //____________________________________________________________________________
264 void AliPHOSv0:: BuildGeometryforPHOS(void)
266 // Build the PHOS-EMC geometry for the ROOT display
268 const Int_t kColorPHOS = kRed ;
269 const Int_t kColorXTAL = kBlue ;
271 Double_t const kRADDEG = 180.0 / kPI ;
273 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
274 fGeom->GetOuterBoxSize(1)/2,
275 fGeom->GetOuterBoxSize(2)/2 );
277 // Textolit Wall box, position inside PHOS
279 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
280 fGeom->GetTextolitBoxSize(1)/2,
281 fGeom->GetTextolitBoxSize(2)/2);
283 // Polystyrene Foam Plate
285 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
286 fGeom->GetSecondUpperPlateThickness()/2,
287 fGeom->GetTextolitBoxSize(2)/2 ) ;
291 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
292 fGeom->GetAirFilledBoxSize(1)/2,
293 fGeom->GetAirFilledBoxSize(2)/2 );
297 Float_t xtlX = fGeom->GetCrystalSize(0) ;
298 Float_t xtlY = fGeom->GetCrystalSize(1) ;
299 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
301 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
302 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
303 + fGeom->GetModuleBoxThickness() / 2.0 ;
304 Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
306 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
308 // position PHOS into ALICE
310 Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
312 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
314 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
316 char * nodename = new char[20] ;
317 char * rotname = new char[20] ;
319 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
320 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
321 sprintf(rotname, "%s%d", "rot", number++) ;
322 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
324 sprintf(nodename,"%s%d", "Module", i) ;
325 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
326 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
327 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
328 outerboxnode->SetLineColor(kColorPHOS) ;
329 fNodes->Add(outerboxnode) ;
331 // now inside the outer box the textolit box
332 y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
333 sprintf(nodename,"%s%d", "TexBox", i) ;
334 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
335 textolitboxnode->SetLineColor(kColorPHOS) ;
336 fNodes->Add(textolitboxnode) ;
337 // upper foam plate inside outre box
339 sprintf(nodename, "%s%d", "UFPlate", i) ;
340 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
341 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
342 upperfoamplatenode->SetLineColor(kColorPHOS) ;
343 fNodes->Add(upperfoamplatenode) ;
344 // air filled box inside textolit box (not drawn)
345 textolitboxnode->cd();
346 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
347 sprintf(nodename, "%s%d", "AFBox", i) ;
348 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
349 fNodes->Add(airfilledboxnode) ;
350 // crystals box inside air filled box
351 airfilledboxnode->cd() ;
352 y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl
353 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
354 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
355 sprintf(nodename, "%s%d", "XTBox", i) ;
356 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
357 crystalsboxnode->SetLineColor(kColorXTAL) ;
358 fNodes->Add(crystalsboxnode) ;
362 //____________________________________________________________________________
363 void AliPHOSv0:: BuildGeometryforPPSD(void)
365 // Build the PHOS-PPSD geometry for the ROOT display
369 PPSD displayed by root
372 <LI> Zoom on PPSD: Front View
375 <IMG Align=BOTTOM ALT="PPSD Front View" SRC="../images/AliPHOSv0PPSDFrontView.gif">
377 <LI> Zoom on PPSD: Perspective View
380 <IMG Align=BOTTOM ALT="PPSD Prespective View" SRC="../images/AliPHOSv0PPSDPerspectiveView.gif">
385 Double_t const kRADDEG = 180.0 / kPI ;
387 const Int_t kColorPHOS = kRed ;
388 const Int_t kColorPPSD = kGreen ;
389 const Int_t kColorGas = kBlue ;
390 const Int_t kColorAir = kYellow ;
392 // Box for a full PHOS module
394 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
395 fGeom->GetPPSDBoxSize(1)/2,
396 fGeom->GetPPSDBoxSize(2)/2 );
398 // Box containing one micromegas module
400 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
401 fGeom->GetPPSDModuleSize(1)/2,
402 fGeom->GetPPSDModuleSize(2)/2 );
405 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
406 fGeom->GetLidThickness()/2,
407 fGeom->GetPPSDModuleSize(2)/2 ) ;
408 // composite panel (top and bottom)
410 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
411 fGeom->GetCompositeThickness()/2,
412 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
414 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
415 fGeom->GetCompositeThickness()/2,
416 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
417 // gas gap (conversion and avalanche)
419 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
420 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
421 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
425 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
426 fGeom->GetAnodeThickness()/2,
427 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
429 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
430 fGeom->GetCathodeThickness()/2,
431 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
434 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
435 fGeom->GetPCThickness()/2,
436 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
437 // Gap between Lead and top micromegas
439 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
440 fGeom->GetMicro1ToLeadGap()/2,
441 fGeom->GetPPSDBoxSize(2)/2 ) ;
443 // Gap between Lead and bottom micromegas
445 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
446 fGeom->GetLeadToMicro2Gap()/2,
447 fGeom->GetPPSDBoxSize(2)/2 ) ;
450 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
451 fGeom->GetLeadConverterThickness()/2,
452 fGeom->GetPPSDBoxSize(2)/2 ) ;
454 // position PPSD into ALICE
456 char * nodename = new char[20] ;
457 char * rotname = new char[20] ;
459 Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
461 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
463 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
464 Float_t angle = fGeom->GetPHOSAngle(i) ;
465 sprintf(rotname, "%s%d", "rotg", number++) ;
466 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
468 sprintf(nodename, "%s%d", "Moduleg", i) ;
469 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
470 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
471 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
472 ppsdboxnode->SetLineColor(kColorPPSD) ;
473 fNodes->Add(ppsdboxnode) ;
475 // inside the PPSD box:
476 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
477 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
479 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
480 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
482 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
483 y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
484 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
485 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
486 micro1node->SetLineColor(kColorPPSD) ;
487 fNodes->Add(micro1node) ;
488 // inside top micromegas
491 y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
492 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
493 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
494 toplidnode->SetLineColor(kColorPPSD) ;
495 fNodes->Add(toplidnode) ;
496 // b. composite panel
497 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
498 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
499 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
500 compupnode->SetLineColor(kColorPPSD) ;
501 fNodes->Add(compupnode) ;
503 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
504 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
505 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
506 anodenode->SetLineColor(kColorPHOS) ;
507 fNodes->Add(anodenode) ;
509 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
510 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
511 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
512 ggapnode->SetLineColor(kColorGas) ;
513 fNodes->Add(ggapnode) ;
515 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
516 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
517 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
518 cathodenode->SetLineColor(kColorPHOS) ;
519 fNodes->Add(cathodenode) ;
520 // g. printed circuit
521 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
522 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
523 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
524 pcnode->SetLineColor(kColorPPSD) ;
525 fNodes->Add(pcnode) ;
526 // h. composite panel
527 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
528 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
529 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
530 compdownnode->SetLineColor(kColorPPSD) ;
531 fNodes->Add(compdownnode) ;
532 z = z - fGeom->GetPPSDModuleSize(2) ;
534 } // end of Z module loop
535 x = x - fGeom->GetPPSDModuleSize(0) ;
537 } // end of phi module loop
541 y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
542 sprintf(nodename, "%s%d", "GapUp", i) ;
543 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
544 gapupnode->SetLineColor(kColorAir) ;
545 fNodes->Add(gapupnode) ;
547 y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
548 sprintf(nodename, "%s%d", "LeadC", i) ;
549 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
550 leadcnode->SetLineColor(kColorPPSD) ;
551 fNodes->Add(leadcnode) ;
553 y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
554 sprintf(nodename, "%s%d", "GapDown", i) ;
555 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
556 gapdownnode->SetLineColor(kColorAir) ;
557 fNodes->Add(gapdownnode) ;
558 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
559 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
561 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
562 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
564 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
565 y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
566 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
567 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
568 micro2node->SetLineColor(kColorPPSD) ;
569 fNodes->Add(micro2node) ;
570 // inside bottom micromegas
573 y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
574 sprintf(nodename, "%s%d", "Lidb", i) ;
575 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
576 toplidbnode->SetLineColor(kColorPPSD) ;
577 fNodes->Add(toplidbnode) ;
578 // b. composite panel
579 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
580 sprintf(nodename, "%s%d", "CompUb", i) ;
581 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
582 compupbnode->SetLineColor(kColorPPSD) ;
583 fNodes->Add(compupbnode) ;
585 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
586 sprintf(nodename, "%s%d", "Anob", i) ;
587 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
588 anodebnode->SetLineColor(kColorPPSD) ;
589 fNodes->Add(anodebnode) ;
591 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
592 sprintf(nodename, "%s%d", "GGapb", i) ;
593 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
594 ggapbnode->SetLineColor(kColorGas) ;
595 fNodes->Add(ggapbnode) ;
597 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
598 sprintf(nodename, "%s%d", "Cathodeb", i) ;
599 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
600 cathodebnode->SetLineColor(kColorPPSD) ;
601 fNodes->Add(cathodebnode) ;
602 // g. printed circuit
603 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
604 sprintf(nodename, "%s%d", "PCb", i) ;
605 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
606 pcbnode->SetLineColor(kColorPPSD) ;
607 fNodes->Add(pcbnode) ;
609 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
610 sprintf(nodename, "%s%d", "CompDownb", i) ;
611 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
612 compdownbnode->SetLineColor(kColorPPSD) ;
613 fNodes->Add(compdownbnode) ;
614 z = z - fGeom->GetPPSDModuleSize(2) ;
616 } // end of Z module loop
617 x = x - fGeom->GetPPSDModuleSize(0) ;
619 } // end of phi module loop
628 //____________________________________________________________________________
629 void AliPHOSv0::CreateGeometry()
631 // Create the PHOS geometry for Geant
633 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
635 if ( phostmp == NULL ) {
637 fprintf(stderr, "PHOS detector not found!\n") ;
641 // Get pointer to the array containing media indeces
642 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
645 bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
646 bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
647 bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
649 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
651 this->CreateGeometryforPHOS() ;
652 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
653 this->CreateGeometryforPPSD() ;
655 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
657 // --- Position PHOS mdules in ALICE setup ---
660 Double_t const kRADDEG = 180.0 / kPI ;
662 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
664 Float_t angle = fGeom->GetPHOSAngle(i) ;
665 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
667 Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
669 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
670 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
672 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
678 //____________________________________________________________________________
679 void AliPHOSv0::CreateGeometryforPHOS()
681 // Create the PHOS-EMC geometry for GEANT
685 Geant3 geometry tree of PHOS-EMC in ALICE
688 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
693 // Get pointer to the array containing media indexes
694 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
697 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
698 // --- Foam Thermo Insulating outer cover dimensions ---
699 // --- Put it in bigbox = PHOS
702 dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
703 dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
704 dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
706 gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
708 Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
710 gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
713 // --- Define Textolit Wall box, position inside EMCA ---
714 // --- Textolit Wall box dimentions ---
718 dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
719 dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
720 dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
722 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
724 yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
726 gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
729 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
730 // --- immediately below Foam Thermo Insulation Upper plate ---
732 // --- Upper Polystyrene Foam plate thickness ---
735 dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
736 dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
737 dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
739 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
741 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
743 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
746 // --- Define air-filled box, place inside PTXW ---
747 // --- Inner AIR volume dimensions ---
751 dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
752 dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
753 dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
755 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
757 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
759 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
761 // --- Dimensions of PbWO4 crystal ---
763 Float_t xtlX = fGeom->GetCrystalSize(0) ;
764 Float_t xtlY = fGeom->GetCrystalSize(1) ;
765 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
768 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
769 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
770 + fGeom->GetModuleBoxThickness() / 2.0 ;
771 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
773 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
775 yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
776 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
777 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
779 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
782 // --- Define Crystal BLock filled with air, position it inside PTCB ---
785 dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
786 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
787 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
789 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
791 // --- Divide PCBL in X (phi) and Z directions --
792 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
793 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
795 yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
797 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
800 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
803 dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
804 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
805 dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
807 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
809 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
812 // --- Define Tyvek volume, place inside PSTC ---
815 dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
816 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
817 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
819 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
821 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
822 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
824 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
827 // --- Define PbWO4 crystal volume, place inside PPAP ---
830 dpxtl[0] = xtlX / 2.0 ;
831 dpxtl[1] = xtlY / 2.0 ;
832 dpxtl[2] = xtlZ / 2.0 ;
834 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
836 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
838 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
841 // --- Define crystal support volume, place inside PPAP ---
844 dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
845 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
846 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
848 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
850 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
852 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
855 // --- Define PIN-diode volume and position it inside crystal support ---
856 // --- right behind PbWO4 crystal
858 // --- PIN-diode dimensions ---
862 dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
863 dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
864 dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
866 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
868 yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
870 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
873 // --- Define Upper Cooling Panel, place it on top of PTCB ---
875 // --- Upper Cooling Plate thickness ---
877 dpucp[0] = dptcb[0] ;
878 dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
879 dpucp[2] = dptcb[2] ;
881 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
883 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
884 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
885 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
887 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
890 // --- Define Al Support Plate, position it inside PAIR ---
891 // --- right beneath PTCB ---
892 // --- Al Support Plate thickness ---
895 dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
896 dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
897 dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
899 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
901 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
902 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
903 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
905 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
908 // --- Define Thermo Insulating Plate, position it inside PAIR ---
909 // --- right beneath PASP ---
910 // --- Lower Thermo Insulating Plate thickness ---
913 dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
914 dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
915 dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
917 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
919 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
920 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
921 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
923 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
926 // --- Define Textolit Plate, position it inside PAIR ---
927 // --- right beneath PTIP ---
928 // --- Lower Textolit Plate thickness ---
931 dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
932 dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
933 dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
935 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
937 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
938 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
939 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness()
940 + fGeom->GetLowerThermoPlateThickness() ) ;
942 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
946 //____________________________________________________________________________
947 void AliPHOSv0::CreateGeometryforPPSD()
949 // Create the PHOS-PPSD geometry for GEANT
954 Geant3 geometry tree of PHOS-PPSD in ALICE
957 <IMG Align=BOTTOM ALT="PPSD geant tree" SRC="../images/PPSDinAlice.gif">
962 // Get pointer to the array containing media indexes
963 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
965 // The box containing all ppsd's for one PHOS module filled with air
967 ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
968 ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
969 ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
971 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
973 Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ;
975 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
977 // Now we build a micromegas module
978 // The box containing the whole module filled with epoxy (FR4)
981 mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
982 mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
983 mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
985 gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;
988 // 1. The Top Lid made of epoxy (FR4)
991 tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
992 tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
993 tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
995 gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ;
997 Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
999 gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1001 // 2. the upper panel made of composite material
1004 upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1005 upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
1006 upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1008 gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ;
1010 y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
1012 gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1014 // 3. the anode made of Copper
1017 anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1018 anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ;
1019 anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1021 gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ;
1023 y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
1025 gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1027 // 4. the conversion gap + avalanche gap filled with gas
1030 ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1031 ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
1032 ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1034 gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ;
1036 // --- Divide GGPP in X (phi) and Z directions --
1037 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
1038 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
1040 y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
1042 gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1045 // 6. the cathode made of Copper
1048 cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1049 cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ;
1050 cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1052 gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ;
1054 y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
1056 gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1058 // 7. the printed circuit made of G10
1061 pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
1062 pcppsd[1] = fGeom->GetPCThickness() / 2.0 ;
1063 pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1065 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
1067 y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
1069 gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1071 // 8. the lower panel made of composite material
1074 lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1075 lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
1076 lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1078 gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ;
1080 y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
1082 gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1084 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
1085 // the top and bottom one's (which are assumed identical) :
1087 Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
1088 Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
1090 Int_t copyNumbertop = 0 ;
1091 Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
1093 Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
1095 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
1096 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
1098 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
1099 gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
1100 gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
1101 z = z - fGeom->GetPPSDModuleSize(2) ;
1102 } // end of Z module loop
1103 x = x - fGeom->GetPPSDModuleSize(0) ;
1104 } // end of phi module loop
1106 // The Lead converter between two air gaps
1110 uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1111 uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
1112 uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1114 gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ;
1116 y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
1118 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1120 // 2. Lead converter
1123 lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1124 lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
1125 lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1127 gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ;
1129 y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
1131 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1136 lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1137 lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
1138 lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1140 gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ;
1142 y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
1144 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1148 //___________________________________________________________________________
1149 Int_t AliPHOSv0::Digitize(Float_t Energy)
1151 // Applies the energy calibration
1153 Float_t fB = 100000000. ;
1155 Int_t chan = Int_t(fA + Energy*fB ) ;
1159 //___________________________________________________________________________
1160 void AliPHOSv0::FinishEvent()
1162 // Makes the digits from the sum of summed hit in a single crystal or PPSD gas cell
1163 // Adds to the energy the electronic noise
1164 // Keeps digits with energy above fDigitThreshold
1166 // Save the cumulated hits instead of raw hits (need to create the branch myself)
1167 // It is put in the Digit Tree because the TreeH is filled after each primary
1168 // and the TreeD at the end of the event.
1174 TClonesArray &lDigits = *fDigits ;
1176 AliPHOSDigit * newdigit ;
1177 AliPHOSDigit * curdigit ;
1178 Bool_t deja = kFALSE ;
1180 for ( i = 0 ; i < fNTmpHits ; i++ ) {
1181 hit = (AliPHOSHit*)fTmpHits->At(i) ;
1182 newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
1184 for ( j = 0 ; j < fNdigits ; j++) {
1185 curdigit = (AliPHOSDigit*) lDigits[j] ;
1186 if ( *curdigit == *newdigit) {
1187 *curdigit = *curdigit + *newdigit ;
1192 new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ;
1199 // Noise induced by the PIN diode of the PbWO crystals
1201 Float_t energyandnoise ;
1202 for ( i = 0 ; i < fNdigits ; i++ ) {
1203 newdigit = (AliPHOSDigit * ) fDigits->At(i) ;
1204 fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ;
1206 if (relid[1]==0){ // Digits belong to EMC (PbW0_4 crystals)
1207 energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ;
1209 if (energyandnoise < 0 )
1210 energyandnoise = 0 ;
1212 if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list
1213 fDigits->RemoveAt(i) ;
1217 fDigits->Compress() ;
1219 fNdigits = fDigits->GetEntries() ;
1220 for (i = 0 ; i < fNdigits ; i++) {
1221 newdigit = (AliPHOSDigit *) fDigits->At(i) ;
1222 newdigit->SetIndexInList(i) ;
1227 //____________________________________________________________________________
1228 void AliPHOSv0::Init(void)
1230 // Just prints an information message
1235 for(i=0;i<35;i++) printf("*");
1236 printf(" PHOS_INIT ");
1237 for(i=0;i<35;i++) printf("*");
1240 // Here the PHOS initialisation code (if any!)
1242 for(i=0;i<80;i++) printf("*");
1247 //___________________________________________________________________________
1248 void AliPHOSv0::MakeBranch(Option_t* opt)
1250 // Create new branche in the current Root Tree in the digit Tree
1252 AliDetector::MakeBranch(opt) ;
1254 char branchname[10];
1255 sprintf(branchname,"%s",GetName());
1256 char *cdD = strstr(opt,"D");
1257 if (fDigits && gAlice->TreeD() && cdD) {
1258 gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize);
1261 // Create new branche PHOSCH in the current Root Tree in the digit Tree for accumulated Hits
1262 if ( ! (gAlice->IsLegoRun()) ) { // only when not in lego plot mode
1263 if ( fTmpHits && gAlice->TreeD() && cdD) {
1264 char branchname[10] ;
1265 sprintf(branchname, "%sCH", GetName()) ;
1266 gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
1272 //____________________________________________________________________________
1273 AliPHOSRecPoint::RecPointsList * AliPHOSv0::PpsdRecPoints(Int_t evt)
1275 // returns the pointer to the PPSD RecPoints list
1276 // if the list is empty, get it from TreeR on the disk file
1278 AliPHOSRecPoint::RecPointsList * rv = 0 ;
1280 if ( fPpsdRecPoints )
1281 rv = fPpsdRecPoints ;
1284 fPpsdRecPoints = new TClonesArray("AliPHOSPpsdRecPoint", 100) ;
1285 gAlice->GetEvent(evt) ;
1286 TTree * fReconstruct = gAlice->TreeR() ;
1287 fReconstruct->SetBranchAddress( "PHOSPpsdRP", &fPpsdRecPoints) ;
1288 fReconstruct->GetEvent(0) ;
1289 rv = fPpsdRecPoints ;
1292 fPpsdRecPoints->Expand( fPpsdRecPoints->GetEntries() ) ;
1298 //_____________________________________________________________________________
1299 void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
1301 // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
1302 // 2. Creates TreeR with a branch for each list
1303 // 3. Steers the reconstruction processes
1304 // 4. Saves the 3 lists in TreeR
1305 // 5. Write the Tree to File
1307 fReconstructioner = Reconstructioner ;
1309 char branchname[10] ;
1316 // gAlice->MakeTree("R") ;
1317 Int_t splitlevel = 0 ;
1319 if (fEmcRecPoints) {
1320 fEmcRecPoints->Delete() ;
1321 delete fEmcRecPoints ;
1325 // fEmcRecPoints= new AliPHOSRecPoint::RecPointsList("AliPHOSEmcRecPoint", 1000) ; if TClonesArray
1326 fEmcRecPoints= new AliPHOSRecPoint::RecPointsList(100) ;
1328 if ( fEmcRecPoints && gAlice->TreeR() ) {
1329 sprintf(branchname,"%sEmcRP",GetName()) ;
1331 // gAlice->TreeR()->Branch(branchname, &fEmcRecPoints, fBufferSize); if TClonesArray
1332 gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ;
1335 if (fPpsdRecPoints) {
1336 fPpsdRecPoints->Delete() ;
1337 delete fPpsdRecPoints ;
1338 fPpsdRecPoints = 0 ;
1341 // fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList("AliPHOSPpsdRecPoint", 1000) ; if TClonesArray
1342 fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList(100) ;
1344 if ( fPpsdRecPoints && gAlice->TreeR() ) {
1345 sprintf(branchname,"%sPpsdRP",GetName()) ;
1347 // gAlice->TreeR()->Branch(branchname, &fPpsdRecPoints, fBufferSize); if TClonesArray
1348 gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ;
1351 if (fTrackSegments) {
1352 fTrackSegments->Delete() ;
1353 delete fTrackSegments ;
1354 fTrackSegments = 0 ;
1357 fTrackSegments = new AliPHOSTrackSegment::TrackSegmentsList("AliPHOSTrackSegment", 1000) ;
1358 if ( fTrackSegments && gAlice->TreeR() ) {
1359 sprintf(branchname,"%sTS",GetName()) ;
1360 gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ;
1363 if (fRecParticles) {
1364 fRecParticles->Delete() ;
1365 delete fRecParticles ;
1368 fRecParticles = new AliPHOSRecParticle::RecParticlesList("AliPHOSRecParticle", 1000) ;
1369 if ( fRecParticles && gAlice->TreeR() ) {
1370 sprintf(branchname,"%sRP",GetName()) ;
1371 gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ;
1376 fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles);
1378 // 4. Expand or Shrink the arrays to the proper size
1382 size = fEmcRecPoints->GetEntries() ;
1383 fEmcRecPoints->Expand(size) ;
1385 size = fPpsdRecPoints->GetEntries() ;
1386 fPpsdRecPoints->Expand(size) ;
1388 size = fTrackSegments->GetEntries() ;
1389 fTrackSegments->Expand(size) ;
1391 size = fRecParticles->GetEntries() ;
1392 fRecParticles->Expand(size) ;
1394 gAlice->TreeR()->Fill() ;
1395 cout << "filled" << endl ;
1398 gAlice->TreeR()->Write() ;
1399 cout << "writen" << endl ;
1401 // Deleting reconstructed objects
1402 ResetReconstruction();
1407 //____________________________________________________________________________
1408 void AliPHOSv0::ResetDigits()
1410 // May sound strange, but cumulative hits are store in digits Tree
1411 AliDetector::ResetDigits();
1417 //____________________________________________________________________________
1418 void AliPHOSv0::ResetReconstruction()
1420 // Deleting reconstructed objects
1422 if ( fEmcRecPoints ) fEmcRecPoints->Delete();
1423 if ( fPpsdRecPoints ) fPpsdRecPoints->Delete();
1424 if ( fTrackSegments ) fTrackSegments->Delete();
1425 if ( fRecParticles ) fRecParticles->Delete();
1428 //____________________________________________________________________________
1429 void AliPHOSv0::StepManager(void)
1431 // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
1433 Int_t relid[4] ; // (box, layer, row, column) indices
1434 Float_t xyze[4] ; // position wrt MRS and energy deposited
1435 TLorentzVector pos ;
1438 Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
1439 TString name = fGeom->GetName() ;
1440 if ( name == "GPS2" ) { // the CPV is a PPSD
1441 if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell
1443 gMC->TrackPosition(pos) ;
1447 xyze[3] = gMC->Edep() ;
1449 if ( xyze[3] != 0 ) { // there is deposited energy
1450 gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number
1451 gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
1452 // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
1453 // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
1454 gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell
1455 gMC->CurrentVolID(relid[3]) ; // get the column number
1457 // get the absolute Id number
1460 fGeom->RelToAbsNumbering(relid, absid) ;
1462 // add current hit to the hit list
1463 AddHit(primary, absid, xyze);
1465 } // there is deposited energy
1466 } // We are inside the gas of the CPV
1467 } // GPS2 configuration
1469 if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) // We are inside a PBWO crystal
1471 gMC->TrackPosition(pos) ;
1475 xyze[3] = gMC->Edep() ;
1477 if ( xyze[3] != 0 ) {
1478 gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
1479 relid[1] = 0 ; // means PBW04
1480 gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
1481 gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
1483 // get the absolute Id number
1486 fGeom->RelToAbsNumbering(relid, absid) ;
1488 // add current hit to the hit list
1490 AddHit(primary, absid, xyze);
1492 } // there is deposited energy
1493 } // we are inside a PHOS Xtal