SetEventListRange setter added. Events in specified range are listed for
[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
a3dfe79c 21// Layout EMC + CPV has name IHEP
5f20d3fb 22// An object of this class does not produce hits nor digits
23// It is the one to use if you do not want to produce outputs in TREEH or TREED
b2a60966 24//
25//*-- Author: Yves Schutz (SUBATECH)
26
d2cf0e38 27
fe4da5cc 28// --- ROOT system ---
d15a28e7 29
fe4da5cc 30#include "TBRIK.h"
31#include "TNode.h"
0869cea5 32#include "TRandom.h"
94de3818 33#include "TGeometry.h"
fa7cce36 34#include "TFolder.h"
35#include "TROOT.h"
fe4da5cc 36
81e92872 37
d15a28e7 38// --- Standard library ---
39
de9ec31b 40#include <stdio.h>
41#include <string.h>
42#include <stdlib.h>
43#include <strstream.h>
d15a28e7 44
45// --- AliRoot header files ---
46
fe4da5cc 47#include "AliPHOSv0.h"
48#include "AliRun.h"
d15a28e7 49#include "AliConst.h"
94de3818 50#include "AliMC.h"
13add4de 51#include "AliPHOSGeometry.h"
fe4da5cc 52
53ClassImp(AliPHOSv0)
54
d15a28e7 55//____________________________________________________________________________
d15a28e7 56AliPHOSv0::AliPHOSv0(const char *name, const char *title):
57 AliPHOS(name,title)
58{
b2a60966 59 // ctor : title is used to identify the layout
ed4205d8 60 // GPS2 = 5 modules (EMC + PPSD)
61 // IHEP = 5 modules (EMC + CPV)
62 // MIXT = 4 modules (EMC + CPV) and 1 module (EMC + PPSD)
fe4da5cc 63
fa7cce36 64 // create the geometry parameters object
65 // it will posted to a folder
e04976bd 66
67 if (strcmp(GetTitle(),"") != 0 )
fa7cce36 68 fGeom = AliPHOSGeometry::GetInstance(GetTitle(), "") ;
e04976bd 69
d15a28e7 70}
71
72//____________________________________________________________________________
d15a28e7 73void AliPHOSv0::BuildGeometry()
fe4da5cc 74{
b2a60966 75 // Build the PHOS geometry for the ROOT display
76 //BEGIN_HTML
77 /*
78 <H2>
79 PHOS in ALICE displayed by root
80 </H2>
81 <UL>
82 <LI> All Views
83 <P>
84 <CENTER>
85 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
86 </CENTER></P></LI>
87 <LI> Front View
88 <P>
89 <CENTER>
90 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
91 </CENTER></P></LI>
92 <LI> 3D View 1
93 <P>
94 <CENTER>
95 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
96 </CENTER></P></LI>
97 <LI> 3D View 2
98 <P>
99 <CENTER>
100 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
101 </CENTER></P></LI>
102 </UL>
103 */
104 //END_HTML
fa7cce36 105
106 AliPHOSGeometry * geom = GetGeometry() ;
d15a28e7 107
108 this->BuildGeometryforPHOS() ;
fa7cce36 109 if (strcmp(geom->GetName(),"GPS2") == 0)
d15a28e7 110 this->BuildGeometryforPPSD() ;
fa7cce36 111 else if (strcmp(geom->GetName(),"IHEP") == 0)
bacd0b23 112 this->BuildGeometryforCPV() ;
fa7cce36 113 else if (strcmp(geom->GetName(),"MIXT") == 0) {
ed4205d8 114 this->BuildGeometryforPPSD() ;
115 this->BuildGeometryforCPV() ;
116 }
d15a28e7 117 else
ed4205d8 118 cout << "AliPHOSv0::BuildGeometry : no charged particle identification system installed: "
fa7cce36 119 << "Geometry name = " << geom->GetName() << endl;
d15a28e7 120
fe4da5cc 121}
d15a28e7 122
123//____________________________________________________________________________
124void AliPHOSv0:: BuildGeometryforPHOS(void)
125{
b2a60966 126 // Build the PHOS-EMC geometry for the ROOT display
d15a28e7 127
128 const Int_t kColorPHOS = kRed ;
129 const Int_t kColorXTAL = kBlue ;
130
92862013 131 Double_t const kRADDEG = 180.0 / kPI ;
fa7cce36 132
133 AliPHOSGeometry * geom = GetGeometry() ;
134
135 new TBRIK( "OuterBox", "PHOS box", "void", geom->GetOuterBoxSize(0)/2,
136 geom->GetOuterBoxSize(1)/2,
137 geom->GetOuterBoxSize(2)/2 );
d15a28e7 138
139 // Textolit Wall box, position inside PHOS
140
fa7cce36 141 new TBRIK( "TextolitBox", "PHOS Textolit box ", "void", geom->GetTextolitBoxSize(0)/2,
142 geom->GetTextolitBoxSize(1)/2,
143 geom->GetTextolitBoxSize(2)/2);
d15a28e7 144
145 // Polystyrene Foam Plate
146
fa7cce36 147 new TBRIK( "UpperFoamPlate", "PHOS Upper foam plate", "void", geom->GetTextolitBoxSize(0)/2,
148 geom->GetSecondUpperPlateThickness()/2,
149 geom->GetTextolitBoxSize(2)/2 ) ;
d15a28e7 150
151 // Air Filled Box
fe4da5cc 152
fa7cce36 153 new TBRIK( "AirFilledBox", "PHOS air filled box", "void", geom->GetAirFilledBoxSize(0)/2,
154 geom->GetAirFilledBoxSize(1)/2,
155 geom->GetAirFilledBoxSize(2)/2 );
d15a28e7 156
157 // Crystals Box
158
fa7cce36 159 Float_t xtlX = geom->GetCrystalSize(0) ;
160 Float_t xtlY = geom->GetCrystalSize(1) ;
161 Float_t xtlZ = geom->GetCrystalSize(2) ;
d15a28e7 162
fa7cce36 163 Float_t xl = geom->GetNPhi() * ( xtlX + 2 * geom->GetGapBetweenCrystals() ) / 2.0 + geom->GetModuleBoxThickness() ;
164 Float_t yl = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0
165 + geom->GetModuleBoxThickness() / 2.0 ;
166 Float_t zl = geom->GetNZ() * ( xtlZ + 2 * geom->GetGapBetweenCrystals() ) / 2.0 + geom->GetModuleBoxThickness() ;
d15a28e7 167
92862013 168 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", xl, yl, zl ) ;
d15a28e7 169
170// position PHOS into ALICE
171
fa7cce36 172 Float_t r = geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1) / 2.0 ;
d15a28e7 173 Int_t number = 988 ;
fa7cce36 174 Float_t pphi = TMath::ATan( geom->GetOuterBoxSize(0) / ( 2.0 * geom->GetIPtoOuterCoverDistance() ) ) ;
92862013 175 pphi *= kRADDEG ;
176 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
d15a28e7 177
178 char * nodename = new char[20] ;
179 char * rotname = new char[20] ;
180
fa7cce36 181 for( Int_t i = 1; i <= geom->GetNModules(); i++ ) {
182 Float_t angle = pphi * 2 * ( i - geom->GetNModules() / 2.0 - 0.5 ) ;
d15a28e7 183 sprintf(rotname, "%s%d", "rot", number++) ;
184 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
92862013 185 top->cd();
d15a28e7 186 sprintf(nodename,"%s%d", "Module", i) ;
92862013 187 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
188 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
189 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
190 outerboxnode->SetLineColor(kColorPHOS) ;
191 fNodes->Add(outerboxnode) ;
192 outerboxnode->cd() ;
d15a28e7 193 // now inside the outer box the textolit box
fa7cce36 194 y = ( geom->GetOuterBoxThickness(1) - geom->GetUpperPlateThickness() ) / 2. ;
d15a28e7 195 sprintf(nodename,"%s%d", "TexBox", i) ;
92862013 196 TNode * textolitboxnode = new TNode(nodename, nodename, "TextolitBox", 0, y, 0) ;
197 textolitboxnode->SetLineColor(kColorPHOS) ;
198 fNodes->Add(textolitboxnode) ;
d15a28e7 199 // upper foam plate inside outre box
92862013 200 outerboxnode->cd() ;
d15a28e7 201 sprintf(nodename, "%s%d", "UFPlate", i) ;
fa7cce36 202 y = ( geom->GetTextolitBoxSize(1) - geom->GetSecondUpperPlateThickness() ) / 2.0 ;
92862013 203 TNode * upperfoamplatenode = new TNode(nodename, nodename, "UpperFoamPlate", 0, y, 0) ;
204 upperfoamplatenode->SetLineColor(kColorPHOS) ;
205 fNodes->Add(upperfoamplatenode) ;
d15a28e7 206 // air filled box inside textolit box (not drawn)
92862013 207 textolitboxnode->cd();
fa7cce36 208 y = ( geom->GetTextolitBoxSize(1) - geom->GetAirFilledBoxSize(1) ) / 2.0 - geom->GetSecondUpperPlateThickness() ;
d15a28e7 209 sprintf(nodename, "%s%d", "AFBox", i) ;
92862013 210 TNode * airfilledboxnode = new TNode(nodename, nodename, "AirFilledBox", 0, y, 0) ;
211 fNodes->Add(airfilledboxnode) ;
d15a28e7 212 // crystals box inside air filled box
92862013 213 airfilledboxnode->cd() ;
fa7cce36 214 y = geom->GetAirFilledBoxSize(1) / 2.0 - yl
215 - ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetModuleBoxThickness()
216 - geom->GetUpperPlateThickness() - geom->GetSecondUpperPlateThickness() ) ;
d15a28e7 217 sprintf(nodename, "%s%d", "XTBox", i) ;
92862013 218 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, y, 0) ;
219 crystalsboxnode->SetLineColor(kColorXTAL) ;
220 fNodes->Add(crystalsboxnode) ;
d15a28e7 221 }
b27d82c8 222
223 delete[] rotname ;
224 delete[] nodename ;
d15a28e7 225}
226
227//____________________________________________________________________________
228void AliPHOSv0:: BuildGeometryforPPSD(void)
fe4da5cc 229{
b2a60966 230 // Build the PHOS-PPSD geometry for the ROOT display
231 //BEGIN_HTML
232 /*
233 <H2>
234 PPSD displayed by root
235 </H2>
236 <UL>
237 <LI> Zoom on PPSD: Front View
238 <P>
239 <CENTER>
240 <IMG Align=BOTTOM ALT="PPSD Front View" SRC="../images/AliPHOSv0PPSDFrontView.gif">
241 </CENTER></P></LI>
242 <LI> Zoom on PPSD: Perspective View
243 <P>
244 <CENTER>
245 <IMG Align=BOTTOM ALT="PPSD Prespective View" SRC="../images/AliPHOSv0PPSDPerspectiveView.gif">
246 </CENTER></P></LI>
247 </UL>
248 */
249 //END_HTML
92862013 250 Double_t const kRADDEG = 180.0 / kPI ;
d15a28e7 251
252 const Int_t kColorPHOS = kRed ;
253 const Int_t kColorPPSD = kGreen ;
254 const Int_t kColorGas = kBlue ;
255 const Int_t kColorAir = kYellow ;
256
fa7cce36 257 AliPHOSGeometry * geom = GetGeometry() ;
258
d15a28e7 259 // Box for a full PHOS module
260
fa7cce36 261 new TBRIK( "PPSDBox", "PPSD box", "void", geom->GetCPVBoxSize(0)/2,
262 geom->GetCPVBoxSize(1)/2,
263 geom->GetCPVBoxSize(2)/2 );
d15a28e7 264
265 // Box containing one micromegas module
266
fa7cce36 267 new TBRIK( "PPSDModule", "PPSD module", "void", geom->GetPPSDModuleSize(0)/2,
268 geom->GetPPSDModuleSize(1)/2,
269 geom->GetPPSDModuleSize(2)/2 );
d15a28e7 270 // top lid
271
fa7cce36 272 new TBRIK ( "TopLid", "Micromegas top lid", "void", geom->GetPPSDModuleSize(0)/2,
273 geom->GetLidThickness()/2,
274 geom->GetPPSDModuleSize(2)/2 ) ;
d15a28e7 275 // composite panel (top and bottom)
276
fa7cce36 277 new TBRIK ( "TopPanel", "Composite top panel", "void", ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
278 geom->GetCompositeThickness()/2,
279 ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ;
d15a28e7 280
fa7cce36 281 new TBRIK ( "BottomPanel", "Composite bottom panel", "void", ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
282 geom->GetCompositeThickness()/2,
283 ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ;
d15a28e7 284 // gas gap (conversion and avalanche)
285
fa7cce36 286 new TBRIK ( "GasGap", "gas gap", "void", ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
287 ( geom->GetConversionGap() + geom->GetAvalancheGap() )/2,
288 ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ;
d15a28e7 289
290 // anode and cathode
291
fa7cce36 292 new TBRIK ( "Anode", "Anode", "void", ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
293 geom->GetAnodeThickness()/2,
294 ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ;
d15a28e7 295
fa7cce36 296 new TBRIK ( "Cathode", "Cathode", "void", ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
297 geom->GetCathodeThickness()/2,
298 ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ;
d15a28e7 299 // PC
300
fa7cce36 301 new TBRIK ( "PCBoard", "Printed Circuit", "void", ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() )/2,
302 geom->GetPCThickness()/2,
303 ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() )/2 ) ;
d15a28e7 304 // Gap between Lead and top micromegas
305
fa7cce36 306 new TBRIK ( "LeadToM", "Air Gap top", "void", geom->GetCPVBoxSize(0)/2,
307 geom->GetMicro1ToLeadGap()/2,
308 geom->GetCPVBoxSize(2)/2 ) ;
d15a28e7 309
310// Gap between Lead and bottom micromegas
311
fa7cce36 312 new TBRIK ( "MToLead", "Air Gap bottom", "void", geom->GetCPVBoxSize(0)/2,
313 geom->GetLeadToMicro2Gap()/2,
314 geom->GetCPVBoxSize(2)/2 ) ;
d15a28e7 315 // Lead converter
316
fa7cce36 317 new TBRIK ( "Lead", "Lead converter", "void", geom->GetCPVBoxSize(0)/2,
318 geom->GetLeadConverterThickness()/2,
319 geom->GetCPVBoxSize(2)/2 ) ;
d15a28e7 320
321 // position PPSD into ALICE
322
323 char * nodename = new char[20] ;
324 char * rotname = new char[20] ;
325
fa7cce36 326 Float_t r = geom->GetIPtoTopLidDistance() + geom->GetCPVBoxSize(1) / 2.0 ;
d15a28e7 327 Int_t number = 988 ;
92862013 328 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
d15a28e7 329
ed4205d8 330 Int_t firstModule = 0 ;
fa7cce36 331 if (strcmp(geom->GetName(),"GPS2") == 0)
ed4205d8 332 firstModule = 1;
fa7cce36 333 else if (strcmp(geom->GetName(),"MIXT") == 0)
334 firstModule = geom->GetNModules() - geom->GetNPPSDModules() + 1;
ed4205d8 335
fa7cce36 336 for( Int_t i = firstModule; i <= geom->GetNModules(); i++ ) { // the number of PHOS modules
337 Float_t angle = geom->GetPHOSAngle(i) ;
ed4205d8 338 sprintf(rotname, "%s%d", "rotg", number+i) ;
d15a28e7 339 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
92862013 340 top->cd();
d15a28e7 341 sprintf(nodename, "%s%d", "Moduleg", i) ;
92862013 342 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
343 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
344 TNode * ppsdboxnode = new TNode(nodename , nodename ,"PPSDBox", x, y, 0, rotname ) ;
345 ppsdboxnode->SetLineColor(kColorPPSD) ;
346 fNodes->Add(ppsdboxnode) ;
347 ppsdboxnode->cd() ;
d15a28e7 348 // inside the PPSD box:
349 // 1. fNumberOfModulesPhi x fNumberOfModulesZ top micromegas
fa7cce36 350 x = ( geom->GetCPVBoxSize(0) - geom->GetPPSDModuleSize(0) ) / 2. ;
31aa6d6c 351 {
fa7cce36 352 for ( Int_t iphi = 1; iphi <= geom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
353 Float_t z = ( geom->GetCPVBoxSize(2) - geom->GetPPSDModuleSize(2) ) / 2. ;
31aa6d6c 354 TNode * micro1node ;
fa7cce36 355 for ( Int_t iz = 1; iz <= geom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
356 y = ( geom->GetCPVBoxSize(1) - geom->GetMicromegas1Thickness() ) / 2. ;
31aa6d6c 357 sprintf(nodename, "%s%d%d%d", "Mic1", i, iphi, iz) ;
358 micro1node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
359 micro1node->SetLineColor(kColorPPSD) ;
360 fNodes->Add(micro1node) ;
361 // inside top micromegas
362 micro1node->cd() ;
363 // a. top lid
fa7cce36 364 y = ( geom->GetMicromegas1Thickness() - geom->GetLidThickness() ) / 2. ;
31aa6d6c 365 sprintf(nodename, "%s%d%d%d", "Lid", i, iphi, iz) ;
366 TNode * toplidnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
367 toplidnode->SetLineColor(kColorPPSD) ;
368 fNodes->Add(toplidnode) ;
369 // b. composite panel
fa7cce36 370 y = y - geom->GetLidThickness() / 2. - geom->GetCompositeThickness() / 2. ;
31aa6d6c 371 sprintf(nodename, "%s%d%d%d", "CompU", i, iphi, iz) ;
372 TNode * compupnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
373 compupnode->SetLineColor(kColorPPSD) ;
374 fNodes->Add(compupnode) ;
375 // c. anode
fa7cce36 376 y = y - geom->GetCompositeThickness() / 2. - geom->GetAnodeThickness() / 2. ;
31aa6d6c 377 sprintf(nodename, "%s%d%d%d", "Ano", i, iphi, iz) ;
378 TNode * anodenode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
379 anodenode->SetLineColor(kColorPHOS) ;
380 fNodes->Add(anodenode) ;
381 // d. gas
fa7cce36 382 y = y - geom->GetAnodeThickness() / 2. - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. ;
31aa6d6c 383 sprintf(nodename, "%s%d%d%d", "GGap", i, iphi, iz) ;
384 TNode * ggapnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
385 ggapnode->SetLineColor(kColorGas) ;
386 fNodes->Add(ggapnode) ;
d15a28e7 387 // f. cathode
fa7cce36 388 y = y - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. - geom->GetCathodeThickness() / 2. ;
31aa6d6c 389 sprintf(nodename, "%s%d%d%d", "Cathode", i, iphi, iz) ;
390 TNode * cathodenode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
391 cathodenode->SetLineColor(kColorPHOS) ;
392 fNodes->Add(cathodenode) ;
393 // g. printed circuit
fa7cce36 394 y = y - geom->GetCathodeThickness() / 2. - geom->GetPCThickness() / 2. ;
31aa6d6c 395 sprintf(nodename, "%s%d%d%d", "PC", i, iphi, iz) ;
396 TNode * pcnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
397 pcnode->SetLineColor(kColorPPSD) ;
398 fNodes->Add(pcnode) ;
399 // h. composite panel
fa7cce36 400 y = y - geom->GetPCThickness() / 2. - geom->GetCompositeThickness() / 2. ;
31aa6d6c 401 sprintf(nodename, "%s%d%d%d", "CompDown", i, iphi, iz) ;
402 TNode * compdownnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
403 compdownnode->SetLineColor(kColorPPSD) ;
404 fNodes->Add(compdownnode) ;
fa7cce36 405 z = z - geom->GetPPSDModuleSize(2) ;
31aa6d6c 406 ppsdboxnode->cd() ;
407 } // end of Z module loop
fa7cce36 408 x = x - geom->GetPPSDModuleSize(0) ;
92862013 409 ppsdboxnode->cd() ;
31aa6d6c 410 } // end of phi module loop
411 }
d15a28e7 412 // 2. air gap
92862013 413 ppsdboxnode->cd() ;
fa7cce36 414 y = ( geom->GetCPVBoxSize(1) - 2 * geom->GetMicromegas1Thickness() - geom->GetMicro1ToLeadGap() ) / 2. ;
d15a28e7 415 sprintf(nodename, "%s%d", "GapUp", i) ;
92862013 416 TNode * gapupnode = new TNode(nodename, nodename, "LeadToM", 0, y, 0) ;
417 gapupnode->SetLineColor(kColorAir) ;
418 fNodes->Add(gapupnode) ;
d15a28e7 419 // 3. lead converter
fa7cce36 420 y = y - geom->GetMicro1ToLeadGap() / 2. - geom->GetLeadConverterThickness() / 2. ;
d15a28e7 421 sprintf(nodename, "%s%d", "LeadC", i) ;
92862013 422 TNode * leadcnode = new TNode(nodename, nodename, "Lead", 0, y, 0) ;
423 leadcnode->SetLineColor(kColorPPSD) ;
424 fNodes->Add(leadcnode) ;
d15a28e7 425 // 4. air gap
fa7cce36 426 y = y - geom->GetLeadConverterThickness() / 2. - geom->GetLeadToMicro2Gap() / 2. ;
d15a28e7 427 sprintf(nodename, "%s%d", "GapDown", i) ;
92862013 428 TNode * gapdownnode = new TNode(nodename, nodename, "MToLead", 0, y, 0) ;
429 gapdownnode->SetLineColor(kColorAir) ;
430 fNodes->Add(gapdownnode) ;
d15a28e7 431 // 5. fNumberOfModulesPhi x fNumberOfModulesZ bottom micromegas
fa7cce36 432 x = ( geom->GetCPVBoxSize(0) - geom->GetPPSDModuleSize(0) ) / 2. - geom->GetPhiDisplacement() ;
31aa6d6c 433 {
fa7cce36 434 for ( Int_t iphi = 1; iphi <= geom->GetNumberOfModulesPhi(); iphi++ ) {
435 Float_t z = ( geom->GetCPVBoxSize(2) - geom->GetPPSDModuleSize(2) ) / 2. - geom->GetZDisplacement() ;;
31aa6d6c 436 TNode * micro2node ;
fa7cce36 437 for ( Int_t iz = 1; iz <= geom->GetNumberOfModulesZ(); iz++ ) {
438 y = - ( geom->GetCPVBoxSize(1) - geom->GetMicromegas2Thickness() ) / 2. ;
31aa6d6c 439 sprintf(nodename, "%s%d%d%d", "Mic2", i, iphi, iz) ;
440 micro2node = new TNode(nodename, nodename, "PPSDModule", x, y, z) ;
441 micro2node->SetLineColor(kColorPPSD) ;
442 fNodes->Add(micro2node) ;
443 // inside bottom micromegas
444 micro2node->cd() ;
d15a28e7 445 // a. top lid
fa7cce36 446 y = ( geom->GetMicromegas2Thickness() - geom->GetLidThickness() ) / 2. ;
d15a28e7 447 sprintf(nodename, "%s%d", "Lidb", i) ;
92862013 448 TNode * toplidbnode = new TNode(nodename, nodename, "TopLid", 0, y, 0) ;
449 toplidbnode->SetLineColor(kColorPPSD) ;
450 fNodes->Add(toplidbnode) ;
d15a28e7 451 // b. composite panel
fa7cce36 452 y = y - geom->GetLidThickness() / 2. - geom->GetCompositeThickness() / 2. ;
d15a28e7 453 sprintf(nodename, "%s%d", "CompUb", i) ;
92862013 454 TNode * compupbnode = new TNode(nodename, nodename, "TopPanel", 0, y, 0) ;
455 compupbnode->SetLineColor(kColorPPSD) ;
456 fNodes->Add(compupbnode) ;
d15a28e7 457 // c. anode
fa7cce36 458 y = y - geom->GetCompositeThickness() / 2. - geom->GetAnodeThickness() / 2. ;
d15a28e7 459 sprintf(nodename, "%s%d", "Anob", i) ;
92862013 460 TNode * anodebnode = new TNode(nodename, nodename, "Anode", 0, y, 0) ;
461 anodebnode->SetLineColor(kColorPPSD) ;
462 fNodes->Add(anodebnode) ;
d15a28e7 463 // d. conversion gas
fa7cce36 464 y = y - geom->GetAnodeThickness() / 2. - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. ;
d15a28e7 465 sprintf(nodename, "%s%d", "GGapb", i) ;
92862013 466 TNode * ggapbnode = new TNode(nodename, nodename, "GasGap", 0, y, 0) ;
467 ggapbnode->SetLineColor(kColorGas) ;
468 fNodes->Add(ggapbnode) ;
d15a28e7 469 // f. cathode
fa7cce36 470 y = y - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. - geom->GetCathodeThickness() / 2. ;
d15a28e7 471 sprintf(nodename, "%s%d", "Cathodeb", i) ;
92862013 472 TNode * cathodebnode = new TNode(nodename, nodename, "Cathode", 0, y, 0) ;
473 cathodebnode->SetLineColor(kColorPPSD) ;
474 fNodes->Add(cathodebnode) ;
d15a28e7 475 // g. printed circuit
fa7cce36 476 y = y - geom->GetCathodeThickness() / 2. - geom->GetPCThickness() / 2. ;
d15a28e7 477 sprintf(nodename, "%s%d", "PCb", i) ;
92862013 478 TNode * pcbnode = new TNode(nodename, nodename, "PCBoard", 0, y, 0) ;
479 pcbnode->SetLineColor(kColorPPSD) ;
480 fNodes->Add(pcbnode) ;
d15a28e7 481 // h. composite pane
fa7cce36 482 y = y - geom->GetPCThickness() / 2. - geom->GetCompositeThickness() / 2. ;
d15a28e7 483 sprintf(nodename, "%s%d", "CompDownb", i) ;
92862013 484 TNode * compdownbnode = new TNode(nodename, nodename, "BottomPanel", 0, y, 0) ;
485 compdownbnode->SetLineColor(kColorPPSD) ;
486 fNodes->Add(compdownbnode) ;
fa7cce36 487 z = z - geom->GetPPSDModuleSize(2) ;
92862013 488 ppsdboxnode->cd() ;
d15a28e7 489 } // end of Z module loop
fa7cce36 490 x = x - geom->GetPPSDModuleSize(0) ;
92862013 491 ppsdboxnode->cd() ;
31aa6d6c 492 } // end of phi module loop
493 }
494 } // PHOS modules
495
e126816e 496 delete[] rotname ;
497 delete[] nodename ;
31aa6d6c 498
fe4da5cc 499}
500
d15a28e7 501//____________________________________________________________________________
bacd0b23 502void AliPHOSv0:: BuildGeometryforCPV(void)
503{
504 // Build the PHOS-CPV geometry for the ROOT display
505 // Author: Yuri Kharlov 11 September 2000
506 //
507 //BEGIN_HTML
508 /*
509 <H2>
510 CPV displayed by root
511 </H2>
512 <table width=700>
513
514 <tr>
515 <td>CPV perspective view</td>
516 <td>CPV front view </td>
517 </tr>
518
519 <tr>
520 <td> <img height=300 width=290 src="../images/CPVRootPersp.gif"> </td>
521 <td> <img height=300 width=290 src="../images/CPVRootFront.gif"> </td>
522 </tr>
523
524 </table>
525
526 */
527 //END_HTML
528
529 const Double_t kRADDEG = 180.0 / kPI ;
530 const Int_t kColorCPV = kGreen ;
531 const Int_t kColorFrame = kYellow ;
532 const Int_t kColorGassiplex = kRed;
533 const Int_t kColorPCB = kCyan;
534
fa7cce36 535 AliPHOSGeometry * geom = GetGeometry() ;
536
bacd0b23 537 // Box for a full PHOS module
538
fa7cce36 539 new TBRIK ("CPVBox", "CPV box", "void", geom->GetCPVBoxSize(0)/2,
540 geom->GetCPVBoxSize(1)/2,
541 geom->GetCPVBoxSize(2)/2 );
542 new TBRIK ("CPVFrameLR", "CPV frame Left-Right", "void", geom->GetCPVFrameSize(0)/2,
543 geom->GetCPVFrameSize(1)/2,
544 geom->GetCPVBoxSize(2)/2 );
545 new TBRIK ("CPVFrameUD", "CPV frame Up-Down", "void", geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0),
546 geom->GetCPVFrameSize(1)/2,
547 geom->GetCPVFrameSize(2)/2);
548 new TBRIK ("CPVPCB", "CPV PCB", "void", geom->GetCPVActiveSize(0)/2,
549 geom->GetCPVTextoliteThickness()/2,
550 geom->GetCPVActiveSize(1)/2);
551 new TBRIK ("CPVGassiplex", "CPV Gassiplex PCB", "void", geom->GetGassiplexChipSize(0)/2,
552 geom->GetGassiplexChipSize(1)/2,
553 geom->GetGassiplexChipSize(2)/2);
bacd0b23 554
555 // position CPV into ALICE
556
557 char * nodename = new char[25] ;
558 char * rotname = new char[25] ;
559
fa7cce36 560 Float_t r = geom->GetIPtoCPVDistance() + geom->GetCPVBoxSize(1) / 2.0 ;
bacd0b23 561 Int_t number = 988 ;
562 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
ed4205d8 563
564 Int_t lastModule = 0 ;
fa7cce36 565 if (strcmp(geom->GetName(),"IHEP") == 0)
566 lastModule = geom->GetNModules();
567 else if (strcmp(geom->GetName(),"MIXT") == 0)
568 lastModule = geom->GetNModules() - geom->GetNPPSDModules();
ed4205d8 569
570 for( Int_t i = 1; i <= lastModule; i++ ) { // the number of PHOS modules
bacd0b23 571
572 // One CPV module
573
fa7cce36 574 Float_t angle = geom->GetPHOSAngle(i) ;
ed4205d8 575 sprintf(rotname, "%s%d", "rotg", number+i) ;
bacd0b23 576 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
577 top->cd();
578 sprintf(nodename, "%s%d", "CPVModule", i) ;
579 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
580 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
581 Float_t z;
582 TNode * cpvBoxNode = new TNode(nodename , nodename ,"CPVBox", x, y, 0, rotname ) ;
583 cpvBoxNode->SetLineColor(kColorCPV) ;
584 fNodes->Add(cpvBoxNode) ;
585 cpvBoxNode->cd() ;
586
587 // inside each CPV box:
588
589 // Frame around CPV
cd461ab8 590 Int_t j;
591 for (j=0; j<=1; j++) {
bacd0b23 592 sprintf(nodename, "CPVModule%d Frame%d", i, j+1) ;
fa7cce36 593 x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->GetCPVFrameSize(0)) / 2;
bacd0b23 594 TNode * cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameLR", x, 0, 0) ;
595 cpvFrameNode->SetLineColor(kColorFrame) ;
596 fNodes->Add(cpvFrameNode) ;
597
598 sprintf(nodename, "CPVModule%d Frame%d", i, j+3) ;
fa7cce36 599 z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
bacd0b23 600 cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameUD", 0, 0, z) ;
601 cpvFrameNode->SetLineColor(kColorFrame) ;
602 fNodes->Add(cpvFrameNode) ;
603 }
604
605 // 4 printed circuit boards
cd461ab8 606 for (j=0; j<4; j++) {
bacd0b23 607 sprintf(nodename, "CPVModule%d PCB%d", i, j+1) ;
fa7cce36 608 y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(j) + geom->GetCPVTextoliteThickness()/2;
bacd0b23 609 TNode * cpvPCBNode = new TNode(nodename , nodename ,"CPVPCB", 0, y, 0) ;
610 cpvPCBNode->SetLineColor(kColorPCB) ;
611 fNodes->Add(cpvPCBNode) ;
612 }
613
614 // Gassiplex chips
fa7cce36 615 Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
616 Float_t zStep = geom->GetCPVActiveSize(1) / (geom->GetNumberOfCPVChipsZ() + 1);
617 y = geom->GetCPVFrameSize(1)/2 - geom->GetFTPosition(0) +
618 geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
619 for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
620 x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
621 for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
622 z = zStep * (iz+1) - geom->GetCPVActiveSize(1)/2;
bacd0b23 623 sprintf(nodename, "CPVModule%d Chip(%dx%d)", i, ix+1,iz+1) ;
624 TNode * cpvGassiplexNode = new TNode(nodename , nodename ,"CPVGassiplex", x, y, z) ;
625 cpvGassiplexNode->SetLineColor(kColorGassiplex) ;
626 fNodes->Add(cpvGassiplexNode) ;
627 }
628 }
629
630 } // PHOS modules
631
632 delete[] rotname ;
633 delete[] nodename ;
634}
635
636//____________________________________________________________________________
fe4da5cc 637void AliPHOSv0::CreateGeometry()
638{
b2a60966 639 // Create the PHOS geometry for Geant
d15a28e7 640
92862013 641 AliPHOSv0 *phostmp = (AliPHOSv0*)gAlice->GetModule("PHOS") ;
d15a28e7 642
92862013 643 if ( phostmp == NULL ) {
d15a28e7 644
645 fprintf(stderr, "PHOS detector not found!\n") ;
646 return;
fe4da5cc 647
d15a28e7 648 }
fa7cce36 649
650 AliPHOSGeometry * geom = GetGeometry() ;
651
d15a28e7 652 // Get pointer to the array containing media indeces
92862013 653 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 654
ed4205d8 655 // Create a box a PHOS module.
656 // In case of MIXT geometry 2 different boxes are needed
657
92862013 658 Float_t bigbox[3] ;
fa7cce36 659 bigbox[0] = geom->GetOuterBoxSize(0) / 2.0 ;
660 bigbox[1] = ( geom->GetOuterBoxSize(1) + geom->GetCPVBoxSize(1) ) / 2.0 ;
661 bigbox[2] = geom->GetOuterBoxSize(2) / 2.0 ;
d15a28e7 662
ed4205d8 663 gMC->Gsvolu("PHOS", "BOX ", idtmed[798], bigbox, 3) ;
664
fa7cce36 665 if ( strcmp( geom->GetName(),"MIXT") == 0 && geom->GetNPPSDModules() > 0)
ed4205d8 666 gMC->Gsvolu("PHO1", "BOX ", idtmed[798], bigbox, 3) ;
d15a28e7 667
ed4205d8 668 this->CreateGeometryforPHOS() ;
fa7cce36 669 if ( strcmp( geom->GetName(), "GPS2") == 0 )
d15a28e7 670 this->CreateGeometryforPPSD() ;
fa7cce36 671 else if ( strcmp( geom->GetName(), "IHEP") == 0 )
bacd0b23 672 this->CreateGeometryforCPV() ;
fa7cce36 673 else if ( strcmp( geom->GetName(), "MIXT") == 0 ) {
ed4205d8 674 this->CreateGeometryforPPSD() ;
675 this->CreateGeometryforCPV() ;
676 }
d15a28e7 677 else
678 cout << "AliPHOSv0::CreateGeometry : no charged particle identification system installed" << endl;
ed4205d8 679
b73f246d 680 this->CreateGeometryforSupport() ;
d15a28e7 681
682 // --- Position PHOS mdules in ALICE setup ---
683
92862013 684 Int_t idrotm[99] ;
685 Double_t const kRADDEG = 180.0 / kPI ;
d15a28e7 686
ed4205d8 687 Int_t lastModule;
fa7cce36 688 if (strcmp(geom->GetName(),"MIXT") == 0)
689 lastModule = geom->GetNModules() - geom->GetNPPSDModules();
ed4205d8 690 else
fa7cce36 691 lastModule = geom->GetNModules();
ed4205d8 692
693 Int_t i;
694 for( i = 1; i <= lastModule ; i++ ) {
d15a28e7 695
fa7cce36 696 Float_t angle = geom->GetPHOSAngle(i) ;
92862013 697 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
d15a28e7 698
fa7cce36 699 Float_t r = geom->GetIPtoOuterCoverDistance() + ( geom->GetOuterBoxSize(1) + geom->GetCPVBoxSize(1) ) / 2.0 ;
d15a28e7 700
ed4205d8 701 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
92862013 702 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
d15a28e7 703
92862013 704 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
d15a28e7 705
706 } // for GetNModules
707
fa7cce36 708 for( i = lastModule+1; i <= geom->GetNModules(); i++ ) {
ed4205d8 709
fa7cce36 710 Float_t angle = geom->GetPHOSAngle(i) ;
ed4205d8 711 AliMatrix(idrotm[i-1], 90.0, angle, 90.0, 90.0+angle, 0.0, 0.0) ;
712
fa7cce36 713 Float_t r = geom->GetIPtoOuterCoverDistance() + ( geom->GetOuterBoxSize(1) + geom->GetCPVBoxSize(1) ) / 2.0 ;
ed4205d8 714
715 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
716 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
717
718 gMC->Gspos("PHO1", i-lastModule, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
719
720 } // for GetNModules
721
fe4da5cc 722}
d15a28e7 723
724//____________________________________________________________________________
725void AliPHOSv0::CreateGeometryforPHOS()
726{
b2a60966 727 // Create the PHOS-EMC geometry for GEANT
728 //BEGIN_HTML
729 /*
730 <H2>
731 Geant3 geometry tree of PHOS-EMC in ALICE
732 </H2>
733 <P><CENTER>
734 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
735 </CENTER><P>
736 */
737 //END_HTML
738
739 // Get pointer to the array containing media indexes
92862013 740 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 741
fa7cce36 742 AliPHOSGeometry * geom = GetGeometry() ;
743
d15a28e7 744 // ---
745 // --- Define PHOS box volume, fPUFPill with thermo insulating foam ---
746 // --- Foam Thermo Insulating outer cover dimensions ---
92862013 747 // --- Put it in bigbox = PHOS
d15a28e7 748
92862013 749 Float_t dphos[3] ;
fa7cce36 750 dphos[0] = geom->GetOuterBoxSize(0) / 2.0 ;
751 dphos[1] = geom->GetOuterBoxSize(1) / 2.0 ;
752 dphos[2] = geom->GetOuterBoxSize(2) / 2.0 ;
d15a28e7 753
13add4de 754 gMC->Gsvolu("PEMC", "BOX ", idtmed[706], dphos, 3) ;
d15a28e7 755
fa7cce36 756 Float_t yO = - geom->GetCPVBoxSize(1) / 2.0 ;
d15a28e7 757
13add4de 758 gMC->Gspos("PEMC", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
fa7cce36 759 if ( strcmp( geom->GetName(),"MIXT") == 0 && geom->GetNPPSDModules() > 0)
13add4de 760 gMC->Gspos("PEMC", 1, "PHO1", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 761
762 // ---
13add4de 763 // --- Define Textolit Wall box, position inside PEMC ---
d15a28e7 764 // --- Textolit Wall box dimentions ---
765
766
92862013 767 Float_t dptxw[3];
fa7cce36 768 dptxw[0] = geom->GetTextolitBoxSize(0) / 2.0 ;
769 dptxw[1] = geom->GetTextolitBoxSize(1) / 2.0 ;
770 dptxw[2] = geom->GetTextolitBoxSize(2) / 2.0 ;
d15a28e7 771
92862013 772 gMC->Gsvolu("PTXW", "BOX ", idtmed[707], dptxw, 3);
d15a28e7 773
fa7cce36 774 yO = ( geom->GetOuterBoxThickness(1) - geom->GetUpperPlateThickness() ) / 2. ;
d15a28e7 775
13add4de 776 gMC->Gspos("PTXW", 1, "PEMC", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 777
778 // ---
779 // --- Define Upper Polystyrene Foam Plate, place inside PTXW ---
780 // --- immediately below Foam Thermo Insulation Upper plate ---
781
782 // --- Upper Polystyrene Foam plate thickness ---
783
92862013 784 Float_t dpufp[3] ;
fa7cce36 785 dpufp[0] = geom->GetTextolitBoxSize(0) / 2.0 ;
786 dpufp[1] = geom->GetSecondUpperPlateThickness() / 2. ;
787 dpufp[2] = geom->GetTextolitBoxSize(2) /2.0 ;
d15a28e7 788
92862013 789 gMC->Gsvolu("PUFP", "BOX ", idtmed[703], dpufp, 3) ;
d15a28e7 790
fa7cce36 791 yO = ( geom->GetTextolitBoxSize(1) - geom->GetSecondUpperPlateThickness() ) / 2.0 ;
d15a28e7 792
92862013 793 gMC->Gspos("PUFP", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 794
795 // ---
796 // --- Define air-filled box, place inside PTXW ---
797 // --- Inner AIR volume dimensions ---
fe4da5cc 798
d15a28e7 799
92862013 800 Float_t dpair[3] ;
fa7cce36 801 dpair[0] = geom->GetAirFilledBoxSize(0) / 2.0 ;
802 dpair[1] = geom->GetAirFilledBoxSize(1) / 2.0 ;
803 dpair[2] = geom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 804
92862013 805 gMC->Gsvolu("PAIR", "BOX ", idtmed[798], dpair, 3) ;
d15a28e7 806
fa7cce36 807 yO = ( geom->GetTextolitBoxSize(1) - geom->GetAirFilledBoxSize(1) ) / 2.0 - geom->GetSecondUpperPlateThickness() ;
d15a28e7 808
92862013 809 gMC->Gspos("PAIR", 1, "PTXW", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 810
811// --- Dimensions of PbWO4 crystal ---
812
fa7cce36 813 Float_t xtlX = geom->GetCrystalSize(0) ;
814 Float_t xtlY = geom->GetCrystalSize(1) ;
815 Float_t xtlZ = geom->GetCrystalSize(2) ;
d15a28e7 816
92862013 817 Float_t dptcb[3] ;
fa7cce36 818 dptcb[0] = geom->GetNPhi() * ( xtlX + 2 * geom->GetGapBetweenCrystals() ) / 2.0 + geom->GetModuleBoxThickness() ;
819 dptcb[1] = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0
820 + geom->GetModuleBoxThickness() / 2.0 ;
821 dptcb[2] = geom->GetNZ() * ( xtlZ + 2 * geom->GetGapBetweenCrystals() ) / 2.0 + geom->GetModuleBoxThickness() ;
d15a28e7 822
92862013 823 gMC->Gsvolu("PTCB", "BOX ", idtmed[706], dptcb, 3) ;
d15a28e7 824
fa7cce36 825 yO = geom->GetAirFilledBoxSize(1) / 2.0 - dptcb[1]
826 - ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetModuleBoxThickness()
827 - geom->GetUpperPlateThickness() - geom->GetSecondUpperPlateThickness() ) ;
d15a28e7 828
92862013 829 gMC->Gspos("PTCB", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 830
831 // ---
832 // --- Define Crystal BLock filled with air, position it inside PTCB ---
92862013 833 Float_t dpcbl[3] ;
d15a28e7 834
fa7cce36 835 dpcbl[0] = geom->GetNPhi() * ( xtlX + 2 * geom->GetGapBetweenCrystals() ) / 2.0 ;
836 dpcbl[1] = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0 ;
837 dpcbl[2] = geom->GetNZ() * ( xtlZ + 2 * geom->GetGapBetweenCrystals() ) / 2.0 ;
d15a28e7 838
92862013 839 gMC->Gsvolu("PCBL", "BOX ", idtmed[798], dpcbl, 3) ;
d15a28e7 840
841 // --- Divide PCBL in X (phi) and Z directions --
fa7cce36 842 gMC->Gsdvn("PROW", "PCBL", Int_t (geom->GetNPhi()), 1) ;
843 gMC->Gsdvn("PCEL", "PROW", Int_t (geom->GetNZ()), 3) ;
d15a28e7 844
fa7cce36 845 yO = -geom->GetModuleBoxThickness() / 2.0 ;
d15a28e7 846
92862013 847 gMC->Gspos("PCBL", 1, "PTCB", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 848
849 // ---
850 // --- Define STeel (actually, it's titanium) Cover volume, place inside PCEL
92862013 851 Float_t dpstc[3] ;
d15a28e7 852
fa7cce36 853 dpstc[0] = ( xtlX + 2 * geom->GetCrystalWrapThickness() ) / 2.0 ;
854 dpstc[1] = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0 ;
855 dpstc[2] = ( xtlZ + 2 * geom->GetCrystalWrapThickness() + 2 * geom->GetCrystalHolderThickness() ) / 2.0 ;
d15a28e7 856
92862013 857 gMC->Gsvolu("PSTC", "BOX ", idtmed[704], dpstc, 3) ;
d15a28e7 858
859 gMC->Gspos("PSTC", 1, "PCEL", 0.0, 0.0, 0.0, 0, "ONLY") ;
860
861 // ---
862 // --- Define Tyvek volume, place inside PSTC ---
92862013 863 Float_t dppap[3] ;
d15a28e7 864
fa7cce36 865 dppap[0] = xtlX / 2.0 + geom->GetCrystalWrapThickness() ;
866 dppap[1] = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() ) / 2.0 ;
867 dppap[2] = xtlZ / 2.0 + geom->GetCrystalWrapThickness() ;
d15a28e7 868
92862013 869 gMC->Gsvolu("PPAP", "BOX ", idtmed[702], dppap, 3) ;
d15a28e7 870
fa7cce36 871 yO = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() ) / 2.0
872 - ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() + geom->GetCrystalHolderThickness() ) / 2.0 ;
d15a28e7 873
92862013 874 gMC->Gspos("PPAP", 1, "PSTC", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 875
876 // ---
877 // --- Define PbWO4 crystal volume, place inside PPAP ---
92862013 878 Float_t dpxtl[3] ;
d15a28e7 879
92862013 880 dpxtl[0] = xtlX / 2.0 ;
881 dpxtl[1] = xtlY / 2.0 ;
882 dpxtl[2] = xtlZ / 2.0 ;
d15a28e7 883
92862013 884 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], dpxtl, 3) ;
d15a28e7 885
fa7cce36 886 yO = ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() ) / 2.0 - xtlY / 2.0 - geom->GetCrystalWrapThickness() ;
d15a28e7 887
92862013 888 gMC->Gspos("PXTL", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 889
890 // ---
891 // --- Define crystal support volume, place inside PPAP ---
92862013 892 Float_t dpsup[3] ;
d15a28e7 893
fa7cce36 894 dpsup[0] = xtlX / 2.0 + geom->GetCrystalWrapThickness() ;
895 dpsup[1] = geom->GetCrystalSupportHeight() / 2.0 ;
896 dpsup[2] = xtlZ / 2.0 + geom->GetCrystalWrapThickness() ;
d15a28e7 897
92862013 898 gMC->Gsvolu("PSUP", "BOX ", idtmed[798], dpsup, 3) ;
d15a28e7 899
fa7cce36 900 yO = geom->GetCrystalSupportHeight() / 2.0 - ( xtlY + geom->GetCrystalSupportHeight() + geom->GetCrystalWrapThickness() ) / 2.0 ;
d15a28e7 901
92862013 902 gMC->Gspos("PSUP", 1, "PPAP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 903
904 // ---
905 // --- Define PIN-diode volume and position it inside crystal support ---
906 // --- right behind PbWO4 crystal
907
908 // --- PIN-diode dimensions ---
909
910
92862013 911 Float_t dppin[3] ;
fa7cce36 912 dppin[0] = geom->GetPinDiodeSize(0) / 2.0 ;
913 dppin[1] = geom->GetPinDiodeSize(1) / 2.0 ;
914 dppin[2] = geom->GetPinDiodeSize(2) / 2.0 ;
d15a28e7 915
92862013 916 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], dppin, 3) ;
d15a28e7 917
fa7cce36 918 yO = geom->GetCrystalSupportHeight() / 2.0 - geom->GetPinDiodeSize(1) / 2.0 ;
d15a28e7 919
92862013 920 gMC->Gspos("PPIN", 1, "PSUP", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 921
922 // ---
923 // --- Define Upper Cooling Panel, place it on top of PTCB ---
92862013 924 Float_t dpucp[3] ;
d15a28e7 925 // --- Upper Cooling Plate thickness ---
926
92862013 927 dpucp[0] = dptcb[0] ;
fa7cce36 928 dpucp[1] = geom->GetUpperCoolingPlateThickness() ;
92862013 929 dpucp[2] = dptcb[2] ;
d15a28e7 930
92862013 931 gMC->Gsvolu("PUCP", "BOX ", idtmed[701], dpucp,3) ;
d15a28e7 932
fa7cce36 933 yO = geom->GetAirFilledBoxSize(1) / 2.
934 -( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetModuleBoxThickness()
935 -geom->GetUpperPlateThickness() - geom->GetSecondUpperPlateThickness() - geom->GetUpperCoolingPlateThickness() ) ;
d15a28e7 936
92862013 937 gMC->Gspos("PUCP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 938
939 // ---
940 // --- Define Al Support Plate, position it inside PAIR ---
941 // --- right beneath PTCB ---
942 // --- Al Support Plate thickness ---
943
92862013 944 Float_t dpasp[3] ;
fa7cce36 945 dpasp[0] = geom->GetAirFilledBoxSize(0) / 2.0 ;
946 dpasp[1] = geom->GetSupportPlateThickness() / 2.0 ;
947 dpasp[2] = geom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 948
92862013 949 gMC->Gsvolu("PASP", "BOX ", idtmed[701], dpasp, 3) ;
d15a28e7 950
fa7cce36 951 yO = ( geom->GetAirFilledBoxSize(1) - geom->GetSupportPlateThickness() ) / 2.
952 - ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance()
953 - geom->GetUpperPlateThickness() - geom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 ) ;
d15a28e7 954
92862013 955 gMC->Gspos("PASP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 956
957 // ---
958 // --- Define Thermo Insulating Plate, position it inside PAIR ---
959 // --- right beneath PASP ---
960 // --- Lower Thermo Insulating Plate thickness ---
961
92862013 962 Float_t dptip[3] ;
fa7cce36 963 dptip[0] = geom->GetAirFilledBoxSize(0) / 2.0 ;
964 dptip[1] = geom->GetLowerThermoPlateThickness() / 2.0 ;
965 dptip[2] = geom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 966
92862013 967 gMC->Gsvolu("PTIP", "BOX ", idtmed[706], dptip, 3) ;
d15a28e7 968
fa7cce36 969 yO = ( geom->GetAirFilledBoxSize(1) - geom->GetLowerThermoPlateThickness() ) / 2.
970 - ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetUpperPlateThickness()
971 - geom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + geom->GetSupportPlateThickness() ) ;
d15a28e7 972
92862013 973 gMC->Gspos("PTIP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 974
975 // ---
976 // --- Define Textolit Plate, position it inside PAIR ---
977 // --- right beneath PTIP ---
978 // --- Lower Textolit Plate thickness ---
979
92862013 980 Float_t dptxp[3] ;
fa7cce36 981 dptxp[0] = geom->GetAirFilledBoxSize(0) / 2.0 ;
982 dptxp[1] = geom->GetLowerTextolitPlateThickness() / 2.0 ;
983 dptxp[2] = geom->GetAirFilledBoxSize(2) / 2.0 ;
d15a28e7 984
92862013 985 gMC->Gsvolu("PTXP", "BOX ", idtmed[707], dptxp, 3) ;
d15a28e7 986
fa7cce36 987 yO = ( geom->GetAirFilledBoxSize(1) - geom->GetLowerTextolitPlateThickness() ) / 2.
988 - ( geom->GetIPtoCrystalSurface() - geom->GetIPtoOuterCoverDistance() - geom->GetUpperPlateThickness()
989 - geom->GetSecondUpperPlateThickness() + dpcbl[1] * 2 + geom->GetSupportPlateThickness()
990 + geom->GetLowerThermoPlateThickness() ) ;
d15a28e7 991
92862013 992 gMC->Gspos("PTXP", 1, "PAIR", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 993
994}
995
996//____________________________________________________________________________
997void AliPHOSv0::CreateGeometryforPPSD()
fe4da5cc 998{
b2a60966 999 // Create the PHOS-PPSD geometry for GEANT
b2a60966 1000 //BEGIN_HTML
1001 /*
1002 <H2>
1003 Geant3 geometry tree of PHOS-PPSD in ALICE
1004 </H2>
1005 <P><CENTER>
1006 <IMG Align=BOTTOM ALT="PPSD geant tree" SRC="../images/PPSDinAlice.gif">
1007 </CENTER><P>
1008 */
1009 //END_HTML
1010
1011 // Get pointer to the array containing media indexes
92862013 1012 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
fa7cce36 1013
1014 AliPHOSGeometry * geom = GetGeometry() ;
1015
92862013 1016 // The box containing all ppsd's for one PHOS module filled with air
1017 Float_t ppsd[3] ;
fa7cce36 1018 ppsd[0] = geom->GetCPVBoxSize(0) / 2.0 ;
1019 ppsd[1] = geom->GetCPVBoxSize(1) / 2.0 ;
1020 ppsd[2] = geom->GetCPVBoxSize(2) / 2.0 ;
fe4da5cc 1021
92862013 1022 gMC->Gsvolu("PPSD", "BOX ", idtmed[798], ppsd, 3) ;
d15a28e7 1023
fa7cce36 1024 Float_t yO = geom->GetOuterBoxSize(1) / 2.0 ;
d15a28e7 1025
fa7cce36 1026 if ( strcmp( geom->GetName(),"MIXT") == 0 && geom->GetNPPSDModules() > 0)
ed4205d8 1027 gMC->Gspos("PPSD", 1, "PHO1", 0.0, yO, 0.0, 0, "ONLY") ;
1028 else
1029 gMC->Gspos("PPSD", 1, "PHOS", 0.0, yO, 0.0, 0, "ONLY") ;
d15a28e7 1030
1031 // Now we build a micromegas module
1032 // The box containing the whole module filled with epoxy (FR4)
1033
92862013 1034 Float_t mppsd[3] ;
fa7cce36 1035 mppsd[0] = geom->GetPPSDModuleSize(0) / 2.0 ;
1036 mppsd[1] = geom->GetPPSDModuleSize(1) / 2.0 ;
1037 mppsd[2] = geom->GetPPSDModuleSize(2) / 2.0 ;
d15a28e7 1038
13add4de 1039 gMC->Gsvolu("PMPP", "BOX ", idtmed[708], mppsd, 3) ;
d15a28e7 1040
92862013 1041 // Inside mppsd :
d15a28e7 1042 // 1. The Top Lid made of epoxy (FR4)
1043
92862013 1044 Float_t tlppsd[3] ;
fa7cce36 1045 tlppsd[0] = geom->GetPPSDModuleSize(0) / 2.0 ;
1046 tlppsd[1] = geom->GetLidThickness() / 2.0 ;
1047 tlppsd[2] = geom->GetPPSDModuleSize(2) / 2.0 ;
d15a28e7 1048
13add4de 1049 gMC->Gsvolu("PTLP", "BOX ", idtmed[708], tlppsd, 3) ;
d15a28e7 1050
fa7cce36 1051 Float_t y0 = ( geom->GetMicromegas1Thickness() - geom->GetLidThickness() ) / 2. ;
d15a28e7 1052
13add4de 1053 gMC->Gspos("PTLP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1054
1055 // 2. the upper panel made of composite material
1056
92862013 1057 Float_t upppsd[3] ;
fa7cce36 1058 upppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ;
1059 upppsd[1] = geom->GetCompositeThickness() / 2.0 ;
1060 upppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1061
13add4de 1062 gMC->Gsvolu("PUPP", "BOX ", idtmed[709], upppsd, 3) ;
d15a28e7 1063
fa7cce36 1064 y0 = y0 - geom->GetLidThickness() / 2. - geom->GetCompositeThickness() / 2. ;
d15a28e7 1065
13add4de 1066 gMC->Gspos("PUPP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1067
1068 // 3. the anode made of Copper
1069
92862013 1070 Float_t anppsd[3] ;
fa7cce36 1071 anppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ;
1072 anppsd[1] = geom->GetAnodeThickness() / 2.0 ;
1073 anppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1074
13add4de 1075 gMC->Gsvolu("PANP", "BOX ", idtmed[710], anppsd, 3) ;
d15a28e7 1076
fa7cce36 1077 y0 = y0 - geom->GetCompositeThickness() / 2. - geom->GetAnodeThickness() / 2. ;
d15a28e7 1078
13add4de 1079 gMC->Gspos("PANP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1080
1081 // 4. the conversion gap + avalanche gap filled with gas
1082
92862013 1083 Float_t ggppsd[3] ;
fa7cce36 1084 ggppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ;
1085 ggppsd[1] = ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2.0 ;
1086 ggppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1087
13add4de 1088 gMC->Gsvolu("PGGP", "BOX ", idtmed[715], ggppsd, 3) ;
d15a28e7 1089
1090 // --- Divide GGPP in X (phi) and Z directions --
fa7cce36 1091 gMC->Gsdvn("PPRO", "PGGP", geom->GetNumberOfPadsPhi(), 1) ;
1092 gMC->Gsdvn("PPCE", "PPRO", geom->GetNumberOfPadsZ() , 3) ;
d15a28e7 1093
fa7cce36 1094 y0 = y0 - geom->GetAnodeThickness() / 2. - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. ;
d15a28e7 1095
13add4de 1096 gMC->Gspos("PGGP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1097
1098
1099 // 6. the cathode made of Copper
1100
92862013 1101 Float_t cappsd[3] ;
fa7cce36 1102 cappsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ;
1103 cappsd[1] = geom->GetCathodeThickness() / 2.0 ;
1104 cappsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1105
13add4de 1106 gMC->Gsvolu("PCAP", "BOX ", idtmed[710], cappsd, 3) ;
d15a28e7 1107
fa7cce36 1108 y0 = y0 - ( geom->GetConversionGap() + geom->GetAvalancheGap() ) / 2. - geom->GetCathodeThickness() / 2. ;
d15a28e7 1109
13add4de 1110 gMC->Gspos("PCAP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1111
1112 // 7. the printed circuit made of G10
1113
92862013 1114 Float_t pcppsd[3] ;
fa7cce36 1115 pcppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2,.0 ;
1116 pcppsd[1] = geom->GetPCThickness() / 2.0 ;
1117 pcppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1118
92862013 1119 gMC->Gsvolu("PCPS", "BOX ", idtmed[711], cappsd, 3) ;
d15a28e7 1120
fa7cce36 1121 y0 = y0 - geom->GetCathodeThickness() / 2. - geom->GetPCThickness() / 2. ;
d15a28e7 1122
13add4de 1123 gMC->Gspos("PCPS", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1124
1125 // 8. the lower panel made of composite material
1126
92862013 1127 Float_t lpppsd[3] ;
fa7cce36 1128 lpppsd[0] = ( geom->GetPPSDModuleSize(0) - geom->GetMicromegasWallThickness() ) / 2.0 ;
1129 lpppsd[1] = geom->GetCompositeThickness() / 2.0 ;
1130 lpppsd[2] = ( geom->GetPPSDModuleSize(2) - geom->GetMicromegasWallThickness() ) / 2.0 ;
d15a28e7 1131
13add4de 1132 gMC->Gsvolu("PLPP", "BOX ", idtmed[709], lpppsd, 3) ;
d15a28e7 1133
fa7cce36 1134 y0 = y0 - geom->GetPCThickness() / 2. - geom->GetCompositeThickness() / 2. ;
d15a28e7 1135
13add4de 1136 gMC->Gspos("PLPP", 1, "PMPP", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1137
92862013 1138 // Position the fNumberOfModulesPhi x fNumberOfModulesZ modules (mppsd) inside PPSD to cover a PHOS module
d15a28e7 1139 // the top and bottom one's (which are assumed identical) :
1140
fa7cce36 1141 Float_t yt = ( geom->GetCPVBoxSize(1) - geom->GetMicromegas1Thickness() ) / 2. ;
1142 Float_t yb = - ( geom->GetCPVBoxSize(1) - geom->GetMicromegas2Thickness() ) / 2. ;
d15a28e7 1143
92862013 1144 Int_t copyNumbertop = 0 ;
fa7cce36 1145 Int_t copyNumberbot = geom->GetNumberOfModulesPhi() * geom->GetNumberOfModulesZ() ;
d15a28e7 1146
fa7cce36 1147 Float_t x = ( geom->GetCPVBoxSize(0) - geom->GetPPSDModuleSize(0) ) / 2. ;
d15a28e7 1148
fa7cce36 1149 for ( Int_t iphi = 1; iphi <= geom->GetNumberOfModulesPhi(); iphi++ ) { // the number of micromegas modules in phi per PHOS module
1150 Float_t z = ( geom->GetCPVBoxSize(2) - geom->GetPPSDModuleSize(2) ) / 2. ;
d15a28e7 1151
fa7cce36 1152 for ( Int_t iz = 1; iz <= geom->GetNumberOfModulesZ(); iz++ ) { // the number of micromegas modules in z per PHOS module
13add4de 1153 gMC->Gspos("PMPP", ++copyNumbertop, "PPSD", x, yt, z, 0, "ONLY") ;
1154 gMC->Gspos("PMPP", ++copyNumberbot, "PPSD", x, yb, z, 0, "ONLY") ;
fa7cce36 1155 z = z - geom->GetPPSDModuleSize(2) ;
d15a28e7 1156 } // end of Z module loop
fa7cce36 1157 x = x - geom->GetPPSDModuleSize(0) ;
d15a28e7 1158 } // end of phi module loop
1159
1160 // The Lead converter between two air gaps
1161 // 1. Upper air gap
1162
92862013 1163 Float_t uappsd[3] ;
fa7cce36 1164 uappsd[0] = geom->GetCPVBoxSize(0) / 2.0 ;
1165 uappsd[1] = geom->GetMicro1ToLeadGap() / 2.0 ;
1166 uappsd[2] = geom->GetCPVBoxSize(2) / 2.0 ;
d15a28e7 1167
13add4de 1168 gMC->Gsvolu("PUAPPS", "BOX ", idtmed[798], uappsd, 3) ;
d15a28e7 1169
fa7cce36 1170 y0 = ( geom->GetCPVBoxSize(1) - 2 * geom->GetMicromegas1Thickness() - geom->GetMicro1ToLeadGap() ) / 2. ;
d15a28e7 1171
13add4de 1172 gMC->Gspos("PUAPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1173
1174 // 2. Lead converter
1175
92862013 1176 Float_t lcppsd[3] ;
fa7cce36 1177 lcppsd[0] = geom->GetCPVBoxSize(0) / 2.0 ;
1178 lcppsd[1] = geom->GetLeadConverterThickness() / 2.0 ;
1179 lcppsd[2] = geom->GetCPVBoxSize(2) / 2.0 ;
d15a28e7 1180
13add4de 1181 gMC->Gsvolu("PLCPPS", "BOX ", idtmed[712], lcppsd, 3) ;
d15a28e7 1182
fa7cce36 1183 y0 = y0 - geom->GetMicro1ToLeadGap() / 2. - geom->GetLeadConverterThickness() / 2. ;
d15a28e7 1184
13add4de 1185 gMC->Gspos("PLCPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1186
1187 // 3. Lower air gap
1188
92862013 1189 Float_t lappsd[3] ;
fa7cce36 1190 lappsd[0] = geom->GetCPVBoxSize(0) / 2.0 ;
1191 lappsd[1] = geom->GetLeadToMicro2Gap() / 2.0 ;
1192 lappsd[2] = geom->GetCPVBoxSize(2) / 2.0 ;
d15a28e7 1193
13add4de 1194 gMC->Gsvolu("PLAPPS", "BOX ", idtmed[798], lappsd, 3) ;
fe4da5cc 1195
fa7cce36 1196 y0 = y0 - geom->GetLeadConverterThickness() / 2. - geom->GetLeadToMicro2Gap() / 2. ;
d15a28e7 1197
13add4de 1198 gMC->Gspos("PLAPPS", 1, "PPSD", 0.0, y0, 0.0, 0, "ONLY") ;
d15a28e7 1199
fe4da5cc 1200}
1201
d15a28e7 1202
1203//____________________________________________________________________________
bacd0b23 1204void AliPHOSv0::CreateGeometryforCPV()
1205{
1206 // Create the PHOS-CPV geometry for GEANT
1207 // Author: Yuri Kharlov 11 September 2000
bacd0b23 1208 //BEGIN_HTML
1209 /*
1210 <H2>
1211 Geant3 geometry of PHOS-CPV in ALICE
1212 </H2>
1213 <table width=700>
1214
1215 <tr>
1216 <td>CPV perspective view</td>
1217 <td>CPV front view </td>
1218 </tr>
1219
1220 <tr>
1221 <td> <img height=300 width=290 src="../images/CPVallPersp.gif"> </td>
1222 <td> <img height=300 width=290 src="../images/CPVallFront.gif"> </td>
1223 </tr>
1224
1225 <tr>
1226 <td>One CPV module, perspective view </td>
1227 <td>One CPV module, front view (extended in vertical direction) </td>
1228 </tr>
1229
1230 <tr>
1231 <td><img height=300 width=290 src="../images/CPVmodulePers.gif"></td>
1232 <td><img height=300 width=290 src="../images/CPVmoduleSide.gif"></td>
1233 </tr>
1234
1235 </table>
1236
1237 <H2>
1238 Geant3 geometry tree of PHOS-CPV in ALICE
1239 </H2>
1240 <center>
1241 <img height=300 width=290 src="../images/CPVtree.gif">
1242 </center>
1243 */
1244 //END_HTML
1245
1246 Float_t par[3], x,y,z;
1247
1248 // Get pointer to the array containing media indexes
1249 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
fa7cce36 1250
1251 AliPHOSGeometry * geom = GetGeometry() ;
1252
bacd0b23 1253 // The box containing all CPV for one PHOS module filled with air
fa7cce36 1254 par[0] = geom->GetCPVBoxSize(0) / 2.0 ;
1255 par[1] = geom->GetCPVBoxSize(1) / 2.0 ;
1256 par[2] = geom->GetCPVBoxSize(2) / 2.0 ;
13add4de 1257 gMC->Gsvolu("PCPV", "BOX ", idtmed[798], par, 3) ;
bacd0b23 1258
fa7cce36 1259 y = geom->GetOuterBoxSize(1) / 2.0 ;
13add4de 1260 gMC->Gspos("PCPV", 1, "PHOS", 0.0, y, 0.0, 0, "ONLY") ;
bacd0b23 1261
1262 // Gassiplex board
1263
fa7cce36 1264 par[0] = geom->GetGassiplexChipSize(0)/2.;
1265 par[1] = geom->GetGassiplexChipSize(1)/2.;
1266 par[2] = geom->GetGassiplexChipSize(2)/2.;
13add4de 1267 gMC->Gsvolu("PCPC","BOX ",idtmed[707],par,3);
bacd0b23 1268
1269 // Cu+Ni foil covers Gassiplex board
1270
fa7cce36 1271 par[1] = geom->GetCPVCuNiFoilThickness()/2;
13add4de 1272 gMC->Gsvolu("PCPD","BOX ",idtmed[710],par,3);
fa7cce36 1273 y = -(geom->GetGassiplexChipSize(1)/2 - par[1]);
13add4de 1274 gMC->Gspos("PCPD",1,"PCPC",0,y,0,0,"ONLY");
bacd0b23 1275
1276 // Position of the chip inside CPV
1277
fa7cce36 1278 Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
1279 Float_t zStep = geom->GetCPVActiveSize(1) / (geom->GetNumberOfCPVChipsZ() + 1);
bacd0b23 1280 Int_t copy = 0;
fa7cce36 1281 y = geom->GetCPVFrameSize(1)/2 - geom->GetFTPosition(0) +
1282 geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
1283 for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
1284 x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
1285 for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
bacd0b23 1286 copy++;
fa7cce36 1287 z = zStep * (iz+1) - geom->GetCPVActiveSize(1)/2;
13add4de 1288 gMC->Gspos("PCPC",copy,"PCPV",x,y,z,0,"ONLY");
bacd0b23 1289 }
1290 }
1291
1292 // Foiled textolite (1 mm of textolite + 50 mkm of Cu + 6 mkm of Ni)
1293
fa7cce36 1294 par[0] = geom->GetCPVActiveSize(0) / 2;
1295 par[1] = geom->GetCPVTextoliteThickness() / 2;
1296 par[2] = geom->GetCPVActiveSize(1) / 2;
13add4de 1297 gMC->Gsvolu("PCPF","BOX ",idtmed[707],par,3);
bacd0b23 1298
1299 // Argon gas volume
1300
fa7cce36 1301 par[1] = (geom->GetFTPosition(2) - geom->GetFTPosition(1) - geom->GetCPVTextoliteThickness()) / 2;
13add4de 1302 gMC->Gsvolu("PCPG","BOX ",idtmed[715],par,3);
bacd0b23 1303
1304 for (Int_t i=0; i<4; i++) {
fa7cce36 1305 y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(i) + geom->GetCPVTextoliteThickness()/2;
13add4de 1306 gMC->Gspos("PCPF",i+1,"PCPV",0,y,0,0,"ONLY");
bacd0b23 1307 if(i==1){
fa7cce36 1308 y-= (geom->GetFTPosition(2) - geom->GetFTPosition(1)) / 2;
13add4de 1309 gMC->Gspos("PCPG",1,"PCPV ",0,y,0,0,"ONLY");
bacd0b23 1310 }
1311 }
1312
1313 // Dummy sensitive plane in the middle of argone gas volume
1314
1315 par[1]=0.001;
13add4de 1316 gMC->Gsvolu("PCPQ","BOX ",idtmed[715],par,3);
1317 gMC->Gspos ("PCPQ",1,"PCPG",0,0,0,0,"ONLY");
bacd0b23 1318
1319 // Cu+Ni foil covers textolite
1320
fa7cce36 1321 par[1] = geom->GetCPVCuNiFoilThickness() / 2;
13add4de 1322 gMC->Gsvolu("PCP1","BOX ",idtmed[710],par,3);
fa7cce36 1323 y = geom->GetCPVTextoliteThickness()/2 - par[1];
13add4de 1324 gMC->Gspos ("PCP1",1,"PCPF",0,y,0,0,"ONLY");
bacd0b23 1325
1326 // Aluminum frame around CPV
1327
fa7cce36 1328 par[0] = geom->GetCPVFrameSize(0)/2;
1329 par[1] = geom->GetCPVFrameSize(1)/2;
1330 par[2] = geom->GetCPVBoxSize(2) /2;
13add4de 1331 gMC->Gsvolu("PCF1","BOX ",idtmed[701],par,3);
bacd0b23 1332
fa7cce36 1333 par[0] = geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0);
1334 par[1] = geom->GetCPVFrameSize(1)/2;
1335 par[2] = geom->GetCPVFrameSize(2)/2;
13add4de 1336 gMC->Gsvolu("PCF2","BOX ",idtmed[701],par,3);
bacd0b23 1337
1338 for (Int_t j=0; j<=1; j++) {
fa7cce36 1339 x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->GetCPVFrameSize(0)) / 2;
13add4de 1340 gMC->Gspos("PCF1",j+1,"PCPV", x,0,0,0,"ONLY");
fa7cce36 1341 z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
13add4de 1342 gMC->Gspos("PCF2",j+1,"PCPV",0, 0,z,0,"ONLY");
bacd0b23 1343 }
1344
1345}
1346
1347
1348//____________________________________________________________________________
6a5795b4 1349void AliPHOSv0::CreateGeometryforSupport()
1350{
1351 // Create the PHOS' support geometry for GEANT
1352 //BEGIN_HTML
1353 /*
1354 <H2>
1355 Geant3 geometry of the PHOS's support
1356 </H2>
1357 <P><CENTER>
1358 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/PHOS_support.gif">
1359 </CENTER><P>
1360 */
1361 //END_HTML
1362
1363 Float_t par[5], x0,y0,z0 ;
1364 Int_t i,j,copy;
1365
1366 // Get pointer to the array containing media indexes
1367 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
1368
fa7cce36 1369 AliPHOSGeometry * geom = GetGeometry() ;
1370
6a5795b4 1371 // --- Dummy box containing two rails on which PHOS support moves
1372 // --- Put these rails to the bottom of the L3 magnet
1373
fa7cce36 1374 par[0] = geom->GetRailRoadSize(0) / 2.0 ;
1375 par[1] = geom->GetRailRoadSize(1) / 2.0 ;
1376 par[2] = geom->GetRailRoadSize(2) / 2.0 ;
6a5795b4 1377 gMC->Gsvolu("PRRD", "BOX ", idtmed[798], par, 3) ;
1378
fa7cce36 1379 y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) / 2.0) ;
6a5795b4 1380 gMC->Gspos("PRRD", 1, "ALIC", 0.0, y0, 0.0, 0, "ONLY") ;
1381
1382 // --- Dummy box containing one rail
1383
fa7cce36 1384 par[0] = geom->GetRailOuterSize(0) / 2.0 ;
1385 par[1] = geom->GetRailOuterSize(1) / 2.0 ;
1386 par[2] = geom->GetRailOuterSize(2) / 2.0 ;
6a5795b4 1387 gMC->Gsvolu("PRAI", "BOX ", idtmed[798], par, 3) ;
1388
1389 for (i=0; i<2; i++) {
fa7cce36 1390 x0 = (2*i-1) * geom->GetDistanceBetwRails() / 2.0 ;
6a5795b4 1391 gMC->Gspos("PRAI", i, "PRRD", x0, 0.0, 0.0, 0, "ONLY") ;
1392 }
1393
1394 // --- Upper and bottom steel parts of the rail
1395
fa7cce36 1396 par[0] = geom->GetRailPart1(0) / 2.0 ;
1397 par[1] = geom->GetRailPart1(1) / 2.0 ;
1398 par[2] = geom->GetRailPart1(2) / 2.0 ;
6a5795b4 1399 gMC->Gsvolu("PRP1", "BOX ", idtmed[716], par, 3) ;
1400
fa7cce36 1401 y0 = - (geom->GetRailOuterSize(1) - geom->GetRailPart1(1)) / 2.0 ;
6a5795b4 1402 gMC->Gspos("PRP1", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
fa7cce36 1403 y0 = (geom->GetRailOuterSize(1) - geom->GetRailPart1(1)) / 2.0 - geom->GetRailPart3(1);
6a5795b4 1404 gMC->Gspos("PRP1", 2, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
1405
1406 // --- The middle vertical steel parts of the rail
1407
fa7cce36 1408 par[0] = geom->GetRailPart2(0) / 2.0 ;
1409 par[1] = geom->GetRailPart2(1) / 2.0 ;
1410 par[2] = geom->GetRailPart2(2) / 2.0 ;
6a5795b4 1411 gMC->Gsvolu("PRP2", "BOX ", idtmed[716], par, 3) ;
1412
fa7cce36 1413 y0 = - geom->GetRailPart3(1) / 2.0 ;
6a5795b4 1414 gMC->Gspos("PRP2", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
1415
1416 // --- The most upper steel parts of the rail
1417
fa7cce36 1418 par[0] = geom->GetRailPart3(0) / 2.0 ;
1419 par[1] = geom->GetRailPart3(1) / 2.0 ;
1420 par[2] = geom->GetRailPart3(2) / 2.0 ;
6a5795b4 1421 gMC->Gsvolu("PRP3", "BOX ", idtmed[716], par, 3) ;
1422
fa7cce36 1423 y0 = (geom->GetRailOuterSize(1) - geom->GetRailPart3(1)) / 2.0 ;
6a5795b4 1424 gMC->Gspos("PRP3", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
1425
1426 // --- The wall of the cradle
1427 // --- The wall is empty: steel thin walls and air inside
1428
1429 par[1] = TMath::Sqrt(
fa7cce36 1430 TMath::Power((geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1)),2) +
1431 TMath::Power((geom->GetOuterBoxSize(0)/2),2)) + 10.;
1432 par[0] = par[1] - geom->GetCradleWall(1) ;
1433 par[2] = geom->GetCradleWall(2) / 2.0 ;
1434 par[3] = geom->GetCradleWall(3) ;
1435 par[4] = geom->GetCradleWall(4) ;
6a5795b4 1436 gMC->Gsvolu("PCRA", "TUBS", idtmed[716], par, 5) ;
1437
fa7cce36 1438 par[0] -= geom->GetCradleWallThickness() ;
1439 par[1] -= geom->GetCradleWallThickness() ;
1440 par[2] -= geom->GetCradleWallThickness() ;
6a5795b4 1441 gMC->Gsvolu("PCRE", "TUBS", idtmed[798], par, 5) ;
1442 gMC->Gspos ("PCRE", 1, "PCRA", 0.0, 0.0, 0.0, 0, "ONLY") ;
1443
1444 for (i=0; i<2; i++) {
fa7cce36 1445 z0 = (2*i-1) * (geom->GetOuterBoxSize(2) + geom->GetCradleWall(2)) / 2.0 ;
6a5795b4 1446 gMC->Gspos("PCRA", i, "ALIC", 0.0, 0.0, z0, 0, "ONLY") ;
1447 }
1448
1449 // --- The "wheels" of the cradle
1450
fa7cce36 1451 par[0] = geom->GetCradleWheel(0) / 2;
1452 par[1] = geom->GetCradleWheel(1) / 2;
1453 par[2] = geom->GetCradleWheel(2) / 2;
6a5795b4 1454 gMC->Gsvolu("PWHE", "BOX ", idtmed[716], par, 3) ;
1455
fa7cce36 1456 y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) -
1457 geom->GetCradleWheel(1)/2) ;
6a5795b4 1458 for (i=0; i<2; i++) {
fa7cce36 1459 z0 = (2*i-1) * ((geom->GetOuterBoxSize(2) + geom->GetCradleWheel(2)) / 2.0 +
1460 geom->GetCradleWall(2));
6a5795b4 1461 for (j=0; j<2; j++) {
1462 copy = 2*i + j;
fa7cce36 1463 x0 = (2*j-1) * geom->GetDistanceBetwRails() / 2.0 ;
6a5795b4 1464 gMC->Gspos("PWHE", copy, "ALIC", x0, y0, z0, 0, "ONLY") ;
1465 }
1466 }
1467
1468}
1469
1470//____________________________________________________________________________
ed4205d8 1471Float_t AliPHOSv0::ZMin(void) const
1472{
1473 // Overall dimension of the PHOS (min)
1474 // Take it twice more than the PHOS module size
fa7cce36 1475
1476 AliPHOSGeometry * geom = GetGeometry() ;
1477
1478 return -geom->GetOuterBoxSize(2);
ed4205d8 1479}
1480
1481//____________________________________________________________________________
1482Float_t AliPHOSv0::ZMax(void) const
1483{
1484 // Overall dimension of the PHOS (max)
1485 // Take it twice more than the PHOS module size
fa7cce36 1486
1487 AliPHOSGeometry * geom = GetGeometry() ;
1488
1489 return geom->GetOuterBoxSize(2);
ed4205d8 1490}
1491
1492//____________________________________________________________________________
d15a28e7 1493void AliPHOSv0::Init(void)
1494{
b2a60966 1495 // Just prints an information message
1496
d15a28e7 1497 Int_t i;
1498
9e1a0ddb 1499 if(fDebug) {
1500 printf("\n%s: ",ClassName());
1501 for(i=0;i<35;i++) printf("*");
1502 printf(" PHOS_INIT ");
1503 for(i=0;i<35;i++) printf("*");
1504 printf("\n%s: ",ClassName());
1505
1506
1507 // Here the PHOS initialisation code (if any!)
fa7cce36 1508
1509 AliPHOSGeometry * geom = GetGeometry() ;
1510
1511 if (geom!=0)
1512 cout << "AliPHOS" << Version() << " : PHOS geometry intialized for " << geom->GetName() << endl ;
9e1a0ddb 1513 else
1514 cout << "AliPHOS" << Version() << " : PHOS geometry initialization failed !" << endl ;
1515
1516 for(i=0;i<80;i++) printf("*");
1517 printf("\n");
1518 }
d15a28e7 1519}
1520