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 **************************************************************************/
16 //_________________________________________________________________________
17 // Manager class for PHOS version SUBATECH
18 //*-- Author : Y. Schutz SUBATECH
19 //////////////////////////////////////////////////////////////////////////////
21 // --- ROOT system ---
26 // --- Standard library ---
34 // --- AliRoot header files ---
36 #include "AliPHOSv0.h"
37 #include "AliPHOSHit.h"
38 #include "AliPHOSDigit.h"
39 #include "AliPHOSReconstructioner.h"
45 //____________________________________________________________________________
46 AliPHOSv0::AliPHOSv0()
52 //____________________________________________________________________________
53 AliPHOSv0::AliPHOSv0(const char *name, const char *title):
57 // We use 2 arrays of hits :
59 // - fHits (the "normal" one), which retains the hits associated with
60 // the current primary particle being tracked
61 // (this array is reset after each primary has been tracked).
63 // - fTmpHits, which retains all the hits of the current event. It
64 // is used for the digitization part.
66 fHits = new TClonesArray("AliPHOSHit",100) ;
67 gAlice->AddHitList(fHits) ;
69 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
71 fNTmpHits = fNhits = 0 ;
73 fDigits = new TClonesArray("AliPHOSDigit",100) ;
76 fIshunt = 1 ; // All hits are associated with primary particles
78 // gets an instance of the geometry parameters class
80 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
82 if (fGeom->IsInitialized() )
83 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
85 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
87 //____________________________________________________________________________
88 AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
92 // We use 2 arrays of hits :
94 // - fHits (the "normal" one), which retains the hits associated with
95 // the current primary particle being tracked
96 // (this array is reset after each primary has been tracked).
98 // - fTmpHits, which retains all the hits of the current event. It
99 // is used for the digitization part.
101 fHits = new TClonesArray("AliPHOSHit",100) ;
102 fDigits = new TClonesArray("AliPHOSDigit",100) ;
103 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
105 fNTmpHits = fNhits = 0 ;
107 fIshunt = 1 ; // All hits are associated with primary particles
109 // gets an instance of the geometry parameters class
110 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
112 if (fGeom->IsInitialized() )
113 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
115 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
117 // Defining the PHOS Reconstructioner
119 fReconstructioner = Reconstructioner ;
122 //____________________________________________________________________________
123 AliPHOSv0::~AliPHOSv0()
129 fEmcClusters->Delete() ;
130 delete fEmcClusters ;
133 fPpsdClusters->Delete() ;
134 delete fPpsdClusters ;
137 fTrackSegments->Delete() ;
138 delete fTrackSegments ;
142 //____________________________________________________________________________
143 void AliPHOSv0::AddHit(Int_t track, Int_t Id, Float_t * hits)
146 TClonesArray <mphits = *fTmpHits;
149 bool already = false ;
151 // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
153 newHit = new AliPHOSHit(fIshunt, track, Id, hits) ;
155 for ( hitCounter = 0 ; hitCounter < fNTmpHits && !already ; hitCounter++ ) {
156 curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
157 if( *curHit == *newHit ) {
158 *curHit = *curHit + *newHit ;
164 new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
168 // Please note that the fTmpHits array must survive up to the
169 // end of the events, so it does not appear e.g. in ResetHits() (
170 // which is called at the end of each primary).
172 // if (IsTreeSelected('H')) {
173 // And, if we really want raw hits tree, have the fHits array filled also
174 // TClonesArray &lhits = *fHits;
175 // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
184 //____________________________________________________________________________
185 void AliPHOSv0::BuildGeometry()
188 this->BuildGeometryforPHOS() ;
189 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
190 this->BuildGeometryforPPSD() ;
192 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
196 //____________________________________________________________________________
197 void AliPHOSv0:: BuildGeometryforPHOS(void)
199 // Build the PHOS geometry for the ROOT display
201 const Int_t kColorPHOS = kRed ;
202 const Int_t kColorXTAL = kBlue ;
204 Double_t const RADDEG = 180.0 / kPI ;
206 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
207 fGeom->GetOuterBoxSize(1)/2,
208 fGeom->GetOuterBoxSize(2)/2 );
210 // Textolit Wall box, position inside PHOS
212 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
213 fGeom->GetTextolitBoxSize(1)/2,
214 fGeom->GetTextolitBoxSize(2)/2);
216 // Polystyrene Foam Plate
218 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
219 fGeom->GetSecondUpperPlateThickness()/2,
220 fGeom->GetTextolitBoxSize(2)/2 ) ;
224 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
225 fGeom->GetAirFilledBoxSize(1)/2,
226 fGeom->GetAirFilledBoxSize(2)/2 );
230 Float_t XTL_X = fGeom->GetCrystalSize(0) ;
231 Float_t XTL_Y = fGeom->GetCrystalSize(1) ;
232 Float_t XTL_Z = fGeom->GetCrystalSize(2) ;
234 Float_t XL = fGeom->GetNPhi() * ( XTL_X + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
235 Float_t YL = ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
236 + fGeom->GetModuleBoxThickness() / 2.0 ;
237 Float_t ZL = fGeom->GetNZ() * ( XTL_Z + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
239 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", XL, YL, ZL ) ;
241 // position PHOS into ALICE
243 Float_t R = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
245 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
247 TNode * Top = gAlice->GetGeometry()->GetNode("alice") ;
249 char * nodename = new char[20] ;
250 char * rotname = new char[20] ;
252 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
253 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
254 sprintf(rotname, "%s%d", "rot", number++) ;
255 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
257 sprintf(nodename,"%s%d", "Module", i) ;
258 Float_t X = R * TMath::Sin( angle / RADDEG ) ;
259 Float_t Y = -R * TMath::Cos( angle / RADDEG ) ;
260 TNode * OuterBoxNode = new TNode(nodename, nodename, "OuterBox", X, Y, 0, rotname ) ;
261 OuterBoxNode->SetLineColor(kColorPHOS) ;
262 fNodes->Add(OuterBoxNode) ;
264 // now inside the outer box the textolit box
265 Y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
266 sprintf(nodename,"%s%d", "TexBox", i) ;
267 TNode * TextolitBoxNode = new TNode(nodename, nodename, "TextolitBox", 0, Y, 0) ;
268 TextolitBoxNode->SetLineColor(kColorPHOS) ;
269 fNodes->Add(TextolitBoxNode) ;
270 // upper foam plate inside outre box
272 sprintf(nodename, "%s%d", "UFPlate", i) ;
273 Y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
274 TNode * UpperFoamPlateNode = new TNode(nodename, nodename, "UpperFoamPlate", 0, Y, 0) ;
275 UpperFoamPlateNode->SetLineColor(kColorPHOS) ;
276 fNodes->Add(UpperFoamPlateNode) ;
277 // air filled box inside textolit box (not drawn)
278 TextolitBoxNode->cd();
279 Y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
280 sprintf(nodename, "%s%d", "AFBox", i) ;
281 TNode * AirFilledBoxNode = new TNode(nodename, nodename, "AirFilledBox", 0, Y, 0) ;
282 fNodes->Add(AirFilledBoxNode) ;
283 // crystals box inside air filled box
284 AirFilledBoxNode->cd() ;
285 Y = fGeom->GetAirFilledBoxSize(1) / 2.0 - YL
286 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
287 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
288 sprintf(nodename, "%s%d", "XTBox", i) ;
289 TNode * CrystalsBoxNode = new TNode(nodename, nodename, "CrystalsBox", 0, Y, 0) ;
290 CrystalsBoxNode->SetLineColor(kColorXTAL) ;
291 fNodes->Add(CrystalsBoxNode) ;
295 //____________________________________________________________________________
296 void AliPHOSv0:: BuildGeometryforPPSD(void)
298 // Build the PPSD geometry for the ROOT display
300 Double_t const RADDEG = 180.0 / kPI ;
302 const Int_t kColorPHOS = kRed ;
303 const Int_t kColorPPSD = kGreen ;
304 const Int_t kColorGas = kBlue ;
305 const Int_t kColorAir = kYellow ;
307 // Box for a full PHOS module
309 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
310 fGeom->GetPPSDBoxSize(1)/2,
311 fGeom->GetPPSDBoxSize(2)/2 );
313 // Box containing one micromegas module
315 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
316 fGeom->GetPPSDModuleSize(1)/2,
317 fGeom->GetPPSDModuleSize(2)/2 );
320 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
321 fGeom->GetLidThickness()/2,
322 fGeom->GetPPSDModuleSize(2)/2 ) ;
323 // composite panel (top and bottom)
325 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
326 fGeom->GetCompositeThickness()/2,
327 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
329 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
330 fGeom->GetCompositeThickness()/2,
331 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
332 // gas gap (conversion and avalanche)
334 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
335 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
336 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
340 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
341 fGeom->GetAnodeThickness()/2,
342 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
344 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
345 fGeom->GetCathodeThickness()/2,
346 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
349 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
350 fGeom->GetPCThickness()/2,
351 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
352 // Gap between Lead and top micromegas
354 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
355 fGeom->GetMicro1ToLeadGap()/2,
356 fGeom->GetPPSDBoxSize(2)/2 ) ;
358 // Gap between Lead and bottom micromegas
360 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
361 fGeom->GetLeadToMicro2Gap()/2,
362 fGeom->GetPPSDBoxSize(2)/2 ) ;
365 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
366 fGeom->GetLeadConverterThickness()/2,
367 fGeom->GetPPSDBoxSize(2)/2 ) ;
369 // position PPSD into ALICE
371 char * nodename = new char[20] ;
372 char * rotname = new char[20] ;
374 Float_t R = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
376 TNode * Top = gAlice->GetGeometry()->GetNode("alice") ;
378 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
379 Float_t angle = fGeom->GetPHOSAngle(i) ;
380 sprintf(rotname, "%s%d", "rotg", number++) ;
381 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
383 sprintf(nodename, "%s%d", "Moduleg", i) ;
384 Float_t X = R * TMath::Sin( angle / RADDEG ) ;
385 Float_t Y = -R * TMath::Cos( angle / RADDEG ) ;
386 TNode * PPSDBoxNode = new TNode(nodename , nodename ,"PPSDBox", X, Y, 0, rotname ) ;
387 PPSDBoxNode->SetLineColor(kColorPPSD) ;
388 fNodes->Add(PPSDBoxNode) ;
390 // inside the PPSD box:
391 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
392 X = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
393 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
394 Float_t Z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
396 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
397 Y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
398 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
399 Micro1Node = new TNode(nodename, nodename, "PPSDModule", X, Y, Z) ;
400 Micro1Node->SetLineColor(kColorPPSD) ;
401 fNodes->Add(Micro1Node) ;
402 // inside top micromegas
405 Y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
406 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
407 TNode * TopLidNode = new TNode(nodename, nodename, "TopLid", 0, Y, 0) ;
408 TopLidNode->SetLineColor(kColorPPSD) ;
409 fNodes->Add(TopLidNode) ;
410 // b. composite panel
411 Y = Y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
412 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
413 TNode * CompUpNode = new TNode(nodename, nodename, "TopPanel", 0, Y, 0) ;
414 CompUpNode->SetLineColor(kColorPPSD) ;
415 fNodes->Add(CompUpNode) ;
417 Y = Y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
418 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
419 TNode * AnodeNode = new TNode(nodename, nodename, "Anode", 0, Y, 0) ;
420 AnodeNode->SetLineColor(kColorPHOS) ;
421 fNodes->Add(AnodeNode) ;
423 Y = Y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
424 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
425 TNode * GGapNode = new TNode(nodename, nodename, "GasGap", 0, Y, 0) ;
426 GGapNode->SetLineColor(kColorGas) ;
427 fNodes->Add(GGapNode) ;
429 Y = Y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
430 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
431 TNode * CathodeNode = new TNode(nodename, nodename, "Cathode", 0, Y, 0) ;
432 CathodeNode->SetLineColor(kColorPHOS) ;
433 fNodes->Add(CathodeNode) ;
434 // g. printed circuit
435 Y = Y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
436 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
437 TNode * PCNode = new TNode(nodename, nodename, "PCBoard", 0, Y, 0) ;
438 PCNode->SetLineColor(kColorPPSD) ;
439 fNodes->Add(PCNode) ;
440 // h. composite panel
441 Y = Y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
442 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
443 TNode * CompDownNode = new TNode(nodename, nodename, "BottomPanel", 0, Y, 0) ;
444 CompDownNode->SetLineColor(kColorPPSD) ;
445 fNodes->Add(CompDownNode) ;
446 Z = Z - fGeom->GetPPSDModuleSize(2) ;
448 } // end of Z module loop
449 X = X - fGeom->GetPPSDModuleSize(0) ;
451 } // end of phi module loop
454 Y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
455 sprintf(nodename, "%s%d", "GapUp", i) ;
456 TNode * GapUpNode = new TNode(nodename, nodename, "LeadToM", 0, Y, 0) ;
457 GapUpNode->SetLineColor(kColorAir) ;
458 fNodes->Add(GapUpNode) ;
460 Y = Y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
461 sprintf(nodename, "%s%d", "LeadC", i) ;
462 TNode * LeadCNode = new TNode(nodename, nodename, "Lead", 0, Y, 0) ;
463 LeadCNode->SetLineColor(kColorPPSD) ;
464 fNodes->Add(LeadCNode) ;
466 Y = Y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
467 sprintf(nodename, "%s%d", "GapDown", i) ;
468 TNode * GapDownNode = new TNode(nodename, nodename, "MToLead", 0, Y, 0) ;
469 GapDownNode->SetLineColor(kColorAir) ;
470 fNodes->Add(GapDownNode) ;
471 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
472 X = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
473 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
474 Float_t Z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
476 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
477 Y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
478 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
479 Micro2Node = new TNode(nodename, nodename, "PPSDModule", X, Y, Z) ;
480 Micro2Node->SetLineColor(kColorPPSD) ;
481 fNodes->Add(Micro2Node) ;
482 // inside bottom micromegas
485 Y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
486 sprintf(nodename, "%s%d", "Lidb", i) ;
487 TNode * TopLidbNode = new TNode(nodename, nodename, "TopLid", 0, Y, 0) ;
488 TopLidbNode->SetLineColor(kColorPPSD) ;
489 fNodes->Add(TopLidbNode) ;
490 // b. composite panel
491 Y = Y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
492 sprintf(nodename, "%s%d", "CompUb", i) ;
493 TNode * CompUpbNode = new TNode(nodename, nodename, "TopPanel", 0, Y, 0) ;
494 CompUpbNode->SetLineColor(kColorPPSD) ;
495 fNodes->Add(CompUpbNode) ;
497 Y = Y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
498 sprintf(nodename, "%s%d", "Anob", i) ;
499 TNode * AnodebNode = new TNode(nodename, nodename, "Anode", 0, Y, 0) ;
500 AnodebNode->SetLineColor(kColorPPSD) ;
501 fNodes->Add(AnodebNode) ;
503 Y = Y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
504 sprintf(nodename, "%s%d", "GGapb", i) ;
505 TNode * GGapbNode = new TNode(nodename, nodename, "GasGap", 0, Y, 0) ;
506 GGapbNode->SetLineColor(kColorGas) ;
507 fNodes->Add(GGapbNode) ;
509 Y = Y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
510 sprintf(nodename, "%s%d", "Cathodeb", i) ;
511 TNode * CathodebNode = new TNode(nodename, nodename, "Cathode", 0, Y, 0) ;
512 CathodebNode->SetLineColor(kColorPPSD) ;
513 fNodes->Add(CathodebNode) ;
514 // g. printed circuit
515 Y = Y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
516 sprintf(nodename, "%s%d", "PCb", i) ;
517 TNode * PCbNode = new TNode(nodename, nodename, "PCBoard", 0, Y, 0) ;
518 PCbNode->SetLineColor(kColorPPSD) ;
519 fNodes->Add(PCbNode) ;
521 Y = Y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
522 sprintf(nodename, "%s%d", "CompDownb", i) ;
523 TNode * CompDownbNode = new TNode(nodename, nodename, "BottomPanel", 0, Y, 0) ;
524 CompDownbNode->SetLineColor(kColorPPSD) ;
525 fNodes->Add(CompDownbNode) ;
526 Z = Z - fGeom->GetPPSDModuleSize(2) ;
528 } // end of Z module loop
529 X = X - fGeom->GetPPSDModuleSize(0) ;
531 } // end of phi module loop
537 //____________________________________________________________________________
538 void AliPHOSv0::CreateGeometry()
541 AliPHOSv0 *PHOS_tmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
543 if ( PHOS_tmp == NULL ) {
545 fprintf(stderr, "PHOS detector not found!\n") ;
550 // Get pointer to the array containing media indeces
551 Int_t *IDTMED = fIdtmed->GetArray() - 699 ;
554 BigBox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
555 BigBox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
556 BigBox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
558 gMC->Gsvolu("PHOS", "BOX ", IDTMED[798], BigBox, 3) ;
560 this->CreateGeometryforPHOS() ;
561 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
562 this->CreateGeometryforPPSD() ;
564 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
566 // --- Position PHOS mdules in ALICE setup ---
569 Double_t const RADDEG = 180.0 / kPI ;
571 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
573 Float_t angle = fGeom->GetPHOSAngle(i) ;
574 AliMatrix(IDROTM[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
576 Float_t R = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
578 Float_t XP1 = R * TMath::Sin( angle / RADDEG ) ;
579 Float_t YP1 = -R * TMath::Cos( angle / RADDEG ) ;
581 gMC->Gspos("PHOS", i, "ALIC", XP1, YP1, 0.0, IDROTM[i-1], "ONLY") ;
587 //____________________________________________________________________________
588 void AliPHOSv0::CreateGeometryforPHOS()
590 // Get pointer to the array containing media indeces
591 Int_t *IDTMED = fIdtmed->GetArray() - 699 ;
594 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
595 // --- Foam Thermo Insulating outer cover dimensions ---
596 // --- Put it in BigBox = PHOS
599 DPHOS[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
600 DPHOS[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
601 DPHOS[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
603 gMC->Gsvolu("EMCA", "BOX ", IDTMED[706], DPHOS, 3) ;
605 Float_t YO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
607 gMC->Gspos("EMCA", 1, "PHOS", 0.0, YO, 0.0, 0, "ONLY") ;
610 // --- Define Textolit Wall box, position inside EMCA ---
611 // --- Textolit Wall box dimentions ---
615 DPTXW[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
616 DPTXW[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
617 DPTXW[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
619 gMC->Gsvolu("PTXW", "BOX ", IDTMED[707], DPTXW, 3);
621 YO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
623 gMC->Gspos("PTXW", 1, "EMCA", 0.0, YO, 0.0, 0, "ONLY") ;
626 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
627 // --- immediately below Foam Thermo Insulation Upper plate ---
629 // --- Upper Polystyrene Foam plate thickness ---
632 DPUFP[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
633 DPUFP[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
634 DPUFP[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
636 gMC->Gsvolu("PUFP", "BOX ", IDTMED[703], DPUFP, 3) ;
638 YO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
640 gMC->Gspos("PUFP", 1, "PTXW", 0.0, YO, 0.0, 0, "ONLY") ;
643 // --- Define air-filled box, place inside PTXW ---
644 // --- Inner AIR volume dimensions ---
648 DPAIR[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
649 DPAIR[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
650 DPAIR[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
652 gMC->Gsvolu("PAIR", "BOX ", IDTMED[798], DPAIR, 3) ;
654 YO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
656 gMC->Gspos("PAIR", 1, "PTXW", 0.0, YO, 0.0, 0, "ONLY") ;
658 // --- Dimensions of PbWO4 crystal ---
660 Float_t XTL_X = fGeom->GetCrystalSize(0) ;
661 Float_t XTL_Y = fGeom->GetCrystalSize(1) ;
662 Float_t XTL_Z = fGeom->GetCrystalSize(2) ;
665 DPTCB[0] = fGeom->GetNPhi() * ( XTL_X + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
666 DPTCB[1] = ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
667 + fGeom->GetModuleBoxThickness() / 2.0 ;
668 DPTCB[2] = fGeom->GetNZ() * ( XTL_Z + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
670 gMC->Gsvolu("PTCB", "BOX ", IDTMED[706], DPTCB, 3) ;
672 YO = fGeom->GetAirFilledBoxSize(1) / 2.0 - DPTCB[1]
673 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
674 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
676 gMC->Gspos("PTCB", 1, "PAIR", 0.0, YO, 0.0, 0, "ONLY") ;
679 // --- Define Crystal BLock filled with air, position it inside PTCB ---
682 DPCBL[0] = fGeom->GetNPhi() * ( XTL_X + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
683 DPCBL[1] = ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
684 DPCBL[2] = fGeom->GetNZ() * ( XTL_Z + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
686 gMC->Gsvolu("PCBL", "BOX ", IDTMED[798], DPCBL, 3) ;
688 // --- Divide PCBL in X (phi) and Z directions --
689 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
690 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
692 YO = -fGeom->GetModuleBoxThickness() / 2.0 ;
694 gMC->Gspos("PCBL", 1, "PTCB", 0.0, YO, 0.0, 0, "ONLY") ;
697 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
700 DPSTC[0] = ( XTL_X + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
701 DPSTC[1] = ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
702 DPSTC[2] = ( XTL_Z + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
704 gMC->Gsvolu("PSTC", "BOX ", IDTMED[704], DPSTC, 3) ;
706 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
709 // --- Define Tyvek volume, place inside PSTC ---
712 DPPAP[0] = XTL_X / 2.0 + fGeom->GetCrystalWrapThickness() ;
713 DPPAP[1] = ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
714 DPPAP[2] = XTL_Z / 2.0 + fGeom->GetCrystalWrapThickness() ;
716 gMC->Gsvolu("PPAP", "BOX ", IDTMED[702], DPPAP, 3) ;
718 YO = ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
719 - ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
721 gMC->Gspos("PPAP", 1, "PSTC", 0.0, YO, 0.0, 0, "ONLY") ;
724 // --- Define PbWO4 crystal volume, place inside PPAP ---
727 DPXTL[0] = XTL_X / 2.0 ;
728 DPXTL[1] = XTL_Y / 2.0 ;
729 DPXTL[2] = XTL_Z / 2.0 ;
731 gMC->Gsvolu("PXTL", "BOX ", IDTMED[699], DPXTL, 3) ;
733 YO = ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - XTL_Y / 2.0 - fGeom->GetCrystalWrapThickness() ;
735 gMC->Gspos("PXTL", 1, "PPAP", 0.0, YO, 0.0, 0, "ONLY") ;
738 // --- Define crystal support volume, place inside PPAP ---
741 DPSUP[0] = XTL_X / 2.0 + fGeom->GetCrystalWrapThickness() ;
742 DPSUP[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
743 DPSUP[2] = XTL_Z / 2.0 + fGeom->GetCrystalWrapThickness() ;
745 gMC->Gsvolu("PSUP", "BOX ", IDTMED[798], DPSUP, 3) ;
747 YO = fGeom->GetCrystalSupportHeight() / 2.0 - ( XTL_Y + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
749 gMC->Gspos("PSUP", 1, "PPAP", 0.0, YO, 0.0, 0, "ONLY") ;
752 // --- Define PIN-diode volume and position it inside crystal support ---
753 // --- right behind PbWO4 crystal
755 // --- PIN-diode dimensions ---
759 DPPIN[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
760 DPPIN[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
761 DPPIN[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
763 gMC->Gsvolu("PPIN", "BOX ", IDTMED[705], DPPIN, 3) ;
765 YO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
767 gMC->Gspos("PPIN", 1, "PSUP", 0.0, YO, 0.0, 0, "ONLY") ;
770 // --- Define Upper Cooling Panel, place it on top of PTCB ---
772 // --- Upper Cooling Plate thickness ---
774 DPUCP[0] = DPTCB[0] ;
775 DPUCP[1] = fGeom->GetUpperCoolingPlateThickness() ;
776 DPUCP[2] = DPTCB[2] ;
778 gMC->Gsvolu("PUCP", "BOX ", IDTMED[701], DPUCP,3) ;
780 YO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
781 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
782 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
784 gMC->Gspos("PUCP", 1, "PAIR", 0.0, YO, 0.0, 0, "ONLY") ;
787 // --- Define Al Support Plate, position it inside PAIR ---
788 // --- right beneath PTCB ---
789 // --- Al Support Plate thickness ---
792 DPASP[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
793 DPASP[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
794 DPASP[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
796 gMC->Gsvolu("PASP", "BOX ", IDTMED[701], DPASP, 3) ;
798 YO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
799 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
800 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + DPCBL[1] * 2 ) ;
802 gMC->Gspos("PASP", 1, "PAIR", 0.0, YO, 0.0, 0, "ONLY") ;
805 // --- Define Thermo Insulating Plate, position it inside PAIR ---
806 // --- right beneath PASP ---
807 // --- Lower Thermo Insulating Plate thickness ---
810 DPTIP[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
811 DPTIP[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
812 DPTIP[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
814 gMC->Gsvolu("PTIP", "BOX ", IDTMED[706], DPTIP, 3) ;
816 YO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
817 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
818 - fGeom->GetSecondUpperPlateThickness() + DPCBL[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
820 gMC->Gspos("PTIP", 1, "PAIR", 0.0, YO, 0.0, 0, "ONLY") ;
823 // --- Define Textolit Plate, position it inside PAIR ---
824 // --- right beneath PTIP ---
825 // --- Lower Textolit Plate thickness ---
828 DPTXP[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
829 DPTXP[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
830 DPTXP[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
832 gMC->Gsvolu("PTXP", "BOX ", IDTMED[707], DPTXP, 3) ;
834 YO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
835 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
836 - fGeom->GetSecondUpperPlateThickness() + DPCBL[1] * 2 + fGeom->GetSupportPlateThickness()
837 + fGeom->GetLowerThermoPlateThickness() ) ;
839 gMC->Gspos("PTXP", 1, "PAIR", 0.0, YO, 0.0, 0, "ONLY") ;
843 //____________________________________________________________________________
844 void AliPHOSv0::CreateGeometryforPPSD()
846 // Get pointer to the array containing media indeces
847 Int_t *IDTMED = fIdtmed->GetArray() - 699 ;
849 // The box containing all PPSD's for one PHOS module filled with air
851 PPSD[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
852 PPSD[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
853 PPSD[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
855 gMC->Gsvolu("PPSD", "BOX ", IDTMED[798], PPSD, 3) ;
857 Float_t YO = fGeom->GetOuterBoxSize(1) / 2.0 ;
859 gMC->Gspos("PPSD", 1, "PHOS", 0.0, YO, 0.0, 0, "ONLY") ;
861 // Now we build a micromegas module
862 // The box containing the whole module filled with epoxy (FR4)
865 MPPSD[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
866 MPPSD[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
867 MPPSD[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
869 gMC->Gsvolu("MPPS", "BOX ", IDTMED[708], MPPSD, 3) ;
872 // 1. The Top Lid made of epoxy (FR4)
875 TLPPSD[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
876 TLPPSD[1] = fGeom->GetLidThickness() / 2.0 ;
877 TLPPSD[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
879 gMC->Gsvolu("TLPS", "BOX ", IDTMED[708], TLPPSD, 3) ;
881 Float_t Y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
883 gMC->Gspos("TLPS", 1, "MPPS", 0.0, Y0, 0.0, 0, "ONLY") ;
885 // 2. the upper panel made of composite material
888 UPPPSD[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
889 UPPPSD[1] = fGeom->GetCompositeThickness() / 2.0 ;
890 UPPPSD[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
892 gMC->Gsvolu("UPPS", "BOX ", IDTMED[709], UPPPSD, 3) ;
894 Y0 = Y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
896 gMC->Gspos("UPPS", 1, "MPPS", 0.0, Y0, 0.0, 0, "ONLY") ;
898 // 3. the anode made of Copper
901 ANPPSD[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
902 ANPPSD[1] = fGeom->GetAnodeThickness() / 2.0 ;
903 ANPPSD[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
905 gMC->Gsvolu("ANPS", "BOX ", IDTMED[710], ANPPSD, 3) ;
907 Y0 = Y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
909 gMC->Gspos("ANPS", 1, "MPPS", 0.0, Y0, 0.0, 0, "ONLY") ;
911 // 4. the conversion gap + avalanche gap filled with gas
914 GGPPSD[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
915 GGPPSD[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
916 GGPPSD[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
918 gMC->Gsvolu("GGPS", "BOX ", IDTMED[715], GGPPSD, 3) ;
920 // --- Divide GGPP in X (phi) and Z directions --
921 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
922 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
924 Y0 = Y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
926 gMC->Gspos("GGPS", 1, "MPPS", 0.0, Y0, 0.0, 0, "ONLY") ;
929 // 6. the cathode made of Copper
932 CAPPSD[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
933 CAPPSD[1] = fGeom->GetCathodeThickness() / 2.0 ;
934 CAPPSD[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
936 gMC->Gsvolu("CAPS", "BOX ", IDTMED[710], CAPPSD, 3) ;
938 Y0 = Y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
940 gMC->Gspos("CAPS", 1, "MPPS", 0.0, Y0, 0.0, 0, "ONLY") ;
942 // 7. the printed circuit made of G10
945 PCPPSD[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
946 PCPPSD[1] = fGeom->GetPCThickness() / 2.0 ;
947 PCPPSD[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
949 gMC->Gsvolu("PCPS", "BOX ", IDTMED[711], CAPPSD, 3) ;
951 Y0 = Y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
953 gMC->Gspos("PCPS", 1, "MPPS", 0.0, Y0, 0.0, 0, "ONLY") ;
955 // 8. the lower panel made of composite material
958 LPPPSD[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
959 LPPPSD[1] = fGeom->GetCompositeThickness() / 2.0 ;
960 LPPPSD[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
962 gMC->Gsvolu("LPPS", "BOX ", IDTMED[709], LPPPSD, 3) ;
964 Y0 = Y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
966 gMC->Gspos("LPPS", 1, "MPPS", 0.0, Y0, 0.0, 0, "ONLY") ;
968 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (MPPSD) inside PPSD to cover a PHOS module
969 // the top and bottom one's (which are assumed identical) :
971 Float_t Yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
972 Float_t Yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
974 Int_t CopyNumbertop = 0 ;
975 Int_t CopyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
977 Float_t X = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
979 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
980 Float_t Z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
982 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
983 gMC->Gspos("MPPS", ++CopyNumbertop, "PPSD", X, Yt, Z, 0, "ONLY") ;
984 gMC->Gspos("MPPS", ++CopyNumberbot, "PPSD", X, Yb, Z, 0, "ONLY") ;
985 Z = Z - fGeom->GetPPSDModuleSize(2) ;
986 } // end of Z module loop
987 X = X - fGeom->GetPPSDModuleSize(0) ;
988 } // end of phi module loop
990 // The Lead converter between two air gaps
994 UAPPSD[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
995 UAPPSD[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
996 UAPPSD[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
998 gMC->Gsvolu("UAPPSD", "BOX ", IDTMED[798], UAPPSD, 3) ;
1000 Y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
1002 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, Y0, 0.0, 0, "ONLY") ;
1004 // 2. Lead converter
1007 LCPPSD[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1008 LCPPSD[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
1009 LCPPSD[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1011 gMC->Gsvolu("LCPPSD", "BOX ", IDTMED[712], LCPPSD, 3) ;
1013 Y0 = Y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
1015 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, Y0, 0.0, 0, "ONLY") ;
1020 LAPPSD[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1021 LAPPSD[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
1022 LAPPSD[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1024 gMC->Gsvolu("LAPPSD", "BOX ", IDTMED[798], LAPPSD, 3) ;
1026 Y0 = Y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
1028 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, Y0, 0.0, 0, "ONLY") ;
1032 //___________________________________________________________________________
1033 Int_t AliPHOSv0::Digitize(Float_t Energy){
1034 Float_t fB = 100000000. ;
1036 Int_t chan = Int_t(fA + Energy*fB ) ;
1039 //___________________________________________________________________________
1040 void AliPHOSv0::FinishEvent()
1042 cout << "//_____________________________________________________" << endl ;
1043 cout << "<I> AliPHOSv0::FinishEvent() -- Starting digitalization" << endl ;
1045 TClonesArray &lDigits = *fDigits ;
1047 AliPHOSDigit * Digit ;
1049 for ( i = 0 ; i < fNTmpHits ; i++ ) {
1050 Hit = (AliPHOSHit*)fTmpHits->At(i) ;
1051 Digit = new AliPHOSDigit(Hit->GetId(),Digitize(Hit->GetEnergy())) ;
1052 new(lDigits[fNdigits]) AliPHOSDigit(* Digit) ;
1053 fNdigits++; delete Digit ;
1056 // Reset the array of all the "accumulated hits" of this event.
1061 //____________________________________________________________________________
1062 void AliPHOSv0::Init(void)
1068 for(i=0;i<35;i++) printf("*");
1069 printf(" PHOS_INIT ");
1070 for(i=0;i<35;i++) printf("*");
1073 // Here the PHOS initialisation code (if any!)
1075 for(i=0;i<80;i++) printf("*");
1080 //___________________________________________________________________________
1081 void AliPHOSv0::MakeBranch(Option_t* opt)
1084 // Create a new branch in the current Root Tree
1085 // The branch of fHits is automatically split
1087 AliDetector::MakeBranch(opt) ;
1089 char branchname[10];
1090 sprintf(branchname,"%s",GetName());
1091 char *D = strstr(opt,"D");
1093 if (fDigits && gAlice->TreeD() && D) {
1094 gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1095 printf("* AliPHOS::MakeBranch * Making Branch %s for digits\n",branchname);
1099 //_____________________________________________________________________________
1100 void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
1102 // reinitializes the existing RecPoint Lists and steers the reconstruction processes
1104 fReconstructioner = Reconstructioner ;
1107 fEmcClusters->Delete() ;
1108 delete fEmcClusters ;
1111 fEmcClusters= new RecPointsList("AliPHOSEmcRecPoint", 100) ;
1113 if (fPpsdClusters) {
1114 fPpsdClusters->Delete() ;
1115 delete fPpsdClusters ;
1118 fPpsdClusters = new RecPointsList("AliPHOSPpsdRecPoint", 100) ;
1120 if (fTrackSegments) {
1121 fTrackSegments->Delete() ;
1122 delete fTrackSegments ;
1123 fTrackSegments = 0 ;
1125 fTrackSegments = new TrackSegmentsList(100) ;
1127 if (fRecParticles) {
1128 fRecParticles->Delete() ;
1129 delete fRecParticles ;
1132 fRecParticles = new RecParticlesList("AliPHOSRecParticle", 100) ;
1134 fReconstructioner->Make(fDigits, fEmcClusters, fPpsdClusters, fTrackSegments, fRecParticles);
1138 //____________________________________________________________________________
1139 void AliPHOSv0::StepManager(void)
1141 Int_t RelId[4] ; // (box, layer, row, column) indices
1142 Float_t xyze[4] ; // position wrt MRS and energy deposited
1143 TLorentzVector pos ;
1146 TString name = fGeom->GetName() ;
1148 if ( name == "GPS2" ) { // the CPV is a PPSD
1149 if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") )
1150 // if( strcmp ( gMC->CurrentVolName(), "GCEL" ) == 0 ) // We are inside a gas cell
1152 gMC->TrackPosition(pos) ;
1156 xyze[3] = gMC->Edep() ;
1158 if ( xyze[3] != 0 ) { // there is deposited energy
1159 gMC->CurrentVolOffID(5, RelId[0]) ; // get the PHOS Module number
1160 gMC->CurrentVolOffID(3, RelId[1]) ; // get the Micromegas Module number
1161 // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
1162 // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
1163 gMC->CurrentVolOffID(1, RelId[2]) ; // get the row number of the cell
1164 gMC->CurrentVolID(RelId[3]) ; // get the column number
1166 // get the absolute Id number
1169 fGeom->RelToAbsNumbering(RelId,AbsId) ;
1171 // add current hit to the hit list
1172 AddHit(gAlice->CurrentTrack(), AbsId, xyze);
1174 } // there is deposited energy
1175 } // We are inside the gas of the CPV
1176 } // GPS2 configuration
1178 if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") )
1179 // if( strcmp ( gMC->CurrentVolName(), "PXTL" ) == 0 ) { // We are inside a PWO crystal
1181 gMC->TrackPosition(pos) ;
1185 xyze[3] = gMC->Edep() ;
1187 if ( xyze[3] != 0 ) {
1188 gMC->CurrentVolOffID(10, RelId[0]) ; // get the PHOS module number ;
1189 RelId[1] = 0 ; // means PW04
1190 gMC->CurrentVolOffID(4, RelId[2]) ; // get the row number inside the module
1191 gMC->CurrentVolOffID(3, RelId[3]) ; // get the cell number inside the module
1193 // get the absolute Id number
1196 fGeom->RelToAbsNumbering(RelId,AbsId) ;
1198 // add current hit to the hit list
1200 AddHit(gAlice->CurrentTrack(), AbsId, xyze);
1202 } // there is deposited energy
1203 } // we are inside a PHOS Xtal