]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSv0.cxx
Including assert.h (Sun)
[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 **************************************************************************/
b2a60966 15/* $Id$ */
16
7b7c1533 17
d15a28e7 18//_________________________________________________________________________
b2a60966 19// Implementation version v0 of PHOS Manager class
5f20d3fb 20// An object of this class does not produce hits nor digits
21// It is the one to use if you do not want to produce outputs in TREEH or TREED
6b07a799 22//...
85218d13 23//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
b2a60966 24
d2cf0e38 25
fe4da5cc 26// --- ROOT system ---
d15a28e7 27
fe4da5cc 28#include "TBRIK.h"
85218d13 29#include "TTRD1.h"
fe4da5cc 30#include "TNode.h"
6b07a799 31#include "TArrayI.h"
0869cea5 32#include "TRandom.h"
94de3818 33#include "TGeometry.h"
7367f709 34#include "TROOT.h"
81e92872 35
d15a28e7 36// --- Standard library ---
37
d15a28e7 38// --- AliRoot header files ---
39
fe4da5cc 40#include "AliPHOSv0.h"
41#include "AliRun.h"
13add4de 42#include "AliPHOSGeometry.h"
fe4da5cc 43
44ClassImp(AliPHOSv0)
45
d15a28e7 46//____________________________________________________________________________
47AliPHOSv0::AliPHOSv0(const char *name, const char *title):
48 AliPHOS(name,title)
49{
b2a60966 50 // ctor : title is used to identify the layout
bd46a237 51 GetGeometry() ;
d15a28e7 52}
53
d15a28e7 54//____________________________________________________________________________
55void AliPHOSv0::BuildGeometry()
fe4da5cc 56{
b2a60966 57 // Build the PHOS geometry for the ROOT display
58 //BEGIN_HTML
59 /*
60 <H2>
61 PHOS in ALICE displayed by root
62 </H2>
63 <UL>
64 <LI> All Views
65 <P>
66 <CENTER>
67 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
68 </CENTER></P></LI>
69 <LI> Front View
70 <P>
71 <CENTER>
72 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
73 </CENTER></P></LI>
74 <LI> 3D View 1
75 <P>
76 <CENTER>
77 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
78 </CENTER></P></LI>
79 <LI> 3D View 2
80 <P>
81 <CENTER>
82 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
83 </CENTER></P></LI>
84 </UL>
85 */
86 //END_HTML
7367f709 87
85218d13 88 this->BuildGeometryforEMC() ;
89 this->BuildGeometryforCPV() ;
90
fe4da5cc 91}
d15a28e7 92
93//____________________________________________________________________________
85218d13 94void AliPHOSv0:: BuildGeometryforEMC(void)
d15a28e7 95{
85218d13 96 // Build the PHOS-EMC geometry for the ROOT display
97
d15a28e7 98 const Int_t kColorPHOS = kRed ;
99 const Int_t kColorXTAL = kBlue ;
85218d13 100
92862013 101 Double_t const kRADDEG = 180.0 / kPI ;
85218d13 102
7367f709 103 AliPHOSGeometry * geom = GetGeometry() ;
85218d13 104 AliPHOSEMCAGeometry * emcg = geom->GetEMCAGeometry() ;
105 Float_t * boxparams = emcg->GetEMCParams() ;
7367f709 106
85218d13 107 new TTRD1("OuterBox", "PHOS box", "void",boxparams[0],boxparams[1],boxparams[2], boxparams[3] );
108
d15a28e7 109
d15a28e7 110 // Crystals Box
d15a28e7 111
85218d13 112 Float_t * cribox = emcg->GetInnerThermoHalfSize() ;
113 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", cribox[0], cribox[2], cribox[1] ) ;
114
115 // position PHOS into ALICE
116
117 Float_t r = geom->GetIPtoOuterCoverDistance() + boxparams[3] ;
d15a28e7 118 Int_t number = 988 ;
92862013 119 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
85218d13 120
d15a28e7 121 char * nodename = new char[20] ;
122 char * rotname = new char[20] ;
123
85218d13 124 new TRotMatrix("cribox", "cribox", 90, 0, 90, 90, 0, 0);
d15a28e7 125
85218d13 126 for( Int_t i = 1; i <= geom->GetNModules(); i++ ) {
d15a28e7 127
7367f709 128 Float_t angle = geom->GetPHOSAngle(i) ;
85218d13 129 sprintf(rotname, "%s%d", "rot", number++) ;
130 new TRotMatrix(rotname, rotname, 90, angle, 0, 0, 90, 270 + angle);
131
92862013 132 top->cd();
85218d13 133 sprintf(nodename,"%s%d", "Module", i) ;
92862013 134 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
135 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
85218d13 136 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
137 outerboxnode->SetLineColor(kColorPHOS) ;
138 fNodes->Add(outerboxnode) ;
139 outerboxnode->cd() ;
140
141 Float_t z = -boxparams[3] - geom->GetIPtoOuterCoverDistance() +
142 cribox[1] + geom->GetIPtoCrystalSurface() ;
143 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, 0, z) ;
144 crystalsboxnode->SetLineColor(kColorXTAL) ;
145 fNodes->Add(crystalsboxnode) ;
146 }
31aa6d6c 147
85218d13 148 delete[] rotname ;
149 delete[] nodename ;
fe4da5cc 150}
151
85218d13 152
bacd0b23 153//____________________________________________________________________________
154void AliPHOSv0:: BuildGeometryforCPV(void)
155{
156 // Build the PHOS-CPV geometry for the ROOT display
157 // Author: Yuri Kharlov 11 September 2000
158 //
159 //BEGIN_HTML
160 /*
161 <H2>
162 CPV displayed by root
163 </H2>
164 <table width=700>
165
166 <tr>
167 <td>CPV perspective view</td>
168 <td>CPV front view </td>
169 </tr>
170
171 <tr>
172 <td> <img height=300 width=290 src="../images/CPVRootPersp.gif"> </td>
173 <td> <img height=300 width=290 src="../images/CPVRootFront.gif"> </td>
174 </tr>
175
176 </table>
177
178 */
179 //END_HTML
180
181 const Double_t kRADDEG = 180.0 / kPI ;
182 const Int_t kColorCPV = kGreen ;
183 const Int_t kColorFrame = kYellow ;
184 const Int_t kColorGassiplex = kRed;
185 const Int_t kColorPCB = kCyan;
186
7367f709 187 AliPHOSGeometry * geom = GetGeometry() ;
188
bacd0b23 189 // Box for a full PHOS module
190
7367f709 191 new TBRIK ("CPVBox", "CPV box", "void", geom->GetCPVBoxSize(0)/2,
192 geom->GetCPVBoxSize(1)/2,
193 geom->GetCPVBoxSize(2)/2 );
194 new TBRIK ("CPVFrameLR", "CPV frame Left-Right", "void", geom->GetCPVFrameSize(0)/2,
195 geom->GetCPVFrameSize(1)/2,
196 geom->GetCPVBoxSize(2)/2 );
197 new TBRIK ("CPVFrameUD", "CPV frame Up-Down", "void", geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0),
198 geom->GetCPVFrameSize(1)/2,
199 geom->GetCPVFrameSize(2)/2);
200 new TBRIK ("CPVPCB", "CPV PCB", "void", geom->GetCPVActiveSize(0)/2,
201 geom->GetCPVTextoliteThickness()/2,
202 geom->GetCPVActiveSize(1)/2);
203 new TBRIK ("CPVGassiplex", "CPV Gassiplex PCB", "void", geom->GetGassiplexChipSize(0)/2,
204 geom->GetGassiplexChipSize(1)/2,
205 geom->GetGassiplexChipSize(2)/2);
bacd0b23 206
207 // position CPV into ALICE
208
209 char * nodename = new char[25] ;
210 char * rotname = new char[25] ;
211
7367f709 212 Float_t r = geom->GetIPtoCPVDistance() + geom->GetCPVBoxSize(1) / 2.0 ;
bacd0b23 213 Int_t number = 988 ;
214 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
ed4205d8 215
216 Int_t lastModule = 0 ;
85218d13 217 lastModule = geom->GetNModules();
ed4205d8 218
219 for( Int_t i = 1; i <= lastModule; i++ ) { // the number of PHOS modules
85218d13 220
bacd0b23 221 // One CPV module
85218d13 222
7367f709 223 Float_t angle = geom->GetPHOSAngle(i) ;
ed4205d8 224 sprintf(rotname, "%s%d", "rotg", number+i) ;
bacd0b23 225 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
226 top->cd();
227 sprintf(nodename, "%s%d", "CPVModule", i) ;
228 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
229 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
230 Float_t z;
231 TNode * cpvBoxNode = new TNode(nodename , nodename ,"CPVBox", x, y, 0, rotname ) ;
232 cpvBoxNode->SetLineColor(kColorCPV) ;
233 fNodes->Add(cpvBoxNode) ;
234 cpvBoxNode->cd() ;
235
236 // inside each CPV box:
237
238 // Frame around CPV
cd461ab8 239 Int_t j;
240 for (j=0; j<=1; j++) {
bacd0b23 241 sprintf(nodename, "CPVModule%d Frame%d", i, j+1) ;
7367f709 242 x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->GetCPVFrameSize(0)) / 2;
bacd0b23 243 TNode * cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameLR", x, 0, 0) ;
244 cpvFrameNode->SetLineColor(kColorFrame) ;
245 fNodes->Add(cpvFrameNode) ;
246
247 sprintf(nodename, "CPVModule%d Frame%d", i, j+3) ;
7367f709 248 z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
bacd0b23 249 cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameUD", 0, 0, z) ;
250 cpvFrameNode->SetLineColor(kColorFrame) ;
251 fNodes->Add(cpvFrameNode) ;
252 }
253
254 // 4 printed circuit boards
cd461ab8 255 for (j=0; j<4; j++) {
bacd0b23 256 sprintf(nodename, "CPVModule%d PCB%d", i, j+1) ;
7367f709 257 y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(j) + geom->GetCPVTextoliteThickness()/2;
bacd0b23 258 TNode * cpvPCBNode = new TNode(nodename , nodename ,"CPVPCB", 0, y, 0) ;
259 cpvPCBNode->SetLineColor(kColorPCB) ;
260 fNodes->Add(cpvPCBNode) ;
261 }
262
263 // Gassiplex chips
7367f709 264 Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
265 Float_t zStep = geom->GetCPVActiveSize(1) / (geom->GetNumberOfCPVChipsZ() + 1);
266 y = geom->GetCPVFrameSize(1)/2 - geom->GetFTPosition(0) +
267 geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
268 for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
269 x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
270 for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
271 z = zStep * (iz+1) - geom->GetCPVActiveSize(1)/2;
bacd0b23 272 sprintf(nodename, "CPVModule%d Chip(%dx%d)", i, ix+1,iz+1) ;
273 TNode * cpvGassiplexNode = new TNode(nodename , nodename ,"CPVGassiplex", x, y, z) ;
274 cpvGassiplexNode->SetLineColor(kColorGassiplex) ;
275 fNodes->Add(cpvGassiplexNode) ;
276 }
277 }
278
279 } // PHOS modules
280
281 delete[] rotname ;
282 delete[] nodename ;
283}
284
d15a28e7 285//____________________________________________________________________________
fe4da5cc 286void AliPHOSv0::CreateGeometry()
287{
b2a60966 288 // Create the PHOS geometry for Geant
d15a28e7 289
7a9d98f9 290 AliPHOSv0 *phostmp = dynamic_cast<AliPHOSv0*>(gAlice->GetModule("PHOS")) ;
d15a28e7 291
92862013 292 if ( phostmp == NULL ) {
d15a28e7 293
294 fprintf(stderr, "PHOS detector not found!\n") ;
295 return;
fe4da5cc 296
d15a28e7 297 }
7367f709 298
299 AliPHOSGeometry * geom = GetGeometry() ;
300
d15a28e7 301 // Get pointer to the array containing media indeces
92862013 302 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 303
85218d13 304 // Create a PHOS module.
d15a28e7 305
85218d13 306 gMC->Gsvolu("PHOS", "TRD1", idtmed[798], geom->GetPHOSParams(), 4) ;
d15a28e7 307
85218d13 308 this->CreateGeometryforEMC() ;
ed4205d8 309
85218d13 310 this->CreateGeometryforCPV() ;
311
b73f246d 312 this->CreateGeometryforSupport() ;
d15a28e7 313
314 // --- Position PHOS mdules in ALICE setup ---
315
92862013 316 Int_t idrotm[99] ;
317 Double_t const kRADDEG = 180.0 / kPI ;
85218d13 318 Float_t * phosParams = geom->GetPHOSParams() ;
382780d0 319
320 Float_t r = geom->GetIPtoOuterCoverDistance() + phosParams[3] - geom->GetCPVBoxSize(1) ;
ed4205d8 321 Int_t i;
85218d13 322 for( i = 1; i <= geom->GetNModules() ; i++ ) {
d15a28e7 323
7367f709 324 Float_t angle = geom->GetPHOSAngle(i) ;
85218d13 325 AliMatrix(idrotm[i-1], 90.,angle, 0., 0., 90., 270. +angle) ;
326
ed4205d8 327 Float_t xP1 = r * TMath::Sin( angle / kRADDEG ) ;
92862013 328 Float_t yP1 = -r * TMath::Cos( angle / kRADDEG ) ;
85218d13 329
92862013 330 gMC->Gspos("PHOS", i, "ALIC", xP1, yP1, 0.0, idrotm[i-1], "ONLY") ;
ed4205d8 331
85218d13 332 }
ed4205d8 333
fe4da5cc 334}
d15a28e7 335
336//____________________________________________________________________________
85218d13 337void AliPHOSv0::CreateGeometryforEMC()
d15a28e7 338{
b2a60966 339 // Create the PHOS-EMC geometry for GEANT
85218d13 340 // Author: Dmitri Peressounko August 2001
341 // The used coordinate system:
342 // 1. in Module: X along longer side, Y out of beam, Z along shorter side (along beam)
343 // 2. In Strip the same: X along longer side, Y out of beam, Z along shorter side (along beam)
344
345
b2a60966 346 //BEGIN_HTML
347 /*
348 <H2>
349 Geant3 geometry tree of PHOS-EMC in ALICE
350 </H2>
351 <P><CENTER>
352 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
353 </CENTER><P>
354 */
355 //END_HTML
356
357 // Get pointer to the array containing media indexes
92862013 358 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 359
7367f709 360 AliPHOSGeometry * geom = GetGeometry() ;
85218d13 361 AliPHOSEMCAGeometry * emcg = geom->GetEMCAGeometry() ;
7367f709 362
85218d13 363 // ======= Define the strip ===============
d15a28e7 364
85218d13 365 gMC->Gsvolu("PSTR", "BOX ", idtmed[716], emcg->GetStripHalfSize(), 3) ; //Made of stell
d15a28e7 366
85218d13 367 // --- define air volume (cell of the honeycomb)
368 gMC->Gsvolu("PCEL", "BOX ", idtmed[798], emcg->GetAirCellHalfSize(), 3);
d15a28e7 369
85218d13 370 // --- define wrapped crystal and put it into AirCell
d15a28e7 371
85218d13 372 gMC->Gsvolu("PWRA", "BOX ", idtmed[702], emcg->GetWrappedHalfSize(), 3);
373 Float_t * pin = emcg->GetAPDHalfSize() ;
374 Float_t * preamp = emcg->GetPreampHalfSize() ;
375 Float_t y = (emcg->GetAirGapLed()-2*pin[1]-2*preamp[1])/2;
376 gMC->Gspos("PWRA", 1, "PCEL", 0.0, y, 0.0, 0, "ONLY") ;
377
378 // --- Define crystall and put it into wrapped crystall ---
379 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], emcg->GetCrystalHalfSize(), 3) ;
380 gMC->Gspos("PXTL", 1, "PWRA", 0.0, 0.0, 0.0, 0, "ONLY") ;
381
382 // --- define APD/PIN preamp and put it into AirCell
fe4da5cc 383
85218d13 384 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], emcg->GetAPDHalfSize(), 3) ;
385 Float_t * crystal = emcg->GetCrystalHalfSize() ;
386 y = crystal[1] + emcg->GetAirGapLed() /2 - preamp[1];
387 gMC->Gspos("PPIN", 1, "PCEL", 0.0, y, 0.0, 0, "ONLY") ;
388
389 gMC->Gsvolu("PREA", "BOX ", idtmed[711], emcg->GetPreampHalfSize(), 3) ; // Here I assumed preamp
390 // as a printed Circuit
391 y = crystal[1] + emcg->GetAirGapLed() /2 + pin[1] ; // May it should be changed
392 gMC->Gspos("PREA", 1, "PCEL", 0.0, y, 0.0, 0, "ONLY") ; // to ceramics?
d15a28e7 393
d15a28e7 394
85218d13 395 // --- Fill strip with wrapped cristalls in Air Cells
b2a60966 396
85218d13 397 Float_t* splate = emcg->GetSupportPlateHalfSize();
398 y = -splate[1] ;
399 Float_t* acel = emcg->GetAirCellHalfSize() ;
400 Int_t icel ;
401 for(icel = 1; icel <= emcg->GetNCellsInStrip(); icel++){
402 Float_t x = (2*icel - 1 - emcg->GetNCellsInStrip())* acel[0] ;
403 gMC->Gspos("PCEL", icel, "PSTR", x, y, 0.0, 0, "ONLY") ;
404 }
7367f709 405
85218d13 406 // --- define the support plate, hole in it and position it in strip ----
407 gMC->Gsvolu("PSUP", "BOX ", idtmed[701], emcg->GetSupportPlateHalfSize(), 3) ;
7367f709 408
85218d13 409 gMC->Gsvolu("PSHO", "BOX ", idtmed[798], emcg->GetSupportPlateInHalfSize(), 3) ;
410 Float_t z = emcg->GetSupportPlateThickness()/2 ;
411 gMC->Gspos("PSHO", 1, "PSUP", 0.0, 0.0, z, 0, "ONLY") ;
fe4da5cc 412
85218d13 413 y = acel[1] ;
414 gMC->Gspos("PSUP", 1, "PSTR", 0.0, y, 0.0, 0, "ONLY") ;
d15a28e7 415
d15a28e7 416
85218d13 417 // ========== Fill module with strips and put them into inner thermoinsulation=============
418 gMC->Gsvolu("PTII", "BOX ", idtmed[706], emcg->GetInnerThermoHalfSize(), 3) ;
d15a28e7 419
85218d13 420 Float_t * inthermo = emcg->GetInnerThermoHalfSize() ;
421 Float_t * strip = emcg->GetStripHalfSize() ;
422 y = inthermo[1] - strip[1] ;
423 Int_t irow;
424 Int_t nr = 1 ;
425 Int_t icol ;
d15a28e7 426
85218d13 427 for(irow = 0; irow < emcg->GetNStripX(); irow ++){
428 Float_t x = (2*irow + 1 - emcg->GetNStripX())* strip[0] ;
429 for(icol = 0; icol < emcg->GetNStripZ(); icol ++){
430 z = (2*icol + 1 - emcg->GetNStripZ()) * strip[2] ;
431 gMC->Gspos("PSTR", nr, "PTII", x, y, z, 0, "ONLY") ;
432 nr++ ;
433 }
434 }
435
d15a28e7 436
85218d13 437 // ------- define the air gap between thermoinsulation and cooler
438 gMC->Gsvolu("PAGA", "BOX ", idtmed[798], emcg->GetAirGapHalfSize(), 3) ;
439 Float_t * agap = emcg->GetAirGapHalfSize() ;
440 y = agap[1] - inthermo[1] ;
441
442 gMC->Gspos("PTII", 1, "PAGA", 0.0, y, 0.0, 0, "ONLY") ;
d15a28e7 443
d15a28e7 444
d15a28e7 445
85218d13 446 // ------- define the Al passive cooler
447 gMC->Gsvolu("PCOR", "BOX ", idtmed[701], emcg->GetCoolerHalfSize(), 3) ;
448 Float_t * cooler = emcg->GetCoolerHalfSize() ;
449 y = cooler[1] - agap[1] ;
450
451 gMC->Gspos("PAGA", 1, "PCOR", 0.0, y, 0.0, 0, "ONLY") ;
d15a28e7 452
85218d13 453 // ------- define the outer thermoinsulating cover
454 gMC->Gsvolu("PTIO", "TRD1", idtmed[706], emcg->GetOuterThermoParams(), 4) ;
455 Float_t * outparams = emcg->GetOuterThermoParams() ;
d15a28e7 456
85218d13 457 Int_t idrotm[99] ;
458 AliMatrix(idrotm[1], 90.0, 0.0, 0.0, 0.0, 90.0, 270.0) ;
459 // Frame in outer thermoinsulation and so on: z out of beam, y along beam, x across beam
d15a28e7 460
85218d13 461 z = outparams[3] - cooler[1] ;
462 gMC->Gspos("PCOR", 1, "PTIO", 0., 0.0, z, idrotm[1], "ONLY") ;
463
464 // -------- Define the outer Aluminium cover -----
465 gMC->Gsvolu("PCOL", "TRD1", idtmed[701], emcg->GetAlCoverParams(), 4) ;
466 Float_t * covparams = emcg->GetAlCoverParams() ;
467 z = covparams[3] - outparams[3] ;
468 gMC->Gspos("PTIO", 1, "PCOL", 0., 0.0, z, 0, "ONLY") ;
469
470 // --------- Define front fiberglass cover -----------
471 gMC->Gsvolu("PFGC", "BOX ", idtmed[717], emcg->GetFiberGlassHalfSize(), 3) ;
472 z = - outparams[3] ;
473 gMC->Gspos("PFGC", 1, "PCOL", 0., 0.0, z, 0, "ONLY") ;
474
475 //=============This is all with cold section==============
476
477
478 //------ Warm Section --------------
479 gMC->Gsvolu("PWAR", "BOX ", idtmed[701], emcg->GetWarmAlCoverHalfSize(), 3) ;
480 Float_t * warmcov = emcg->GetWarmAlCoverHalfSize() ;
481
482 // --- Define the outer thermoinsulation ---
483 gMC->Gsvolu("PWTI", "BOX ", idtmed[706], emcg->GetWarmThermoHalfSize(), 3) ;
484 Float_t * warmthermo = emcg->GetWarmThermoHalfSize() ;
485 z = -warmcov[2] + warmthermo[2] ;
486
487 gMC->Gspos("PWTI", 1, "PWAR", 0., 0.0, z, 0, "ONLY") ;
488
489 // --- Define cables area and put in it T-supports ----
490 gMC->Gsvolu("PCA1", "BOX ", idtmed[718], emcg->GetTCables1HalfSize(), 3) ;
491 Float_t * cbox = emcg->GetTCables1HalfSize() ;
492
493 gMC->Gsvolu("PBE1", "BOX ", idtmed[701], emcg->GetTSupport1HalfSize(), 3) ;
494 Float_t * beams = emcg->GetTSupport1HalfSize() ;
495 Int_t isup ;
496 for(isup = 0; isup < emcg->GetNTSuppots(); isup++){
497 Float_t x = -cbox[0] + beams[0] + (2*beams[0]+emcg->GetTSupportDist())*isup ;
498 gMC->Gspos("PBE1", isup, "PCA1", x, 0.0, 0.0, 0, "ONLY") ;
499 }
d15a28e7 500
85218d13 501 z = -warmthermo[2] + cbox[2] ;
502 gMC->Gspos("PCA1", 1, "PWTI", 0.0, 0.0, z, 0, "ONLY") ;
d15a28e7 503
85218d13 504 gMC->Gsvolu("PCA2", "BOX ", idtmed[718], emcg->GetTCables2HalfSize(), 3) ;
505 Float_t * cbox2 = emcg->GetTCables2HalfSize() ;
d15a28e7 506
85218d13 507 gMC->Gsvolu("PBE2", "BOX ", idtmed[701], emcg->GetTSupport2HalfSize(), 3) ;
508 for(isup = 0; isup < emcg->GetNTSuppots(); isup++){
509 Float_t x = -cbox[0] + beams[0] + (2*beams[0]+emcg->GetTSupportDist())*isup ;
510 gMC->Gspos("PBE2", isup, "PCA2", x, 0.0, 0.0, 0, "ONLY") ;
511 }
d15a28e7 512
85218d13 513 z = -warmthermo[2] + 2*cbox[2] + cbox2[2];
514 gMC->Gspos("PCA2", 1, "PWTI", 0.0, 0.0, z, 0, "ONLY") ;
d15a28e7 515
d15a28e7 516
85218d13 517 // --- Define frame ---
518 gMC->Gsvolu("PFRX", "BOX ", idtmed[716], emcg->GetFrameXHalfSize(), 3) ;
519 Float_t * posit = emcg->GetFrameXPosition() ;
520 gMC->Gspos("PFRX", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
521 gMC->Gspos("PFRX", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
d15a28e7 522
85218d13 523 gMC->Gsvolu("PFRZ", "BOX ", idtmed[716], emcg->GetFrameZHalfSize(), 3) ;
524 posit = emcg->GetFrameZPosition() ;
525 gMC->Gspos("PFRZ", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
526 gMC->Gspos("PFRZ", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
d15a28e7 527
85218d13 528 // --- Define Fiber Glass support ---
529 gMC->Gsvolu("PFG1", "BOX ", idtmed[717], emcg->GetFGupXHalfSize(), 3) ;
530 posit = emcg->GetFGupXPosition() ;
531 gMC->Gspos("PFG1", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
532 gMC->Gspos("PFG1", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
d15a28e7 533
85218d13 534 gMC->Gsvolu("PFG2", "BOX ", idtmed[717], emcg->GetFGupZHalfSize(), 3) ;
535 posit = emcg->GetFGupZPosition() ;
536 gMC->Gspos("PFG2", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
537 gMC->Gspos("PFG2", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
d15a28e7 538
85218d13 539 gMC->Gsvolu("PFG3", "BOX ", idtmed[717], emcg->GetFGlowXHalfSize(), 3) ;
540 posit = emcg->GetFGlowXPosition() ;
541 gMC->Gspos("PFG3", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
542 gMC->Gspos("PFG3", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
d15a28e7 543
85218d13 544 gMC->Gsvolu("PFG4", "BOX ", idtmed[717], emcg->GetFGlowZHalfSize(), 3) ;
545 posit = emcg->GetFGlowZPosition() ;
546 gMC->Gspos("PFG4", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
547 gMC->Gspos("PFG4", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
d15a28e7 548
85218d13 549 // --- Define Air Gap for FEE electronics -----
d15a28e7 550
85218d13 551 gMC->Gsvolu("PAFE", "BOX ", idtmed[798], emcg->GetFEEAirHalfSize(), 3) ;
552 posit = emcg->GetFEEAirPosition() ;
553 gMC->Gspos("PAFE", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
d15a28e7 554
85218d13 555 // Define the EMC module volume and combine Cool and Warm sections
d15a28e7 556
85218d13 557 gMC->Gsvolu("PEMC", "TRD1", idtmed[798], emcg->GetEMCParams(), 4) ;
d15a28e7 558
85218d13 559 z = - warmcov[2] ;
560 gMC->Gspos("PCOL", 1, "PEMC", 0., 0., z, 0, "ONLY") ;
561 z = covparams[3] ;
562 gMC->Gspos("PWAR", 1, "PEMC", 0., 0., z, 0, "ONLY") ;
d15a28e7 563
d15a28e7 564
85218d13 565 // Put created EMC geometry into PHOS volume
566
567 z = geom->GetCPVBoxSize(1) / 2. ;
568 gMC->Gspos("PEMC", 1, "PHOS", 0., 0., z, 0, "ONLY") ;
569
fe4da5cc 570}
571
bacd0b23 572//____________________________________________________________________________
573void AliPHOSv0::CreateGeometryforCPV()
574{
575 // Create the PHOS-CPV geometry for GEANT
576 // Author: Yuri Kharlov 11 September 2000
bacd0b23 577 //BEGIN_HTML
578 /*
579 <H2>
580 Geant3 geometry of PHOS-CPV in ALICE
581 </H2>
582 <table width=700>
583
584 <tr>
585 <td>CPV perspective view</td>
586 <td>CPV front view </td>
587 </tr>
588
589 <tr>
590 <td> <img height=300 width=290 src="../images/CPVallPersp.gif"> </td>
591 <td> <img height=300 width=290 src="../images/CPVallFront.gif"> </td>
592 </tr>
593
594 <tr>
595 <td>One CPV module, perspective view </td>
596 <td>One CPV module, front view (extended in vertical direction) </td>
597 </tr>
598
599 <tr>
600 <td><img height=300 width=290 src="../images/CPVmodulePers.gif"></td>
601 <td><img height=300 width=290 src="../images/CPVmoduleSide.gif"></td>
602 </tr>
603
604 </table>
605
606 <H2>
607 Geant3 geometry tree of PHOS-CPV in ALICE
608 </H2>
609 <center>
610 <img height=300 width=290 src="../images/CPVtree.gif">
611 </center>
612 */
613 //END_HTML
614
615 Float_t par[3], x,y,z;
616
617 // Get pointer to the array containing media indexes
618 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
7367f709 619
620 AliPHOSGeometry * geom = GetGeometry() ;
621
bacd0b23 622 // The box containing all CPV for one PHOS module filled with air
7367f709 623 par[0] = geom->GetCPVBoxSize(0) / 2.0 ;
624 par[1] = geom->GetCPVBoxSize(1) / 2.0 ;
625 par[2] = geom->GetCPVBoxSize(2) / 2.0 ;
13add4de 626 gMC->Gsvolu("PCPV", "BOX ", idtmed[798], par, 3) ;
85218d13 627
628 Float_t * emcParams = geom->GetEMCAGeometry()->GetEMCParams() ;
629 z = - emcParams[3] ;
630 Int_t rotm ;
631 AliMatrix(rotm, 90.,0., 0., 0., 90., 90.) ;
632
633 gMC->Gspos("PCPV", 1, "PHOS", 0.0, 0.0, z, rotm, "ONLY") ;
bacd0b23 634
635 // Gassiplex board
636
7367f709 637 par[0] = geom->GetGassiplexChipSize(0)/2.;
638 par[1] = geom->GetGassiplexChipSize(1)/2.;
639 par[2] = geom->GetGassiplexChipSize(2)/2.;
13add4de 640 gMC->Gsvolu("PCPC","BOX ",idtmed[707],par,3);
bacd0b23 641
642 // Cu+Ni foil covers Gassiplex board
643
7367f709 644 par[1] = geom->GetCPVCuNiFoilThickness()/2;
13add4de 645 gMC->Gsvolu("PCPD","BOX ",idtmed[710],par,3);
7367f709 646 y = -(geom->GetGassiplexChipSize(1)/2 - par[1]);
13add4de 647 gMC->Gspos("PCPD",1,"PCPC",0,y,0,0,"ONLY");
bacd0b23 648
649 // Position of the chip inside CPV
650
7367f709 651 Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
652 Float_t zStep = geom->GetCPVActiveSize(1) / (geom->GetNumberOfCPVChipsZ() + 1);
bacd0b23 653 Int_t copy = 0;
7367f709 654 y = geom->GetCPVFrameSize(1)/2 - geom->GetFTPosition(0) +
655 geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
656 for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
657 x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
658 for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
bacd0b23 659 copy++;
7367f709 660 z = zStep * (iz+1) - geom->GetCPVActiveSize(1)/2;
13add4de 661 gMC->Gspos("PCPC",copy,"PCPV",x,y,z,0,"ONLY");
bacd0b23 662 }
663 }
664
665 // Foiled textolite (1 mm of textolite + 50 mkm of Cu + 6 mkm of Ni)
666
7367f709 667 par[0] = geom->GetCPVActiveSize(0) / 2;
668 par[1] = geom->GetCPVTextoliteThickness() / 2;
669 par[2] = geom->GetCPVActiveSize(1) / 2;
13add4de 670 gMC->Gsvolu("PCPF","BOX ",idtmed[707],par,3);
bacd0b23 671
672 // Argon gas volume
673
7367f709 674 par[1] = (geom->GetFTPosition(2) - geom->GetFTPosition(1) - geom->GetCPVTextoliteThickness()) / 2;
13add4de 675 gMC->Gsvolu("PCPG","BOX ",idtmed[715],par,3);
bacd0b23 676
677 for (Int_t i=0; i<4; i++) {
7367f709 678 y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(i) + geom->GetCPVTextoliteThickness()/2;
13add4de 679 gMC->Gspos("PCPF",i+1,"PCPV",0,y,0,0,"ONLY");
bacd0b23 680 if(i==1){
7367f709 681 y-= (geom->GetFTPosition(2) - geom->GetFTPosition(1)) / 2;
13add4de 682 gMC->Gspos("PCPG",1,"PCPV ",0,y,0,0,"ONLY");
bacd0b23 683 }
684 }
685
686 // Dummy sensitive plane in the middle of argone gas volume
687
688 par[1]=0.001;
13add4de 689 gMC->Gsvolu("PCPQ","BOX ",idtmed[715],par,3);
690 gMC->Gspos ("PCPQ",1,"PCPG",0,0,0,0,"ONLY");
bacd0b23 691
692 // Cu+Ni foil covers textolite
693
7367f709 694 par[1] = geom->GetCPVCuNiFoilThickness() / 2;
13add4de 695 gMC->Gsvolu("PCP1","BOX ",idtmed[710],par,3);
7367f709 696 y = geom->GetCPVTextoliteThickness()/2 - par[1];
13add4de 697 gMC->Gspos ("PCP1",1,"PCPF",0,y,0,0,"ONLY");
bacd0b23 698
699 // Aluminum frame around CPV
700
7367f709 701 par[0] = geom->GetCPVFrameSize(0)/2;
702 par[1] = geom->GetCPVFrameSize(1)/2;
703 par[2] = geom->GetCPVBoxSize(2) /2;
13add4de 704 gMC->Gsvolu("PCF1","BOX ",idtmed[701],par,3);
bacd0b23 705
7367f709 706 par[0] = geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0);
707 par[1] = geom->GetCPVFrameSize(1)/2;
708 par[2] = geom->GetCPVFrameSize(2)/2;
13add4de 709 gMC->Gsvolu("PCF2","BOX ",idtmed[701],par,3);
bacd0b23 710
711 for (Int_t j=0; j<=1; j++) {
7367f709 712 x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->GetCPVFrameSize(0)) / 2;
13add4de 713 gMC->Gspos("PCF1",j+1,"PCPV", x,0,0,0,"ONLY");
7367f709 714 z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
13add4de 715 gMC->Gspos("PCF2",j+1,"PCPV",0, 0,z,0,"ONLY");
bacd0b23 716 }
717
718}
719
720
6a5795b4 721//____________________________________________________________________________
722void AliPHOSv0::CreateGeometryforSupport()
723{
724 // Create the PHOS' support geometry for GEANT
725 //BEGIN_HTML
726 /*
727 <H2>
728 Geant3 geometry of the PHOS's support
729 </H2>
730 <P><CENTER>
731 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/PHOS_support.gif">
732 </CENTER><P>
733 */
734 //END_HTML
735
736 Float_t par[5], x0,y0,z0 ;
737 Int_t i,j,copy;
738
739 // Get pointer to the array containing media indexes
740 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
741
7367f709 742 AliPHOSGeometry * geom = GetGeometry() ;
743
6a5795b4 744 // --- Dummy box containing two rails on which PHOS support moves
745 // --- Put these rails to the bottom of the L3 magnet
746
7367f709 747 par[0] = geom->GetRailRoadSize(0) / 2.0 ;
748 par[1] = geom->GetRailRoadSize(1) / 2.0 ;
749 par[2] = geom->GetRailRoadSize(2) / 2.0 ;
6a5795b4 750 gMC->Gsvolu("PRRD", "BOX ", idtmed[798], par, 3) ;
751
7367f709 752 y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) / 2.0) ;
6a5795b4 753 gMC->Gspos("PRRD", 1, "ALIC", 0.0, y0, 0.0, 0, "ONLY") ;
754
755 // --- Dummy box containing one rail
756
7367f709 757 par[0] = geom->GetRailOuterSize(0) / 2.0 ;
758 par[1] = geom->GetRailOuterSize(1) / 2.0 ;
759 par[2] = geom->GetRailOuterSize(2) / 2.0 ;
6a5795b4 760 gMC->Gsvolu("PRAI", "BOX ", idtmed[798], par, 3) ;
761
762 for (i=0; i<2; i++) {
7367f709 763 x0 = (2*i-1) * geom->GetDistanceBetwRails() / 2.0 ;
6a5795b4 764 gMC->Gspos("PRAI", i, "PRRD", x0, 0.0, 0.0, 0, "ONLY") ;
765 }
766
767 // --- Upper and bottom steel parts of the rail
768
7367f709 769 par[0] = geom->GetRailPart1(0) / 2.0 ;
770 par[1] = geom->GetRailPart1(1) / 2.0 ;
771 par[2] = geom->GetRailPart1(2) / 2.0 ;
6a5795b4 772 gMC->Gsvolu("PRP1", "BOX ", idtmed[716], par, 3) ;
773
7367f709 774 y0 = - (geom->GetRailOuterSize(1) - geom->GetRailPart1(1)) / 2.0 ;
6a5795b4 775 gMC->Gspos("PRP1", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
7367f709 776 y0 = (geom->GetRailOuterSize(1) - geom->GetRailPart1(1)) / 2.0 - geom->GetRailPart3(1);
6a5795b4 777 gMC->Gspos("PRP1", 2, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
778
779 // --- The middle vertical steel parts of the rail
780
7367f709 781 par[0] = geom->GetRailPart2(0) / 2.0 ;
782 par[1] = geom->GetRailPart2(1) / 2.0 ;
783 par[2] = geom->GetRailPart2(2) / 2.0 ;
6a5795b4 784 gMC->Gsvolu("PRP2", "BOX ", idtmed[716], par, 3) ;
785
7367f709 786 y0 = - geom->GetRailPart3(1) / 2.0 ;
6a5795b4 787 gMC->Gspos("PRP2", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
788
789 // --- The most upper steel parts of the rail
790
7367f709 791 par[0] = geom->GetRailPart3(0) / 2.0 ;
792 par[1] = geom->GetRailPart3(1) / 2.0 ;
793 par[2] = geom->GetRailPart3(2) / 2.0 ;
6a5795b4 794 gMC->Gsvolu("PRP3", "BOX ", idtmed[716], par, 3) ;
795
7367f709 796 y0 = (geom->GetRailOuterSize(1) - geom->GetRailPart3(1)) / 2.0 ;
6a5795b4 797 gMC->Gspos("PRP3", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
798
799 // --- The wall of the cradle
800 // --- The wall is empty: steel thin walls and air inside
801
85218d13 802 par[1] = TMath::Sqrt(TMath::Power((geom->GetIPtoCPVDistance() + geom->GetOuterBoxSize(3)),2) +
803 TMath::Power((geom->GetOuterBoxSize(1)/2),2))+10. ;
7367f709 804 par[0] = par[1] - geom->GetCradleWall(1) ;
805 par[2] = geom->GetCradleWall(2) / 2.0 ;
806 par[3] = geom->GetCradleWall(3) ;
807 par[4] = geom->GetCradleWall(4) ;
6a5795b4 808 gMC->Gsvolu("PCRA", "TUBS", idtmed[716], par, 5) ;
809
7367f709 810 par[0] -= geom->GetCradleWallThickness() ;
811 par[1] -= geom->GetCradleWallThickness() ;
812 par[2] -= geom->GetCradleWallThickness() ;
6a5795b4 813 gMC->Gsvolu("PCRE", "TUBS", idtmed[798], par, 5) ;
814 gMC->Gspos ("PCRE", 1, "PCRA", 0.0, 0.0, 0.0, 0, "ONLY") ;
815
816 for (i=0; i<2; i++) {
85218d13 817 z0 = (2*i-1) * (geom->GetOuterBoxSize(2) + geom->GetCradleWall(2) )/ 2.0 ;
818 gMC->Gspos("PCRA", i, "ALIC", 0.0, 0.0, z0, 0, "ONLY") ;
6a5795b4 819 }
820
821 // --- The "wheels" of the cradle
822
7367f709 823 par[0] = geom->GetCradleWheel(0) / 2;
824 par[1] = geom->GetCradleWheel(1) / 2;
825 par[2] = geom->GetCradleWheel(2) / 2;
6a5795b4 826 gMC->Gsvolu("PWHE", "BOX ", idtmed[716], par, 3) ;
827
7367f709 828 y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) -
829 geom->GetCradleWheel(1)/2) ;
6a5795b4 830 for (i=0; i<2; i++) {
85218d13 831 z0 = (2*i-1) * ((geom->GetOuterBoxSize(2) + geom->GetCradleWheel(2))/ 2.0 +
7367f709 832 geom->GetCradleWall(2));
6a5795b4 833 for (j=0; j<2; j++) {
834 copy = 2*i + j;
7367f709 835 x0 = (2*j-1) * geom->GetDistanceBetwRails() / 2.0 ;
6a5795b4 836 gMC->Gspos("PWHE", copy, "ALIC", x0, y0, z0, 0, "ONLY") ;
837 }
838 }
839
840}
841
ed4205d8 842//____________________________________________________________________________
843Float_t AliPHOSv0::ZMin(void) const
844{
845 // Overall dimension of the PHOS (min)
7367f709 846
847 AliPHOSGeometry * geom = GetGeometry() ;
848
85218d13 849 return -geom->GetOuterBoxSize(2)/2.;
ed4205d8 850}
851
852//____________________________________________________________________________
853Float_t AliPHOSv0::ZMax(void) const
854{
855 // Overall dimension of the PHOS (max)
7367f709 856
857 AliPHOSGeometry * geom = GetGeometry() ;
858
85218d13 859 return geom->GetOuterBoxSize(2)/2.;
ed4205d8 860}
861
d15a28e7 862//____________________________________________________________________________
863void AliPHOSv0::Init(void)
864{
b2a60966 865 // Just prints an information message
866
d15a28e7 867 Int_t i;
868
9e1a0ddb 869 if(fDebug) {
21cd0c07 870 TString st ;
bd46a237 871 for(i=0;i<35;i++)
21cd0c07 872 st += "*";
873 Info("Init", "%s", st.Data()) ;
9e1a0ddb 874 // Here the PHOS initialisation code (if any!)
bd46a237 875
7367f709 876 AliPHOSGeometry * geom = GetGeometry() ;
877
878 if (geom!=0)
21cd0c07 879 Info("Init", "AliPHOS%s: PHOS geometry intialized for %s", Version().Data(), geom->GetName()) ;
9e1a0ddb 880 else
21cd0c07 881 Info("Init", "AliPHOS%s: PHOS geometry initialization failed !", Version().Data()) ;
882
883 Info("Init", "%s", st.Data()) ;
bd46a237 884 }
d15a28e7 885}