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_t deja = 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 && !deja ; 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 kRADDEG = 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 xtlX = fGeom->GetCrystalSize(0) ;
231 Float_t xtlY = fGeom->GetCrystalSize(1) ;
232 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
234 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
235 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
236 + fGeom->GetModuleBoxThickness() / 2.0 ;
237 Float_t zl = fGeom->GetNZ() * ( xtlZ + 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 / kRADDEG ) ;
259 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
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 kRADDEG = 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 / kRADDEG ) ;
385 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
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 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
543 if ( phostmp == 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 kRADDEG = 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 / kRADDEG ) ;
579 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
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 xtlX = fGeom->GetCrystalSize(0) ;
661 Float_t xtlY = fGeom->GetCrystalSize(1) ;
662 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
665 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
666 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
667 + fGeom->GetModuleBoxThickness() / 2.0 ;
668 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 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() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
683 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
684 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 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] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
701 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
702 dpstc[2] = ( xtlZ + 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] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
713 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
714 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
716 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
718 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
719 - ( xtlY + 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] = xtlX / 2.0 ;
728 dpxtl[1] = xtlY / 2.0 ;
729 dpxtl[2] = xtlZ / 2.0 ;
731 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
733 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 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] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
742 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
743 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
745 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
747 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + 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 *cd = strstr(opt,"D");
1093 if (fDigits && gAlice->TreeD() && cd) {
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