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