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