]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSv0.cxx
change to comply with new ROOT version on the CAF
[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$
ac7bf879 20 * Revision 1.89 2007/04/24 14:34:39 hristov
21 * Additional protection: do not search for alignable object if the CPV is not in the geometry
22 *
d67a143b 23 * Revision 1.88 2007/04/19 15:28:30 kharlov
24 * Modify strip unit geometry according to the final drawings (Timur)
25 *
978b14f4 26 * Revision 1.87 2007/04/01 07:37:10 kharlov
27 * TGeo RS to Local RS transf matr added
28 *
facdea24 29 * Revision 1.86 2007/03/06 06:55:46 kharlov
30 * DP:Misalignment of CPV added
31 *
a3627590 32 * Revision 1.85 2007/03/01 11:37:37 kharlov
33 * Strip units changed from 8x1 to 8x2 (T.Pocheptsov)
34 *
331c963c 35 * Revision 1.84 2006/12/20 16:56:43 kharlov
36 * Optional geometry without CPV
37 *
9d1b528b 38 * Revision 1.83 2006/11/14 17:11:15 hristov
39 * Removing inheritances from TAttLine, TAttMarker and AliRndm in AliModule. The copy constructor and assignment operators are moved to the private part of the class and not implemented. The corresponding changes are propagated to the detectors
40 *
e939a978 41 * Revision 1.82 2006/09/27 19:55:57 kharlov
42 * Alignment object with symbolic volume names are introduced
43 *
2aebba19 44 * Revision 1.81 2006/03/04 20:25:56 kharlov
45 * Set geom parameters from CDB
46 *
05d33a3d 47 * Revision 1.80 2005/06/17 07:39:07 hristov
48 * Removing GetDebug and SetDebug from AliRun and AliModule. Using AliLog for the messages
49 *
4951e003 50 * Revision 1.79 2005/05/28 14:19:05 schutz
51 * Compilation warnings fixed by T.P.
52 *
702ab87e 53 */
54
d15a28e7 55//_________________________________________________________________________
b2a60966 56// Implementation version v0 of PHOS Manager class
5f20d3fb 57// An object of this class does not produce hits nor digits
58// It is the one to use if you do not want to produce outputs in TREEH or TREED
88cb7938 59//
85218d13 60//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
b2a60966 61
d2cf0e38 62
fe4da5cc 63// --- ROOT system ---
d15a28e7 64
88cb7938 65#include <TBRIK.h>
66#include <TFolder.h>
67#include <TGeometry.h>
68#include <TNode.h>
69#include <TROOT.h>
70#include <TRandom.h>
71#include <TTRD1.h>
72#include <TTree.h>
73#include <TVirtualMC.h>
facdea24 74#include <TGeoPhysicalNode.h>
2aebba19 75#include <TGeoManager.h>
facdea24 76#include <TVector3.h>
81e92872 77
d15a28e7 78// --- Standard library ---
79
88cb7938 80#include <string.h>
81#include <stdlib.h>
82
d15a28e7 83// --- AliRoot header files ---
84
88cb7938 85#include "AliConst.h"
86#include "AliPHOSGeometry.h"
87#include "AliPHOSLoader.h"
fe4da5cc 88#include "AliPHOSv0.h"
89#include "AliRun.h"
4951e003 90#include "AliLog.h"
fe4da5cc 91
92ClassImp(AliPHOSv0)
93
d15a28e7 94//____________________________________________________________________________
95AliPHOSv0::AliPHOSv0(const char *name, const char *title):
96 AliPHOS(name,title)
97{
b2a60966 98 // ctor : title is used to identify the layout
bd46a237 99 GetGeometry() ;
d15a28e7 100}
101
d15a28e7 102//____________________________________________________________________________
103void AliPHOSv0::BuildGeometry()
fe4da5cc 104{
b2a60966 105 // Build the PHOS geometry for the ROOT display
106 //BEGIN_HTML
107 /*
108 <H2>
109 PHOS in ALICE displayed by root
110 </H2>
111 <UL>
112 <LI> All Views
113 <P>
114 <CENTER>
115 <IMG Align=BOTTOM ALT="All Views" SRC="../images/AliPHOSv0AllViews.gif">
116 </CENTER></P></LI>
117 <LI> Front View
118 <P>
119 <CENTER>
120 <IMG Align=BOTTOM ALT="Front View" SRC="../images/AliPHOSv0FrontView.gif">
121 </CENTER></P></LI>
122 <LI> 3D View 1
123 <P>
124 <CENTER>
125 <IMG Align=BOTTOM ALT="3D View 1" SRC="../images/AliPHOSv03DView1.gif">
126 </CENTER></P></LI>
127 <LI> 3D View 2
128 <P>
129 <CENTER>
130 <IMG Align=BOTTOM ALT="3D View 2" SRC="../images/AliPHOSv03DView2.gif">
131 </CENTER></P></LI>
132 </UL>
133 */
134 //END_HTML
7367f709 135
85218d13 136 this->BuildGeometryforEMC() ;
137 this->BuildGeometryforCPV() ;
138
fe4da5cc 139}
d15a28e7 140
141//____________________________________________________________________________
85218d13 142void AliPHOSv0:: BuildGeometryforEMC(void)
d15a28e7 143{
85218d13 144 // Build the PHOS-EMC geometry for the ROOT display
145
d15a28e7 146 const Int_t kColorPHOS = kRed ;
147 const Int_t kColorXTAL = kBlue ;
85218d13 148
a8c47ab6 149 Double_t const kRADDEG = 180.0 / TMath::Pi() ;
85218d13 150
7367f709 151 AliPHOSGeometry * geom = GetGeometry() ;
85218d13 152 AliPHOSEMCAGeometry * emcg = geom->GetEMCAGeometry() ;
153 Float_t * boxparams = emcg->GetEMCParams() ;
7367f709 154
85218d13 155 new TTRD1("OuterBox", "PHOS box", "void",boxparams[0],boxparams[1],boxparams[2], boxparams[3] );
156
d15a28e7 157
d15a28e7 158 // Crystals Box
d15a28e7 159
85218d13 160 Float_t * cribox = emcg->GetInnerThermoHalfSize() ;
161 new TBRIK( "CrystalsBox", "PHOS crystals box", "void", cribox[0], cribox[2], cribox[1] ) ;
162
163 // position PHOS into ALICE
164
165 Float_t r = geom->GetIPtoOuterCoverDistance() + boxparams[3] ;
d15a28e7 166 Int_t number = 988 ;
92862013 167 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
85218d13 168
d15a28e7 169 char * nodename = new char[20] ;
170 char * rotname = new char[20] ;
171
85218d13 172 new TRotMatrix("cribox", "cribox", 90, 0, 90, 90, 0, 0);
d15a28e7 173
85218d13 174 for( Int_t i = 1; i <= geom->GetNModules(); i++ ) {
d15a28e7 175
7367f709 176 Float_t angle = geom->GetPHOSAngle(i) ;
85218d13 177 sprintf(rotname, "%s%d", "rot", number++) ;
178 new TRotMatrix(rotname, rotname, 90, angle, 0, 0, 90, 270 + angle);
179
92862013 180 top->cd();
85218d13 181 sprintf(nodename,"%s%d", "Module", i) ;
92862013 182 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
183 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
85218d13 184 TNode * outerboxnode = new TNode(nodename, nodename, "OuterBox", x, y, 0, rotname ) ;
185 outerboxnode->SetLineColor(kColorPHOS) ;
186 fNodes->Add(outerboxnode) ;
187 outerboxnode->cd() ;
188
189 Float_t z = -boxparams[3] - geom->GetIPtoOuterCoverDistance() +
190 cribox[1] + geom->GetIPtoCrystalSurface() ;
191 TNode * crystalsboxnode = new TNode(nodename, nodename, "CrystalsBox", 0, 0, z) ;
192 crystalsboxnode->SetLineColor(kColorXTAL) ;
193 fNodes->Add(crystalsboxnode) ;
194 }
31aa6d6c 195
85218d13 196 delete[] rotname ;
197 delete[] nodename ;
fe4da5cc 198}
199
85218d13 200
bacd0b23 201//____________________________________________________________________________
202void AliPHOSv0:: BuildGeometryforCPV(void)
203{
204 // Build the PHOS-CPV geometry for the ROOT display
205 // Author: Yuri Kharlov 11 September 2000
206 //
207 //BEGIN_HTML
208 /*
209 <H2>
210 CPV displayed by root
211 </H2>
212 <table width=700>
213
214 <tr>
215 <td>CPV perspective view</td>
216 <td>CPV front view </td>
217 </tr>
218
219 <tr>
220 <td> <img height=300 width=290 src="../images/CPVRootPersp.gif"> </td>
221 <td> <img height=300 width=290 src="../images/CPVRootFront.gif"> </td>
222 </tr>
223
224 </table>
225
226 */
227 //END_HTML
228
a8c47ab6 229 const Double_t kRADDEG = 180.0 / TMath::Pi() ;
bacd0b23 230 const Int_t kColorCPV = kGreen ;
231 const Int_t kColorFrame = kYellow ;
232 const Int_t kColorGassiplex = kRed;
233 const Int_t kColorPCB = kCyan;
234
7367f709 235 AliPHOSGeometry * geom = GetGeometry() ;
236
bacd0b23 237 // Box for a full PHOS module
238
7367f709 239 new TBRIK ("CPVBox", "CPV box", "void", geom->GetCPVBoxSize(0)/2,
240 geom->GetCPVBoxSize(1)/2,
241 geom->GetCPVBoxSize(2)/2 );
242 new TBRIK ("CPVFrameLR", "CPV frame Left-Right", "void", geom->GetCPVFrameSize(0)/2,
243 geom->GetCPVFrameSize(1)/2,
244 geom->GetCPVBoxSize(2)/2 );
245 new TBRIK ("CPVFrameUD", "CPV frame Up-Down", "void", geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0),
246 geom->GetCPVFrameSize(1)/2,
247 geom->GetCPVFrameSize(2)/2);
248 new TBRIK ("CPVPCB", "CPV PCB", "void", geom->GetCPVActiveSize(0)/2,
249 geom->GetCPVTextoliteThickness()/2,
250 geom->GetCPVActiveSize(1)/2);
251 new TBRIK ("CPVGassiplex", "CPV Gassiplex PCB", "void", geom->GetGassiplexChipSize(0)/2,
252 geom->GetGassiplexChipSize(1)/2,
253 geom->GetGassiplexChipSize(2)/2);
bacd0b23 254
255 // position CPV into ALICE
256
257 char * nodename = new char[25] ;
258 char * rotname = new char[25] ;
259
7367f709 260 Float_t r = geom->GetIPtoCPVDistance() + geom->GetCPVBoxSize(1) / 2.0 ;
bacd0b23 261 Int_t number = 988 ;
262 TNode * top = gAlice->GetGeometry()->GetNode("alice") ;
ed4205d8 263
264 Int_t lastModule = 0 ;
85218d13 265 lastModule = geom->GetNModules();
ed4205d8 266
267 for( Int_t i = 1; i <= lastModule; i++ ) { // the number of PHOS modules
85218d13 268
bacd0b23 269 // One CPV module
85218d13 270
7367f709 271 Float_t angle = geom->GetPHOSAngle(i) ;
ed4205d8 272 sprintf(rotname, "%s%d", "rotg", number+i) ;
bacd0b23 273 new TRotMatrix(rotname, rotname, 90, angle, 90, 90 + angle, 0, 0);
274 top->cd();
275 sprintf(nodename, "%s%d", "CPVModule", i) ;
276 Float_t x = r * TMath::Sin( angle / kRADDEG ) ;
277 Float_t y = -r * TMath::Cos( angle / kRADDEG ) ;
278 Float_t z;
279 TNode * cpvBoxNode = new TNode(nodename , nodename ,"CPVBox", x, y, 0, rotname ) ;
280 cpvBoxNode->SetLineColor(kColorCPV) ;
281 fNodes->Add(cpvBoxNode) ;
282 cpvBoxNode->cd() ;
283
284 // inside each CPV box:
285
286 // Frame around CPV
cd461ab8 287 Int_t j;
288 for (j=0; j<=1; j++) {
bacd0b23 289 sprintf(nodename, "CPVModule%d Frame%d", i, j+1) ;
7367f709 290 x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->GetCPVFrameSize(0)) / 2;
bacd0b23 291 TNode * cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameLR", x, 0, 0) ;
292 cpvFrameNode->SetLineColor(kColorFrame) ;
293 fNodes->Add(cpvFrameNode) ;
294
295 sprintf(nodename, "CPVModule%d Frame%d", i, j+3) ;
7367f709 296 z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
bacd0b23 297 cpvFrameNode = new TNode(nodename , nodename ,"CPVFrameUD", 0, 0, z) ;
298 cpvFrameNode->SetLineColor(kColorFrame) ;
299 fNodes->Add(cpvFrameNode) ;
300 }
301
302 // 4 printed circuit boards
cd461ab8 303 for (j=0; j<4; j++) {
bacd0b23 304 sprintf(nodename, "CPVModule%d PCB%d", i, j+1) ;
7367f709 305 y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(j) + geom->GetCPVTextoliteThickness()/2;
bacd0b23 306 TNode * cpvPCBNode = new TNode(nodename , nodename ,"CPVPCB", 0, y, 0) ;
307 cpvPCBNode->SetLineColor(kColorPCB) ;
308 fNodes->Add(cpvPCBNode) ;
309 }
310
311 // Gassiplex chips
7367f709 312 Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
313 Float_t zStep = geom->GetCPVActiveSize(1) / (geom->GetNumberOfCPVChipsZ() + 1);
314 y = geom->GetCPVFrameSize(1)/2 - geom->GetFTPosition(0) +
315 geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
316 for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
317 x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
318 for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
319 z = zStep * (iz+1) - geom->GetCPVActiveSize(1)/2;
bacd0b23 320 sprintf(nodename, "CPVModule%d Chip(%dx%d)", i, ix+1,iz+1) ;
321 TNode * cpvGassiplexNode = new TNode(nodename , nodename ,"CPVGassiplex", x, y, z) ;
322 cpvGassiplexNode->SetLineColor(kColorGassiplex) ;
323 fNodes->Add(cpvGassiplexNode) ;
324 }
325 }
326
327 } // PHOS modules
328
329 delete[] rotname ;
330 delete[] nodename ;
331}
332
d15a28e7 333//____________________________________________________________________________
fe4da5cc 334void AliPHOSv0::CreateGeometry()
335{
b2a60966 336 // Create the PHOS geometry for Geant
d15a28e7 337
7a9d98f9 338 AliPHOSv0 *phostmp = dynamic_cast<AliPHOSv0*>(gAlice->GetModule("PHOS")) ;
d15a28e7 339
92862013 340 if ( phostmp == NULL ) {
d15a28e7 341
342 fprintf(stderr, "PHOS detector not found!\n") ;
343 return;
fe4da5cc 344
d15a28e7 345 }
7367f709 346
347 AliPHOSGeometry * geom = GetGeometry() ;
348
d15a28e7 349 // Get pointer to the array containing media indeces
92862013 350 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 351
85218d13 352 // Create a PHOS module.
d15a28e7 353
85218d13 354 gMC->Gsvolu("PHOS", "TRD1", idtmed[798], geom->GetPHOSParams(), 4) ;
d15a28e7 355
85218d13 356 this->CreateGeometryforEMC() ;
ed4205d8 357
9d1b528b 358 if (strstr(fTitle.Data(),"noCPV") == 0)
359 this->CreateGeometryforCPV() ;
85218d13 360
b73f246d 361 this->CreateGeometryforSupport() ;
d15a28e7 362
363 // --- Position PHOS mdules in ALICE setup ---
364
92862013 365 Int_t idrotm[99] ;
05d33a3d 366 Int_t iXYZ,iAngle;
367 for (Int_t iModule = 0; iModule < geom->GetNModules(); iModule++ ) {
d15a28e7 368
05d33a3d 369 Float_t angle[3][2];
370 for (iXYZ=0; iXYZ<3; iXYZ++)
371 for (iAngle=0; iAngle<2; iAngle++)
372 angle[iXYZ][iAngle] = geom->GetModuleAngle(iModule,iXYZ, iAngle);
373 AliMatrix(idrotm[iModule],
374 angle[0][0],angle[0][1],
375 angle[1][0],angle[1][1],
376 angle[2][0],angle[2][1]) ;
85218d13 377
05d33a3d 378 Float_t pos[3];
379 for (iXYZ=0; iXYZ<3; iXYZ++)
380 pos[iXYZ] = geom->GetModuleCenter(iModule,iXYZ);
381 gMC->Gspos("PHOS", iModule+1, "ALIC", pos[0], pos[1], pos[2],
382 idrotm[iModule], "ONLY") ;
383 }
ed4205d8 384
fe4da5cc 385}
d15a28e7 386
387//____________________________________________________________________________
85218d13 388void AliPHOSv0::CreateGeometryforEMC()
d15a28e7 389{
b2a60966 390 // Create the PHOS-EMC geometry for GEANT
85218d13 391 // Author: Dmitri Peressounko August 2001
392 // The used coordinate system:
393 // 1. in Module: X along longer side, Y out of beam, Z along shorter side (along beam)
394 // 2. In Strip the same: X along longer side, Y out of beam, Z along shorter side (along beam)
395
396
b2a60966 397 //BEGIN_HTML
398 /*
399 <H2>
400 Geant3 geometry tree of PHOS-EMC in ALICE
401 </H2>
402 <P><CENTER>
403 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/EMCinAlice.gif">
404 </CENTER><P>
405 */
406 //END_HTML
407
408 // Get pointer to the array containing media indexes
92862013 409 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
d15a28e7 410
7367f709 411 AliPHOSGeometry * geom = GetGeometry() ;
85218d13 412 AliPHOSEMCAGeometry * emcg = geom->GetEMCAGeometry() ;
7367f709 413
85218d13 414 // ======= Define the strip ===============
d15a28e7 415
85218d13 416 gMC->Gsvolu("PSTR", "BOX ", idtmed[716], emcg->GetStripHalfSize(), 3) ; //Made of stell
d15a28e7 417
978b14f4 418 // --- define steel volume (cell of the strip unit)
419 gMC->Gsvolu("PCEL", "BOX ", idtmed[716], emcg->GetSteelCellHalfSize(), 3);
d15a28e7 420
978b14f4 421 // --- define wrapped crystal and put it into steel cell
d15a28e7 422
85218d13 423 gMC->Gsvolu("PWRA", "BOX ", idtmed[702], emcg->GetWrappedHalfSize(), 3);
424 Float_t * pin = emcg->GetAPDHalfSize() ;
425 Float_t * preamp = emcg->GetPreampHalfSize() ;
426 Float_t y = (emcg->GetAirGapLed()-2*pin[1]-2*preamp[1])/2;
427 gMC->Gspos("PWRA", 1, "PCEL", 0.0, y, 0.0, 0, "ONLY") ;
428
978b14f4 429 // --- Define crystal and put it into wrapped crystall ---
85218d13 430 gMC->Gsvolu("PXTL", "BOX ", idtmed[699], emcg->GetCrystalHalfSize(), 3) ;
431 gMC->Gspos("PXTL", 1, "PWRA", 0.0, 0.0, 0.0, 0, "ONLY") ;
432
433 // --- define APD/PIN preamp and put it into AirCell
fe4da5cc 434
85218d13 435 gMC->Gsvolu("PPIN", "BOX ", idtmed[705], emcg->GetAPDHalfSize(), 3) ;
436 Float_t * crystal = emcg->GetCrystalHalfSize() ;
437 y = crystal[1] + emcg->GetAirGapLed() /2 - preamp[1];
438 gMC->Gspos("PPIN", 1, "PCEL", 0.0, y, 0.0, 0, "ONLY") ;
439
440 gMC->Gsvolu("PREA", "BOX ", idtmed[711], emcg->GetPreampHalfSize(), 3) ; // Here I assumed preamp
441 // as a printed Circuit
442 y = crystal[1] + emcg->GetAirGapLed() /2 + pin[1] ; // May it should be changed
443 gMC->Gspos("PREA", 1, "PCEL", 0.0, y, 0.0, 0, "ONLY") ; // to ceramics?
d15a28e7 444
d15a28e7 445
978b14f4 446 // --- Fill strip with wrapped cristals in steel cells
b2a60966 447
85218d13 448 Float_t* splate = emcg->GetSupportPlateHalfSize();
449 y = -splate[1] ;
978b14f4 450 Float_t* acel = emcg->GetSteelCellHalfSize() ;
331c963c 451
452 for(Int_t lev = 2, icel = 1; icel <= emcg->GetNCellsXInStrip()*emcg->GetNCellsZInStrip(); icel += 2, lev += 2){
453 Float_t x = (2*(lev / 2) - 1 - emcg->GetNCellsXInStrip())* acel[0] ;
454 Float_t z = acel[2];
455 gMC->Gspos("PCEL", icel, "PSTR", x, y, +z, 0, "ONLY") ;
456 gMC->Gspos("PCEL", icel + 1, "PSTR", x, y, -z, 0, "ONLY") ;
85218d13 457 }
7367f709 458
85218d13 459 // --- define the support plate, hole in it and position it in strip ----
460 gMC->Gsvolu("PSUP", "BOX ", idtmed[701], emcg->GetSupportPlateHalfSize(), 3) ;
7367f709 461
85218d13 462 gMC->Gsvolu("PSHO", "BOX ", idtmed[798], emcg->GetSupportPlateInHalfSize(), 3) ;
463 Float_t z = emcg->GetSupportPlateThickness()/2 ;
464 gMC->Gspos("PSHO", 1, "PSUP", 0.0, 0.0, z, 0, "ONLY") ;
fe4da5cc 465
85218d13 466 y = acel[1] ;
467 gMC->Gspos("PSUP", 1, "PSTR", 0.0, y, 0.0, 0, "ONLY") ;
d15a28e7 468
d15a28e7 469
85218d13 470 // ========== Fill module with strips and put them into inner thermoinsulation=============
471 gMC->Gsvolu("PTII", "BOX ", idtmed[706], emcg->GetInnerThermoHalfSize(), 3) ;
d15a28e7 472
85218d13 473 Float_t * inthermo = emcg->GetInnerThermoHalfSize() ;
474 Float_t * strip = emcg->GetStripHalfSize() ;
475 y = inthermo[1] - strip[1] ;
476 Int_t irow;
477 Int_t nr = 1 ;
478 Int_t icol ;
d15a28e7 479
85218d13 480 for(irow = 0; irow < emcg->GetNStripX(); irow ++){
481 Float_t x = (2*irow + 1 - emcg->GetNStripX())* strip[0] ;
482 for(icol = 0; icol < emcg->GetNStripZ(); icol ++){
483 z = (2*icol + 1 - emcg->GetNStripZ()) * strip[2] ;
484 gMC->Gspos("PSTR", nr, "PTII", x, y, z, 0, "ONLY") ;
485 nr++ ;
486 }
487 }
488
d15a28e7 489
85218d13 490 // ------- define the air gap between thermoinsulation and cooler
491 gMC->Gsvolu("PAGA", "BOX ", idtmed[798], emcg->GetAirGapHalfSize(), 3) ;
492 Float_t * agap = emcg->GetAirGapHalfSize() ;
493 y = agap[1] - inthermo[1] ;
494
495 gMC->Gspos("PTII", 1, "PAGA", 0.0, y, 0.0, 0, "ONLY") ;
d15a28e7 496
d15a28e7 497
d15a28e7 498
85218d13 499 // ------- define the Al passive cooler
500 gMC->Gsvolu("PCOR", "BOX ", idtmed[701], emcg->GetCoolerHalfSize(), 3) ;
501 Float_t * cooler = emcg->GetCoolerHalfSize() ;
502 y = cooler[1] - agap[1] ;
503
504 gMC->Gspos("PAGA", 1, "PCOR", 0.0, y, 0.0, 0, "ONLY") ;
d15a28e7 505
85218d13 506 // ------- define the outer thermoinsulating cover
507 gMC->Gsvolu("PTIO", "TRD1", idtmed[706], emcg->GetOuterThermoParams(), 4) ;
508 Float_t * outparams = emcg->GetOuterThermoParams() ;
d15a28e7 509
85218d13 510 Int_t idrotm[99] ;
511 AliMatrix(idrotm[1], 90.0, 0.0, 0.0, 0.0, 90.0, 270.0) ;
512 // Frame in outer thermoinsulation and so on: z out of beam, y along beam, x across beam
d15a28e7 513
85218d13 514 z = outparams[3] - cooler[1] ;
515 gMC->Gspos("PCOR", 1, "PTIO", 0., 0.0, z, idrotm[1], "ONLY") ;
516
517 // -------- Define the outer Aluminium cover -----
518 gMC->Gsvolu("PCOL", "TRD1", idtmed[701], emcg->GetAlCoverParams(), 4) ;
519 Float_t * covparams = emcg->GetAlCoverParams() ;
520 z = covparams[3] - outparams[3] ;
521 gMC->Gspos("PTIO", 1, "PCOL", 0., 0.0, z, 0, "ONLY") ;
522
523 // --------- Define front fiberglass cover -----------
524 gMC->Gsvolu("PFGC", "BOX ", idtmed[717], emcg->GetFiberGlassHalfSize(), 3) ;
525 z = - outparams[3] ;
526 gMC->Gspos("PFGC", 1, "PCOL", 0., 0.0, z, 0, "ONLY") ;
527
528 //=============This is all with cold section==============
529
530
531 //------ Warm Section --------------
532 gMC->Gsvolu("PWAR", "BOX ", idtmed[701], emcg->GetWarmAlCoverHalfSize(), 3) ;
533 Float_t * warmcov = emcg->GetWarmAlCoverHalfSize() ;
534
535 // --- Define the outer thermoinsulation ---
536 gMC->Gsvolu("PWTI", "BOX ", idtmed[706], emcg->GetWarmThermoHalfSize(), 3) ;
537 Float_t * warmthermo = emcg->GetWarmThermoHalfSize() ;
538 z = -warmcov[2] + warmthermo[2] ;
539
540 gMC->Gspos("PWTI", 1, "PWAR", 0., 0.0, z, 0, "ONLY") ;
541
542 // --- Define cables area and put in it T-supports ----
543 gMC->Gsvolu("PCA1", "BOX ", idtmed[718], emcg->GetTCables1HalfSize(), 3) ;
544 Float_t * cbox = emcg->GetTCables1HalfSize() ;
545
546 gMC->Gsvolu("PBE1", "BOX ", idtmed[701], emcg->GetTSupport1HalfSize(), 3) ;
547 Float_t * beams = emcg->GetTSupport1HalfSize() ;
548 Int_t isup ;
549 for(isup = 0; isup < emcg->GetNTSuppots(); isup++){
550 Float_t x = -cbox[0] + beams[0] + (2*beams[0]+emcg->GetTSupportDist())*isup ;
551 gMC->Gspos("PBE1", isup, "PCA1", x, 0.0, 0.0, 0, "ONLY") ;
552 }
d15a28e7 553
85218d13 554 z = -warmthermo[2] + cbox[2] ;
555 gMC->Gspos("PCA1", 1, "PWTI", 0.0, 0.0, z, 0, "ONLY") ;
d15a28e7 556
85218d13 557 gMC->Gsvolu("PCA2", "BOX ", idtmed[718], emcg->GetTCables2HalfSize(), 3) ;
558 Float_t * cbox2 = emcg->GetTCables2HalfSize() ;
d15a28e7 559
85218d13 560 gMC->Gsvolu("PBE2", "BOX ", idtmed[701], emcg->GetTSupport2HalfSize(), 3) ;
561 for(isup = 0; isup < emcg->GetNTSuppots(); isup++){
562 Float_t x = -cbox[0] + beams[0] + (2*beams[0]+emcg->GetTSupportDist())*isup ;
563 gMC->Gspos("PBE2", isup, "PCA2", x, 0.0, 0.0, 0, "ONLY") ;
564 }
d15a28e7 565
85218d13 566 z = -warmthermo[2] + 2*cbox[2] + cbox2[2];
567 gMC->Gspos("PCA2", 1, "PWTI", 0.0, 0.0, z, 0, "ONLY") ;
d15a28e7 568
d15a28e7 569
85218d13 570 // --- Define frame ---
571 gMC->Gsvolu("PFRX", "BOX ", idtmed[716], emcg->GetFrameXHalfSize(), 3) ;
572 Float_t * posit = emcg->GetFrameXPosition() ;
573 gMC->Gspos("PFRX", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
574 gMC->Gspos("PFRX", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
d15a28e7 575
85218d13 576 gMC->Gsvolu("PFRZ", "BOX ", idtmed[716], emcg->GetFrameZHalfSize(), 3) ;
577 posit = emcg->GetFrameZPosition() ;
578 gMC->Gspos("PFRZ", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
579 gMC->Gspos("PFRZ", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
d15a28e7 580
85218d13 581 // --- Define Fiber Glass support ---
582 gMC->Gsvolu("PFG1", "BOX ", idtmed[717], emcg->GetFGupXHalfSize(), 3) ;
583 posit = emcg->GetFGupXPosition() ;
584 gMC->Gspos("PFG1", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
585 gMC->Gspos("PFG1", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
d15a28e7 586
85218d13 587 gMC->Gsvolu("PFG2", "BOX ", idtmed[717], emcg->GetFGupZHalfSize(), 3) ;
588 posit = emcg->GetFGupZPosition() ;
589 gMC->Gspos("PFG2", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
590 gMC->Gspos("PFG2", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
d15a28e7 591
85218d13 592 gMC->Gsvolu("PFG3", "BOX ", idtmed[717], emcg->GetFGlowXHalfSize(), 3) ;
593 posit = emcg->GetFGlowXPosition() ;
594 gMC->Gspos("PFG3", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
595 gMC->Gspos("PFG3", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
d15a28e7 596
85218d13 597 gMC->Gsvolu("PFG4", "BOX ", idtmed[717], emcg->GetFGlowZHalfSize(), 3) ;
598 posit = emcg->GetFGlowZPosition() ;
599 gMC->Gspos("PFG4", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
600 gMC->Gspos("PFG4", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
d15a28e7 601
85218d13 602 // --- Define Air Gap for FEE electronics -----
d15a28e7 603
85218d13 604 gMC->Gsvolu("PAFE", "BOX ", idtmed[798], emcg->GetFEEAirHalfSize(), 3) ;
605 posit = emcg->GetFEEAirPosition() ;
606 gMC->Gspos("PAFE", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
d15a28e7 607
85218d13 608 // Define the EMC module volume and combine Cool and Warm sections
d15a28e7 609
85218d13 610 gMC->Gsvolu("PEMC", "TRD1", idtmed[798], emcg->GetEMCParams(), 4) ;
d15a28e7 611
85218d13 612 z = - warmcov[2] ;
613 gMC->Gspos("PCOL", 1, "PEMC", 0., 0., z, 0, "ONLY") ;
614 z = covparams[3] ;
615 gMC->Gspos("PWAR", 1, "PEMC", 0., 0., z, 0, "ONLY") ;
d15a28e7 616
d15a28e7 617
85218d13 618 // Put created EMC geometry into PHOS volume
619
620 z = geom->GetCPVBoxSize(1) / 2. ;
621 gMC->Gspos("PEMC", 1, "PHOS", 0., 0., z, 0, "ONLY") ;
622
fe4da5cc 623}
624
bacd0b23 625//____________________________________________________________________________
626void AliPHOSv0::CreateGeometryforCPV()
627{
628 // Create the PHOS-CPV geometry for GEANT
629 // Author: Yuri Kharlov 11 September 2000
bacd0b23 630 //BEGIN_HTML
631 /*
632 <H2>
633 Geant3 geometry of PHOS-CPV in ALICE
634 </H2>
635 <table width=700>
636
637 <tr>
638 <td>CPV perspective view</td>
639 <td>CPV front view </td>
640 </tr>
641
642 <tr>
643 <td> <img height=300 width=290 src="../images/CPVallPersp.gif"> </td>
644 <td> <img height=300 width=290 src="../images/CPVallFront.gif"> </td>
645 </tr>
646
647 <tr>
648 <td>One CPV module, perspective view </td>
649 <td>One CPV module, front view (extended in vertical direction) </td>
650 </tr>
651
652 <tr>
653 <td><img height=300 width=290 src="../images/CPVmodulePers.gif"></td>
654 <td><img height=300 width=290 src="../images/CPVmoduleSide.gif"></td>
655 </tr>
656
657 </table>
658
659 <H2>
660 Geant3 geometry tree of PHOS-CPV in ALICE
661 </H2>
662 <center>
663 <img height=300 width=290 src="../images/CPVtree.gif">
664 </center>
665 */
666 //END_HTML
667
668 Float_t par[3], x,y,z;
669
670 // Get pointer to the array containing media indexes
671 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
7367f709 672
673 AliPHOSGeometry * geom = GetGeometry() ;
674
bacd0b23 675 // The box containing all CPV for one PHOS module filled with air
7367f709 676 par[0] = geom->GetCPVBoxSize(0) / 2.0 ;
677 par[1] = geom->GetCPVBoxSize(1) / 2.0 ;
678 par[2] = geom->GetCPVBoxSize(2) / 2.0 ;
13add4de 679 gMC->Gsvolu("PCPV", "BOX ", idtmed[798], par, 3) ;
85218d13 680
681 Float_t * emcParams = geom->GetEMCAGeometry()->GetEMCParams() ;
682 z = - emcParams[3] ;
683 Int_t rotm ;
684 AliMatrix(rotm, 90.,0., 0., 0., 90., 90.) ;
685
686 gMC->Gspos("PCPV", 1, "PHOS", 0.0, 0.0, z, rotm, "ONLY") ;
bacd0b23 687
688 // Gassiplex board
689
7367f709 690 par[0] = geom->GetGassiplexChipSize(0)/2.;
691 par[1] = geom->GetGassiplexChipSize(1)/2.;
692 par[2] = geom->GetGassiplexChipSize(2)/2.;
13add4de 693 gMC->Gsvolu("PCPC","BOX ",idtmed[707],par,3);
bacd0b23 694
695 // Cu+Ni foil covers Gassiplex board
696
7367f709 697 par[1] = geom->GetCPVCuNiFoilThickness()/2;
13add4de 698 gMC->Gsvolu("PCPD","BOX ",idtmed[710],par,3);
7367f709 699 y = -(geom->GetGassiplexChipSize(1)/2 - par[1]);
13add4de 700 gMC->Gspos("PCPD",1,"PCPC",0,y,0,0,"ONLY");
bacd0b23 701
702 // Position of the chip inside CPV
703
7367f709 704 Float_t xStep = geom->GetCPVActiveSize(0) / (geom->GetNumberOfCPVChipsPhi() + 1);
705 Float_t zStep = geom->GetCPVActiveSize(1) / (geom->GetNumberOfCPVChipsZ() + 1);
bacd0b23 706 Int_t copy = 0;
7367f709 707 y = geom->GetCPVFrameSize(1)/2 - geom->GetFTPosition(0) +
708 geom->GetCPVTextoliteThickness() / 2 + geom->GetGassiplexChipSize(1) / 2 + 0.1;
709 for (Int_t ix=0; ix<geom->GetNumberOfCPVChipsPhi(); ix++) {
710 x = xStep * (ix+1) - geom->GetCPVActiveSize(0)/2;
711 for (Int_t iz=0; iz<geom->GetNumberOfCPVChipsZ(); iz++) {
bacd0b23 712 copy++;
7367f709 713 z = zStep * (iz+1) - geom->GetCPVActiveSize(1)/2;
13add4de 714 gMC->Gspos("PCPC",copy,"PCPV",x,y,z,0,"ONLY");
bacd0b23 715 }
716 }
717
718 // Foiled textolite (1 mm of textolite + 50 mkm of Cu + 6 mkm of Ni)
719
7367f709 720 par[0] = geom->GetCPVActiveSize(0) / 2;
721 par[1] = geom->GetCPVTextoliteThickness() / 2;
722 par[2] = geom->GetCPVActiveSize(1) / 2;
13add4de 723 gMC->Gsvolu("PCPF","BOX ",idtmed[707],par,3);
bacd0b23 724
725 // Argon gas volume
726
7367f709 727 par[1] = (geom->GetFTPosition(2) - geom->GetFTPosition(1) - geom->GetCPVTextoliteThickness()) / 2;
13add4de 728 gMC->Gsvolu("PCPG","BOX ",idtmed[715],par,3);
bacd0b23 729
730 for (Int_t i=0; i<4; i++) {
7367f709 731 y = geom->GetCPVFrameSize(1) / 2 - geom->GetFTPosition(i) + geom->GetCPVTextoliteThickness()/2;
13add4de 732 gMC->Gspos("PCPF",i+1,"PCPV",0,y,0,0,"ONLY");
bacd0b23 733 if(i==1){
7367f709 734 y-= (geom->GetFTPosition(2) - geom->GetFTPosition(1)) / 2;
13add4de 735 gMC->Gspos("PCPG",1,"PCPV ",0,y,0,0,"ONLY");
bacd0b23 736 }
737 }
738
739 // Dummy sensitive plane in the middle of argone gas volume
740
741 par[1]=0.001;
13add4de 742 gMC->Gsvolu("PCPQ","BOX ",idtmed[715],par,3);
743 gMC->Gspos ("PCPQ",1,"PCPG",0,0,0,0,"ONLY");
bacd0b23 744
745 // Cu+Ni foil covers textolite
746
7367f709 747 par[1] = geom->GetCPVCuNiFoilThickness() / 2;
13add4de 748 gMC->Gsvolu("PCP1","BOX ",idtmed[710],par,3);
7367f709 749 y = geom->GetCPVTextoliteThickness()/2 - par[1];
13add4de 750 gMC->Gspos ("PCP1",1,"PCPF",0,y,0,0,"ONLY");
bacd0b23 751
752 // Aluminum frame around CPV
753
7367f709 754 par[0] = geom->GetCPVFrameSize(0)/2;
755 par[1] = geom->GetCPVFrameSize(1)/2;
756 par[2] = geom->GetCPVBoxSize(2) /2;
13add4de 757 gMC->Gsvolu("PCF1","BOX ",idtmed[701],par,3);
bacd0b23 758
7367f709 759 par[0] = geom->GetCPVBoxSize(0)/2 - geom->GetCPVFrameSize(0);
760 par[1] = geom->GetCPVFrameSize(1)/2;
761 par[2] = geom->GetCPVFrameSize(2)/2;
13add4de 762 gMC->Gsvolu("PCF2","BOX ",idtmed[701],par,3);
bacd0b23 763
764 for (Int_t j=0; j<=1; j++) {
7367f709 765 x = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(0) - geom->GetCPVFrameSize(0)) / 2;
13add4de 766 gMC->Gspos("PCF1",j+1,"PCPV", x,0,0,0,"ONLY");
7367f709 767 z = TMath::Sign(1,2*j-1) * (geom->GetCPVBoxSize(2) - geom->GetCPVFrameSize(2)) / 2;
13add4de 768 gMC->Gspos("PCF2",j+1,"PCPV",0, 0,z,0,"ONLY");
bacd0b23 769 }
770
771}
772
773
6a5795b4 774//____________________________________________________________________________
775void AliPHOSv0::CreateGeometryforSupport()
776{
777 // Create the PHOS' support geometry for GEANT
778 //BEGIN_HTML
779 /*
780 <H2>
781 Geant3 geometry of the PHOS's support
782 </H2>
783 <P><CENTER>
784 <IMG Align=BOTTOM ALT="EMC geant tree" SRC="../images/PHOS_support.gif">
785 </CENTER><P>
786 */
787 //END_HTML
788
789 Float_t par[5], x0,y0,z0 ;
790 Int_t i,j,copy;
791
792 // Get pointer to the array containing media indexes
793 Int_t *idtmed = fIdtmed->GetArray() - 699 ;
794
7367f709 795 AliPHOSGeometry * geom = GetGeometry() ;
796
6a5795b4 797 // --- Dummy box containing two rails on which PHOS support moves
798 // --- Put these rails to the bottom of the L3 magnet
799
7367f709 800 par[0] = geom->GetRailRoadSize(0) / 2.0 ;
801 par[1] = geom->GetRailRoadSize(1) / 2.0 ;
802 par[2] = geom->GetRailRoadSize(2) / 2.0 ;
6a5795b4 803 gMC->Gsvolu("PRRD", "BOX ", idtmed[798], par, 3) ;
804
7367f709 805 y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) / 2.0) ;
6a5795b4 806 gMC->Gspos("PRRD", 1, "ALIC", 0.0, y0, 0.0, 0, "ONLY") ;
807
808 // --- Dummy box containing one rail
809
7367f709 810 par[0] = geom->GetRailOuterSize(0) / 2.0 ;
811 par[1] = geom->GetRailOuterSize(1) / 2.0 ;
812 par[2] = geom->GetRailOuterSize(2) / 2.0 ;
6a5795b4 813 gMC->Gsvolu("PRAI", "BOX ", idtmed[798], par, 3) ;
814
815 for (i=0; i<2; i++) {
7367f709 816 x0 = (2*i-1) * geom->GetDistanceBetwRails() / 2.0 ;
6a5795b4 817 gMC->Gspos("PRAI", i, "PRRD", x0, 0.0, 0.0, 0, "ONLY") ;
818 }
819
820 // --- Upper and bottom steel parts of the rail
821
7367f709 822 par[0] = geom->GetRailPart1(0) / 2.0 ;
823 par[1] = geom->GetRailPart1(1) / 2.0 ;
824 par[2] = geom->GetRailPart1(2) / 2.0 ;
6a5795b4 825 gMC->Gsvolu("PRP1", "BOX ", idtmed[716], par, 3) ;
826
7367f709 827 y0 = - (geom->GetRailOuterSize(1) - geom->GetRailPart1(1)) / 2.0 ;
6a5795b4 828 gMC->Gspos("PRP1", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
7367f709 829 y0 = (geom->GetRailOuterSize(1) - geom->GetRailPart1(1)) / 2.0 - geom->GetRailPart3(1);
6a5795b4 830 gMC->Gspos("PRP1", 2, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
831
832 // --- The middle vertical steel parts of the rail
833
7367f709 834 par[0] = geom->GetRailPart2(0) / 2.0 ;
835 par[1] = geom->GetRailPart2(1) / 2.0 ;
836 par[2] = geom->GetRailPart2(2) / 2.0 ;
6a5795b4 837 gMC->Gsvolu("PRP2", "BOX ", idtmed[716], par, 3) ;
838
7367f709 839 y0 = - geom->GetRailPart3(1) / 2.0 ;
6a5795b4 840 gMC->Gspos("PRP2", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
841
842 // --- The most upper steel parts of the rail
843
7367f709 844 par[0] = geom->GetRailPart3(0) / 2.0 ;
845 par[1] = geom->GetRailPart3(1) / 2.0 ;
846 par[2] = geom->GetRailPart3(2) / 2.0 ;
6a5795b4 847 gMC->Gsvolu("PRP3", "BOX ", idtmed[716], par, 3) ;
848
7367f709 849 y0 = (geom->GetRailOuterSize(1) - geom->GetRailPart3(1)) / 2.0 ;
6a5795b4 850 gMC->Gspos("PRP3", 1, "PRAI", 0.0, y0, 0.0, 0, "ONLY") ;
851
852 // --- The wall of the cradle
853 // --- The wall is empty: steel thin walls and air inside
854
85218d13 855 par[1] = TMath::Sqrt(TMath::Power((geom->GetIPtoCPVDistance() + geom->GetOuterBoxSize(3)),2) +
856 TMath::Power((geom->GetOuterBoxSize(1)/2),2))+10. ;
7367f709 857 par[0] = par[1] - geom->GetCradleWall(1) ;
858 par[2] = geom->GetCradleWall(2) / 2.0 ;
859 par[3] = geom->GetCradleWall(3) ;
860 par[4] = geom->GetCradleWall(4) ;
6a5795b4 861 gMC->Gsvolu("PCRA", "TUBS", idtmed[716], par, 5) ;
862
5b5f0a07 863 par[0] += geom->GetCradleWallThickness() ;
7367f709 864 par[1] -= geom->GetCradleWallThickness() ;
865 par[2] -= geom->GetCradleWallThickness() ;
6a5795b4 866 gMC->Gsvolu("PCRE", "TUBS", idtmed[798], par, 5) ;
867 gMC->Gspos ("PCRE", 1, "PCRA", 0.0, 0.0, 0.0, 0, "ONLY") ;
868
869 for (i=0; i<2; i++) {
85218d13 870 z0 = (2*i-1) * (geom->GetOuterBoxSize(2) + geom->GetCradleWall(2) )/ 2.0 ;
871 gMC->Gspos("PCRA", i, "ALIC", 0.0, 0.0, z0, 0, "ONLY") ;
6a5795b4 872 }
873
874 // --- The "wheels" of the cradle
875
7367f709 876 par[0] = geom->GetCradleWheel(0) / 2;
877 par[1] = geom->GetCradleWheel(1) / 2;
878 par[2] = geom->GetCradleWheel(2) / 2;
6a5795b4 879 gMC->Gsvolu("PWHE", "BOX ", idtmed[716], par, 3) ;
880
7367f709 881 y0 = -(geom->GetRailsDistanceFromIP() - geom->GetRailRoadSize(1) -
882 geom->GetCradleWheel(1)/2) ;
6a5795b4 883 for (i=0; i<2; i++) {
85218d13 884 z0 = (2*i-1) * ((geom->GetOuterBoxSize(2) + geom->GetCradleWheel(2))/ 2.0 +
7367f709 885 geom->GetCradleWall(2));
6a5795b4 886 for (j=0; j<2; j++) {
887 copy = 2*i + j;
7367f709 888 x0 = (2*j-1) * geom->GetDistanceBetwRails() / 2.0 ;
6a5795b4 889 gMC->Gspos("PWHE", copy, "ALIC", x0, y0, z0, 0, "ONLY") ;
890 }
891 }
892
893}
894
2aebba19 895//_____________________________________________________________________________
896void AliPHOSv0::AddAlignableVolumes() const
897{
898 //
899 // Create entries for alignable volumes associating the symbolic volume
900 // name with the corresponding volume path. Needs to be syncronized with
901 // eventual changes in the geometry
902 // Alignable volumes are:
903 // 1) PHOS modules as a whole
904 // 2) Cradle
905 // 3) Cradle wheels
906 // 4) Strip units (group of 2x8 crystals)
907
908 TString volpath, symname;
909
910 // Alignable modules
911 // Volume path /ALIC_1/PHOS_<i> => symbolic name /PHOS/Module<i>, <i>=1,2,3,4,5
912
913 TString physModulePath="/ALIC_1/PHOS_";
914 TString symbModuleName="PHOS/Module";
915 Int_t nModules = GetGeometry()->GetNModules();
ac7bf879 916 Double_t rotMatrix[9] ;
2aebba19 917
918 for(Int_t iModule=1; iModule<=nModules; iModule++){
919 volpath = physModulePath;
920 volpath += iModule;
921 symname = symbModuleName;
922 symname += iModule;
923 gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
ac7bf879 924
925 // Creates the Local to Tracking transformation matrix for PHOS modules
926 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data()) ;
927 const char *path = alignableEntry->GetTitle();
928 if (!gGeoManager->cd(path))
929 AliFatal(Form("Volume path %s not valid!",path));
930 TGeoHMatrix *matLtoT = new TGeoHMatrix;
931 matLtoT->SetDx(0.) ;
932 matLtoT->SetDy(0.) ;
933 matLtoT->SetDz(0.) ;
934 //Local to Tracking transformation matrix for PHOS modules:
935 //rotation aroung global Z to -pi/2. x->-y, y->x, z->z.
936 //From PPR-II_1 Chapter 5 p.18 (36 in pdf):
937 // - It is a right handed-Cartesian coordinate system;
938 // - its origin and the z axis coincide with those of the global
939 // ALICE coordinate system;
940 // - the x axis is perpendicular to the sub-detector's `sensitive
941 // plane' (TPC pad row, ITS ladder etc).
942 rotMatrix[0]= 0; rotMatrix[1]=-1; rotMatrix[2]= 0;
943 rotMatrix[3]= 1; rotMatrix[4]= 0; rotMatrix[5]= 0;
944 rotMatrix[6]= 0; rotMatrix[7]= 0; rotMatrix[8]= 1;
945 TGeoRotation rot;
946 rot.SetMatrix(rotMatrix);
947 matLtoT->MultiplyLeft(&rot);
948 alignableEntry->SetMatrix(matLtoT);
949 }
2aebba19 950
a3627590 951 //Aligning of CPV should be done for volume PCPV_1
952 symbModuleName="PHOS/Module";
953 for(Int_t iModule=1; iModule<=nModules; iModule++){
954 volpath = physModulePath;
955 volpath += iModule;
956 volpath += "/PCPV_1";
d67a143b 957 // Check the volume path
958 if (!gGeoManager->CheckPath(volpath.Data())) {
959 AliError(Form("Volume path %s not valid!",volpath.Data()));
960 continue;
961 }
962
a3627590 963 symname = symbModuleName;
964 symname += iModule;
965 symname += "/CPV";
966 gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
facdea24 967
968 // Creates the TGeo Local to Tracking transformation matrix ...
969 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data()) ;
970 const char *path = alignableEntry->GetTitle();
971 if (!gGeoManager->cd(path))
972 AliFatal(Form("Volume path %s not valid!",path));
973 TGeoHMatrix *matLtoT = new TGeoHMatrix;
974 matLtoT->SetDx(0.) ;
975 matLtoT->SetDy(0.) ;
976 matLtoT->SetDz(0.) ;
977 rotMatrix[0]= 1; rotMatrix[1]= 0; rotMatrix[2]= 0; //
978 rotMatrix[3]= 0; rotMatrix[4]= 0; rotMatrix[5]= 1; //
979 rotMatrix[6]= 0; rotMatrix[7]= 1; rotMatrix[8]= 0;
980 TGeoRotation rot;
981 rot.SetMatrix(rotMatrix);
982 matLtoT->MultiplyLeft(&rot);
983 TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
984 delete matLtoT;
985 alignableEntry->SetMatrix(matTtoL);
a3627590 986 }
987
988
2aebba19 989 // Alignable cradle walls
990 // Volume path /ALIC_1/PCRA_<i> => symbolic name /PHOS/Cradle<i>, <i>=0,1
991
992 TString physCradlePath="/ALIC_1/PCRA_";
993 TString symbCradleName="PHOS/Cradle";
994 Int_t nCradles = 2;
995
996 for(Int_t iCradle=0; iCradle<nCradles; iCradle++){
997 volpath = physCradlePath;
998 volpath += iCradle;
999 symname = symbCradleName;
1000 symname += iCradle;
1001 gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
1002 }
1003
1004 // Alignable wheels
1005 // Volume path /ALIC_1/PWHE_<i> => symbolic name /PHOS/Wheel<i>, i=0,1,2,3
1006
1007 TString physWheelPath="/ALIC_1/PWHE_";
1008 TString symbWheelName="PHOS/Wheel";
1009 Int_t nWheels = 4;
1010
1011 for(Int_t iWheel=0; iWheel<nWheels; iWheel++){
1012 volpath = physWheelPath;
1013 volpath += iWheel;
1014 symname = symbWheelName;
1015 symname += iWheel;
1016 gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
1017 }
1018
331c963c 1019 //Physical strip path is a combination of: physModulePath + module number +
1020 //physStripPath + strip number == ALIC_1/PHOS_N/..../PSTR_M
1021 const Int_t nStripsX = GetGeometry()->GetEMCAGeometry()->GetNStripX();
1022 const Int_t nStripsZ = GetGeometry()->GetEMCAGeometry()->GetNStripZ();
1023 TString partialPhysStripName(100);
1024 TString fullPhysStripName(100);
1025 TString partialSymbStripName(100);
1026 TString fullSymbStripName(100);
1027
1028 for(Int_t module = 1; module <= nModules; ++module){
1029 partialPhysStripName = physModulePath;
1030 partialPhysStripName += module;
1031 partialPhysStripName += "/PEMC_1/PCOL_1/PTIO_1/PCOR_1/PAGA_1/PTII_1/PSTR_";
1032
1033 partialSymbStripName = symbModuleName;
1034 partialSymbStripName += module;
1035 partialSymbStripName += "/Strip_";
1036
1037 for(Int_t i = 0, ind1D = 1; i < nStripsX; ++i){//ind1D starts from 1 (PSTR_1...PSTR_224...)
1038 for(Int_t j = 0; j < nStripsZ; ++j, ++ind1D){
1039 fullPhysStripName = partialPhysStripName;
1040 fullPhysStripName += ind1D;
1041
1042 fullSymbStripName = partialSymbStripName;
1043 fullSymbStripName += i;//ind1D;
1044 fullSymbStripName += '_';
1045 fullSymbStripName += j;
1046
1047 gGeoManager->SetAlignableEntry(fullSymbStripName.Data(), fullPhysStripName.Data());
facdea24 1048
1049 // Creates the TGeo Local to Tracking transformation matrix ...
1050 TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(fullSymbStripName.Data()) ;
1051 const char *path = alignableEntry->GetTitle();
1052 if (!gGeoManager->cd(path))
1053 AliFatal(Form("Volume path %s not valid!",path));
1054 TGeoHMatrix matLtoT = *gGeoManager->GetCurrentMatrix() ;
1055 Double_t refl[3]={-1.,-1.,-1.} ;
1056 matLtoT.SetScale(refl) ;
1057 TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT.Inverse());
1058
1059 char phosPath[50] ;
1060 sprintf(phosPath,"/ALIC_1/PHOS_%d",module) ;
1061 if (!gGeoManager->cd(phosPath)){
1062 AliFatal("Geo manager can not find path \n");
1063 }
1064 TGeoHMatrix *mPHOS = gGeoManager->GetCurrentMatrix();
1065 if (mPHOS)
1066 matTtoL->Multiply(mPHOS);
1067 else{
1068 AliFatal("Geo matrixes are not loaded \n") ;
1069 }
1070 //Switch y<->z
1071 Double_t rot[9]={1.,0.,0., 0.,1.,0., 0.,0.,1.} ;
1072 matTtoL->SetRotation(rot) ;
1073 alignableEntry->SetMatrix(matTtoL);
1074
1075/*
1076 //Check poisition of corner cell of the strip
1077 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
1078 Int_t relid[4] ;
1079 relid[0] = module ;
1080 relid[1] = 0 ;
1081 Int_t iStrip=ind1D ;
1082 Int_t icell=1 ;
1083 Int_t raw = geom->GetEMCAGeometry()->GetNCellsXInStrip()*((iStrip-1)/geom->GetEMCAGeometry()->GetNStripZ()) +
1084 1 + (icell-1)/geom->GetEMCAGeometry()->GetNCellsZInStrip() ;
1085 Int_t col = geom->GetEMCAGeometry()->GetNCellsZInStrip()*(1+(iStrip-1)%geom->GetEMCAGeometry()->GetNStripZ()) -
1086 (icell-1)%geom->GetEMCAGeometry()->GetNCellsZInStrip() ;
1087 if(col==0) col=geom->GetNZ() ;
1088 relid[2] = raw ;
1089 relid[3] = col ;
1090 Float_t xG,zG ;
1091 geom->RelPosInModule(relid, xG, zG) ;
1092printf("============\n") ;
1093printf("Geometry: x=%f, z=%f \n",xG,zG) ;
1094 Int_t absid ;
1095 geom->RelToAbsNumbering(relid,absid) ;
1096 Double_t pos[3]= {-2.2*3.5,0.0,1.1}; //Position incide the strip (Y coordinalte is not important)
1097 Double_t posC[3]={0.0,0.0,0.}; //Global position
1098
1099 matTtoL->MasterToLocal(pos,posC);
1100printf("Matrix: x=%f, z=%f, y=%f \n",posC[0],posC[2],posC[1]) ;
1101*/
331c963c 1102 }
1103 }
1104 }
2aebba19 1105}
1106
ed4205d8 1107//____________________________________________________________________________
1108Float_t AliPHOSv0::ZMin(void) const
1109{
1110 // Overall dimension of the PHOS (min)
7367f709 1111
1112 AliPHOSGeometry * geom = GetGeometry() ;
1113
85218d13 1114 return -geom->GetOuterBoxSize(2)/2.;
ed4205d8 1115}
1116
1117//____________________________________________________________________________
1118Float_t AliPHOSv0::ZMax(void) const
1119{
1120 // Overall dimension of the PHOS (max)
7367f709 1121
1122 AliPHOSGeometry * geom = GetGeometry() ;
1123
85218d13 1124 return geom->GetOuterBoxSize(2)/2.;
ed4205d8 1125}
1126
d15a28e7 1127//____________________________________________________________________________
1128void AliPHOSv0::Init(void)
1129{
b2a60966 1130 // Just prints an information message
1131
d15a28e7 1132 Int_t i;
1133
4951e003 1134 if(AliLog::GetGlobalDebugLevel()>0) {
21cd0c07 1135 TString st ;
bd46a237 1136 for(i=0;i<35;i++)
21cd0c07 1137 st += "*";
1138 Info("Init", "%s", st.Data()) ;
9e1a0ddb 1139 // Here the PHOS initialisation code (if any!)
bd46a237 1140
7367f709 1141 AliPHOSGeometry * geom = GetGeometry() ;
1142
1143 if (geom!=0)
21cd0c07 1144 Info("Init", "AliPHOS%s: PHOS geometry intialized for %s", Version().Data(), geom->GetName()) ;
9e1a0ddb 1145 else
21cd0c07 1146 Info("Init", "AliPHOS%s: PHOS geometry initialization failed !", Version().Data()) ;
1147
1148 Info("Init", "%s", st.Data()) ;
bd46a237 1149 }
d15a28e7 1150}