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