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