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 ;
68 fDigitThreshold = 1. ; // 1 GeV
70 fHits = new TClonesArray("AliPHOSHit",100) ;
71 gAlice->AddHitList(fHits) ;
73 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
75 fNTmpHits = fNhits = 0 ;
77 fDigits = new TClonesArray("AliPHOSDigit",100) ;
80 fIshunt = 1 ; // All hits are associated with primary particles
82 // gets an instance of the geometry parameters class
84 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
86 if (fGeom->IsInitialized() )
87 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
89 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
91 //____________________________________________________________________________
92 AliPHOSv0::AliPHOSv0(AliPHOSReconstructioner * Reconstructioner, const char *name, const char *title):
96 // We use 2 arrays of hits :
98 // - fHits (the "normal" one), which retains the hits associated with
99 // the current primary particle being tracked
100 // (this array is reset after each primary has been tracked).
102 // - fTmpHits, which retains all the hits of the current event. It
103 // is used for the digitization part.
104 fPinElectronicNoise = 0.010 ;
105 fHits = new TClonesArray("AliPHOSHit",100) ;
106 fDigits = new TClonesArray("AliPHOSDigit",100) ;
107 fTmpHits= new TClonesArray("AliPHOSHit",100) ;
109 fNTmpHits = fNhits = 0 ;
111 fIshunt = 1 ; // All hits are associated with primary particles
113 // gets an instance of the geometry parameters class
114 fGeom = AliPHOSGeometry::GetInstance(title, "") ;
116 if (fGeom->IsInitialized() )
117 cout << "AliPHOSv0 : PHOS geometry intialized for " << fGeom->GetName() << endl ;
119 cout << "AliPHOSv0 : PHOS geometry initialization failed !" << endl ;
121 // Defining the PHOS Reconstructioner
123 fReconstructioner = Reconstructioner ;
126 //____________________________________________________________________________
127 AliPHOSv0::~AliPHOSv0()
133 fEmcClusters->Delete() ;
134 delete fEmcClusters ;
137 fPpsdClusters->Delete() ;
138 delete fPpsdClusters ;
141 fTrackSegments->Delete() ;
142 delete fTrackSegments ;
146 //____________________________________________________________________________
147 void AliPHOSv0::AddHit(Int_t primary, Int_t Id, Float_t * hits)
150 TClonesArray <mphits = *fTmpHits ;
153 Bool_t deja = kFALSE ;
155 // In any case, fills the fTmpHit TClonesArray (with "accumulated hits")
157 newHit = new AliPHOSHit(primary, Id, hits) ;
159 for ( hitCounter = 0 ; hitCounter < fNTmpHits && !deja ; hitCounter++ ) {
160 curHit = (AliPHOSHit*) ltmphits[hitCounter] ;
161 if( *curHit == *newHit ) {
162 *curHit = *curHit + *newHit ;
168 new(ltmphits[fNTmpHits]) AliPHOSHit(*newHit) ;
172 // Please note that the fTmpHits array must survive up to the
173 // end of the events, so it does not appear e.g. in ResetHits() (
174 // which is called at the end of each primary).
176 // if (IsTreeSelected('H')) {
177 // And, if we really want raw hits tree, have the fHits array filled also
178 // TClonesArray &lhits = *fHits;
179 // new(lhits[fNhits]) AliPHOSHit(*newHit) ;
188 //____________________________________________________________________________
189 void AliPHOSv0::BuildGeometry()
192 this->BuildGeometryforPHOS() ;
193 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
194 this->BuildGeometryforPPSD() ;
196 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
200 //____________________________________________________________________________
201 void AliPHOSv0:: BuildGeometryforPHOS(void)
203 // Build the PHOS geometry for the ROOT display
205 const Int_t kColorPHOS = kRed ;
206 const Int_t kColorXTAL = kBlue ;
208 Double_t const kRADDEG = 180.0 / kPI ;
210 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
211 fGeom->GetOuterBoxSize(1)/2,
212 fGeom->GetOuterBoxSize(2)/2 );
214 // Textolit Wall box, position inside PHOS
216 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
217 fGeom->GetTextolitBoxSize(1)/2,
218 fGeom->GetTextolitBoxSize(2)/2);
220 // Polystyrene Foam Plate
222 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
223 fGeom->GetSecondUpperPlateThickness()/2,
224 fGeom->GetTextolitBoxSize(2)/2 ) ;
228 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
229 fGeom->GetAirFilledBoxSize(1)/2,
230 fGeom->GetAirFilledBoxSize(2)/2 );
234 Float_t xtlX = fGeom->GetCrystalSize(0) ;
235 Float_t xtlY = fGeom->GetCrystalSize(1) ;
236 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
238 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
239 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
240 + fGeom->GetModuleBoxThickness() / 2.0 ;
241 Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
243 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
245 // position PHOS into ALICE
247 Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
249 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
251 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
253 char * nodename = new char[20] ;
254 char * rotname = new char[20] ;
256 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
257 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
258 sprintf(rotname, "%s%d", "rot", number++) ;
259 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
261 sprintf(nodename,"%s%d", "Module", i) ;
262 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
263 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
264 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
265 outerboxnode->SetLineColor(kColorPHOS) ;
266 fNodes->Add(outerboxnode) ;
268 // now inside the outer box the textolit box
269 y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
270 sprintf(nodename,"%s%d", "TexBox", i) ;
271 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
272 textolitboxnode->SetLineColor(kColorPHOS) ;
273 fNodes->Add(textolitboxnode) ;
274 // upper foam plate inside outre box
276 sprintf(nodename, "%s%d", "UFPlate", i) ;
277 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
278 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
279 upperfoamplatenode->SetLineColor(kColorPHOS) ;
280 fNodes->Add(upperfoamplatenode) ;
281 // air filled box inside textolit box (not drawn)
282 textolitboxnode->cd();
283 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
284 sprintf(nodename, "%s%d", "AFBox", i) ;
285 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
286 fNodes->Add(airfilledboxnode) ;
287 // crystals box inside air filled box
288 airfilledboxnode->cd() ;
289 y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl
290 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
291 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
292 sprintf(nodename, "%s%d", "XTBox", i) ;
293 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
294 crystalsboxnode->SetLineColor(kColorXTAL) ;
295 fNodes->Add(crystalsboxnode) ;
299 //____________________________________________________________________________
300 void AliPHOSv0:: BuildGeometryforPPSD(void)
302 // Build the PPSD geometry for the ROOT display
304 Double_t const kRADDEG = 180.0 / kPI ;
306 const Int_t kColorPHOS = kRed ;
307 const Int_t kColorPPSD = kGreen ;
308 const Int_t kColorGas = kBlue ;
309 const Int_t kColorAir = kYellow ;
311 // Box for a full PHOS module
313 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
314 fGeom->GetPPSDBoxSize(1)/2,
315 fGeom->GetPPSDBoxSize(2)/2 );
317 // Box containing one micromegas module
319 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
320 fGeom->GetPPSDModuleSize(1)/2,
321 fGeom->GetPPSDModuleSize(2)/2 );
324 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
325 fGeom->GetLidThickness()/2,
326 fGeom->GetPPSDModuleSize(2)/2 ) ;
327 // composite panel (top and bottom)
329 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
330 fGeom->GetCompositeThickness()/2,
331 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
333 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
334 fGeom->GetCompositeThickness()/2,
335 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
336 // gas gap (conversion and avalanche)
338 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
339 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
340 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
344 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
345 fGeom->GetAnodeThickness()/2,
346 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
348 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
349 fGeom->GetCathodeThickness()/2,
350 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
353 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
354 fGeom->GetPCThickness()/2,
355 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
356 // Gap between Lead and top micromegas
358 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
359 fGeom->GetMicro1ToLeadGap()/2,
360 fGeom->GetPPSDBoxSize(2)/2 ) ;
362 // Gap between Lead and bottom micromegas
364 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
365 fGeom->GetLeadToMicro2Gap()/2,
366 fGeom->GetPPSDBoxSize(2)/2 ) ;
369 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
370 fGeom->GetLeadConverterThickness()/2,
371 fGeom->GetPPSDBoxSize(2)/2 ) ;
373 // position PPSD into ALICE
375 char * nodename = new char[20] ;
376 char * rotname = new char[20] ;
378 Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
380 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
382 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
383 Float_t angle = fGeom->GetPHOSAngle(i) ;
384 sprintf(rotname, "%s%d", "rotg", number++) ;
385 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
387 sprintf(nodename, "%s%d", "Moduleg", i) ;
388 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
389 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
390 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
391 ppsdboxnode->SetLineColor(kColorPPSD) ;
392 fNodes->Add(ppsdboxnode) ;
394 // inside the PPSD box:
395 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
396 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
397 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
398 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
400 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
401 y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
402 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
403 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
404 micro1node->SetLineColor(kColorPPSD) ;
405 fNodes->Add(micro1node) ;
406 // inside top micromegas
409 y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
410 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
411 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
412 toplidnode->SetLineColor(kColorPPSD) ;
413 fNodes->Add(toplidnode) ;
414 // b. composite panel
415 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
416 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
417 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
418 compupnode->SetLineColor(kColorPPSD) ;
419 fNodes->Add(compupnode) ;
421 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
422 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
423 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
424 anodenode->SetLineColor(kColorPHOS) ;
425 fNodes->Add(anodenode) ;
427 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
428 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
429 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
430 ggapnode->SetLineColor(kColorGas) ;
431 fNodes->Add(ggapnode) ;
433 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
434 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
435 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
436 cathodenode->SetLineColor(kColorPHOS) ;
437 fNodes->Add(cathodenode) ;
438 // g. printed circuit
439 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
440 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
441 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
442 pcnode->SetLineColor(kColorPPSD) ;
443 fNodes->Add(pcnode) ;
444 // h. composite panel
445 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
446 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
447 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
448 compdownnode->SetLineColor(kColorPPSD) ;
449 fNodes->Add(compdownnode) ;
450 z = z - fGeom->GetPPSDModuleSize(2) ;
452 } // end of Z module loop
453 x = x - fGeom->GetPPSDModuleSize(0) ;
455 } // end of phi module loop
458 y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
459 sprintf(nodename, "%s%d", "GapUp", i) ;
460 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
461 gapupnode->SetLineColor(kColorAir) ;
462 fNodes->Add(gapupnode) ;
464 y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
465 sprintf(nodename, "%s%d", "LeadC", i) ;
466 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
467 leadcnode->SetLineColor(kColorPPSD) ;
468 fNodes->Add(leadcnode) ;
470 y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
471 sprintf(nodename, "%s%d", "GapDown", i) ;
472 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
473 gapdownnode->SetLineColor(kColorAir) ;
474 fNodes->Add(gapdownnode) ;
475 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
476 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
477 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
478 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
480 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
481 y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
482 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
483 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
484 micro2node->SetLineColor(kColorPPSD) ;
485 fNodes->Add(micro2node) ;
486 // inside bottom micromegas
489 y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
490 sprintf(nodename, "%s%d", "Lidb", i) ;
491 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
492 toplidbnode->SetLineColor(kColorPPSD) ;
493 fNodes->Add(toplidbnode) ;
494 // b. composite panel
495 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
496 sprintf(nodename, "%s%d", "CompUb", i) ;
497 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
498 compupbnode->SetLineColor(kColorPPSD) ;
499 fNodes->Add(compupbnode) ;
501 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
502 sprintf(nodename, "%s%d", "Anob", i) ;
503 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
504 anodebnode->SetLineColor(kColorPPSD) ;
505 fNodes->Add(anodebnode) ;
507 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
508 sprintf(nodename, "%s%d", "GGapb", i) ;
509 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
510 ggapbnode->SetLineColor(kColorGas) ;
511 fNodes->Add(ggapbnode) ;
513 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
514 sprintf(nodename, "%s%d", "Cathodeb", i) ;
515 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
516 cathodebnode->SetLineColor(kColorPPSD) ;
517 fNodes->Add(cathodebnode) ;
518 // g. printed circuit
519 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
520 sprintf(nodename, "%s%d", "PCb", i) ;
521 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
522 pcbnode->SetLineColor(kColorPPSD) ;
523 fNodes->Add(pcbnode) ;
525 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
526 sprintf(nodename, "%s%d", "CompDownb", i) ;
527 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
528 compdownbnode->SetLineColor(kColorPPSD) ;
529 fNodes->Add(compdownbnode) ;
530 z = z - fGeom->GetPPSDModuleSize(2) ;
532 } // end of Z module loop
533 x = x - fGeom->GetPPSDModuleSize(0) ;
535 } // end of phi module loop
541 //____________________________________________________________________________
542 void AliPHOSv0::CreateGeometry()
545 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
547 if ( phostmp == NULL ) {
549 fprintf(stderr, "PHOS detector not found!\n") ;
554 // Get pointer to the array containing media indeces
555 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
558 bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
559 bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
560 bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
562 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
564 this->CreateGeometryforPHOS() ;
565 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
566 this->CreateGeometryforPPSD() ;
568 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
570 // --- Position PHOS mdules in ALICE setup ---
573 Double_t const kRADDEG = 180.0 / kPI ;
575 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
577 Float_t angle = fGeom->GetPHOSAngle(i) ;
578 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
580 Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
582 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
583 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
585 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
591 //____________________________________________________________________________
592 void AliPHOSv0::CreateGeometryforPHOS()
594 // Get pointer to the array containing media indeces
595 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
598 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
599 // --- Foam Thermo Insulating outer cover dimensions ---
600 // --- Put it in bigbox = PHOS
603 dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
604 dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
605 dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
607 gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
609 Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
611 gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
614 // --- Define Textolit Wall box, position inside EMCA ---
615 // --- Textolit Wall box dimentions ---
619 dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
620 dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
621 dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
623 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
625 yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
627 gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
630 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
631 // --- immediately below Foam Thermo Insulation Upper plate ---
633 // --- Upper Polystyrene Foam plate thickness ---
636 dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
637 dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
638 dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
640 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
642 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
644 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
647 // --- Define air-filled box, place inside PTXW ---
648 // --- Inner AIR volume dimensions ---
652 dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
653 dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
654 dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
656 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
658 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
660 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
662 // --- Dimensions of PbWO4 crystal ---
664 Float_t xtlX = fGeom->GetCrystalSize(0) ;
665 Float_t xtlY = fGeom->GetCrystalSize(1) ;
666 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
669 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
670 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
671 + fGeom->GetModuleBoxThickness() / 2.0 ;
672 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
674 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
676 yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
677 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
678 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
680 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
683 // --- Define Crystal BLock filled with air, position it inside PTCB ---
686 dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
687 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
688 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
690 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
692 // --- Divide PCBL in X (phi) and Z directions --
693 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
694 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
696 yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
698 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
701 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
704 dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
705 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
706 dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
708 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
710 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
713 // --- Define Tyvek volume, place inside PSTC ---
716 dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
717 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
718 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
720 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
722 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
723 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
725 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
728 // --- Define PbWO4 crystal volume, place inside PPAP ---
731 dpxtl[0] = xtlX / 2.0 ;
732 dpxtl[1] = xtlY / 2.0 ;
733 dpxtl[2] = xtlZ / 2.0 ;
735 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
737 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
739 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
742 // --- Define crystal support volume, place inside PPAP ---
745 dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
746 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
747 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
749 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
751 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
753 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
756 // --- Define PIN-diode volume and position it inside crystal support ---
757 // --- right behind PbWO4 crystal
759 // --- PIN-diode dimensions ---
763 dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
764 dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
765 dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
767 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
769 yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
771 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
774 // --- Define Upper Cooling Panel, place it on top of PTCB ---
776 // --- Upper Cooling Plate thickness ---
778 dpucp[0] = dptcb[0] ;
779 dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
780 dpucp[2] = dptcb[2] ;
782 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
784 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
785 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
786 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
788 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
791 // --- Define Al Support Plate, position it inside PAIR ---
792 // --- right beneath PTCB ---
793 // --- Al Support Plate thickness ---
796 dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
797 dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
798 dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
800 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
802 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
803 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
804 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
806 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
809 // --- Define Thermo Insulating Plate, position it inside PAIR ---
810 // --- right beneath PASP ---
811 // --- Lower Thermo Insulating Plate thickness ---
814 dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
815 dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
816 dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
818 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
820 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
821 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
822 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
824 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
827 // --- Define Textolit Plate, position it inside PAIR ---
828 // --- right beneath PTIP ---
829 // --- Lower Textolit Plate thickness ---
832 dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
833 dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
834 dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
836 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
838 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
839 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
840 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness()
841 + fGeom->GetLowerThermoPlateThickness() ) ;
843 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
847 //____________________________________________________________________________
848 void AliPHOSv0::CreateGeometryforPPSD()
850 // Get pointer to the array containing media indeces
851 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
853 // The box containing all ppsd's for one PHOS module filled with air
855 ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
856 ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
857 ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
859 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
861 Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ;
863 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
865 // Now we build a micromegas module
866 // The box containing the whole module filled with epoxy (FR4)
869 mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
870 mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
871 mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
873 gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;
876 // 1. The Top Lid made of epoxy (FR4)
879 tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
880 tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
881 tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
883 gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ;
885 Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
887 gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
889 // 2. the upper panel made of composite material
892 upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
893 upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
894 upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
896 gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ;
898 y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
900 gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
902 // 3. the anode made of Copper
905 anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
906 anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ;
907 anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
909 gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ;
911 y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
913 gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
915 // 4. the conversion gap + avalanche gap filled with gas
918 ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
919 ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
920 ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
922 gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ;
924 // --- Divide GGPP in X (phi) and Z directions --
925 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
926 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
928 y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
930 gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
933 // 6. the cathode made of Copper
936 cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
937 cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ;
938 cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
940 gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ;
942 y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
944 gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
946 // 7. the printed circuit made of G10
949 pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
950 pcppsd[1] = fGeom->GetPCThickness() / 2.0 ;
951 pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
953 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
955 y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
957 gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
959 // 8. the lower panel made of composite material
962 lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
963 lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
964 lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
966 gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ;
968 y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
970 gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
972 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
973 // the top and bottom one's (which are assumed identical) :
975 Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
976 Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
978 Int_t copyNumbertop = 0 ;
979 Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
981 Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
983 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
984 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
986 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
987 gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
988 gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
989 z = z - fGeom->GetPPSDModuleSize(2) ;
990 } // end of Z module loop
991 x = x - fGeom->GetPPSDModuleSize(0) ;
992 } // end of phi module loop
994 // The Lead converter between two air gaps
998 uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
999 uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
1000 uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1002 gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ;
1004 y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
1006 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1008 // 2. Lead converter
1011 lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1012 lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
1013 lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1015 gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ;
1017 y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
1019 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1024 lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
1025 lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
1026 lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
1028 gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ;
1030 y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
1032 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
1036 //___________________________________________________________________________
1037 Int_t AliPHOSv0::Digitize(Float_t Energy){
1038 Float_t fB = 100000000. ;
1040 Int_t chan = Int_t(fA + Energy*fB ) ;
1043 //___________________________________________________________________________
1044 void AliPHOSv0::FinishEvent()
1046 // cout << "//_____________________________________________________" << endl ;
1047 // cout << "<I> AliPHOSv0::FinishEvent() -- Starting digitalization" << endl ;
1051 TClonesArray &lDigits = *fDigits ;
1053 AliPHOSDigit * newdigit ;
1054 AliPHOSDigit * curdigit ;
1055 Bool_t deja = kFALSE ;
1057 for ( i = 0 ; i < fNTmpHits ; i++ ) {
1058 hit = (AliPHOSHit*)fTmpHits->At(i) ;
1059 newdigit = new AliPHOSDigit( hit->GetPrimary(), hit->GetId(), Digitize( hit->GetEnergy() ) ) ;
1061 for ( j = 0 ; j < fNdigits ; j++) {
1062 curdigit = (AliPHOSDigit*) lDigits[j] ;
1063 if ( *curdigit == *newdigit) {
1064 *curdigit = *curdigit + *newdigit ;
1069 new(lDigits[fNdigits]) AliPHOSDigit(* newdigit) ;
1076 // Noise induced by the PIN diode of the PbWO crystals
1078 Float_t energyandnoise ;
1079 for ( i = 0 ; i < fNdigits ; i++ ) {
1080 newdigit = (AliPHOSDigit * ) fDigits->At(i) ;
1081 fGeom->AbsToRelNumbering(newdigit->GetId(), relid) ;
1082 if (relid[1]==0){ // Digits belong to EMC (PbW0_4 crystals)
1083 energyandnoise = newdigit->GetAmp() + Digitize(gRandom->Gaus(0., fPinElectronicNoise)) ;
1084 if (energyandnoise < 0 )
1085 energyandnoise = 0 ;
1086 newdigit->SetAmp(energyandnoise) ;
1094 //____________________________________________________________________________
1095 void AliPHOSv0::Init(void)
1101 for(i=0;i<35;i++) printf("*");
1102 printf(" PHOS_INIT ");
1103 for(i=0;i<35;i++) printf("*");
1106 // Here the PHOS initialisation code (if any!)
1108 for(i=0;i<80;i++) printf("*");
1113 //___________________________________________________________________________
1114 void AliPHOSv0::MakeBranch(Option_t* opt)
1117 // Create a new branch in the current Root Tree
1118 // The branch of fHits is automatically split
1120 AliDetector::MakeBranch(opt) ;
1122 char branchname[10];
1123 sprintf(branchname,"%s",GetName());
1124 char *cdD = strstr(opt,"D");
1126 if (fDigits && gAlice->TreeD() && cdD) {
1127 gAlice->TreeD()->Branch(branchname,&fDigits, fBufferSize);
1129 char *cdR = strstr(opt,"R");
1130 if (fRecParticles && gAlice->TreeR() && cdR) {
1131 gAlice->TreeR()->Branch(branchname, &fRecParticles, fBufferSize);
1135 //_____________________________________________________________________________
1136 void AliPHOSv0::Reconstruction(AliPHOSReconstructioner * Reconstructioner)
1138 // reinitializes the existing RecPoint Lists and steers the reconstruction processes
1140 fReconstructioner = Reconstructioner ;
1143 fEmcClusters->Delete() ;
1144 delete fEmcClusters ;
1147 fEmcClusters= new RecPointsList("AliPHOSEmcRecPoint", 100) ;
1149 if (fPpsdClusters) {
1150 fPpsdClusters->Delete() ;
1151 delete fPpsdClusters ;
1154 fPpsdClusters = new RecPointsList("AliPHOSPpsdRecPoint", 100) ;
1156 if (fTrackSegments) {
1157 fTrackSegments->Delete() ;
1158 delete fTrackSegments ;
1159 fTrackSegments = 0 ;
1161 fTrackSegments = new TrackSegmentsList(100) ;
1163 if (fRecParticles) {
1164 fRecParticles->Delete() ;
1165 delete fRecParticles ;
1168 fRecParticles = new RecParticlesList("AliPHOSRecParticle", 100) ;
1170 fReconstructioner->Make(fDigits, fEmcClusters, fPpsdClusters, fTrackSegments, fRecParticles);
1174 //____________________________________________________________________________
1175 void AliPHOSv0::StepManager(void)
1177 Int_t relid[4] ; // (box, layer, row, column) indices
1178 Float_t xyze[4] ; // position wrt MRS and energy deposited
1179 TLorentzVector pos ;
1182 Int_t primary = gAlice->GetPrimary( gAlice->CurrentTrack() );
1183 TString name = fGeom->GetName() ;
1185 if ( name == "GPS2" ) { // the CPV is a PPSD
1186 if( gMC->CurrentVolID(copy) == gMC->VolId("GCEL") )
1188 gMC->TrackPosition(pos) ;
1192 xyze[3] = gMC->Edep() ;
1194 if ( xyze[3] != 0 ) { // there is deposited energy
1195 gMC->CurrentVolOffID(5, relid[0]) ; // get the PHOS Module number
1196 gMC->CurrentVolOffID(3, relid[1]) ; // get the Micromegas Module number
1197 // 1-> Geom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() upper
1198 // > fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() lower
1199 gMC->CurrentVolOffID(1, relid[2]) ; // get the row number of the cell
1200 gMC->CurrentVolID(relid[3]) ; // get the column number
1202 // get the absolute Id number
1205 fGeom->RelToAbsNumbering(relid, absid) ;
1207 // add current hit to the hit list
1208 AddHit(primary, absid, xyze);
1210 } // there is deposited energy
1211 } // We are inside the gas of the CPV
1212 } // GPS2 configuration
1214 if(gMC->CurrentVolID(copy) == gMC->VolId("PXTL") ) // We are inside a PBWO crystal
1216 gMC->TrackPosition(pos) ;
1220 xyze[3] = gMC->Edep() ;
1222 if ( xyze[3] != 0 ) {
1223 gMC->CurrentVolOffID(10, relid[0]) ; // get the PHOS module number ;
1224 relid[1] = 0 ; // means PBW04
1225 gMC->CurrentVolOffID(4, relid[2]) ; // get the row number inside the module
1226 gMC->CurrentVolOffID(3, relid[3]) ; // get the cell number inside the module
1228 // get the absolute Id number
1231 fGeom->RelToAbsNumbering(relid, absid) ;
1233 // add current hit to the hit list
1235 AddHit(primary, absid, xyze);
1237 } // there is deposited energy
1238 } // we are inside a PHOS Xtal