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