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 ---
27 // --- Standard library ---
35 // --- AliRoot header files ---
37 #include "AliPHOSv0.h"
38 #include "AliPHOSHit.h"
39 #include "AliPHOSDigit.h"
40 #include "AliPHOSReconstructioner.h"
46 //____________________________________________________________________________
47 AliPHOSv0::AliPHOSv0()
53 //____________________________________________________________________________
54 AliPHOSv0::AliPHOSv0(const char *name, const char *title):
58 // We use 2 arrays of hits :
60 // - fHits (the "normal" one), which retains the hits associated with
61 // the current primary particle being tracked
62 // (this array is reset after each primary has been tracked).
64 // - fTmpHits, which retains all the hits of the current event. It
65 // is used for the digitization part.
67 fPINElectronicNoise = 0.010 ;
69 fHits = new TClonesArray("AliPHOSHit",100) ;
70 gAlice->AddHitList(fHits) ;
72 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
74 fNTmpHits = fNhits = 0 ;
76 fDigits = new TClonesArray("AliPHOSDigit",100) ;
79 fIshunt = 1 ; // All hits are associated with primary particles
81 // gets an instance of the geometry parameters class
83 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
85 if (fGeom->IsInitialized() )
86 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
88 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
90 //____________________________________________________________________________
91 AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
95 // We use 2 arrays of hits :
97 // - fHits (the "normal" one), which retains the hits associated with
98 // the current primary particle being tracked
99 // (this array is reset after each primary has been tracked).
101 // - fTmpHits, which retains all the hits of the current event. It
102 // is used for the digitization part.
103 fPINElectronicNoise = 0.010 ;
104 fHits = new TClonesArray("AliPHOSHit",100) ;
105 fDigits = new TClonesArray("AliPHOSDigit",100) ;
106 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
108 fNTmpHits = fNhits = 0 ;
110 fIshunt = 1 ; // All hits are associated with primary particles
112 // gets an instance of the geometry parameters class
113 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
115 if (fGeom->IsInitialized() )
116 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
118 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
120 // Defining the PHOS Reconstructioner
122 fReconstructioner = Reconstructioner ;
125 //____________________________________________________________________________
126 AliPHOSv0::~AliPHOSv0()
132 fEmcClusters->Delete() ;
133 delete fEmcClusters ;
136 fPpsdClusters->Delete() ;
137 delete fPpsdClusters ;
140 fTrackSegments->Delete() ;
141 delete fTrackSegments ;
145 //____________________________________________________________________________
146 void AliPHOSv0::AddHit(Int_t track, Int_t Id, Float_t * hits)
149 TClonesArray <mphits = *fTmpHits ;
152 Bool_t deja = false ;
154 // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
156 newHit = new AliPHOSHit(fIshunt, track, Id, hits) ;
158 for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
159 curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
160 if( *curHit == *newHit ) {
161 *curHit = *curHit + *newHit ;
167 new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
171 // Please note that the fTmpHits array must survive up to the
172 // end of the events, so it does not appear e.g. in ResetHits() (
173 // which is called at the end of each primary).
175 // if (IsTreeSelected('H')) {
176 // And, if we really want raw hits tree, have the fHits array filled also
177 // TClonesArray &lhits = *fHits;
178 // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
187 //____________________________________________________________________________
188 void AliPHOSv0::BuildGeometry()
191 this->BuildGeometryforPHOS() ;
192 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
193 this->BuildGeometryforPPSD() ;
195 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
199 //____________________________________________________________________________
200 void AliPHOSv0:: BuildGeometryforPHOS(void)
202 // Build the PHOS geometry for the ROOT display
204 const Int_t kColorPHOS = kRed ;
205 const Int_t kColorXTAL = kBlue ;
207 Double_t const kRADDEG = 180.0 / kPI ;
209 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
210 fGeom->GetOuterBoxSize(1)/2,
211 fGeom->GetOuterBoxSize(2)/2 );
213 // Textolit Wall box, position inside PHOS
215 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
216 fGeom->GetTextolitBoxSize(1)/2,
217 fGeom->GetTextolitBoxSize(2)/2);
219 // Polystyrene Foam Plate
221 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
222 fGeom->GetSecondUpperPlateThickness()/2,
223 fGeom->GetTextolitBoxSize(2)/2 ) ;
227 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
228 fGeom->GetAirFilledBoxSize(1)/2,
229 fGeom->GetAirFilledBoxSize(2)/2 );
233 Float_t xtlX = fGeom->GetCrystalSize(0) ;
234 Float_t xtlY = fGeom->GetCrystalSize(1) ;
235 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
237 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
238 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
239 + fGeom->GetModuleBoxThickness() / 2.0 ;
240 Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
242 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
244 // position PHOS into ALICE
246 Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
248 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
250 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
252 char * nodename = new char[20] ;
253 char * rotname = new char[20] ;
255 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
256 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
257 sprintf(rotname, "%s%d", "rot", number++) ;
258 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
260 sprintf(nodename,"%s%d", "Module", i) ;
261 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
262 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
263 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
264 outerboxnode->SetLineColor(kColorPHOS) ;
265 fNodes->Add(outerboxnode) ;
267 // now inside the outer box the textolit box
268 y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
269 sprintf(nodename,"%s%d", "TexBox", i) ;
270 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
271 textolitboxnode->SetLineColor(kColorPHOS) ;
272 fNodes->Add(textolitboxnode) ;
273 // upper foam plate inside outre box
275 sprintf(nodename, "%s%d", "UFPlate", i) ;
276 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
277 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
278 upperfoamplatenode->SetLineColor(kColorPHOS) ;
279 fNodes->Add(upperfoamplatenode) ;
280 // air filled box inside textolit box (not drawn)
281 textolitboxnode->cd();
282 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
283 sprintf(nodename, "%s%d", "AFBox", i) ;
284 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
285 fNodes->Add(airfilledboxnode) ;
286 // crystals box inside air filled box
287 airfilledboxnode->cd() ;
288 y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl
289 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
290 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
291 sprintf(nodename, "%s%d", "XTBox", i) ;
292 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
293 crystalsboxnode->SetLineColor(kColorXTAL) ;
294 fNodes->Add(crystalsboxnode) ;
298 //____________________________________________________________________________
299 void AliPHOSv0:: BuildGeometryforPPSD(void)
301 // Build the PPSD geometry for the ROOT display
303 Double_t const kRADDEG = 180.0 / kPI ;
305 const Int_t kColorPHOS = kRed ;
306 const Int_t kColorPPSD = kGreen ;
307 const Int_t kColorGas = kBlue ;
308 const Int_t kColorAir = kYellow ;
310 // Box for a full PHOS module
312 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
313 fGeom->GetPPSDBoxSize(1)/2,
314 fGeom->GetPPSDBoxSize(2)/2 );
316 // Box containing one micromegas module
318 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
319 fGeom->GetPPSDModuleSize(1)/2,
320 fGeom->GetPPSDModuleSize(2)/2 );
323 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
324 fGeom->GetLidThickness()/2,
325 fGeom->GetPPSDModuleSize(2)/2 ) ;
326 // composite panel (top and bottom)
328 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
329 fGeom->GetCompositeThickness()/2,
330 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
332 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
333 fGeom->GetCompositeThickness()/2,
334 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
335 // gas gap (conversion and avalanche)
337 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
338 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
339 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
343 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
344 fGeom->GetAnodeThickness()/2,
345 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
347 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
348 fGeom->GetCathodeThickness()/2,
349 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
352 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
353 fGeom->GetPCThickness()/2,
354 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
355 // Gap between Lead and top micromegas
357 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
358 fGeom->GetMicro1ToLeadGap()/2,
359 fGeom->GetPPSDBoxSize(2)/2 ) ;
361 // Gap between Lead and bottom micromegas
363 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
364 fGeom->GetLeadToMicro2Gap()/2,
365 fGeom->GetPPSDBoxSize(2)/2 ) ;
368 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
369 fGeom->GetLeadConverterThickness()/2,
370 fGeom->GetPPSDBoxSize(2)/2 ) ;
372 // position PPSD into ALICE
374 char * nodename = new char[20] ;
375 char * rotname = new char[20] ;
377 Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
379 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
381 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
382 Float_t angle = fGeom->GetPHOSAngle(i) ;
383 sprintf(rotname, "%s%d", "rotg", number++) ;
384 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
386 sprintf(nodename, "%s%d", "Moduleg", i) ;
387 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
388 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
389 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
390 ppsdboxnode->SetLineColor(kColorPPSD) ;
391 fNodes->Add(ppsdboxnode) ;
393 // inside the PPSD box:
394 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
395 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
396 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
397 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
399 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
400 y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
401 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
402 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
403 micro1node->SetLineColor(kColorPPSD) ;
404 fNodes->Add(micro1node) ;
405 // inside top micromegas
408 y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
409 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
410 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
411 toplidnode->SetLineColor(kColorPPSD) ;
412 fNodes->Add(toplidnode) ;
413 // b. composite panel
414 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
415 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
416 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
417 compupnode->SetLineColor(kColorPPSD) ;
418 fNodes->Add(compupnode) ;
420 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
421 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
422 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
423 anodenode->SetLineColor(kColorPHOS) ;
424 fNodes->Add(anodenode) ;
426 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
427 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
428 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
429 ggapnode->SetLineColor(kColorGas) ;
430 fNodes->Add(ggapnode) ;
432 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
433 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
434 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
435 cathodenode->SetLineColor(kColorPHOS) ;
436 fNodes->Add(cathodenode) ;
437 // g. printed circuit
438 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
439 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
440 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
441 pcnode->SetLineColor(kColorPPSD) ;
442 fNodes->Add(pcnode) ;
443 // h. composite panel
444 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
445 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
446 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
447 compdownnode->SetLineColor(kColorPPSD) ;
448 fNodes->Add(compdownnode) ;
449 z = z - fGeom->GetPPSDModuleSize(2) ;
451 } // end of Z module loop
452 x = x - fGeom->GetPPSDModuleSize(0) ;
454 } // end of phi module loop
457 y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
458 sprintf(nodename, "%s%d", "GapUp", i) ;
459 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
460 gapupnode->SetLineColor(kColorAir) ;
461 fNodes->Add(gapupnode) ;
463 y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
464 sprintf(nodename, "%s%d", "LeadC", i) ;
465 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
466 leadcnode->SetLineColor(kColorPPSD) ;
467 fNodes->Add(leadcnode) ;
469 y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
470 sprintf(nodename, "%s%d", "GapDown", i) ;
471 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
472 gapdownnode->SetLineColor(kColorAir) ;
473 fNodes->Add(gapdownnode) ;
474 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
475 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
476 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
477 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
479 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
480 y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
481 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
482 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
483 micro2node->SetLineColor(kColorPPSD) ;
484 fNodes->Add(micro2node) ;
485 // inside bottom micromegas
488 y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
489 sprintf(nodename, "%s%d", "Lidb", i) ;
490 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
491 toplidbnode->SetLineColor(kColorPPSD) ;
492 fNodes->Add(toplidbnode) ;
493 // b. composite panel
494 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
495 sprintf(nodename, "%s%d", "CompUb", i) ;
496 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
497 compupbnode->SetLineColor(kColorPPSD) ;
498 fNodes->Add(compupbnode) ;
500 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
501 sprintf(nodename, "%s%d", "Anob", i) ;
502 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
503 anodebnode->SetLineColor(kColorPPSD) ;
504 fNodes->Add(anodebnode) ;
506 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
507 sprintf(nodename, "%s%d", "GGapb", i) ;
508 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
509 ggapbnode->SetLineColor(kColorGas) ;
510 fNodes->Add(ggapbnode) ;
512 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
513 sprintf(nodename, "%s%d", "Cathodeb", i) ;
514 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
515 cathodebnode->SetLineColor(kColorPPSD) ;
516 fNodes->Add(cathodebnode) ;
517 // g. printed circuit
518 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
519 sprintf(nodename, "%s%d", "PCb", i) ;
520 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
521 pcbnode->SetLineColor(kColorPPSD) ;
522 fNodes->Add(pcbnode) ;
524 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
525 sprintf(nodename, "%s%d", "CompDownb", i) ;
526 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
527 compdownbnode->SetLineColor(kColorPPSD) ;
528 fNodes->Add(compdownbnode) ;
529 z = z - fGeom->GetPPSDModuleSize(2) ;
531 } // end of Z module loop
532 x = x - fGeom->GetPPSDModuleSize(0) ;
534 } // end of phi module loop
540 //____________________________________________________________________________
541 void AliPHOSv0::CreateGeometry()
544 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
546 if ( phostmp == NULL ) {
548 fprintf(stderr, "PHOS detector not found!\n") ;
553 // Get pointer to the array containing media indeces
554 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
557 bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
558 bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
559 bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
561 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
563 this->CreateGeometryforPHOS() ;
564 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
565 this->CreateGeometryforPPSD() ;
567 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
569 // --- Position PHOS mdules in ALICE setup ---
572 Double_t const kRADDEG = 180.0 / kPI ;
574 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
576 Float_t angle = fGeom->GetPHOSAngle(i) ;
577 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
579 Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
581 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
582 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
584 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
590 //____________________________________________________________________________
591 void AliPHOSv0::CreateGeometryforPHOS()
593 // Get pointer to the array containing media indeces
594 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
597 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
598 // --- Foam Thermo Insulating outer cover dimensions ---
599 // --- Put it in bigbox = PHOS
602 dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
603 dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
604 dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
606 gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
608 Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
610 gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
613 // --- Define Textolit Wall box, position inside EMCA ---
614 // --- Textolit Wall box dimentions ---
618 dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
619 dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
620 dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
622 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
624 yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
626 gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
629 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
630 // --- immediately below Foam Thermo Insulation Upper plate ---
632 // --- Upper Polystyrene Foam plate thickness ---
635 dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
636 dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
637 dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
639 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
641 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
643 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
646 // --- Define air-filled box, place inside PTXW ---
647 // --- Inner AIR volume dimensions ---
651 dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
652 dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
653 dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
655 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
657 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
659 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
661 // --- Dimensions of PbWO4 crystal ---
663 Float_t xtlX = fGeom->GetCrystalSize(0) ;
664 Float_t xtlY = fGeom->GetCrystalSize(1) ;
665 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
668 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
669 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
670 + fGeom->GetModuleBoxThickness() / 2.0 ;
671 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
673 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
675 yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
676 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
677 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
679 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
682 // --- Define Crystal BLock filled with air, position it inside PTCB ---
685 dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
686 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
687 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
689 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
691 // --- Divide PCBL in X (phi) and Z directions --
692 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
693 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
695 yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
697 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
700 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
703 dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
704 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
705 dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
707 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
709 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
712 // --- Define Tyvek volume, place inside PSTC ---
715 dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
716 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
717 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
719 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
721 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
722 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
724 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
727 // --- Define PbWO4 crystal volume, place inside PPAP ---
730 dpxtl[0] = xtlX / 2.0 ;
731 dpxtl[1] = xtlY / 2.0 ;
732 dpxtl[2] = xtlZ / 2.0 ;
734 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
736 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
738 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
741 // --- Define crystal support volume, place inside PPAP ---
744 dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
745 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
746 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
748 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
750 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
752 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
755 // --- Define PIN-diode volume and position it inside crystal support ---
756 // --- right behind PbWO4 crystal
758 // --- PIN-diode dimensions ---
762 dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
763 dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
764 dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
766 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
768 yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
770 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
773 // --- Define Upper Cooling Panel, place it on top of PTCB ---
775 // --- Upper Cooling Plate thickness ---
777 dpucp[0] = dptcb[0] ;
778 dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
779 dpucp[2] = dptcb[2] ;
781 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
783 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
784 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
785 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
787 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
790 // --- Define Al Support Plate, position it inside PAIR ---
791 // --- right beneath PTCB ---
792 // --- Al Support Plate thickness ---
795 dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
796 dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
797 dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
799 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
801 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
802 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
803 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
805 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
808 // --- Define Thermo Insulating Plate, position it inside PAIR ---
809 // --- right beneath PASP ---
810 // --- Lower Thermo Insulating Plate thickness ---
813 dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
814 dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
815 dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
817 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
819 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
820 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
821 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
823 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
826 // --- Define Textolit Plate, position it inside PAIR ---
827 // --- right beneath PTIP ---
828 // --- Lower Textolit Plate thickness ---
831 dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
832 dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
833 dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
835 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
837 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
838 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
839 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness()
840 + fGeom->GetLowerThermoPlateThickness() ) ;
842 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
846 //____________________________________________________________________________
847 void AliPHOSv0::CreateGeometryforPPSD()
849 // Get pointer to the array containing media indeces
850 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
852 // The box containing all ppsd's for one PHOS module filled with air
854 ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
855 ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
856 ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
858 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
860 Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ;
862 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
864 // Now we build a micromegas module
865 // The box containing the whole module filled with epoxy (FR4)
868 mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
869 mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
870 mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
872 gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;
875 // 1. The Top Lid made of epoxy (FR4)
878 tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
879 tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
880 tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
882 gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ;
884 Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
886 gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
888 // 2. the upper panel made of composite material
891 upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
892 upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
893 upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
895 gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ;
897 y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
899 gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
901 // 3. the anode made of Copper
904 anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
905 anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ;
906 anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
908 gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ;
910 y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
912 gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
914 // 4. the conversion gap + avalanche gap filled with gas
917 ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
918 ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
919 ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
921 gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ;
923 // --- Divide GGPP in X (phi) and Z directions --
924 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
925 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
927 y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
929 gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
932 // 6. the cathode made of Copper
935 cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
936 cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ;
937 cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
939 gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ;
941 y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
943 gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
945 // 7. the printed circuit made of G10
948 pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
949 pcppsd[1] = fGeom->GetPCThickness() / 2.0 ;
950 pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
952 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
954 y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
956 gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
958 // 8. the lower panel made of composite material
961 lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
962 lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
963 lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
965 gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ;
967 y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
969 gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
971 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
972 // the top and bottom one's (which are assumed identical) :
974 Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
975 Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
977 Int_t copyNumbertop = 0 ;
978 Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
980 Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
982 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
983 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
985 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
986 gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
987 gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
988 z = z - fGeom->GetPPSDModuleSize(2) ;
989 } // end of Z module loop
990 x = x - fGeom->GetPPSDModuleSize(0) ;
991 } // end of phi module loop
993 // The Lead converter between two air gaps
997 uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
998 uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
999 uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1001 gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ;
1003 y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
1005 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1007 // 2. Lead converter
1010 lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1011 lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
1012 lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1014 gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ;
1016 y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
1018 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1023 lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1024 lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
1025 lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1027 gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ;
1029 y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
1031 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1035 //___________________________________________________________________________
1036 Int_t AliPHOSv0::Digitize(Float_t Energy){
1037 Float_t fB = 100000000. ;
1039 Int_t chan = Int_t(fA + Energy*fB ) ;
1042 //___________________________________________________________________________
1043 void AliPHOSv0::FinishEvent()
1045 cout << "//_____________________________________________________" << endl ;
1046 cout << "<I> AliPHOSv0::FinishEvent() -- Starting digitalization" << endl ;
1048 TClonesArray &lDigits = *fDigits ;
1050 AliPHOSDigit * digit ;
1052 for ( i = 0 ; i < fNTmpHits ; i++ ) {
1053 hit = (AliPHOSHit*)fTmpHits->At(i) ;
1054 digit = new AliPHOSDigit(hit->GetId(),Digitize(hit->GetEnergy())) ;
1055 new(lDigits[fNdigits]) AliPHOSDigit(* digit) ;
1056 fNdigits++; delete digit ;
1058 Float_t energyandnoise ;
1059 for ( i = 0 ; i < fNdigits ; i++ ) {
1060 digit = (AliPHOSDigit * ) fDigits->At(i) ;
1061 // printf("GetId is %d and GetAmp is %d \n",digit->GetId(), digit->GetAmp()) ;
1062 energyandnoise = digit->GetAmp() + Digitize(gRandom->Gaus(0.,fPINElectronicNoise)) ;
1063 if (energyandnoise < 0 ) energyandnoise = 0 ;
1064 digit->SetAmp(energyandnoise);
1065 // printf("GetId is %d and GetAmp is %d \n",digit->GetId(), digit->GetAmp()) ;
1071 // Reset the array of all the "accumulated hits" of this event.
1076 //____________________________________________________________________________
1077 void AliPHOSv0::Init(void)
1083 for(i=0;i<35;i++) printf("*");
1084 printf(" PHOS_INIT ");
1085 for(i=0;i<35;i++) printf("*");
1088 // Here the PHOS initialisation code (if any!)
1090 for(i=0;i<80;i++) printf("*");
1095 //___________________________________________________________________________
1096 void AliPHOSv0::MakeBranch(Option_t* opt)
1099 // Create a new branch in the current Root Tree
1100 // The branch of fHits is automatically split
1102 AliDetector::MakeBranch(opt) ;
1104 char branchname[10];
1105 sprintf(branchname,"%s",GetName());
1106 char *cd = strstr(opt,"D");
1108 if (fDigits && gAlice->TreeD() && cd) {
1109 gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1110 printf("* AliPHOS::MakeBranch * Making Branch %s for digits\n",branchname);
1114 //_____________________________________________________________________________
1115 void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
1117 // reinitializes the existing RecPoint Lists and steers the reconstruction processes
1119 fReconstructioner = Reconstructioner ;
1122 fEmcClusters->Delete() ;
1123 delete fEmcClusters ;
1126 fEmcClusters= new RecPointsList("AliPHOSEmcRecPoint", 100) ;
1128 if (fPpsdClusters) {
1129 fPpsdClusters->Delete() ;
1130 delete fPpsdClusters ;
1133 fPpsdClusters = new RecPointsList("AliPHOSPpsdRecPoint", 100) ;
1135 if (fTrackSegments) {
1136 fTrackSegments->Delete() ;
1137 delete fTrackSegments ;
1138 fTrackSegments = 0 ;
1140 fTrackSegments = new TrackSegmentsList(100) ;
1142 if (fRecParticles) {
1143 fRecParticles->Delete() ;
1144 delete fRecParticles ;
1147 fRecParticles = new RecParticlesList("AliPHOSRecParticle", 100) ;
1149 fReconstructioner->Make(fDigits, fEmcClusters, fPpsdClusters, fTrackSegments, fRecParticles);
1153 //____________________________________________________________________________
1154 void AliPHOSv0::StepManager(void)
1156 Int_t relid[4] ; // (box, layer, row, column) indices
1157 Float_t xyze[4] ; // position wrt MRS and energy deposited
1158 TLorentzVector pos ;
1161 TString name = fGeom->GetName() ;
1163 if ( name == "GPS2" ) { // the CPV is a PPSD
1164 if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") )
1165 // if( strcmp ( gMC->CurrentVolName(), "GCEL" ) == 0 ) // We are inside a gas cell
1167 gMC->TrackPosition(pos) ;
1171 xyze[3] = gMC->Edep() ;
1173 if ( xyze[3] != 0 ) { // there is deposited energy
1174 gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number
1175 gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
1176 // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
1177 // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
1178 gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell
1179 gMC->CurrentVolID(relid[3]) ; // get the column number
1181 // get the absolute Id number
1184 fGeom->RelToAbsNumbering(relid,absid) ;
1186 // add current hit to the hit list
1187 AddHit(gAlice->CurrentTrack(), absid, xyze);
1189 } // there is deposited energy
1190 } // We are inside the gas of the CPV
1191 } // GPS2 configuration
1193 if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") )
1194 // if( strcmp ( gMC->CurrentVolName(), "PXTL" ) == 0 ) { // We are inside a PWO crystal
1196 gMC->TrackPosition(pos) ;
1200 xyze[3] = gMC->Edep() ;
1202 if ( xyze[3] != 0 ) {
1203 gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
1204 relid[1] = 0 ; // means PW04
1205 gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
1206 gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
1208 // get the absolute Id number
1211 fGeom->RelToAbsNumbering(relid, absid) ;
1213 // add current hit to the hit list
1215 AddHit(gAlice->CurrentTrack(), absid, xyze);
1217 } // there is deposited energy
1218 } // we are inside a PHOS Xtal