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