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()
151 fEmcRecPoints->Delete() ;
152 delete fEmcRecPoints ;
155 fPpsdRecPoints->Delete() ;
156 delete fPpsdRecPoints ;
159 fTrackSegments->Delete() ;
160 delete fTrackSegments ;
164 //____________________________________________________________________________
165 void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits)
167 // Add a hit to the hit list.
168 // A PHOS hit is the sum of all hits in a single crystal
169 // or in a single PPSD gas cell
172 TClonesArray <mphits = *fTmpHits ;
175 // AliPHOSHit *curHit2 ;
176 Bool_t deja = kFALSE ;
178 // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
180 newHit = new AliPHOSHit(primary, Id, hits) ;
182 // We do not want to save in TreeH the raw hits
183 // TClonesArray &lhits = *fHits;
185 for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
186 curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
187 if( *curHit == *newHit ) {
188 *curHit = *curHit + *newHit ;
194 new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
198 // We do not want to save in TreeH the raw hits
199 // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
202 // Please note that the fTmpHits array must survive up to the
203 // end of the events, so it does not appear e.g. in ResetHits() (
204 // which is called at the end of each primary).
211 //____________________________________________________________________________
212 void AliPHOSv0::BuildGeometry()
214 // Build the PHOS geometry for the ROOT display
218 PHOS in ALICE displayed by root
224 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
229 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
234 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
239 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
245 this->BuildGeometryforPHOS() ;
246 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
247 this->BuildGeometryforPPSD() ;
249 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
253 //____________________________________________________________________________
254 void AliPHOSv0:: BuildGeometryforPHOS(void)
256 // Build the PHOS-EMC geometry for the ROOT display
258 const Int_t kColorPHOS = kRed ;
259 const Int_t kColorXTAL = kBlue ;
261 Double_t const kRADDEG = 180.0 / kPI ;
263 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
264 fGeom->GetOuterBoxSize(1)/2,
265 fGeom->GetOuterBoxSize(2)/2 );
267 // Textolit Wall box, position inside PHOS
269 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
270 fGeom->GetTextolitBoxSize(1)/2,
271 fGeom->GetTextolitBoxSize(2)/2);
273 // Polystyrene Foam Plate
275 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
276 fGeom->GetSecondUpperPlateThickness()/2,
277 fGeom->GetTextolitBoxSize(2)/2 ) ;
281 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
282 fGeom->GetAirFilledBoxSize(1)/2,
283 fGeom->GetAirFilledBoxSize(2)/2 );
287 Float_t xtlX = fGeom->GetCrystalSize(0) ;
288 Float_t xtlY = fGeom->GetCrystalSize(1) ;
289 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
291 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
292 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
293 + fGeom->GetModuleBoxThickness() / 2.0 ;
294 Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
296 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
298 // position PHOS into ALICE
300 Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
302 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
304 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
306 char * nodename = new char[20] ;
307 char * rotname = new char[20] ;
309 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
310 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
311 sprintf(rotname, "%s%d", "rot", number++) ;
312 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
314 sprintf(nodename,"%s%d", "Module", i) ;
315 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
316 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
317 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
318 outerboxnode->SetLineColor(kColorPHOS) ;
319 fNodes->Add(outerboxnode) ;
321 // now inside the outer box the textolit box
322 y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
323 sprintf(nodename,"%s%d", "TexBox", i) ;
324 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
325 textolitboxnode->SetLineColor(kColorPHOS) ;
326 fNodes->Add(textolitboxnode) ;
327 // upper foam plate inside outre box
329 sprintf(nodename, "%s%d", "UFPlate", i) ;
330 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
331 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
332 upperfoamplatenode->SetLineColor(kColorPHOS) ;
333 fNodes->Add(upperfoamplatenode) ;
334 // air filled box inside textolit box (not drawn)
335 textolitboxnode->cd();
336 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
337 sprintf(nodename, "%s%d", "AFBox", i) ;
338 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
339 fNodes->Add(airfilledboxnode) ;
340 // crystals box inside air filled box
341 airfilledboxnode->cd() ;
342 y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl
343 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
344 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
345 sprintf(nodename, "%s%d", "XTBox", i) ;
346 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
347 crystalsboxnode->SetLineColor(kColorXTAL) ;
348 fNodes->Add(crystalsboxnode) ;
352 //____________________________________________________________________________
353 void AliPHOSv0:: BuildGeometryforPPSD(void)
355 // Build the PHOS-PPSD geometry for the ROOT display
359 PPSD displayed by root
362 <LI> Zoom on PPSD: Front View
365 <IMG Align=BOTTOM ALT="PPSD Front View" SRC="../images/AliPHOSv0PPSDFrontView.gif">
367 <LI> Zoom on PPSD: Perspective View
370 <IMG Align=BOTTOM ALT="PPSD Prespective View" SRC="../images/AliPHOSv0PPSDPerspectiveView.gif">
375 Double_t const kRADDEG = 180.0 / kPI ;
377 const Int_t kColorPHOS = kRed ;
378 const Int_t kColorPPSD = kGreen ;
379 const Int_t kColorGas = kBlue ;
380 const Int_t kColorAir = kYellow ;
382 // Box for a full PHOS module
384 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
385 fGeom->GetPPSDBoxSize(1)/2,
386 fGeom->GetPPSDBoxSize(2)/2 );
388 // Box containing one micromegas module
390 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
391 fGeom->GetPPSDModuleSize(1)/2,
392 fGeom->GetPPSDModuleSize(2)/2 );
395 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
396 fGeom->GetLidThickness()/2,
397 fGeom->GetPPSDModuleSize(2)/2 ) ;
398 // composite panel (top and bottom)
400 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
401 fGeom->GetCompositeThickness()/2,
402 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
404 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
405 fGeom->GetCompositeThickness()/2,
406 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
407 // gas gap (conversion and avalanche)
409 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
410 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
411 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
415 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
416 fGeom->GetAnodeThickness()/2,
417 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
419 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
420 fGeom->GetCathodeThickness()/2,
421 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
424 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
425 fGeom->GetPCThickness()/2,
426 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
427 // Gap between Lead and top micromegas
429 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
430 fGeom->GetMicro1ToLeadGap()/2,
431 fGeom->GetPPSDBoxSize(2)/2 ) ;
433 // Gap between Lead and bottom micromegas
435 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
436 fGeom->GetLeadToMicro2Gap()/2,
437 fGeom->GetPPSDBoxSize(2)/2 ) ;
440 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
441 fGeom->GetLeadConverterThickness()/2,
442 fGeom->GetPPSDBoxSize(2)/2 ) ;
444 // position PPSD into ALICE
446 char * nodename = new char[20] ;
447 char * rotname = new char[20] ;
449 Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
451 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
453 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
454 Float_t angle = fGeom->GetPHOSAngle(i) ;
455 sprintf(rotname, "%s%d", "rotg", number++) ;
456 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
458 sprintf(nodename, "%s%d", "Moduleg", i) ;
459 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
460 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
461 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
462 ppsdboxnode->SetLineColor(kColorPPSD) ;
463 fNodes->Add(ppsdboxnode) ;
465 // inside the PPSD box:
466 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
467 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
469 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
470 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
472 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
473 y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
474 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
475 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
476 micro1node->SetLineColor(kColorPPSD) ;
477 fNodes->Add(micro1node) ;
478 // inside top micromegas
481 y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
482 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
483 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
484 toplidnode->SetLineColor(kColorPPSD) ;
485 fNodes->Add(toplidnode) ;
486 // b. composite panel
487 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
488 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
489 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
490 compupnode->SetLineColor(kColorPPSD) ;
491 fNodes->Add(compupnode) ;
493 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
494 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
495 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
496 anodenode->SetLineColor(kColorPHOS) ;
497 fNodes->Add(anodenode) ;
499 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
500 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
501 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
502 ggapnode->SetLineColor(kColorGas) ;
503 fNodes->Add(ggapnode) ;
505 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
506 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
507 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
508 cathodenode->SetLineColor(kColorPHOS) ;
509 fNodes->Add(cathodenode) ;
510 // g. printed circuit
511 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
512 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
513 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
514 pcnode->SetLineColor(kColorPPSD) ;
515 fNodes->Add(pcnode) ;
516 // h. composite panel
517 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
518 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
519 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
520 compdownnode->SetLineColor(kColorPPSD) ;
521 fNodes->Add(compdownnode) ;
522 z = z - fGeom->GetPPSDModuleSize(2) ;
524 } // end of Z module loop
525 x = x - fGeom->GetPPSDModuleSize(0) ;
527 } // end of phi module loop
531 y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
532 sprintf(nodename, "%s%d", "GapUp", i) ;
533 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
534 gapupnode->SetLineColor(kColorAir) ;
535 fNodes->Add(gapupnode) ;
537 y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
538 sprintf(nodename, "%s%d", "LeadC", i) ;
539 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
540 leadcnode->SetLineColor(kColorPPSD) ;
541 fNodes->Add(leadcnode) ;
543 y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
544 sprintf(nodename, "%s%d", "GapDown", i) ;
545 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
546 gapdownnode->SetLineColor(kColorAir) ;
547 fNodes->Add(gapdownnode) ;
548 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
549 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
551 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
552 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
554 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
555 y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
556 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
557 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
558 micro2node->SetLineColor(kColorPPSD) ;
559 fNodes->Add(micro2node) ;
560 // inside bottom micromegas
563 y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
564 sprintf(nodename, "%s%d", "Lidb", i) ;
565 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
566 toplidbnode->SetLineColor(kColorPPSD) ;
567 fNodes->Add(toplidbnode) ;
568 // b. composite panel
569 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
570 sprintf(nodename, "%s%d", "CompUb", i) ;
571 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
572 compupbnode->SetLineColor(kColorPPSD) ;
573 fNodes->Add(compupbnode) ;
575 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
576 sprintf(nodename, "%s%d", "Anob", i) ;
577 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
578 anodebnode->SetLineColor(kColorPPSD) ;
579 fNodes->Add(anodebnode) ;
581 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
582 sprintf(nodename, "%s%d", "GGapb", i) ;
583 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
584 ggapbnode->SetLineColor(kColorGas) ;
585 fNodes->Add(ggapbnode) ;
587 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
588 sprintf(nodename, "%s%d", "Cathodeb", i) ;
589 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
590 cathodebnode->SetLineColor(kColorPPSD) ;
591 fNodes->Add(cathodebnode) ;
592 // g. printed circuit
593 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
594 sprintf(nodename, "%s%d", "PCb", i) ;
595 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
596 pcbnode->SetLineColor(kColorPPSD) ;
597 fNodes->Add(pcbnode) ;
599 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
600 sprintf(nodename, "%s%d", "CompDownb", i) ;
601 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
602 compdownbnode->SetLineColor(kColorPPSD) ;
603 fNodes->Add(compdownbnode) ;
604 z = z - fGeom->GetPPSDModuleSize(2) ;
606 } // end of Z module loop
607 x = x - fGeom->GetPPSDModuleSize(0) ;
609 } // end of phi module loop
618 //____________________________________________________________________________
619 void AliPHOSv0::CreateGeometry()
621 // Create the PHOS geometry for Geant
623 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
625 if ( phostmp == NULL ) {
627 fprintf(stderr, "PHOS detector not found!\n") ;
631 // Get pointer to the array containing media indeces
632 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
635 bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
636 bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
637 bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
639 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
641 this->CreateGeometryforPHOS() ;
642 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
643 this->CreateGeometryforPPSD() ;
645 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
647 // --- Position PHOS mdules in ALICE setup ---
650 Double_t const kRADDEG = 180.0 / kPI ;
652 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
654 Float_t angle = fGeom->GetPHOSAngle(i) ;
655 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
657 Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
659 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
660 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
662 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
668 //____________________________________________________________________________
669 void AliPHOSv0::CreateGeometryforPHOS()
671 // Create the PHOS-EMC geometry for GEANT
675 Geant3 geometry tree of PHOS-EMC in ALICE
678 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
683 // Get pointer to the array containing media indexes
684 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
687 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
688 // --- Foam Thermo Insulating outer cover dimensions ---
689 // --- Put it in bigbox = PHOS
692 dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
693 dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
694 dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
696 gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
698 Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
700 gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
703 // --- Define Textolit Wall box, position inside EMCA ---
704 // --- Textolit Wall box dimentions ---
708 dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
709 dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
710 dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
712 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
714 yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
716 gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
719 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
720 // --- immediately below Foam Thermo Insulation Upper plate ---
722 // --- Upper Polystyrene Foam plate thickness ---
725 dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
726 dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
727 dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
729 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
731 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
733 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
736 // --- Define air-filled box, place inside PTXW ---
737 // --- Inner AIR volume dimensions ---
741 dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
742 dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
743 dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
745 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
747 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
749 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
751 // --- Dimensions of PbWO4 crystal ---
753 Float_t xtlX = fGeom->GetCrystalSize(0) ;
754 Float_t xtlY = fGeom->GetCrystalSize(1) ;
755 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
758 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
759 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
760 + fGeom->GetModuleBoxThickness() / 2.0 ;
761 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
763 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
765 yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
766 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
767 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
769 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
772 // --- Define Crystal BLock filled with air, position it inside PTCB ---
775 dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
776 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
777 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
779 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
781 // --- Divide PCBL in X (phi) and Z directions --
782 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
783 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
785 yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
787 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
790 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
793 dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
794 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
795 dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
797 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
799 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
802 // --- Define Tyvek volume, place inside PSTC ---
805 dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
806 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
807 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
809 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
811 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
812 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
814 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
817 // --- Define PbWO4 crystal volume, place inside PPAP ---
820 dpxtl[0] = xtlX / 2.0 ;
821 dpxtl[1] = xtlY / 2.0 ;
822 dpxtl[2] = xtlZ / 2.0 ;
824 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
826 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
828 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
831 // --- Define crystal support volume, place inside PPAP ---
834 dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
835 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
836 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
838 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
840 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
842 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
845 // --- Define PIN-diode volume and position it inside crystal support ---
846 // --- right behind PbWO4 crystal
848 // --- PIN-diode dimensions ---
852 dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
853 dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
854 dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
856 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
858 yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
860 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
863 // --- Define Upper Cooling Panel, place it on top of PTCB ---
865 // --- Upper Cooling Plate thickness ---
867 dpucp[0] = dptcb[0] ;
868 dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
869 dpucp[2] = dptcb[2] ;
871 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
873 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
874 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
875 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
877 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
880 // --- Define Al Support Plate, position it inside PAIR ---
881 // --- right beneath PTCB ---
882 // --- Al Support Plate thickness ---
885 dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
886 dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
887 dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
889 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
891 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
892 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
893 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
895 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
898 // --- Define Thermo Insulating Plate, position it inside PAIR ---
899 // --- right beneath PASP ---
900 // --- Lower Thermo Insulating Plate thickness ---
903 dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
904 dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
905 dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
907 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
909 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
910 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
911 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
913 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
916 // --- Define Textolit Plate, position it inside PAIR ---
917 // --- right beneath PTIP ---
918 // --- Lower Textolit Plate thickness ---
921 dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
922 dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
923 dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
925 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
927 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
928 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
929 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness()
930 + fGeom->GetLowerThermoPlateThickness() ) ;
932 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
936 //____________________________________________________________________________
937 void AliPHOSv0::CreateGeometryforPPSD()
939 // Create the PHOS-PPSD geometry for GEANT
944 Geant3 geometry tree of PHOS-PPSD in ALICE
947 <IMG Align=BOTTOM ALT="PPSD geant tree" SRC="../images/PPSDinAlice.gif">
952 // Get pointer to the array containing media indexes
953 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
955 // The box containing all ppsd's for one PHOS module filled with air
957 ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
958 ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
959 ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
961 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
963 Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ;
965 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
967 // Now we build a micromegas module
968 // The box containing the whole module filled with epoxy (FR4)
971 mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
972 mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
973 mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
975 gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;
978 // 1. The Top Lid made of epoxy (FR4)
981 tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
982 tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
983 tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
985 gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ;
987 Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
989 gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
991 // 2. the upper panel made of composite material
994 upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
995 upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
996 upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
998 gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ;
1000 y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
1002 gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1004 // 3. the anode made of Copper
1007 anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1008 anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ;
1009 anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1011 gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ;
1013 y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
1015 gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1017 // 4. the conversion gap + avalanche gap filled with gas
1020 ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1021 ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
1022 ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1024 gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ;
1026 // --- Divide GGPP in X (phi) and Z directions --
1027 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
1028 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
1030 y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
1032 gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1035 // 6. the cathode made of Copper
1038 cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1039 cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ;
1040 cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1042 gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ;
1044 y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
1046 gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1048 // 7. the printed circuit made of G10
1051 pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
1052 pcppsd[1] = fGeom->GetPCThickness() / 2.0 ;
1053 pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1055 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
1057 y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
1059 gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1061 // 8. the lower panel made of composite material
1064 lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1065 lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
1066 lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
1068 gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ;
1070 y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
1072 gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
1074 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
1075 // the top and bottom one's (which are assumed identical) :
1077 Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
1078 Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
1080 Int_t copyNumbertop = 0 ;
1081 Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
1083 Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
1085 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
1086 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
1088 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
1089 gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
1090 gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
1091 z = z - fGeom->GetPPSDModuleSize(2) ;
1092 } // end of Z module loop
1093 x = x - fGeom->GetPPSDModuleSize(0) ;
1094 } // end of phi module loop
1096 // The Lead converter between two air gaps
1100 uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1101 uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
1102 uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1104 gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ;
1106 y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
1108 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1110 // 2. Lead converter
1113 lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1114 lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
1115 lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1117 gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ;
1119 y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
1121 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1126 lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1127 lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
1128 lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1130 gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ;
1132 y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
1134 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1138 //___________________________________________________________________________
1139 Int_t AliPHOSv0::Digitize(Float_t Energy)
1141 // Applies the energy calibration
1143 Float_t fB = 100000000. ;
1145 Int_t chan = Int_t(fA + Energy*fB ) ;
1149 //___________________________________________________________________________
1150 void AliPHOSv0::FinishEvent()
1152 // Makes the digits from the sum of summed hit in a single crystal or PPSD gas cell
1153 // Adds to the energy the electronic noise
1154 // Keeps digits with energy above fDigitThreshold
1156 // Save the cumulated hits instead of raw hits (need to create the branch myself)
1157 // It is put in the Digit Tree because the TreeH is filled after each primary
1158 // and the TreeD at the end of the event.
1159 if ( fTmpHits && gAlice->TreeD() ) {
1160 char branchname[10] ;
1161 sprintf(branchname, "%sCH", GetName()) ;
1162 gAlice->TreeD()->Branch(branchname, &fTmpHits, fBufferSize) ;
1164 cout << "AliPHOSv0::AliPHOSv0: Failed to create branch PHOSCH in TreeD " << endl ;
1169 TClonesArray &lDigits = *fDigits ;
1171 AliPHOSDigit * newdigit ;
1172 AliPHOSDigit * curdigit ;
1173 Bool_t deja = kFALSE ;
1175 for ( i = 0 ; i < fNTmpHits ; i++ ) {
1176 hit = (AliPHOSHit*)fTmpHits->At(i) ;
1177 newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
1179 for ( j = 0 ; j < fNdigits ; j++) {
1180 curdigit = (AliPHOSDigit*) lDigits[j] ;
1181 if ( *curdigit == *newdigit) {
1182 *curdigit = *curdigit + *newdigit ;
1187 new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ;
1194 // Noise induced by the PIN diode of the PbWO crystals
1196 Float_t energyandnoise ;
1197 for ( i = 0 ; i < fNdigits ; i++ ) {
1198 newdigit = (AliPHOSDigit * ) fDigits->At(i) ;
1199 fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ;
1201 if (relid[1]==0){ // Digits belong to EMC (PbW0_4 crystals)
1202 energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ;
1204 if (energyandnoise < 0 )
1205 energyandnoise = 0 ;
1207 if ( newdigit->GetAmp() < fDigitThreshold ) // if threshold not surpassed, remove digit from list
1208 fDigits->RemoveAt(i) ;
1212 fDigits->Compress() ;
1214 fNdigits = fDigits->GetEntries() ;
1215 for (i = 0 ; i < fNdigits ; i++) {
1216 newdigit = (AliPHOSDigit *) fDigits->At(i) ;
1217 newdigit->SetIndexInList(i) ;
1222 //____________________________________________________________________________
1223 void AliPHOSv0::Init(void)
1225 // Just prints an information message
1230 for(i=0;i<35;i++) printf("*");
1231 printf(" PHOS_INIT ");
1232 for(i=0;i<35;i++) printf("*");
1235 // Here the PHOS initialisation code (if any!)
1237 for(i=0;i<80;i++) printf("*");
1242 //___________________________________________________________________________
1243 void AliPHOSv0::MakeBranch(Option_t* opt)
1245 // Create new branche in the current Root Tree in the digit Tree
1247 AliDetector::MakeBranch(opt) ;
1249 char branchname[10];
1250 sprintf(branchname,"%s",GetName());
1251 char *cdD = strstr(opt,"D");
1253 if (fDigits && gAlice->TreeD() && cdD) {
1254 gAlice->TreeD()->Branch(branchname, &fDigits, fBufferSize);
1258 //____________________________________________________________________________
1259 RecPointsList * AliPHOSv0::PpsdRecPoints(Int_t evt)
1261 // returns the pointer to the PPSD RecPoints list
1262 // if the list is empty, get it from TreeR on the disk file
1264 RecPointsList * rv = 0 ;
1266 if ( fPpsdRecPoints )
1267 rv = fPpsdRecPoints ;
1270 fPpsdRecPoints = new TClonesArray("AliPHOSPpsdRecPoint", 100) ;
1271 gAlice->GetEvent(evt) ;
1272 TTree * fReconstruct = gAlice->TreeR() ;
1273 fReconstruct->SetBranchAddress( "PHOSPpsdRP", &fPpsdRecPoints) ;
1274 fReconstruct->GetEvent(0) ;
1275 rv = fPpsdRecPoints ;
1278 fPpsdRecPoints->Expand( fPpsdRecPoints->GetEntries() ) ;
1284 //_____________________________________________________________________________
1285 void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
1287 // 1. Reinitializes the existing RecPoint, TrackSegment, and RecParticles Lists and
1288 // 2. Creates TreeR wit 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 RecPointsList("AliPHOSEmcRecPoint", 100) ; if TClonesArray
1309 fEmcRecPoints= new RecPointsList(100) ;
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 RecPointsList("AliPHOSPpsdRecPoint", 100) ; if TClonesArray
1325 fPpsdRecPoints = new RecPointsList(100) ;
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 TrackSegmentsList("AliPHOSTrackSegment", 100) ;
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 RecParticlesList("AliPHOSRecParticle", 100) ;
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() ;
1381 gAlice->TreeR()->Write() ;
1385 //____________________________________________________________________________
1386 void AliPHOSv0::ResetDigits()
1388 // May sound strange, but cumulative hits are store in digits Tree
1396 //____________________________________________________________________________
1397 void AliPHOSv0::StepManager(void)
1399 // Accumulates hits as long as the track stays in a single crystal or PPSD gas Cell
1401 Int_t relid[4] ; // (box, layer, row, column) indices
1402 Float_t xyze[4] ; // position wrt MRS and energy deposited
1403 TLorentzVector pos ;
1406 Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
1407 TString name = fGeom->GetName() ;
1408 if ( name == "GPS2" ) { // the CPV is a PPSD
1409 if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") ) // We are inside a gas cell
1411 gMC->TrackPosition(pos) ;
1415 xyze[3] = gMC->Edep() ;
1417 if ( xyze[3] != 0 ) { // there is deposited energy
1418 gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number
1419 gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
1420 // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
1421 // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
1422 gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell
1423 gMC->CurrentVolID(relid[3]) ; // get the column number
1425 // get the absolute Id number
1428 fGeom->RelToAbsNumbering(relid, absid) ;
1430 // add current hit to the hit list
1431 AddHit(primary, absid, xyze);
1433 } // there is deposited energy
1434 } // We are inside the gas of the CPV
1435 } // GPS2 configuration
1437 if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) // We are inside a PBWO crystal
1439 gMC->TrackPosition(pos) ;
1443 xyze[3] = gMC->Edep() ;
1445 if ( xyze[3] != 0 ) {
1446 gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
1447 relid[1] = 0 ; // means PBW04
1448 gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
1449 gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
1451 // get the absolute Id number
1454 fGeom->RelToAbsNumbering(relid, absid) ;
1456 // add current hit to the hit list
1458 AddHit(primary, absid, xyze);
1460 } // there is deposited energy
1461 } // we are inside a PHOS Xtal