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 ---
31 // --- Standard library ---
36 #include <strstream.h>
38 // --- AliRoot header files ---
40 #include "AliPHOSv0.h"
41 #include "AliPHOSHit.h"
42 #include "AliPHOSDigit.h"
43 #include "AliPHOSReconstructioner.h"
49 //____________________________________________________________________________
50 AliPHOSv0::AliPHOSv0()
57 //____________________________________________________________________________
58 AliPHOSv0::AliPHOSv0(const char *name, const char *title):
61 // ctor : title is used to identify the layout
62 // GPS2 = 5 modules (EMC + PPSD)
63 // We use 2 arrays of hits :
65 // - fHits (the "normal" one), which retains the hits associated with
66 // the current primary particle being tracked
67 // (this array is reset after each primary has been tracked).
69 // - fTmpHits, which retains all the hits of the current event. It
70 // is used for the digitization part.
72 fPinElectronicNoise = 0.010 ;
73 fDigitThreshold = 1. ; // 1 GeV
75 // We do not want to save in TreeH the raw hits
76 // fHits = new TClonesArray("AliPHOSHit",100) ;
77 // gAlice->AddHitList(fHits) ;
79 // But save the cumulated hits instead (need to create the branch myself)
80 // It is put in the Digit Tree because the TreeH is filled after each primary
81 // and the TreeD at the end of the event (branch is set in FinishEvent() ).
83 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
85 fNTmpHits = fNhits = 0 ;
87 fDigits = new TClonesArray("AliPHOSDigit",100) ;
90 fIshunt = 1 ; // All hits are associated with primary particles
92 // gets an instance of the geometry parameters class
94 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
96 if (fGeom->IsInitialized() )
97 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
99 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
102 //____________________________________________________________________________
103 AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
106 // ctor : title is used to identify the layout
107 // GPS2 = 5 modules (EMC + PPSD)
108 // We use 2 arrays of hits :
110 // - fHits (the "normal" one), which retains the hits associated with
111 // the current primary particle being tracked
112 // (this array is reset after each primary has been tracked).
114 // - fTmpHits, which retains all the hits of the current event. It
115 // is used for the digitization part.
117 fPinElectronicNoise = 0.010 ;
119 // We do not want to save in TreeH the raw hits
120 //fHits = new TClonesArray("AliPHOSHit",100) ;
122 fDigits = new TClonesArray("AliPHOSDigit",100) ;
123 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
125 fNTmpHits = fNhits = 0 ;
127 fIshunt = 1 ; // All hits are associated with primary particles
129 // gets an instance of the geometry parameters class
130 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
132 if (fGeom->IsInitialized() )
133 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
135 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
137 // Defining the PHOS Reconstructioner
139 fReconstructioner = Reconstructioner ;
142 //____________________________________________________________________________
143 AliPHOSv0::~AliPHOSv0()
153 if ( fEmcRecPoints ) {
154 fEmcRecPoints->Delete() ;
155 delete fEmcRecPoints ;
159 if ( fPpsdRecPoints ) {
160 fPpsdRecPoints->Delete() ;
161 delete fPpsdRecPoints ;
165 if ( fTrackSegments ) {
166 fTrackSegments->Delete() ;
167 delete fTrackSegments ;
173 //____________________________________________________________________________
174 void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits)
176 // Add a hit to the hit list.
177 // A PHOS hit is the sum of all hits in a single crystal
178 // or in a single PPSD gas cell
181 TClonesArray <mphits = *fTmpHits ;
184 // AliPHOSHit *curHit2 ;
185 Bool_t deja = kFALSE ;
187 // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
189 newHit = new AliPHOSHit(primary, Id, hits) ;
191 // We do not want to save in TreeH the raw hits
192 // TClonesArray &lhits = *fHits;
194 for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
195 curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
196 if( *curHit == *newHit ) {
197 *curHit = *curHit + *newHit ;
203 new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
207 // We do not want to save in TreeH the raw hits
208 // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
211 // Please note that the fTmpHits array must survive up to the
212 // end of the events, so it does not appear e.g. in ResetHits() (
213 // which is called at the end of each primary).
220 //____________________________________________________________________________
221 void AliPHOSv0::BuildGeometry()
223 // Build the PHOS geometry for the ROOT display
227 PHOS in ALICE displayed by root
233 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
238 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
243 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
248 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
254 this->BuildGeometryforPHOS() ;
255 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
256 this->BuildGeometryforPPSD() ;
258 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
262 //____________________________________________________________________________
263 void AliPHOSv0:: BuildGeometryforPHOS(void)
265 // Build the PHOS-EMC geometry for the ROOT display
267 const Int_t kColorPHOS = kRed ;
268 const Int_t kColorXTAL = kBlue ;
270 Double_t const kRADDEG = 180.0 / kPI ;
272 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
273 fGeom->GetOuterBoxSize(1)/2,
274 fGeom->GetOuterBoxSize(2)/2 );
276 // Textolit Wall box, position inside PHOS
278 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
279 fGeom->GetTextolitBoxSize(1)/2,
280 fGeom->GetTextolitBoxSize(2)/2);
282 // Polystyrene Foam Plate
284 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
285 fGeom->GetSecondUpperPlateThickness()/2,
286 fGeom->GetTextolitBoxSize(2)/2 ) ;
290 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
291 fGeom->GetAirFilledBoxSize(1)/2,
292 fGeom->GetAirFilledBoxSize(2)/2 );
296 Float_t xtlX = fGeom->GetCrystalSize(0) ;
297 Float_t xtlY = fGeom->GetCrystalSize(1) ;
298 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
300 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
301 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
302 + fGeom->GetModuleBoxThickness() / 2.0 ;
303 Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
305 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
307 // position PHOS into ALICE
309 Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
311 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
313 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
315 char * nodename = new char[20] ;
316 char * rotname = new char[20] ;
318 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
319 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
320 sprintf(rotname, "%s%d", "rot", number++) ;
321 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
323 sprintf(nodename,"%s%d", "Module", i) ;
324 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
325 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
326 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
327 outerboxnode->SetLineColor(kColorPHOS) ;
328 fNodes->Add(outerboxnode) ;
330 // now inside the outer box the textolit box
331 y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
332 sprintf(nodename,"%s%d", "TexBox", i) ;
333 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
334 textolitboxnode->SetLineColor(kColorPHOS) ;
335 fNodes->Add(textolitboxnode) ;
336 // upper foam plate inside outre box
338 sprintf(nodename, "%s%d", "UFPlate", i) ;
339 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
340 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
341 upperfoamplatenode->SetLineColor(kColorPHOS) ;
342 fNodes->Add(upperfoamplatenode) ;
343 // air filled box inside textolit box (not drawn)
344 textolitboxnode->cd();
345 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
346 sprintf(nodename, "%s%d", "AFBox", i) ;
347 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
348 fNodes->Add(airfilledboxnode) ;
349 // crystals box inside air filled box
350 airfilledboxnode->cd() ;
351 y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl
352 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
353 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
354 sprintf(nodename, "%s%d", "XTBox", i) ;
355 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
356 crystalsboxnode->SetLineColor(kColorXTAL) ;
357 fNodes->Add(crystalsboxnode) ;
361 //____________________________________________________________________________
362 void AliPHOSv0:: BuildGeometryforPPSD(void)
364 // Build the PHOS-PPSD geometry for the ROOT display
368 PPSD displayed by root
371 <LI> Zoom on PPSD: Front View
374 <IMG Align=BOTTOM ALT="PPSD Front View" SRC="../images/AliPHOSv0PPSDFrontView.gif">
376 <LI> Zoom on PPSD: Perspective View
379 <IMG Align=BOTTOM ALT="PPSD Prespective View" SRC="../images/AliPHOSv0PPSDPerspectiveView.gif">
384 Double_t const kRADDEG = 180.0 / kPI ;
386 const Int_t kColorPHOS = kRed ;
387 const Int_t kColorPPSD = kGreen ;
388 const Int_t kColorGas = kBlue ;
389 const Int_t kColorAir = kYellow ;
391 // Box for a full PHOS module
393 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
394 fGeom->GetPPSDBoxSize(1)/2,
395 fGeom->GetPPSDBoxSize(2)/2 );
397 // Box containing one micromegas module
399 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
400 fGeom->GetPPSDModuleSize(1)/2,
401 fGeom->GetPPSDModuleSize(2)/2 );
404 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
405 fGeom->GetLidThickness()/2,
406 fGeom->GetPPSDModuleSize(2)/2 ) ;
407 // composite panel (top and bottom)
409 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
410 fGeom->GetCompositeThickness()/2,
411 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
413 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
414 fGeom->GetCompositeThickness()/2,
415 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
416 // gas gap (conversion and avalanche)
418 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
419 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
420 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
424 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
425 fGeom->GetAnodeThickness()/2,
426 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
428 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
429 fGeom->GetCathodeThickness()/2,
430 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
433 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
434 fGeom->GetPCThickness()/2,
435 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
436 // Gap between Lead and top micromegas
438 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
439 fGeom->GetMicro1ToLeadGap()/2,
440 fGeom->GetPPSDBoxSize(2)/2 ) ;
442 // Gap between Lead and bottom micromegas
444 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
445 fGeom->GetLeadToMicro2Gap()/2,
446 fGeom->GetPPSDBoxSize(2)/2 ) ;
449 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
450 fGeom->GetLeadConverterThickness()/2,
451 fGeom->GetPPSDBoxSize(2)/2 ) ;
453 // position PPSD into ALICE
455 char * nodename = new char[20] ;
456 char * rotname = new char[20] ;
458 Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
460 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
462 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
463 Float_t angle = fGeom->GetPHOSAngle(i) ;
464 sprintf(rotname, "%s%d", "rotg", number++) ;
465 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
467 sprintf(nodename, "%s%d", "Moduleg", i) ;
468 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
469 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
470 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
471 ppsdboxnode->SetLineColor(kColorPPSD) ;
472 fNodes->Add(ppsdboxnode) ;
474 // inside the PPSD box:
475 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
476 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
478 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
479 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
481 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
482 y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
483 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
484 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
485 micro1node->SetLineColor(kColorPPSD) ;
486 fNodes->Add(micro1node) ;
487 // inside top micromegas
490 y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
491 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
492 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
493 toplidnode->SetLineColor(kColorPPSD) ;
494 fNodes->Add(toplidnode) ;
495 // b. composite panel
496 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
497 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
498 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
499 compupnode->SetLineColor(kColorPPSD) ;
500 fNodes->Add(compupnode) ;
502 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
503 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
504 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
505 anodenode->SetLineColor(kColorPHOS) ;
506 fNodes->Add(anodenode) ;
508 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
509 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
510 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
511 ggapnode->SetLineColor(kColorGas) ;
512 fNodes->Add(ggapnode) ;
514 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
515 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
516 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
517 cathodenode->SetLineColor(kColorPHOS) ;
518 fNodes->Add(cathodenode) ;
519 // g. printed circuit
520 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
521 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
522 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
523 pcnode->SetLineColor(kColorPPSD) ;
524 fNodes->Add(pcnode) ;
525 // h. composite panel
526 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
527 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
528 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
529 compdownnode->SetLineColor(kColorPPSD) ;
530 fNodes->Add(compdownnode) ;
531 z = z - fGeom->GetPPSDModuleSize(2) ;
533 } // end of Z module loop
534 x = x - fGeom->GetPPSDModuleSize(0) ;
536 } // end of phi module loop
540 y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
541 sprintf(nodename, "%s%d", "GapUp", i) ;
542 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
543 gapupnode->SetLineColor(kColorAir) ;
544 fNodes->Add(gapupnode) ;
546 y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
547 sprintf(nodename, "%s%d", "LeadC", i) ;
548 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
549 leadcnode->SetLineColor(kColorPPSD) ;
550 fNodes->Add(leadcnode) ;
552 y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
553 sprintf(nodename, "%s%d", "GapDown", i) ;
554 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
555 gapdownnode->SetLineColor(kColorAir) ;
556 fNodes->Add(gapdownnode) ;
557 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
558 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
560 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
561 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
563 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
564 y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
565 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
566 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
567 micro2node->SetLineColor(kColorPPSD) ;
568 fNodes->Add(micro2node) ;
569 // inside bottom micromegas
572 y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
573 sprintf(nodename, "%s%d", "Lidb", i) ;
574 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
575 toplidbnode->SetLineColor(kColorPPSD) ;
576 fNodes->Add(toplidbnode) ;
577 // b. composite panel
578 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
579 sprintf(nodename, "%s%d", "CompUb", i) ;
580 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
581 compupbnode->SetLineColor(kColorPPSD) ;
582 fNodes->Add(compupbnode) ;
584 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
585 sprintf(nodename, "%s%d", "Anob", i) ;
586 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
587 anodebnode->SetLineColor(kColorPPSD) ;
588 fNodes->Add(anodebnode) ;
590 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
591 sprintf(nodename, "%s%d", "GGapb", i) ;
592 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
593 ggapbnode->SetLineColor(kColorGas) ;
594 fNodes->Add(ggapbnode) ;
596 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
597 sprintf(nodename, "%s%d", "Cathodeb", i) ;
598 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
599 cathodebnode->SetLineColor(kColorPPSD) ;
600 fNodes->Add(cathodebnode) ;
601 // g. printed circuit
602 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
603 sprintf(nodename, "%s%d", "PCb", i) ;
604 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
605 pcbnode->SetLineColor(kColorPPSD) ;
606 fNodes->Add(pcbnode) ;
608 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
609 sprintf(nodename, "%s%d", "CompDownb", i) ;
610 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
611 compdownbnode->SetLineColor(kColorPPSD) ;
612 fNodes->Add(compdownbnode) ;
613 z = z - fGeom->GetPPSDModuleSize(2) ;
615 } // end of Z module loop
616 x = x - fGeom->GetPPSDModuleSize(0) ;
618 } // end of phi module loop
627 //____________________________________________________________________________
628 void AliPHOSv0::CreateGeometry()
630 // Create the PHOS geometry for Geant
632 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
634 if ( phostmp == NULL ) {
636 fprintf(stderr, "PHOS detector not found!\n") ;
640 // Get pointer to the array containing media indeces
641 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
644 bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
645 bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
646 bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
648 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
650 this->CreateGeometryforPHOS() ;
651 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
652 this->CreateGeometryforPPSD() ;
654 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
656 // --- Position PHOS mdules in ALICE setup ---
659 Double_t const kRADDEG = 180.0 / kPI ;
661 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
663 Float_t angle = fGeom->GetPHOSAngle(i) ;
664 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
666 Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
668 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
669 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
671 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
677 //____________________________________________________________________________
678 void AliPHOSv0::CreateGeometryforPHOS()
680 // Create the PHOS-EMC geometry for GEANT
684 Geant3 geometry tree of PHOS-EMC in ALICE
687 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
692 // Get pointer to the array containing media indexes
693 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
696 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
697 // --- Foam Thermo Insulating outer cover dimensions ---
698 // --- Put it in bigbox = PHOS
701 dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
702 dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
703 dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
705 gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
707 Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
709 gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
712 // --- Define Textolit Wall box, position inside EMCA ---
713 // --- Textolit Wall box dimentions ---
717 dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
718 dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
719 dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
721 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
723 yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
725 gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
728 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
729 // --- immediately below Foam Thermo Insulation Upper plate ---
731 // --- Upper Polystyrene Foam plate thickness ---
734 dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
735 dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
736 dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
738 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
740 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
742 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
745 // --- Define air-filled box, place inside PTXW ---
746 // --- Inner AIR volume dimensions ---
750 dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
751 dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
752 dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
754 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
756 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
758 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
760 // --- Dimensions of PbWO4 crystal ---
762 Float_t xtlX = fGeom->GetCrystalSize(0) ;
763 Float_t xtlY = fGeom->GetCrystalSize(1) ;
764 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
767 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
768 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
769 + fGeom->GetModuleBoxThickness() / 2.0 ;
770 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
772 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
774 yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
775 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
776 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
778 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
781 // --- Define Crystal BLock filled with air, position it inside PTCB ---
784 dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
785 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
786 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
788 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
790 // --- Divide PCBL in X (phi) and Z directions --
791 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
792 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
794 yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
796 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
799 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
802 dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
803 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
804 dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
806 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
808 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
811 // --- Define Tyvek volume, place inside PSTC ---
814 dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
815 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
816 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
818 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
820 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
821 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
823 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
826 // --- Define PbWO4 crystal volume, place inside PPAP ---
829 dpxtl[0] = xtlX / 2.0 ;
830 dpxtl[1] = xtlY / 2.0 ;
831 dpxtl[2] = xtlZ / 2.0 ;
833 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
835 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
837 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
840 // --- Define crystal support volume, place inside PPAP ---
843 dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
844 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
845 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
847 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
849 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
851 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
854 // --- Define PIN-diode volume and position it inside crystal support ---
855 // --- right behind PbWO4 crystal
857 // --- PIN-diode dimensions ---
861 dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
862 dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
863 dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
865 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
867 yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
869 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
872 // --- Define Upper Cooling Panel, place it on top of PTCB ---
874 // --- Upper Cooling Plate thickness ---
876 dpucp[0] = dptcb[0] ;
877 dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
878 dpucp[2] = dptcb[2] ;
880 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
882 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
883 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
884 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
886 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
889 // --- Define Al Support Plate, position it inside PAIR ---
890 // --- right beneath PTCB ---
891 // --- Al Support Plate thickness ---
894 dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
895 dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
896 dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
898 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
900 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
901 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
902 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
904 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
907 // --- Define Thermo Insulating Plate, position it inside PAIR ---
908 // --- right beneath PASP ---
909 // --- Lower Thermo Insulating Plate thickness ---
912 dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
913 dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
914 dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
916 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
918 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
919 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
920 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
922 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
925 // --- Define Textolit Plate, position it inside PAIR ---
926 // --- right beneath PTIP ---
927 // --- Lower Textolit Plate thickness ---
930 dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
931 dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
932 dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
934 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
936 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
937 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
938 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness()
939 + fGeom->GetLowerThermoPlateThickness() ) ;
941 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
945 //____________________________________________________________________________
946 void AliPHOSv0::CreateGeometryforPPSD()
948 // Create the PHOS-PPSD geometry for GEANT
953 Geant3 geometry tree of PHOS-PPSD in ALICE
956 <IMG Align=BOTTOM ALT="PPSD geant tree" SRC="../images/PPSDinAlice.gif">
961 // Get pointer to the array containing media indexes
962 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
964 // The box containing all ppsd's for one PHOS module filled with air
966 ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
967 ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
968 ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
970 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
972 Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ;
974 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
976 // Now we build a micromegas module
977 // The box containing the whole module filled with epoxy (FR4)
980 mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
981 mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
982 mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
984 gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;
987 // 1. The Top Lid made of epoxy (FR4)
990 tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
991 tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
992 tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
994 gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ;
996 Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
998 gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1000 // 2. the upper panel made of composite material
1003 upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1004 upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
1005 upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1007 gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ;
1009 y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
1011 gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1013 // 3. the anode made of Copper
1016 anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1017 anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ;
1018 anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1020 gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ;
1022 y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
1024 gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1026 // 4. the conversion gap + avalanche gap filled with gas
1029 ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1030 ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
1031 ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1033 gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ;
1035 // --- Divide GGPP in X (phi) and Z directions --
1036 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
1037 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
1039 y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
1041 gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1044 // 6. the cathode made of Copper
1047 cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1048 cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ;
1049 cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1051 gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ;
1053 y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
1055 gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1057 // 7. the printed circuit made of G10
1060 pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
1061 pcppsd[1] = fGeom->GetPCThickness() / 2.0 ;
1062 pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1064 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
1066 y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
1068 gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1070 // 8. the lower panel made of composite material
1073 lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1074 lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
1075 lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1077 gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ;
1079 y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
1081 gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1083 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
1084 // the top and bottom one's (which are assumed identical) :
1086 Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
1087 Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
1089 Int_t copyNumbertop = 0 ;
1090 Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
1092 Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
1094 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
1095 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
1097 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
1098 gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
1099 gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
1100 z = z - fGeom->GetPPSDModuleSize(2) ;
1101 } // end of Z module loop
1102 x = x - fGeom->GetPPSDModuleSize(0) ;
1103 } // end of phi module loop
1105 // The Lead converter between two air gaps
1109 uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1110 uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
1111 uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1113 gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ;
1115 y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
1117 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1119 // 2. Lead converter
1122 lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1123 lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
1124 lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1126 gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ;
1128 y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
1130 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1135 lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1136 lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
1137 lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1139 gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ;
1141 y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
1143 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1147 //___________________________________________________________________________
1148 Int_t AliPHOSv0::Digitize(Float_t Energy)
1150 // Applies the energy calibration
1152 Float_t fB = 100000000. ;
1154 Int_t chan = Int_t(fA + Energy*fB ) ;
1158 //___________________________________________________________________________
1159 void AliPHOSv0::FinishEvent()
1161 // Makes the digits from the sum of summed hit in a single crystal or PPSD gas cell
1162 // Adds to the energy the electronic noise
1163 // Keeps digits with energy above fDigitThreshold
1165 // Save the cumulated hits instead of raw hits (need to create the branch myself)
1166 // It is put in the Digit Tree because the TreeH is filled after each primary
1167 // and the TreeD at the end of the event.
1168 if ( fTmpHits && gAlice->TreeD() ) {
1169 char branchname[10] ;
1170 sprintf(branchname, "%sCH", GetName()) ;
1171 gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
1173 cout << "AliPHOSv0::AliPHOSv0: Failed to create branch PHOSCH in TreeD " << endl ;
1178 TClonesArray &lDigits = *fDigits ;
1180 AliPHOSDigit * newdigit ;
1181 AliPHOSDigit * curdigit ;
1182 Bool_t deja = kFALSE ;
1184 for ( i = 0 ; i < fNTmpHits ; i++ ) {
1185 hit = (AliPHOSHit*)fTmpHits->At(i) ;
1186 newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
1188 for ( j = 0 ; j < fNdigits ; j++) {
1189 curdigit = (AliPHOSDigit*) lDigits[j] ;
1190 if ( *curdigit == *newdigit) {
1191 *curdigit = *curdigit + *newdigit ;
1196 new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ;
1203 // Noise induced by the PIN diode of the PbWO crystals
1205 Float_t energyandnoise ;
1206 for ( i = 0 ; i < fNdigits ; i++ ) {
1207 newdigit = (AliPHOSDigit * ) fDigits->At(i) ;
1208 fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ;
1210 if (relid[1]==0){ // Digits belong to EMC (PbW0_4 crystals)
1211 energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ;
1213 if (energyandnoise < 0 )
1214 energyandnoise = 0 ;
1216 if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list
1217 fDigits->RemoveAt(i) ;
1221 fDigits->Compress() ;
1223 fNdigits = fDigits->GetEntries() ;
1224 for (i = 0 ; i < fNdigits ; i++) {
1225 newdigit = (AliPHOSDigit *) fDigits->At(i) ;
1226 newdigit->SetIndexInList(i) ;
1231 //____________________________________________________________________________
1232 void AliPHOSv0::Init(void)
1234 // Just prints an information message
1239 for(i=0;i<35;i++) printf("*");
1240 printf(" PHOS_INIT ");
1241 for(i=0;i<35;i++) printf("*");
1244 // Here the PHOS initialisation code (if any!)
1246 for(i=0;i<80;i++) printf("*");
1251 //___________________________________________________________________________
1252 void AliPHOSv0::MakeBranch(Option_t* opt)
1254 // Create new branche in the current Root Tree in the digit Tree
1256 AliDetector::MakeBranch(opt) ;
1258 char branchname[10];
1259 sprintf(branchname,"%s",GetName());
1260 char *cdD = strstr(opt,"D");
1262 if (fDigits && gAlice->TreeD() && cdD) {
1263 gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize);
1267 //____________________________________________________________________________
1268 RecPointsList * AliPHOSv0::PpsdRecPoints(Int_t evt)
1270 // returns the pointer to the PPSD RecPoints list
1271 // if the list is empty, get it from TreeR on the disk file
1273 RecPointsList * rv = 0 ;
1275 if ( fPpsdRecPoints )
1276 rv = fPpsdRecPoints ;
1279 fPpsdRecPoints = new TClonesArray("AliPHOSPpsdRecPoint", 100) ;
1280 gAlice->GetEvent(evt) ;
1281 TTree * fReconstruct = gAlice->TreeR() ;
1282 fReconstruct->SetBranchAddress( "PHOSPpsdRP", &fPpsdRecPoints) ;
1283 fReconstruct->GetEvent(0) ;
1284 rv = fPpsdRecPoints ;
1287 fPpsdRecPoints->Expand( fPpsdRecPoints->GetEntries() ) ;
1293 //_____________________________________________________________________________
1294 void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
1296 // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
1297 // 2. Creates TreeR wit a branch for each list
1298 // 3. Steers the reconstruction processes
1299 // 4. Saves the 3 lists in TreeR
1300 // 5. Write the Tree to File
1302 fReconstructioner = Reconstructioner ;
1304 char branchname[10] ;
1308 gAlice->MakeTree("R") ;
1309 Int_t splitlevel = 0 ;
1311 if (fEmcRecPoints) {
1312 fEmcRecPoints->Delete() ;
1313 delete fEmcRecPoints ;
1317 // fEmcRecPoints= new RecPointsList("AliPHOSEmcRecPoint", 100) ; if TClonesArray
1318 fEmcRecPoints= new RecPointsList(100) ;
1320 if ( fEmcRecPoints && gAlice->TreeR() ) {
1321 sprintf(branchname,"%sEmcRP",GetName()) ;
1323 // gAlice->TreeR()->Branch(branchname, &fEmcRecPoints, fBufferSize); if TClonesArray
1324 gAlice->TreeR()->Branch(branchname, "TObjArray", &fEmcRecPoints, fBufferSize, splitlevel) ;
1327 if (fPpsdRecPoints) {
1328 fPpsdRecPoints->Delete() ;
1329 delete fPpsdRecPoints ;
1330 fPpsdRecPoints = 0 ;
1333 // fPpsdRecPoints = new RecPointsList("AliPHOSPpsdRecPoint", 100) ; if TClonesArray
1334 fPpsdRecPoints = new RecPointsList(100) ;
1336 if ( fPpsdRecPoints && gAlice->TreeR() ) {
1337 sprintf(branchname,"%sPpsdRP",GetName()) ;
1339 // gAlice->TreeR()->Branch(branchname, &fPpsdRecPoints, fBufferSize); if TClonesArray
1340 gAlice->TreeR()->Branch(branchname, "TObjArray", &fPpsdRecPoints, fBufferSize, splitlevel) ;
1343 if (fTrackSegments) {
1344 fTrackSegments->Delete() ;
1345 delete fTrackSegments ;
1346 fTrackSegments = 0 ;
1349 fTrackSegments = new TrackSegmentsList("AliPHOSTrackSegment", 100) ;
1350 if ( fTrackSegments && gAlice->TreeR() ) {
1351 sprintf(branchname,"%sTS",GetName()) ;
1352 gAlice->TreeR()->Branch(branchname, &fTrackSegments, fBufferSize) ;
1355 if (fRecParticles) {
1356 fRecParticles->Delete() ;
1357 delete fRecParticles ;
1360 fRecParticles = new RecParticlesList("AliPHOSRecParticle", 100) ;
1361 if ( fRecParticles && gAlice->TreeR() ) {
1362 sprintf(branchname,"%sRP",GetName()) ;
1363 gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize) ;
1368 fReconstructioner->Make(fDigits, fEmcRecPoints, fPpsdRecPoints, fTrackSegments, fRecParticles);
1370 // 4. Expand or Shrink the arrays to the proper size
1374 size = fEmcRecPoints->GetEntries() ;
1375 fEmcRecPoints->Expand(size) ;
1377 size = fPpsdRecPoints->GetEntries() ;
1378 fPpsdRecPoints->Expand(size) ;
1380 size = fTrackSegments->GetEntries() ;
1381 fTrackSegments->Expand(size) ;
1383 size = fRecParticles->GetEntries() ;
1384 fRecParticles->Expand(size) ;
1386 gAlice->TreeR()->Fill() ;
1390 gAlice->TreeR()->Write() ;
1394 //____________________________________________________________________________
1395 void AliPHOSv0::ResetDigits()
1397 // May sound strange, but cumulative hits are store in digits Tree
1405 //____________________________________________________________________________
1406 void AliPHOSv0::StepManager(void)
1408 // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
1410 Int_t relid[4] ; // (box, layer, row, column) indices
1411 Float_t xyze[4] ; // position wrt MRS and energy deposited
1412 TLorentzVector pos ;
1415 Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
1416 TString name = fGeom->GetName() ;
1417 if ( name == "GPS2" ) { // the CPV is a PPSD
1418 if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell
1420 gMC->TrackPosition(pos) ;
1424 xyze[3] = gMC->Edep() ;
1426 if ( xyze[3] != 0 ) { // there is deposited energy
1427 gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number
1428 gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
1429 // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
1430 // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
1431 gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell
1432 gMC->CurrentVolID(relid[3]) ; // get the column number
1434 // get the absolute Id number
1437 fGeom->RelToAbsNumbering(relid, absid) ;
1439 // add current hit to the hit list
1440 AddHit(primary, absid, xyze);
1442 } // there is deposited energy
1443 } // We are inside the gas of the CPV
1444 } // GPS2 configuration
1446 if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) // We are inside a PBWO crystal
1448 gMC->TrackPosition(pos) ;
1452 xyze[3] = gMC->Edep() ;
1454 if ( xyze[3] != 0 ) {
1455 gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
1456 relid[1] = 0 ; // means PBW04
1457 gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
1458 gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
1460 // get the absolute Id number
1463 fGeom->RelToAbsNumbering(relid, absid) ;
1465 // add current hit to the hit list
1467 AddHit(primary, absid, xyze);
1469 } // there is deposited energy
1470 } // we are inside a PHOS Xtal