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