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