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 ;
102 // For reconstruction
103 // fEmcRecPoints = new TObjArray(1000);
104 //fPpsdRecPoints = new TObjArray(1000);
105 //fRecParticles = new TClonesArray("AliPHOSRecParticle", 1000) ;
106 //fTrackSegments = new TClonesArray("AliPHOSTrackSegment", 1000) ;
109 //____________________________________________________________________________
110 AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
113 // ctor : title is used to identify the layout
114 // GPS2 = 5 modules (EMC + PPSD)
115 // We use 2 arrays of hits :
117 // - fHits (the "normal" one), which retains the hits associated with
118 // the current primary particle being tracked
119 // (this array is reset after each primary has been tracked).
121 // - fTmpHits, which retains all the hits of the current event. It
122 // is used for the digitization part.
124 fPinElectronicNoise = 0.010 ;
126 // We do not want to save in TreeH the raw hits
127 //fHits = new TClonesArray("AliPHOSHit",100) ;
129 fDigits = new TClonesArray("AliPHOSDigit",1000) ;
130 fTmpHits= new TClonesArray("AliPHOSHit",1000) ;
132 fNTmpHits = fNhits = 0 ;
134 fIshunt = 1 ; // All hits are associated with primary particles
136 // gets an instance of the geometry parameters class
137 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
139 if (fGeom->IsInitialized() )
140 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
142 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
144 // Defining the PHOS Reconstructioner
146 fReconstructioner = Reconstructioner ;
151 //____________________________________________________________________________
152 AliPHOSv0::~AliPHOSv0()
162 if ( fEmcRecPoints ) {
163 fEmcRecPoints->Delete() ;
164 delete fEmcRecPoints ;
168 if ( fPpsdRecPoints ) {
169 fPpsdRecPoints->Delete() ;
170 delete fPpsdRecPoints ;
174 if ( fTrackSegments ) {
175 fTrackSegments->Delete() ;
176 delete fTrackSegments ;
182 //____________________________________________________________________________
183 void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits)
185 // Add a hit to the hit list.
186 // A PHOS hit is the sum of all hits in a single crystal
187 // or in a single PPSD gas cell
190 TClonesArray <mphits = *fTmpHits ;
193 // AliPHOSHit *curHit2 ;
194 Bool_t deja = kFALSE ;
196 // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
198 newHit = new AliPHOSHit(primary, Id, hits) ;
200 // We do not want to save in TreeH the raw hits
201 // TClonesArray &lhits = *fHits;
203 for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
204 curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
205 if( *curHit == *newHit ) {
206 *curHit = *curHit + *newHit ;
212 new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
216 // We do not want to save in TreeH the raw hits
217 // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
220 // Please note that the fTmpHits array must survive up to the
221 // end of the events, so it does not appear e.g. in ResetHits() (
222 // which is called at the end of each primary).
229 //____________________________________________________________________________
230 void AliPHOSv0::BuildGeometry()
232 // Build the PHOS geometry for the ROOT display
236 PHOS in ALICE displayed by root
242 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
247 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
252 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
257 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
263 this->BuildGeometryforPHOS() ;
264 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
265 this->BuildGeometryforPPSD() ;
267 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
271 //____________________________________________________________________________
272 void AliPHOSv0:: BuildGeometryforPHOS(void)
274 // Build the PHOS-EMC geometry for the ROOT display
276 const Int_t kColorPHOS = kRed ;
277 const Int_t kColorXTAL = kBlue ;
279 Double_t const kRADDEG = 180.0 / kPI ;
281 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
282 fGeom->GetOuterBoxSize(1)/2,
283 fGeom->GetOuterBoxSize(2)/2 );
285 // Textolit Wall box, position inside PHOS
287 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
288 fGeom->GetTextolitBoxSize(1)/2,
289 fGeom->GetTextolitBoxSize(2)/2);
291 // Polystyrene Foam Plate
293 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
294 fGeom->GetSecondUpperPlateThickness()/2,
295 fGeom->GetTextolitBoxSize(2)/2 ) ;
299 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
300 fGeom->GetAirFilledBoxSize(1)/2,
301 fGeom->GetAirFilledBoxSize(2)/2 );
305 Float_t xtlX = fGeom->GetCrystalSize(0) ;
306 Float_t xtlY = fGeom->GetCrystalSize(1) ;
307 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
309 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
310 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
311 + fGeom->GetModuleBoxThickness() / 2.0 ;
312 Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
314 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
316 // position PHOS into ALICE
318 Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
320 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
322 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
324 char * nodename = new char[20] ;
325 char * rotname = new char[20] ;
327 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
328 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
329 sprintf(rotname, "%s%d", "rot", number++) ;
330 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
332 sprintf(nodename,"%s%d", "Module", i) ;
333 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
334 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
335 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
336 outerboxnode->SetLineColor(kColorPHOS) ;
337 fNodes->Add(outerboxnode) ;
339 // now inside the outer box the textolit box
340 y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
341 sprintf(nodename,"%s%d", "TexBox", i) ;
342 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
343 textolitboxnode->SetLineColor(kColorPHOS) ;
344 fNodes->Add(textolitboxnode) ;
345 // upper foam plate inside outre box
347 sprintf(nodename, "%s%d", "UFPlate", i) ;
348 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
349 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
350 upperfoamplatenode->SetLineColor(kColorPHOS) ;
351 fNodes->Add(upperfoamplatenode) ;
352 // air filled box inside textolit box (not drawn)
353 textolitboxnode->cd();
354 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
355 sprintf(nodename, "%s%d", "AFBox", i) ;
356 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
357 fNodes->Add(airfilledboxnode) ;
358 // crystals box inside air filled box
359 airfilledboxnode->cd() ;
360 y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl
361 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
362 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
363 sprintf(nodename, "%s%d", "XTBox", i) ;
364 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
365 crystalsboxnode->SetLineColor(kColorXTAL) ;
366 fNodes->Add(crystalsboxnode) ;
373 //____________________________________________________________________________
374 void AliPHOSv0:: BuildGeometryforPPSD(void)
376 // Build the PHOS-PPSD geometry for the ROOT display
380 PPSD displayed by root
383 <LI> Zoom on PPSD: Front View
386 <IMG Align=BOTTOM ALT="PPSD Front View" SRC="../images/AliPHOSv0PPSDFrontView.gif">
388 <LI> Zoom on PPSD: Perspective View
391 <IMG Align=BOTTOM ALT="PPSD Prespective View" SRC="../images/AliPHOSv0PPSDPerspectiveView.gif">
396 Double_t const kRADDEG = 180.0 / kPI ;
398 const Int_t kColorPHOS = kRed ;
399 const Int_t kColorPPSD = kGreen ;
400 const Int_t kColorGas = kBlue ;
401 const Int_t kColorAir = kYellow ;
403 // Box for a full PHOS module
405 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
406 fGeom->GetPPSDBoxSize(1)/2,
407 fGeom->GetPPSDBoxSize(2)/2 );
409 // Box containing one micromegas module
411 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
412 fGeom->GetPPSDModuleSize(1)/2,
413 fGeom->GetPPSDModuleSize(2)/2 );
416 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
417 fGeom->GetLidThickness()/2,
418 fGeom->GetPPSDModuleSize(2)/2 ) ;
419 // composite panel (top and bottom)
421 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
422 fGeom->GetCompositeThickness()/2,
423 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
425 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
426 fGeom->GetCompositeThickness()/2,
427 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
428 // gas gap (conversion and avalanche)
430 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
431 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
432 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
436 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
437 fGeom->GetAnodeThickness()/2,
438 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
440 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
441 fGeom->GetCathodeThickness()/2,
442 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
445 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
446 fGeom->GetPCThickness()/2,
447 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
448 // Gap between Lead and top micromegas
450 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
451 fGeom->GetMicro1ToLeadGap()/2,
452 fGeom->GetPPSDBoxSize(2)/2 ) ;
454 // Gap between Lead and bottom micromegas
456 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
457 fGeom->GetLeadToMicro2Gap()/2,
458 fGeom->GetPPSDBoxSize(2)/2 ) ;
461 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
462 fGeom->GetLeadConverterThickness()/2,
463 fGeom->GetPPSDBoxSize(2)/2 ) ;
465 // position PPSD into ALICE
467 char * nodename = new char[20] ;
468 char * rotname = new char[20] ;
470 Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
472 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
474 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
475 Float_t angle = fGeom->GetPHOSAngle(i) ;
476 sprintf(rotname, "%s%d", "rotg", number++) ;
477 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
479 sprintf(nodename, "%s%d", "Moduleg", i) ;
480 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
481 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
482 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
483 ppsdboxnode->SetLineColor(kColorPPSD) ;
484 fNodes->Add(ppsdboxnode) ;
486 // inside the PPSD box:
487 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
488 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
490 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
491 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
493 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
494 y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
495 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
496 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
497 micro1node->SetLineColor(kColorPPSD) ;
498 fNodes->Add(micro1node) ;
499 // inside top micromegas
502 y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
503 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
504 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
505 toplidnode->SetLineColor(kColorPPSD) ;
506 fNodes->Add(toplidnode) ;
507 // b. composite panel
508 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
509 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
510 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
511 compupnode->SetLineColor(kColorPPSD) ;
512 fNodes->Add(compupnode) ;
514 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
515 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
516 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
517 anodenode->SetLineColor(kColorPHOS) ;
518 fNodes->Add(anodenode) ;
520 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
521 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
522 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
523 ggapnode->SetLineColor(kColorGas) ;
524 fNodes->Add(ggapnode) ;
526 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
527 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
528 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
529 cathodenode->SetLineColor(kColorPHOS) ;
530 fNodes->Add(cathodenode) ;
531 // g. printed circuit
532 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
533 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
534 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
535 pcnode->SetLineColor(kColorPPSD) ;
536 fNodes->Add(pcnode) ;
537 // h. composite panel
538 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
539 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
540 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
541 compdownnode->SetLineColor(kColorPPSD) ;
542 fNodes->Add(compdownnode) ;
543 z = z - fGeom->GetPPSDModuleSize(2) ;
545 } // end of Z module loop
546 x = x - fGeom->GetPPSDModuleSize(0) ;
548 } // end of phi module loop
552 y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
553 sprintf(nodename, "%s%d", "GapUp", i) ;
554 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
555 gapupnode->SetLineColor(kColorAir) ;
556 fNodes->Add(gapupnode) ;
558 y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
559 sprintf(nodename, "%s%d", "LeadC", i) ;
560 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
561 leadcnode->SetLineColor(kColorPPSD) ;
562 fNodes->Add(leadcnode) ;
564 y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
565 sprintf(nodename, "%s%d", "GapDown", i) ;
566 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
567 gapdownnode->SetLineColor(kColorAir) ;
568 fNodes->Add(gapdownnode) ;
569 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
570 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
572 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
573 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
575 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
576 y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
577 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
578 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
579 micro2node->SetLineColor(kColorPPSD) ;
580 fNodes->Add(micro2node) ;
581 // inside bottom micromegas
584 y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
585 sprintf(nodename, "%s%d", "Lidb", i) ;
586 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
587 toplidbnode->SetLineColor(kColorPPSD) ;
588 fNodes->Add(toplidbnode) ;
589 // b. composite panel
590 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
591 sprintf(nodename, "%s%d", "CompUb", i) ;
592 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
593 compupbnode->SetLineColor(kColorPPSD) ;
594 fNodes->Add(compupbnode) ;
596 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
597 sprintf(nodename, "%s%d", "Anob", i) ;
598 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
599 anodebnode->SetLineColor(kColorPPSD) ;
600 fNodes->Add(anodebnode) ;
602 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
603 sprintf(nodename, "%s%d", "GGapb", i) ;
604 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
605 ggapbnode->SetLineColor(kColorGas) ;
606 fNodes->Add(ggapbnode) ;
608 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
609 sprintf(nodename, "%s%d", "Cathodeb", i) ;
610 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
611 cathodebnode->SetLineColor(kColorPPSD) ;
612 fNodes->Add(cathodebnode) ;
613 // g. printed circuit
614 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
615 sprintf(nodename, "%s%d", "PCb", i) ;
616 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
617 pcbnode->SetLineColor(kColorPPSD) ;
618 fNodes->Add(pcbnode) ;
620 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
621 sprintf(nodename, "%s%d", "CompDownb", i) ;
622 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
623 compdownbnode->SetLineColor(kColorPPSD) ;
624 fNodes->Add(compdownbnode) ;
625 z = z - fGeom->GetPPSDModuleSize(2) ;
627 } // end of Z module loop
628 x = x - fGeom->GetPPSDModuleSize(0) ;
630 } // end of phi module loop
639 //____________________________________________________________________________
640 void AliPHOSv0::CreateGeometry()
642 // Create the PHOS geometry for Geant
644 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
646 if ( phostmp == NULL ) {
648 fprintf(stderr, "PHOS detector not found!\n") ;
652 // Get pointer to the array containing media indeces
653 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
656 bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
657 bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
658 bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
660 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
662 this->CreateGeometryforPHOS() ;
663 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
664 this->CreateGeometryforPPSD() ;
666 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
668 // --- Position PHOS mdules in ALICE setup ---
671 Double_t const kRADDEG = 180.0 / kPI ;
673 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
675 Float_t angle = fGeom->GetPHOSAngle(i) ;
676 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
678 Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
680 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
681 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
683 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
689 //____________________________________________________________________________
690 void AliPHOSv0::CreateGeometryforPHOS()
692 // Create the PHOS-EMC geometry for GEANT
696 Geant3 geometry tree of PHOS-EMC in ALICE
699 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
704 // Get pointer to the array containing media indexes
705 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
708 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
709 // --- Foam Thermo Insulating outer cover dimensions ---
710 // --- Put it in bigbox = PHOS
713 dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
714 dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
715 dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
717 gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
719 Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
721 gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
724 // --- Define Textolit Wall box, position inside EMCA ---
725 // --- Textolit Wall box dimentions ---
729 dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
730 dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
731 dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
733 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
735 yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
737 gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
740 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
741 // --- immediately below Foam Thermo Insulation Upper plate ---
743 // --- Upper Polystyrene Foam plate thickness ---
746 dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
747 dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
748 dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
750 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
752 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
754 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
757 // --- Define air-filled box, place inside PTXW ---
758 // --- Inner AIR volume dimensions ---
762 dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
763 dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
764 dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
766 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
768 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
770 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
772 // --- Dimensions of PbWO4 crystal ---
774 Float_t xtlX = fGeom->GetCrystalSize(0) ;
775 Float_t xtlY = fGeom->GetCrystalSize(1) ;
776 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
779 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
780 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
781 + fGeom->GetModuleBoxThickness() / 2.0 ;
782 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
784 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
786 yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
787 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
788 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
790 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
793 // --- Define Crystal BLock filled with air, position it inside PTCB ---
796 dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
797 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
798 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
800 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
802 // --- Divide PCBL in X (phi) and Z directions --
803 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
804 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
806 yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
808 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
811 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
814 dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
815 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
816 dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
818 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
820 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
823 // --- Define Tyvek volume, place inside PSTC ---
826 dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
827 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
828 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
830 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
832 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
833 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
835 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
838 // --- Define PbWO4 crystal volume, place inside PPAP ---
841 dpxtl[0] = xtlX / 2.0 ;
842 dpxtl[1] = xtlY / 2.0 ;
843 dpxtl[2] = xtlZ / 2.0 ;
845 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
847 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
849 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
852 // --- Define crystal support volume, place inside PPAP ---
855 dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
856 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
857 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
859 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
861 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
863 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
866 // --- Define PIN-diode volume and position it inside crystal support ---
867 // --- right behind PbWO4 crystal
869 // --- PIN-diode dimensions ---
873 dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
874 dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
875 dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
877 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
879 yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
881 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
884 // --- Define Upper Cooling Panel, place it on top of PTCB ---
886 // --- Upper Cooling Plate thickness ---
888 dpucp[0] = dptcb[0] ;
889 dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
890 dpucp[2] = dptcb[2] ;
892 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
894 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
895 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
896 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
898 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
901 // --- Define Al Support Plate, position it inside PAIR ---
902 // --- right beneath PTCB ---
903 // --- Al Support Plate thickness ---
906 dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
907 dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
908 dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
910 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
912 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
913 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
914 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
916 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
919 // --- Define Thermo Insulating Plate, position it inside PAIR ---
920 // --- right beneath PASP ---
921 // --- Lower Thermo Insulating Plate thickness ---
924 dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
925 dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
926 dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
928 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
930 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
931 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
932 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
934 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
937 // --- Define Textolit Plate, position it inside PAIR ---
938 // --- right beneath PTIP ---
939 // --- Lower Textolit Plate thickness ---
942 dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
943 dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
944 dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
946 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
948 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
949 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
950 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness()
951 + fGeom->GetLowerThermoPlateThickness() ) ;
953 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
957 //____________________________________________________________________________
958 void AliPHOSv0::CreateGeometryforPPSD()
960 // Create the PHOS-PPSD geometry for GEANT
965 Geant3 geometry tree of PHOS-PPSD in ALICE
968 <IMG Align=BOTTOM ALT="PPSD geant tree" SRC="../images/PPSDinAlice.gif">
973 // Get pointer to the array containing media indexes
974 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
976 // The box containing all ppsd's for one PHOS module filled with air
978 ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
979 ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
980 ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
982 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
984 Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ;
986 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
988 // Now we build a micromegas module
989 // The box containing the whole module filled with epoxy (FR4)
992 mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
993 mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
994 mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
996 gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;
999 // 1. The Top Lid made of epoxy (FR4)
1002 tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
1003 tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
1004 tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
1006 gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ;
1008 Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
1010 gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1012 // 2. the upper panel made of composite material
1015 upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1016 upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
1017 upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1019 gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ;
1021 y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
1023 gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1025 // 3. the anode made of Copper
1028 anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1029 anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ;
1030 anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1032 gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ;
1034 y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
1036 gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1038 // 4. the conversion gap + avalanche gap filled with gas
1041 ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1042 ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
1043 ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1045 gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ;
1047 // --- Divide GGPP in X (phi) and Z directions --
1048 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
1049 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
1051 y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
1053 gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1056 // 6. the cathode made of Copper
1059 cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1060 cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ;
1061 cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1063 gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ;
1065 y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
1067 gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1069 // 7. the printed circuit made of G10
1072 pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
1073 pcppsd[1] = fGeom->GetPCThickness() / 2.0 ;
1074 pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1076 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
1078 y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
1080 gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1082 // 8. the lower panel made of composite material
1085 lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1086 lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
1087 lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1089 gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ;
1091 y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
1093 gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1095 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
1096 // the top and bottom one's (which are assumed identical) :
1098 Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
1099 Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
1101 Int_t copyNumbertop = 0 ;
1102 Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
1104 Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
1106 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
1107 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
1109 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
1110 gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
1111 gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
1112 z = z - fGeom->GetPPSDModuleSize(2) ;
1113 } // end of Z module loop
1114 x = x - fGeom->GetPPSDModuleSize(0) ;
1115 } // end of phi module loop
1117 // The Lead converter between two air gaps
1121 uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1122 uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
1123 uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1125 gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ;
1127 y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
1129 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1131 // 2. Lead converter
1134 lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1135 lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
1136 lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1138 gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ;
1140 y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
1142 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1147 lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1148 lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
1149 lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1151 gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ;
1153 y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
1155 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1159 //___________________________________________________________________________
1160 Int_t AliPHOSv0::Digitize(Float_t Energy)
1162 // Applies the energy calibration
1164 Float_t fB = 100000000. ;
1166 Int_t chan = Int_t(fA + Energy*fB ) ;
1170 //___________________________________________________________________________
1171 void AliPHOSv0::FinishEvent()
1173 // Makes the digits from the sum of summed hit in a single crystal or PPSD gas cell
1174 // Adds to the energy the electronic noise
1175 // Keeps digits with energy above fDigitThreshold
1177 // Save the cumulated hits instead of raw hits (need to create the branch myself)
1178 // It is put in the Digit Tree because the TreeH is filled after each primary
1179 // and the TreeD at the end of the event.
1185 TClonesArray &lDigits = *fDigits ;
1187 AliPHOSDigit * newdigit ;
1188 AliPHOSDigit * curdigit ;
1189 Bool_t deja = kFALSE ;
1191 for ( i = 0 ; i < fNTmpHits ; i++ ) {
1192 hit = (AliPHOSHit*)fTmpHits->At(i) ;
1193 newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
1195 for ( j = 0 ; j < fNdigits ; j++) {
1196 curdigit = (AliPHOSDigit*) lDigits[j] ;
1197 if ( *curdigit == *newdigit) {
1198 *curdigit = *curdigit + *newdigit ;
1203 new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ;
1210 // Noise induced by the PIN diode of the PbWO crystals
1212 Float_t energyandnoise ;
1213 for ( i = 0 ; i < fNdigits ; i++ ) {
1214 newdigit = (AliPHOSDigit * ) fDigits->At(i) ;
1215 fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ;
1217 if (relid[1]==0){ // Digits belong to EMC (PbW0_4 crystals)
1218 energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ;
1220 if (energyandnoise < 0 )
1221 energyandnoise = 0 ;
1223 if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list
1224 fDigits->RemoveAt(i) ;
1228 fDigits->Compress() ;
1230 fNdigits = fDigits->GetEntries() ;
1231 for (i = 0 ; i < fNdigits ; i++) {
1232 newdigit = (AliPHOSDigit *) fDigits->At(i) ;
1233 newdigit->SetIndexInList(i) ;
1238 //____________________________________________________________________________
1239 void AliPHOSv0::Init(void)
1241 // Just prints an information message
1246 for(i=0;i<35;i++) printf("*");
1247 printf(" PHOS_INIT ");
1248 for(i=0;i<35;i++) printf("*");
1251 // Here the PHOS initialisation code (if any!)
1253 for(i=0;i<80;i++) printf("*");
1258 //___________________________________________________________________________
1259 void AliPHOSv0::MakeBranch(Option_t* opt)
1261 // Create new branche in the current Root Tree in the digit Tree
1263 AliDetector::MakeBranch(opt) ;
1265 char branchname[10];
1266 sprintf(branchname,"%s",GetName());
1267 char *cdD = strstr(opt,"D");
1268 if (fDigits && gAlice->TreeD() && cdD) {
1269 gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize);
1272 // Create new branche PHOSCH in the current Root Tree in the digit Tree for accumulated Hits
1273 if ( ! (gAlice->IsLegoRun()) ) { // only when not in lego plot mode
1274 if ( fTmpHits && gAlice->TreeD() && cdD) {
1275 char branchname[10] ;
1276 sprintf(branchname, "%sCH", GetName()) ;
1277 gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
1284 //_____________________________________________________________________________
1285 void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
1287 // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
1288 // 2. Creates TreeR with a branch for each list
1289 // 3. Steers the reconstruction processes
1290 // 4. Saves the 3 lists in TreeR
1291 // 5. Write the Tree to File
1293 fReconstructioner = Reconstructioner ;
1295 char branchname[10] ;
1299 // gAlice->MakeTree("R") ;
1300 Int_t splitlevel = 0 ;
1302 if (fEmcRecPoints) {
1303 fEmcRecPoints->Delete() ;
1304 delete fEmcRecPoints ;
1308 // fEmcRecPoints= new AliPHOSRecPoint::RecPointsList("AliPHOSEmcRecPoint", 1000) ; if TClonesArray
1309 fEmcRecPoints= new AliPHOSRecPoint::RecPointsList(1000) ;
1311 if ( fEmcRecPoints && gAlice->TreeR() ) {
1312 sprintf(branchname,"%sEmcRP",GetName()) ;
1314 // gAlice->TreeR()->Branch(branchname, &fEmcRecPoints, fBufferSize); if TClonesArray
1315 gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ;
1318 if (fPpsdRecPoints) {
1319 fPpsdRecPoints->Delete() ;
1320 delete fPpsdRecPoints ;
1321 fPpsdRecPoints = 0 ;
1324 // fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList("AliPHOSPpsdRecPoint", 1000) ; if TClonesArray
1325 fPpsdRecPoints = new AliPHOSRecPoint::RecPointsList(1000) ;
1327 if ( fPpsdRecPoints && gAlice->TreeR() ) {
1328 sprintf(branchname,"%sPpsdRP",GetName()) ;
1330 // gAlice->TreeR()->Branch(branchname, &fPpsdRecPoints, fBufferSize); if TClonesArray
1331 gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ;
1334 if (fTrackSegments) {
1335 fTrackSegments->Delete() ;
1336 delete fTrackSegments ;
1337 fTrackSegments = 0 ;
1340 fTrackSegments = new AliPHOSTrackSegment::TrackSegmentsList("AliPHOSTrackSegment", 1000) ;
1341 if ( fTrackSegments && gAlice->TreeR() ) {
1342 sprintf(branchname,"%sTS",GetName()) ;
1343 gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ;
1346 if (fRecParticles) {
1347 fRecParticles->Delete() ;
1348 delete fRecParticles ;
1351 fRecParticles = new AliPHOSRecParticle::RecParticlesList("AliPHOSRecParticle", 1000) ;
1352 if ( fRecParticles && gAlice->TreeR() ) {
1353 sprintf(branchname,"%sRP",GetName()) ;
1354 gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ;
1359 fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles);
1361 // 4. Expand or Shrink the arrays to the proper size
1365 size = fEmcRecPoints->GetEntries() ;
1366 fEmcRecPoints->Expand(size) ;
1368 size = fPpsdRecPoints->GetEntries() ;
1369 fPpsdRecPoints->Expand(size) ;
1371 size = fTrackSegments->GetEntries() ;
1372 fTrackSegments->Expand(size) ;
1374 size = fRecParticles->GetEntries() ;
1375 fRecParticles->Expand(size) ;
1377 gAlice->TreeR()->Fill() ;
1378 cout << "filled" << endl ;
1381 gAlice->TreeR()->Write() ;
1382 cout << "writen" << endl ;
1384 // Deleting reconstructed objects
1385 ResetReconstruction();
1390 //____________________________________________________________________________
1391 void AliPHOSv0::ResetDigits()
1393 // May sound strange, but cumulative hits are store in digits Tree
1394 AliDetector::ResetDigits();
1400 //____________________________________________________________________________
1401 void AliPHOSv0::ResetReconstruction()
1403 // Deleting reconstructed objects
1405 if ( fEmcRecPoints ) fEmcRecPoints->Delete();
1406 if ( fPpsdRecPoints ) fPpsdRecPoints->Delete();
1407 if ( fTrackSegments ) fTrackSegments->Delete();
1408 if ( fRecParticles ) fRecParticles->Delete();
1411 //____________________________________________________________________________
1413 //____________________________________________________________________________
1414 void AliPHOSv0::SetTreeAddress()
1417 AliPHOS::SetTreeAddress();
1419 // //Branch address for TreeR: RecPpsdRecPoint
1420 // TTree *treeR = gAlice->TreeR();
1421 // if ( treeR && fPpsdRecPoints ) {
1422 // branch = treeR->GetBranch("PHOSPpsdRP");
1423 // if (branch) branch->SetAddress(&fPpsdRecPoints) ;
1427 //____________________________________________________________________________
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