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