New functions MakeTrackSegmentsCPV(), FillOneModule()
[u/mrichter/AliRoot.git] / PHOS / AliPHOSv0.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
b2a60966 16/* $Id$ */
17
d15a28e7 18//_________________________________________________________________________
b2a60966 19// Implementation version v0 of PHOS Manager class
20// Layout EMC + PPSD has name GPS2
5f20d3fb 21// An object of this class does not produce hits nor digits
22// It is the one to use if you do not want to produce outputs in TREEH or TREED
b2a60966 23//
24//*-- Author: Yves Schutz (SUBATECH)
25
d2cf0e38 26
fe4da5cc 27// --- ROOT system ---
d15a28e7 28
fe4da5cc 29#include "TBRIK.h"
30#include "TNode.h"
0869cea5 31#include "TRandom.h"
94de3818 32#include "TGeometry.h"
fe4da5cc 33
81e92872 34
d15a28e7 35// --- Standard library ---
36
de9ec31b 37#include <stdio.h>
38#include <string.h>
39#include <stdlib.h>
40#include <strstream.h>
d15a28e7 41
42// --- AliRoot header files ---
43
fe4da5cc 44#include "AliPHOSv0.h"
45#include "AliRun.h"
d15a28e7 46#include "AliConst.h"
94de3818 47#include "AliMC.h"
fe4da5cc 48
49ClassImp(AliPHOSv0)
50
d15a28e7 51//____________________________________________________________________________
d15a28e7 52AliPHOSv0::AliPHOSv0(const char *name, const char *title):
53 AliPHOS(name,title)
54{
b2a60966 55 // ctor : title is used to identify the layout
56 // GPS2 = 5 modules (EMC + PPSD)
fe4da5cc 57
d15a28e7 58 // gets an instance of the geometry parameters class
e04976bd 59
60 if (strcmp(GetTitle(),"") != 0 )
61 fGeom = AliPHOSGeometry::GetInstance(GetTitle(), "") ;
62
d15a28e7 63}
64
65//____________________________________________________________________________
d15a28e7 66void AliPHOSv0::BuildGeometry()
fe4da5cc 67{
b2a60966 68 // Build the PHOS geometry for the ROOT display
69 //BEGIN_HTML
70 /*
71 <H2>
72 PHOS in ALICE displayed by root
73 </H2>
74 <UL>
75 <LI> All Views
76 <P>
77 <CENTER>
78 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
79 </CENTER></P></LI>
80 <LI> Front View
81 <P>
82 <CENTER>
83 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
84 </CENTER></P></LI>
85 <LI> 3D View 1
86 <P>
87 <CENTER>
88 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
89 </CENTER></P></LI>
90 <LI> 3D View 2
91 <P>
92 <CENTER>
93 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
94 </CENTER></P></LI>
95 </UL>
96 */
97 //END_HTML
d15a28e7 98
99 this->BuildGeometryforPHOS() ;
100 if ( ( strcmp(fGeom->GetName(), "GPS2" ) == 0 ) )
101 this->BuildGeometryforPPSD() ;
102 else
103 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed" << endl;
104
fe4da5cc 105}
d15a28e7 106
107//____________________________________________________________________________
108void AliPHOSv0:: BuildGeometryforPHOS(void)
109{
b2a60966 110 // Build the PHOS-EMC geometry for the ROOT display
d15a28e7 111
112 const Int_t kColorPHOS = kRed ;
113 const Int_t kColorXTAL = kBlue ;
114
92862013 115 Double_t const kRADDEG = 180.0 / kPI ;
d15a28e7 116
117 new TBRIK( "OuterBox", "PHOS box", "void", fGeom->GetOuterBoxSize(0)/2,
118 fGeom->GetOuterBoxSize(1)/2,
119 fGeom->GetOuterBoxSize(2)/2 );
120
121 // Textolit Wall box, position inside PHOS
122
123 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", fGeom->GetTextolitBoxSize(0)/2,
124 fGeom->GetTextolitBoxSize(1)/2,
125 fGeom->GetTextolitBoxSize(2)/2);
126
127 // Polystyrene Foam Plate
128
129 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", fGeom->GetTextolitBoxSize(0)/2,
130 fGeom->GetSecondUpperPlateThickness()/2,
131 fGeom->GetTextolitBoxSize(2)/2 ) ;
132
133 // Air Filled Box
fe4da5cc 134
d15a28e7 135 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", fGeom->GetAirFilledBoxSize(0)/2,
136 fGeom->GetAirFilledBoxSize(1)/2,
137 fGeom->GetAirFilledBoxSize(2)/2 );
138
139 // Crystals Box
140
92862013 141 Float_t xtlX = fGeom->GetCrystalSize(0) ;
142 Float_t xtlY = fGeom->GetCrystalSize(1) ;
143 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
d15a28e7 144
92862013 145 Float_t xl = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
146 Float_t yl = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
d15a28e7 147 + fGeom->GetModuleBoxThickness() / 2.0 ;
92862013 148 Float_t zl = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
d15a28e7 149
92862013 150 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
d15a28e7 151
152// position PHOS into ALICE
153
92862013 154 Float_t r = fGeom->GetIPtoOuterCoverDistance() + fGeom->GetOuterBoxSize(1) / 2.0 ;
d15a28e7 155 Int_t number = 988 ;
156 Float_t pphi = TMath::ATan( fGeom->GetOuterBoxSize(0) / ( 2.0 * fGeom->GetIPtoOuterCoverDistance() ) ) ;
92862013 157 pphi *= kRADDEG ;
158 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
d15a28e7 159
160 char * nodename = new char[20] ;
161 char * rotname = new char[20] ;
162
163 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
164 Float_t angle = pphi * 2 * ( i - fGeom->GetNModules() / 2.0 - 0.5 ) ;
165 sprintf(rotname, "%s%d", "rot", number++) ;
166 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
92862013 167 top->cd();
d15a28e7 168 sprintf(nodename,"%s%d", "Module", i) ;
92862013 169 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
170 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
171 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
172 outerboxnode->SetLineColor(kColorPHOS) ;
173 fNodes->Add(outerboxnode) ;
174 outerboxnode->cd() ;
d15a28e7 175 // now inside the outer box the textolit box
92862013 176 y = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
d15a28e7 177 sprintf(nodename,"%s%d", "TexBox", i) ;
92862013 178 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
179 textolitboxnode->SetLineColor(kColorPHOS) ;
180 fNodes->Add(textolitboxnode) ;
d15a28e7 181 // upper foam plate inside outre box
92862013 182 outerboxnode->cd() ;
d15a28e7 183 sprintf(nodename, "%s%d", "UFPlate", i) ;
92862013 184 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
185 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
186 upperfoamplatenode->SetLineColor(kColorPHOS) ;
187 fNodes->Add(upperfoamplatenode) ;
d15a28e7 188 // air filled box inside textolit box (not drawn)
92862013 189 textolitboxnode->cd();
190 y = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
d15a28e7 191 sprintf(nodename, "%s%d", "AFBox", i) ;
92862013 192 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
193 fNodes->Add(airfilledboxnode) ;
d15a28e7 194 // crystals box inside air filled box
92862013 195 airfilledboxnode->cd() ;
196 y = fGeom->GetAirFilledBoxSize(1) / 2.0 - yl
d15a28e7 197 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
198 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
199 sprintf(nodename, "%s%d", "XTBox", i) ;
92862013 200 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
201 crystalsboxnode->SetLineColor(kColorXTAL) ;
202 fNodes->Add(crystalsboxnode) ;
d15a28e7 203 }
b27d82c8 204
205 delete[] rotname ;
206 delete[] nodename ;
d15a28e7 207}
208
209//____________________________________________________________________________
210void AliPHOSv0:: BuildGeometryforPPSD(void)
fe4da5cc 211{
b2a60966 212 // Build the PHOS-PPSD geometry for the ROOT display
213 //BEGIN_HTML
214 /*
215 <H2>
216 PPSD displayed by root
217 </H2>
218 <UL>
219 <LI> Zoom on PPSD: Front View
220 <P>
221 <CENTER>
222 <IMG Align=BOTTOM ALT="PPSD Front View" SRC="../images/AliPHOSv0PPSDFrontView.gif">
223 </CENTER></P></LI>
224 <LI> Zoom on PPSD: Perspective View
225 <P>
226 <CENTER>
227 <IMG Align=BOTTOM ALT="PPSD Prespective View" SRC="../images/AliPHOSv0PPSDPerspectiveView.gif">
228 </CENTER></P></LI>
229 </UL>
230 */
231 //END_HTML
92862013 232 Double_t const kRADDEG = 180.0 / kPI ;
d15a28e7 233
234 const Int_t kColorPHOS = kRed ;
235 const Int_t kColorPPSD = kGreen ;
236 const Int_t kColorGas = kBlue ;
237 const Int_t kColorAir = kYellow ;
238
239 // Box for a full PHOS module
240
241 new TBRIK( "PPSDBox", "PPSD box", "void", fGeom->GetPPSDBoxSize(0)/2,
242 fGeom->GetPPSDBoxSize(1)/2,
243 fGeom->GetPPSDBoxSize(2)/2 );
244
245 // Box containing one micromegas module
246
247 new TBRIK( "PPSDModule", "PPSD module", "void", fGeom->GetPPSDModuleSize(0)/2,
248 fGeom->GetPPSDModuleSize(1)/2,
249 fGeom->GetPPSDModuleSize(2)/2 );
250 // top lid
251
252 new TBRIK ( "TopLid", "Micromegas top lid", "void", fGeom->GetPPSDModuleSize(0)/2,
253 fGeom->GetLidThickness()/2,
254 fGeom->GetPPSDModuleSize(2)/2 ) ;
255 // composite panel (top and bottom)
256
257 new TBRIK ( "TopPanel", "Composite top panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
258 fGeom->GetCompositeThickness()/2,
259 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
260
261 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
262 fGeom->GetCompositeThickness()/2,
263 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
264 // gas gap (conversion and avalanche)
265
266 new TBRIK ( "GasGap", "gas gap", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
267 ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() )/2,
268 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
269
270 // anode and cathode
271
272 new TBRIK ( "Anode", "Anode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
273 fGeom->GetAnodeThickness()/2,
274 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
275
276 new TBRIK ( "Cathode", "Cathode", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
277 fGeom->GetCathodeThickness()/2,
278 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
279 // PC
280
281 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() )/2,
282 fGeom->GetPCThickness()/2,
283 ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() )/2 ) ;
284 // Gap between Lead and top micromegas
285
286 new TBRIK ( "LeadToM", "Air Gap top", "void", fGeom->GetPPSDBoxSize(0)/2,
287 fGeom->GetMicro1ToLeadGap()/2,
288 fGeom->GetPPSDBoxSize(2)/2 ) ;
289
290// Gap between Lead and bottom micromegas
291
292 new TBRIK ( "MToLead", "Air Gap bottom", "void", fGeom->GetPPSDBoxSize(0)/2,
293 fGeom->GetLeadToMicro2Gap()/2,
294 fGeom->GetPPSDBoxSize(2)/2 ) ;
295 // Lead converter
296
297 new TBRIK ( "Lead", "Lead converter", "void", fGeom->GetPPSDBoxSize(0)/2,
298 fGeom->GetLeadConverterThickness()/2,
299 fGeom->GetPPSDBoxSize(2)/2 ) ;
300
301 // position PPSD into ALICE
302
303 char * nodename = new char[20] ;
304 char * rotname = new char[20] ;
305
92862013 306 Float_t r = fGeom->GetIPtoTopLidDistance() + fGeom->GetPPSDBoxSize(1) / 2.0 ;
d15a28e7 307 Int_t number = 988 ;
92862013 308 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
d15a28e7 309
310 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) { // the number of PHOS modules
311 Float_t angle = fGeom->GetPHOSAngle(i) ;
312 sprintf(rotname, "%s%d", "rotg", number++) ;
313 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
92862013 314 top->cd();
d15a28e7 315 sprintf(nodename, "%s%d", "Moduleg", i) ;
92862013 316 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
317 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
318 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
319 ppsdboxnode->SetLineColor(kColorPPSD) ;
320 fNodes->Add(ppsdboxnode) ;
321 ppsdboxnode->cd() ;
d15a28e7 322 // inside the PPSD box:
323 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
92862013 324 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
31aa6d6c 325 {
326 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
327 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
328 TNode * micro1node ;
329 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
330 y = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
331 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
332 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
333 micro1node->SetLineColor(kColorPPSD) ;
334 fNodes->Add(micro1node) ;
335 // inside top micromegas
336 micro1node->cd() ;
337 // a. top lid
338 y = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
339 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
340 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
341 toplidnode->SetLineColor(kColorPPSD) ;
342 fNodes->Add(toplidnode) ;
343 // b. composite panel
344 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
345 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
346 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
347 compupnode->SetLineColor(kColorPPSD) ;
348 fNodes->Add(compupnode) ;
349 // c. anode
350 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
351 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
352 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
353 anodenode->SetLineColor(kColorPHOS) ;
354 fNodes->Add(anodenode) ;
355 // d. gas
356 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
357 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
358 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
359 ggapnode->SetLineColor(kColorGas) ;
360 fNodes->Add(ggapnode) ;
d15a28e7 361 // f. cathode
31aa6d6c 362 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
363 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
364 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
365 cathodenode->SetLineColor(kColorPHOS) ;
366 fNodes->Add(cathodenode) ;
367 // g. printed circuit
368 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
369 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
370 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
371 pcnode->SetLineColor(kColorPPSD) ;
372 fNodes->Add(pcnode) ;
373 // h. composite panel
374 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
375 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
376 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
377 compdownnode->SetLineColor(kColorPPSD) ;
378 fNodes->Add(compdownnode) ;
379 z = z - fGeom->GetPPSDModuleSize(2) ;
380 ppsdboxnode->cd() ;
381 } // end of Z module loop
382 x = x - fGeom->GetPPSDModuleSize(0) ;
92862013 383 ppsdboxnode->cd() ;
31aa6d6c 384 } // end of phi module loop
385 }
d15a28e7 386 // 2. air gap
92862013 387 ppsdboxnode->cd() ;
388 y = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
d15a28e7 389 sprintf(nodename, "%s%d", "GapUp", i) ;
92862013 390 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
391 gapupnode->SetLineColor(kColorAir) ;
392 fNodes->Add(gapupnode) ;
d15a28e7 393 // 3. lead converter
92862013 394 y = y - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
d15a28e7 395 sprintf(nodename, "%s%d", "LeadC", i) ;
92862013 396 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
397 leadcnode->SetLineColor(kColorPPSD) ;
398 fNodes->Add(leadcnode) ;
d15a28e7 399 // 4. air gap
92862013 400 y = y - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
d15a28e7 401 sprintf(nodename, "%s%d", "GapDown", i) ;
92862013 402 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
403 gapdownnode->SetLineColor(kColorAir) ;
404 fNodes->Add(gapdownnode) ;
d15a28e7 405 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
92862013 406 x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. - fGeom->GetPhiDisplacement() ;
31aa6d6c 407 {
408 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) {
409 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. - fGeom->GetZDisplacement() ;;
410 TNode * micro2node ;
411 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) {
412 y = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
413 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
414 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
415 micro2node->SetLineColor(kColorPPSD) ;
416 fNodes->Add(micro2node) ;
417 // inside bottom micromegas
418 micro2node->cd() ;
d15a28e7 419 // a. top lid
92862013 420 y = ( fGeom->GetMicromegas2Thickness() - fGeom->GetLidThickness() ) / 2. ;
d15a28e7 421 sprintf(nodename, "%s%d", "Lidb", i) ;
92862013 422 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
423 toplidbnode->SetLineColor(kColorPPSD) ;
424 fNodes->Add(toplidbnode) ;
d15a28e7 425 // b. composite panel
92862013 426 y = y - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 427 sprintf(nodename, "%s%d", "CompUb", i) ;
92862013 428 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
429 compupbnode->SetLineColor(kColorPPSD) ;
430 fNodes->Add(compupbnode) ;
d15a28e7 431 // c. anode
92862013 432 y = y - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
d15a28e7 433 sprintf(nodename, "%s%d", "Anob", i) ;
92862013 434 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
435 anodebnode->SetLineColor(kColorPPSD) ;
436 fNodes->Add(anodebnode) ;
d15a28e7 437 // d. conversion gas
92862013 438 y = y - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
d15a28e7 439 sprintf(nodename, "%s%d", "GGapb", i) ;
92862013 440 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
441 ggapbnode->SetLineColor(kColorGas) ;
442 fNodes->Add(ggapbnode) ;
d15a28e7 443 // f. cathode
92862013 444 y = y - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
d15a28e7 445 sprintf(nodename, "%s%d", "Cathodeb", i) ;
92862013 446 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
447 cathodebnode->SetLineColor(kColorPPSD) ;
448 fNodes->Add(cathodebnode) ;
d15a28e7 449 // g. printed circuit
92862013 450 y = y - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
d15a28e7 451 sprintf(nodename, "%s%d", "PCb", i) ;
92862013 452 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
453 pcbnode->SetLineColor(kColorPPSD) ;
454 fNodes->Add(pcbnode) ;
d15a28e7 455 // h. composite pane
92862013 456 y = y - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 457 sprintf(nodename, "%s%d", "CompDownb", i) ;
92862013 458 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
459 compdownbnode->SetLineColor(kColorPPSD) ;
460 fNodes->Add(compdownbnode) ;
461 z = z - fGeom->GetPPSDModuleSize(2) ;
462 ppsdboxnode->cd() ;
d15a28e7 463 } // end of Z module loop
92862013 464 x = x - fGeom->GetPPSDModuleSize(0) ;
465 ppsdboxnode->cd() ;
31aa6d6c 466 } // end of phi module loop
467 }
468 } // PHOS modules
469
e126816e 470 delete[] rotname ;
471 delete[] nodename ;
31aa6d6c 472
fe4da5cc 473}
474
d15a28e7 475//____________________________________________________________________________
fe4da5cc 476void AliPHOSv0::CreateGeometry()
477{
b2a60966 478 // Create the PHOS geometry for Geant
d15a28e7 479
92862013 480 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
d15a28e7 481
92862013 482 if ( phostmp == NULL ) {
d15a28e7 483
484 fprintf(stderr, "PHOS detector not found!\n") ;
485 return;
fe4da5cc 486
d15a28e7 487 }
d15a28e7 488 // Get pointer to the array containing media indeces
92862013 489 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 490
92862013 491 Float_t bigbox[3] ;
492 bigbox[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
493 bigbox[1] = ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
494 bigbox[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
d15a28e7 495
92862013 496 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
d15a28e7 497
498 this->CreateGeometryforPHOS() ;
499 if ( strcmp( fGeom->GetName(), "GPS2") == 0 )
500 this->CreateGeometryforPPSD() ;
501 else
502 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
503
504 // --- Position PHOS mdules in ALICE setup ---
505
92862013 506 Int_t idrotm[99] ;
507 Double_t const kRADDEG = 180.0 / kPI ;
d15a28e7 508
509 for( Int_t i = 1; i <= fGeom->GetNModules(); i++ ) {
510
511 Float_t angle = fGeom->GetPHOSAngle(i) ;
92862013 512 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
d15a28e7 513
92862013 514 Float_t r = fGeom->GetIPtoOuterCoverDistance() + ( fGeom->GetOuterBoxSize(1) + fGeom->GetPPSDBoxSize(1) ) / 2.0 ;
d15a28e7 515
92862013 516 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
517 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
d15a28e7 518
92862013 519 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
d15a28e7 520
521 } // for GetNModules
522
fe4da5cc 523}
d15a28e7 524
525//____________________________________________________________________________
526void AliPHOSv0::CreateGeometryforPHOS()
527{
b2a60966 528 // Create the PHOS-EMC geometry for GEANT
529 //BEGIN_HTML
530 /*
531 <H2>
532 Geant3 geometry tree of PHOS-EMC in ALICE
533 </H2>
534 <P><CENTER>
535 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
536 </CENTER><P>
537 */
538 //END_HTML
539
540 // Get pointer to the array containing media indexes
92862013 541 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 542
543 // ---
544 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
545 // --- Foam Thermo Insulating outer cover dimensions ---
92862013 546 // --- Put it in bigbox = PHOS
d15a28e7 547
92862013 548 Float_t dphos[3] ;
549 dphos[0] = fGeom->GetOuterBoxSize(0) / 2.0 ;
550 dphos[1] = fGeom->GetOuterBoxSize(1) / 2.0 ;
551 dphos[2] = fGeom->GetOuterBoxSize(2) / 2.0 ;
d15a28e7 552
92862013 553 gMC->Gsvolu("EMCA", "BOX ", idtmed[706], dphos, 3) ;
d15a28e7 554
92862013 555 Float_t yO = - fGeom->GetPPSDBoxSize(1) / 2.0 ;
d15a28e7 556
92862013 557 gMC->Gspos("EMCA", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 558
559 // ---
560 // --- Define Textolit Wall box, position inside EMCA ---
561 // --- Textolit Wall box dimentions ---
562
563
92862013 564 Float_t dptxw[3];
565 dptxw[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
566 dptxw[1] = fGeom->GetTextolitBoxSize(1) / 2.0 ;
567 dptxw[2] = fGeom->GetTextolitBoxSize(2) / 2.0 ;
d15a28e7 568
92862013 569 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
d15a28e7 570
92862013 571 yO = ( fGeom->GetOuterBoxThickness(1) - fGeom->GetUpperPlateThickness() ) / 2. ;
d15a28e7 572
92862013 573 gMC->Gspos("PTXW", 1, "EMCA", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 574
575 // ---
576 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
577 // --- immediately below Foam Thermo Insulation Upper plate ---
578
579 // --- Upper Polystyrene Foam plate thickness ---
580
92862013 581 Float_t dpufp[3] ;
582 dpufp[0] = fGeom->GetTextolitBoxSize(0) / 2.0 ;
583 dpufp[1] = fGeom->GetSecondUpperPlateThickness() / 2. ;
584 dpufp[2] = fGeom->GetTextolitBoxSize(2) /2.0 ;
d15a28e7 585
92862013 586 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
d15a28e7 587
92862013 588 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetSecondUpperPlateThickness() ) / 2.0 ;
d15a28e7 589
92862013 590 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 591
592 // ---
593 // --- Define air-filled box, place inside PTXW ---
594 // --- Inner AIR volume dimensions ---
fe4da5cc 595
d15a28e7 596
92862013 597 Float_t dpair[3] ;
598 dpair[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
599 dpair[1] = fGeom->GetAirFilledBoxSize(1) / 2.0 ;
600 dpair[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 601
92862013 602 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
d15a28e7 603
92862013 604 yO = ( fGeom->GetTextolitBoxSize(1) - fGeom->GetAirFilledBoxSize(1) ) / 2.0 - fGeom->GetSecondUpperPlateThickness() ;
d15a28e7 605
92862013 606 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 607
608// --- Dimensions of PbWO4 crystal ---
609
92862013 610 Float_t xtlX = fGeom->GetCrystalSize(0) ;
611 Float_t xtlY = fGeom->GetCrystalSize(1) ;
612 Float_t xtlZ = fGeom->GetCrystalSize(2) ;
d15a28e7 613
92862013 614 Float_t dptcb[3] ;
615 dptcb[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
616 dptcb[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0
d15a28e7 617 + fGeom->GetModuleBoxThickness() / 2.0 ;
92862013 618 dptcb[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 + fGeom->GetModuleBoxThickness() ;
d15a28e7 619
92862013 620 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
d15a28e7 621
92862013 622 yO = fGeom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
d15a28e7 623 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
624 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() ) ;
625
92862013 626 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 627
628 // ---
629 // --- Define Crystal BLock filled with air, position it inside PTCB ---
92862013 630 Float_t dpcbl[3] ;
d15a28e7 631
92862013 632 dpcbl[0] = fGeom->GetNPhi() * ( xtlX + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
633 dpcbl[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
634 dpcbl[2] = fGeom->GetNZ() * ( xtlZ + 2 * fGeom->GetGapBetweenCrystals() ) / 2.0 ;
d15a28e7 635
92862013 636 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
d15a28e7 637
638 // --- Divide PCBL in X (phi) and Z directions --
639 gMC->Gsdvn("PROW", "PCBL", Int_t (fGeom->GetNPhi()), 1) ;
640 gMC->Gsdvn("PCEL", "PROW", Int_t (fGeom->GetNZ()), 3) ;
641
92862013 642 yO = -fGeom->GetModuleBoxThickness() / 2.0 ;
d15a28e7 643
92862013 644 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 645
646 // ---
647 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
92862013 648 Float_t dpstc[3] ;
d15a28e7 649
92862013 650 dpstc[0] = ( xtlX + 2 * fGeom->GetCrystalWrapThickness() ) / 2.0 ;
651 dpstc[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
652 dpstc[2] = ( xtlZ + 2 * fGeom->GetCrystalWrapThickness() + 2 * fGeom->GetCrystalHolderThickness() ) / 2.0 ;
d15a28e7 653
92862013 654 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
d15a28e7 655
656 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
657
658 // ---
659 // --- Define Tyvek volume, place inside PSTC ---
92862013 660 Float_t dppap[3] ;
d15a28e7 661
92862013 662 dppap[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
663 dppap[1] = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
664 dppap[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
d15a28e7 665
92862013 666 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
d15a28e7 667
92862013 668 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0
669 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() + fGeom->GetCrystalHolderThickness() ) / 2.0 ;
d15a28e7 670
92862013 671 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 672
673 // ---
674 // --- Define PbWO4 crystal volume, place inside PPAP ---
92862013 675 Float_t dpxtl[3] ;
d15a28e7 676
92862013 677 dpxtl[0] = xtlX / 2.0 ;
678 dpxtl[1] = xtlY / 2.0 ;
679 dpxtl[2] = xtlZ / 2.0 ;
d15a28e7 680
92862013 681 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
d15a28e7 682
92862013 683 yO = ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - fGeom->GetCrystalWrapThickness() ;
d15a28e7 684
92862013 685 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 686
687 // ---
688 // --- Define crystal support volume, place inside PPAP ---
92862013 689 Float_t dpsup[3] ;
d15a28e7 690
92862013 691 dpsup[0] = xtlX / 2.0 + fGeom->GetCrystalWrapThickness() ;
692 dpsup[1] = fGeom->GetCrystalSupportHeight() / 2.0 ;
693 dpsup[2] = xtlZ / 2.0 + fGeom->GetCrystalWrapThickness() ;
d15a28e7 694
92862013 695 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
d15a28e7 696
92862013 697 yO = fGeom->GetCrystalSupportHeight() / 2.0 - ( xtlY + fGeom->GetCrystalSupportHeight() + fGeom->GetCrystalWrapThickness() ) / 2.0 ;
d15a28e7 698
92862013 699 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 700
701 // ---
702 // --- Define PIN-diode volume and position it inside crystal support ---
703 // --- right behind PbWO4 crystal
704
705 // --- PIN-diode dimensions ---
706
707
92862013 708 Float_t dppin[3] ;
709 dppin[0] = fGeom->GetPinDiodeSize(0) / 2.0 ;
710 dppin[1] = fGeom->GetPinDiodeSize(1) / 2.0 ;
711 dppin[2] = fGeom->GetPinDiodeSize(2) / 2.0 ;
d15a28e7 712
92862013 713 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
d15a28e7 714
92862013 715 yO = fGeom->GetCrystalSupportHeight() / 2.0 - fGeom->GetPinDiodeSize(1) / 2.0 ;
d15a28e7 716
92862013 717 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 718
719 // ---
720 // --- Define Upper Cooling Panel, place it on top of PTCB ---
92862013 721 Float_t dpucp[3] ;
d15a28e7 722 // --- Upper Cooling Plate thickness ---
723
92862013 724 dpucp[0] = dptcb[0] ;
725 dpucp[1] = fGeom->GetUpperCoolingPlateThickness() ;
726 dpucp[2] = dptcb[2] ;
d15a28e7 727
92862013 728 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
d15a28e7 729
92862013 730 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetUpperCoolingPlateThickness() ) / 2.
d15a28e7 731 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetModuleBoxThickness()
732 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() - fGeom->GetUpperCoolingPlateThickness() ) ;
733
92862013 734 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 735
736 // ---
737 // --- Define Al Support Plate, position it inside PAIR ---
738 // --- right beneath PTCB ---
739 // --- Al Support Plate thickness ---
740
92862013 741 Float_t dpasp[3] ;
742 dpasp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
743 dpasp[1] = fGeom->GetSupportPlateThickness() / 2.0 ;
744 dpasp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 745
92862013 746 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
d15a28e7 747
92862013 748 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetSupportPlateThickness() ) / 2.
d15a28e7 749 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance()
92862013 750 - fGeom->GetUpperPlateThickness() - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
d15a28e7 751
92862013 752 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 753
754 // ---
755 // --- Define Thermo Insulating Plate, position it inside PAIR ---
756 // --- right beneath PASP ---
757 // --- Lower Thermo Insulating Plate thickness ---
758
92862013 759 Float_t dptip[3] ;
760 dptip[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
761 dptip[1] = fGeom->GetLowerThermoPlateThickness() / 2.0 ;
762 dptip[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 763
92862013 764 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
d15a28e7 765
92862013 766 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerThermoPlateThickness() ) / 2.
d15a28e7 767 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
92862013 768 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness() ) ;
d15a28e7 769
92862013 770 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 771
772 // ---
773 // --- Define Textolit Plate, position it inside PAIR ---
774 // --- right beneath PTIP ---
775 // --- Lower Textolit Plate thickness ---
776
92862013 777 Float_t dptxp[3] ;
778 dptxp[0] = fGeom->GetAirFilledBoxSize(0) / 2.0 ;
779 dptxp[1] = fGeom->GetLowerTextolitPlateThickness() / 2.0 ;
780 dptxp[2] = fGeom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 781
92862013 782 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
d15a28e7 783
92862013 784 yO = ( fGeom->GetAirFilledBoxSize(1) - fGeom->GetLowerTextolitPlateThickness() ) / 2.
d15a28e7 785 - ( fGeom->GetIPtoCrystalSurface() - fGeom->GetIPtoOuterCoverDistance() - fGeom->GetUpperPlateThickness()
92862013 786 - fGeom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + fGeom->GetSupportPlateThickness()
d15a28e7 787 + fGeom->GetLowerThermoPlateThickness() ) ;
788
92862013 789 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 790
791}
792
793//____________________________________________________________________________
794void AliPHOSv0::CreateGeometryforPPSD()
fe4da5cc 795{
b2a60966 796 // Create the PHOS-PPSD geometry for GEANT
797
798 //BEGIN_HTML
799 /*
800 <H2>
801 Geant3 geometry tree of PHOS-PPSD in ALICE
802 </H2>
803 <P><CENTER>
804 <IMG Align=BOTTOM ALT="PPSD geant tree" SRC="../images/PPSDinAlice.gif">
805 </CENTER><P>
806 */
807 //END_HTML
808
809 // Get pointer to the array containing media indexes
92862013 810 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 811
92862013 812 // The box containing all ppsd's for one PHOS module filled with air
813 Float_t ppsd[3] ;
814 ppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
815 ppsd[1] = fGeom->GetPPSDBoxSize(1) / 2.0 ;
816 ppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
fe4da5cc 817
92862013 818 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
d15a28e7 819
92862013 820 Float_t yO = fGeom->GetOuterBoxSize(1) / 2.0 ;
d15a28e7 821
92862013 822 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 823
824 // Now we build a micromegas module
825 // The box containing the whole module filled with epoxy (FR4)
826
92862013 827 Float_t mppsd[3] ;
828 mppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
829 mppsd[1] = fGeom->GetPPSDModuleSize(1) / 2.0 ;
830 mppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
d15a28e7 831
92862013 832 gMC->Gsvolu("MPPS", "BOX ", idtmed[708], mppsd, 3) ;
d15a28e7 833
92862013 834 // Inside mppsd :
d15a28e7 835 // 1. The Top Lid made of epoxy (FR4)
836
92862013 837 Float_t tlppsd[3] ;
838 tlppsd[0] = fGeom->GetPPSDModuleSize(0) / 2.0 ;
839 tlppsd[1] = fGeom->GetLidThickness() / 2.0 ;
840 tlppsd[2] = fGeom->GetPPSDModuleSize(2) / 2.0 ;
d15a28e7 841
92862013 842 gMC->Gsvolu("TLPS", "BOX ", idtmed[708], tlppsd, 3) ;
d15a28e7 843
92862013 844 Float_t y0 = ( fGeom->GetMicromegas1Thickness() - fGeom->GetLidThickness() ) / 2. ;
d15a28e7 845
92862013 846 gMC->Gspos("TLPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 847
848 // 2. the upper panel made of composite material
849
92862013 850 Float_t upppsd[3] ;
851 upppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
852 upppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
853 upppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 854
92862013 855 gMC->Gsvolu("UPPS", "BOX ", idtmed[709], upppsd, 3) ;
d15a28e7 856
92862013 857 y0 = y0 - fGeom->GetLidThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 858
92862013 859 gMC->Gspos("UPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 860
861 // 3. the anode made of Copper
862
92862013 863 Float_t anppsd[3] ;
864 anppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
865 anppsd[1] = fGeom->GetAnodeThickness() / 2.0 ;
866 anppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 867
92862013 868 gMC->Gsvolu("ANPS", "BOX ", idtmed[710], anppsd, 3) ;
d15a28e7 869
92862013 870 y0 = y0 - fGeom->GetCompositeThickness() / 2. - fGeom->GetAnodeThickness() / 2. ;
d15a28e7 871
92862013 872 gMC->Gspos("ANPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 873
874 // 4. the conversion gap + avalanche gap filled with gas
875
92862013 876 Float_t ggppsd[3] ;
877 ggppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
878 ggppsd[1] = ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2.0 ;
879 ggppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 880
92862013 881 gMC->Gsvolu("GGPS", "BOX ", idtmed[715], ggppsd, 3) ;
d15a28e7 882
883 // --- Divide GGPP in X (phi) and Z directions --
884 gMC->Gsdvn("GROW", "GGPS", fGeom->GetNumberOfPadsPhi(), 1) ;
885 gMC->Gsdvn("GCEL", "GROW", fGeom->GetNumberOfPadsZ() , 3) ;
886
92862013 887 y0 = y0 - fGeom->GetAnodeThickness() / 2. - ( fGeom->GetConversionGap() + fGeom->GetAvalancheGap() ) / 2. ;
d15a28e7 888
92862013 889 gMC->Gspos("GGPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 890
891
892 // 6. the cathode made of Copper
893
92862013 894 Float_t cappsd[3] ;
895 cappsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
896 cappsd[1] = fGeom->GetCathodeThickness() / 2.0 ;
897 cappsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 898
92862013 899 gMC->Gsvolu("CAPS", "BOX ", idtmed[710], cappsd, 3) ;
d15a28e7 900
92862013 901 y0 = y0 - ( fGeom->GetAvalancheGap() + fGeom->GetAvalancheGap() ) / 2. - fGeom->GetCathodeThickness() / 2. ;
d15a28e7 902
92862013 903 gMC->Gspos("CAPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 904
905 // 7. the printed circuit made of G10
906
92862013 907 Float_t pcppsd[3] ;
908 pcppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2,.0 ;
909 pcppsd[1] = fGeom->GetPCThickness() / 2.0 ;
910 pcppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 911
92862013 912 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
d15a28e7 913
92862013 914 y0 = y0 - fGeom->GetCathodeThickness() / 2. - fGeom->GetPCThickness() / 2. ;
d15a28e7 915
92862013 916 gMC->Gspos("PCPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 917
918 // 8. the lower panel made of composite material
919
92862013 920 Float_t lpppsd[3] ;
921 lpppsd[0] = ( fGeom->GetPPSDModuleSize(0) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
922 lpppsd[1] = fGeom->GetCompositeThickness() / 2.0 ;
923 lpppsd[2] = ( fGeom->GetPPSDModuleSize(2) - fGeom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 924
92862013 925 gMC->Gsvolu("LPPS", "BOX ", idtmed[709], lpppsd, 3) ;
d15a28e7 926
92862013 927 y0 = y0 - fGeom->GetPCThickness() / 2. - fGeom->GetCompositeThickness() / 2. ;
d15a28e7 928
92862013 929 gMC->Gspos("LPPS", 1, "MPPS", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 930
92862013 931 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
d15a28e7 932 // the top and bottom one's (which are assumed identical) :
933
92862013 934 Float_t yt = ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas1Thickness() ) / 2. ;
935 Float_t yb = - ( fGeom->GetPPSDBoxSize(1) - fGeom->GetMicromegas2Thickness() ) / 2. ;
d15a28e7 936
92862013 937 Int_t copyNumbertop = 0 ;
938 Int_t copyNumberbot = fGeom->GetNumberOfModulesPhi() * fGeom->GetNumberOfModulesZ() ;
d15a28e7 939
92862013 940 Float_t x = ( fGeom->GetPPSDBoxSize(0) - fGeom->GetPPSDModuleSize(0) ) / 2. ;
d15a28e7 941
942 for ( Int_t iphi = 1; iphi <= fGeom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
92862013 943 Float_t z = ( fGeom->GetPPSDBoxSize(2) - fGeom->GetPPSDModuleSize(2) ) / 2. ;
d15a28e7 944
945 for ( Int_t iz = 1; iz <= fGeom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
92862013 946 gMC->Gspos("MPPS", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
947 gMC->Gspos("MPPS", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
948 z = z - fGeom->GetPPSDModuleSize(2) ;
d15a28e7 949 } // end of Z module loop
92862013 950 x = x - fGeom->GetPPSDModuleSize(0) ;
d15a28e7 951 } // end of phi module loop
952
953 // The Lead converter between two air gaps
954 // 1. Upper air gap
955
92862013 956 Float_t uappsd[3] ;
957 uappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
958 uappsd[1] = fGeom->GetMicro1ToLeadGap() / 2.0 ;
959 uappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
d15a28e7 960
92862013 961 gMC->Gsvolu("UAPPSD", "BOX ", idtmed[798], uappsd, 3) ;
d15a28e7 962
92862013 963 y0 = ( fGeom->GetPPSDBoxSize(1) - 2 * fGeom->GetMicromegas1Thickness() - fGeom->GetMicro1ToLeadGap() ) / 2. ;
d15a28e7 964
92862013 965 gMC->Gspos("UAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 966
967 // 2. Lead converter
968
92862013 969 Float_t lcppsd[3] ;
970 lcppsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
971 lcppsd[1] = fGeom->GetLeadConverterThickness() / 2.0 ;
972 lcppsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
d15a28e7 973
92862013 974 gMC->Gsvolu("LCPPSD", "BOX ", idtmed[712], lcppsd, 3) ;
d15a28e7 975
92862013 976 y0 = y0 - fGeom->GetMicro1ToLeadGap() / 2. - fGeom->GetLeadConverterThickness() / 2. ;
d15a28e7 977
92862013 978 gMC->Gspos("LCPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 979
980 // 3. Lower air gap
981
92862013 982 Float_t lappsd[3] ;
983 lappsd[0] = fGeom->GetPPSDBoxSize(0) / 2.0 ;
984 lappsd[1] = fGeom->GetLeadToMicro2Gap() / 2.0 ;
985 lappsd[2] = fGeom->GetPPSDBoxSize(2) / 2.0 ;
d15a28e7 986
92862013 987 gMC->Gsvolu("LAPPSD", "BOX ", idtmed[798], lappsd, 3) ;
fe4da5cc 988
92862013 989 y0 = y0 - fGeom->GetLeadConverterThickness() / 2. - fGeom->GetLeadToMicro2Gap() / 2. ;
d15a28e7 990
92862013 991 gMC->Gspos("LAPPSD", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 992
fe4da5cc 993}
994
d15a28e7 995
996//____________________________________________________________________________
997void AliPHOSv0::Init(void)
998{
b2a60966 999 // Just prints an information message
1000
d15a28e7 1001 Int_t i;
1002
1003 printf("\n");
1004 for(i=0;i<35;i++) printf("*");
1005 printf(" PHOS_INIT ");
1006 for(i=0;i<35;i++) printf("*");
1007 printf("\n");
1008
1009 // Here the PHOS initialisation code (if any!)
1010
e04976bd 1011 if (fGeom!=0)
1012 cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << fGeom->GetName() << endl ;
1013 else
1014 cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ;
1015
d15a28e7 1016 for(i=0;i<80;i++) printf("*");
1017 printf("\n");
1018
1019}
1020