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