]>
Commit | Line | Data |
---|---|---|
d15a28e7 | 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 | **************************************************************************/ | |
15 | ||
b2a60966 | 16 | /* $Id$ */ |
17 | ||
d15a28e7 | 18 | //_________________________________________________________________________ |
b2a60966 | 19 | // Geometry class for PHOS : singleton |
a3dfe79c | 20 | // PHOS consists of the electromagnetic calorimeter (EMCA) |
21 | // and a charged particle veto either in the Subatech's version (PPSD) | |
22 | // or in the IHEP's one (CPV). | |
23 | // The EMCA/PPSD/CPV modules are parametrized so that any configuration | |
24 | // can be easily implemented | |
25 | // The title is used to identify the version of CPV used. | |
b2a60966 | 26 | // |
27 | //*-- Author: Yves Schutz (SUBATECH) | |
d15a28e7 | 28 | |
29 | // --- ROOT system --- | |
30 | ||
31 | #include "TVector3.h" | |
32 | #include "TRotation.h" | |
fa7cce36 | 33 | #include "TFolder.h" |
34 | #include "TROOT.h" | |
d15a28e7 | 35 | |
36 | // --- Standard library --- | |
37 | ||
de9ec31b | 38 | #include <iostream.h> |
d15a28e7 | 39 | |
40 | // --- AliRoot header files --- | |
41 | ||
42 | #include "AliPHOSGeometry.h" | |
468794ea | 43 | #include "AliPHOSEMCAGeometry.h" |
d15a28e7 | 44 | #include "AliPHOSPpsdRecPoint.h" |
45 | #include "AliConst.h" | |
46 | ||
9ec91567 | 47 | ClassImp(AliPHOSGeometry) ; |
d15a28e7 | 48 | |
a4e98857 | 49 | // these initialisations are needed for a singleton |
9ec91567 | 50 | AliPHOSGeometry * AliPHOSGeometry::fgGeom = 0 ; |
282c5906 | 51 | Bool_t AliPHOSGeometry::fgInit = kFALSE ; |
9ec91567 | 52 | |
d15a28e7 | 53 | //____________________________________________________________________________ |
54 | AliPHOSGeometry::~AliPHOSGeometry(void) | |
55 | { | |
b2a60966 | 56 | // dtor |
57 | ||
52a36ffd | 58 | if (fRotMatrixArray) fRotMatrixArray->Delete() ; |
59 | if (fRotMatrixArray) delete fRotMatrixArray ; | |
60 | if (fPHOSAngle ) delete fPHOSAngle ; | |
61 | } | |
62 | ||
63 | //____________________________________________________________________________ | |
64 | ||
65 | void AliPHOSGeometry::Init(void) | |
66 | { | |
a4e98857 | 67 | // Initializes the PHOS parameters : |
68 | // IHEP is the Protvino CPV (cathode pad chambers) | |
69 | // GPS2 is the Subatech Pre-Shower (two micromegas sandwiching a passive lead converter) | |
70 | // MIXT 4 PHOS modules withe the IHEP CPV qnd one PHOS module with the Subatche Pre-Shower | |
52a36ffd | 71 | |
a4e98857 | 72 | if ( ((strcmp( fName, "GPS2" )) == 0) || |
ed4205d8 | 73 | ((strcmp( fName, "IHEP" )) == 0) || |
74 | ((strcmp( fName, "MIXT" )) == 0) ) { | |
52a36ffd | 75 | fgInit = kTRUE ; |
ed4205d8 | 76 | |
77 | fNModules = 5; | |
78 | fNPPSDModules = 0; | |
79 | fAngle = 20; | |
80 | ||
81 | fGeometryEMCA = new AliPHOSEMCAGeometry(); | |
82 | if ( ((strcmp( fName, "GPS2" )) == 0) ) { | |
83 | fGeometryPPSD = new AliPHOSPPSDGeometry(); | |
84 | fGeometryCPV = 0; | |
85 | fNPPSDModules = fNModules; | |
86 | } | |
87 | else if ( ((strcmp( fName, "IHEP" )) == 0) ) { | |
88 | fGeometryCPV = new AliPHOSCPVGeometry (); | |
89 | fGeometryPPSD = 0; | |
90 | fNPPSDModules = 0; | |
91 | } | |
92 | else if ( ((strcmp( fName, "MIXT" )) == 0) ) { | |
93 | fGeometryCPV = new AliPHOSCPVGeometry (); | |
94 | fGeometryPPSD = new AliPHOSPPSDGeometry(); | |
95 | fNPPSDModules = 1; | |
96 | } | |
97 | fGeometrySUPP = new AliPHOSSupportGeometry(); | |
98 | ||
52a36ffd | 99 | fPHOSAngle = new Float_t[fNModules] ; |
100 | Int_t index ; | |
101 | for ( index = 0; index < fNModules; index++ ) | |
102 | fPHOSAngle[index] = 0.0 ; // Module position angles are set in CreateGeometry() | |
103 | ||
104 | this->SetPHOSAngles() ; | |
105 | fRotMatrixArray = new TObjArray(fNModules) ; | |
fa7cce36 | 106 | |
107 | // post the geometry into the appropriate folder | |
7b7c1533 | 108 | TFolder * folder = (TFolder*)gROOT->FindObjectAny("YSAlice/WhiteBoard/Geometry/PHOS"); |
109 | if ( !folder ) { | |
110 | cerr << "ERROR: AliPHOSGeometry::Init -> No WhiteBoard/Geometry/PHOS found !" << endl ; | |
111 | abort(); | |
112 | } else { | |
fa7cce36 | 113 | folder->SetOwner() ; |
114 | folder->Add(this) ; | |
7b7c1533 | 115 | } |
52a36ffd | 116 | } |
ed4205d8 | 117 | else { |
118 | fgInit = kFALSE ; | |
119 | cout << "PHOS Geometry setup: option not defined " << fName << endl ; | |
120 | } | |
52a36ffd | 121 | } |
122 | ||
2f04ed65 | 123 | //____________________________________________________________________________ |
a4e98857 | 124 | Float_t AliPHOSGeometry::GetCPVBoxSize(Int_t index) const |
125 | { | |
126 | // returns the coarse dimension CPV depending on the CPV option set | |
127 | ||
2f04ed65 | 128 | if (strcmp(fName,"GPS2") ==0 ) |
129 | return fGeometryPPSD->GetCPVBoxSize(index); | |
130 | else if (strcmp(fName,"IHEP")==0) | |
131 | return fGeometryCPV ->GetCPVBoxSize(index); | |
132 | else if (strcmp(fName,"MIXT")==0) | |
133 | return TMath::Max(fGeometryCPV ->GetCPVBoxSize(index), fGeometryPPSD->GetCPVBoxSize(index)); | |
134 | else | |
135 | return 0; | |
136 | } | |
137 | ||
52a36ffd | 138 | //____________________________________________________________________________ |
139 | AliPHOSGeometry * AliPHOSGeometry::GetInstance() | |
140 | { | |
a4e98857 | 141 | // Returns the pointer of the unique instance; singleton specific |
142 | ||
52a36ffd | 143 | return (AliPHOSGeometry *) fgGeom ; |
144 | } | |
145 | ||
146 | //____________________________________________________________________________ | |
147 | AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title) | |
148 | { | |
149 | // Returns the pointer of the unique instance | |
a4e98857 | 150 | // Creates it with the specified options (name, title) if it does not exist yet |
151 | ||
52a36ffd | 152 | AliPHOSGeometry * rv = 0 ; |
153 | if ( fgGeom == 0 ) { | |
154 | if ( strcmp(name,"") == 0 ) | |
155 | rv = 0 ; | |
156 | else { | |
157 | fgGeom = new AliPHOSGeometry(name, title) ; | |
158 | if ( fgInit ) | |
159 | rv = (AliPHOSGeometry * ) fgGeom ; | |
160 | else { | |
161 | rv = 0 ; | |
162 | delete fgGeom ; | |
163 | fgGeom = 0 ; | |
164 | } | |
165 | } | |
166 | } | |
167 | else { | |
168 | if ( strcmp(fgGeom->GetName(), name) != 0 ) { | |
169 | cout << "AliPHOSGeometry <E> : current geometry is " << fgGeom->GetName() << endl | |
170 | << " you cannot call " << name << endl ; | |
171 | } | |
172 | else | |
173 | rv = (AliPHOSGeometry *) fgGeom ; | |
174 | } | |
175 | return rv ; | |
176 | } | |
4697edca | 177 | |
52a36ffd | 178 | //____________________________________________________________________________ |
179 | void AliPHOSGeometry::SetPHOSAngles() | |
180 | { | |
a4e98857 | 181 | // Calculates the position of the PHOS modules in ALICE global coordinate system |
52a36ffd | 182 | |
183 | Double_t const kRADDEG = 180.0 / kPI ; | |
ed4205d8 | 184 | Float_t pphi = 2 * TMath::ATan( GetOuterBoxSize(0) / ( 2.0 * GetIPtoOuterCoverDistance() ) ) ; |
52a36ffd | 185 | pphi *= kRADDEG ; |
ed4205d8 | 186 | if (pphi > fAngle) cout << "AliPHOSGeometry: PHOS modules overlap!\n"; |
187 | pphi = fAngle; | |
52a36ffd | 188 | |
189 | for( Int_t i = 1; i <= fNModules ; i++ ) { | |
ed4205d8 | 190 | Float_t angle = pphi * ( i - fNModules / 2.0 - 0.5 ) ; |
52a36ffd | 191 | fPHOSAngle[i-1] = - angle ; |
192 | } | |
d15a28e7 | 193 | } |
194 | ||
195 | //____________________________________________________________________________ | |
7b7c1533 | 196 | Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * relid) const |
d15a28e7 | 197 | { |
b2a60966 | 198 | // Converts the absolute numbering into the following array/ |
199 | // relid[0] = PHOS Module number 1:fNModules | |
200 | // relid[1] = 0 if PbW04 | |
201 | // = PPSD Module number 1:fNumberOfModulesPhi*fNumberOfModulesZ*2 (2->up and bottom level) | |
202 | // relid[2] = Row number inside a PHOS or PPSD module | |
203 | // relid[3] = Column number inside a PHOS or PPSD module | |
d15a28e7 | 204 | |
205 | Bool_t rv = kTRUE ; | |
92862013 | 206 | Float_t id = AbsId ; |
d15a28e7 | 207 | |
92862013 | 208 | Int_t phosmodulenumber = (Int_t)TMath:: Ceil( id / ( GetNPhi() * GetNZ() ) ) ; |
d15a28e7 | 209 | |
52a36ffd | 210 | if ( phosmodulenumber > GetNModules() ) { // it is a PPSD or CPV pad |
211 | ||
212 | if ( strcmp(fName,"GPS2") == 0 ) { | |
213 | id -= GetNPhi() * GetNZ() * GetNModules() ; | |
214 | Float_t tempo = 2 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; | |
215 | relid[0] = (Int_t)TMath::Ceil( id / tempo ) ; | |
216 | id -= ( relid[0] - 1 ) * tempo ; | |
217 | relid[1] = (Int_t)TMath::Ceil( id / ( GetNumberOfPadsPhi() * GetNumberOfPadsZ() ) ) ; | |
218 | id -= ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; | |
219 | relid[2] = (Int_t)TMath::Ceil( id / GetNumberOfPadsPhi() ) ; | |
220 | relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfPadsPhi() ) ; | |
221 | } | |
222 | else if ( strcmp(fName,"IHEP") == 0 ) { | |
223 | id -= GetNPhi() * GetNZ() * GetNModules() ; | |
ed4205d8 | 224 | Float_t nCPV = GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() ; |
225 | relid[0] = (Int_t) TMath::Ceil( id / nCPV ) ; | |
52a36ffd | 226 | relid[1] = 1 ; |
ed4205d8 | 227 | id -= ( relid[0] - 1 ) * nCPV ; |
228 | relid[2] = (Int_t) TMath::Ceil( id / GetNumberOfCPVPadsZ() ) ; | |
229 | relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfCPVPadsZ() ) ; | |
230 | } | |
231 | else if ( strcmp(fName,"MIXT") == 0 ) { | |
232 | id -= GetNPhi() * GetNZ() * GetNModules() ; | |
233 | Float_t nPPSD = 2 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; | |
234 | Float_t nCPV = GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() ; | |
235 | if (id <= nCPV*GetNCPVModules()) { // this pad belons to CPV | |
236 | relid[0] = (Int_t) TMath::Ceil( id / nCPV ) ; | |
237 | relid[1] = 1 ; | |
238 | id -= ( relid[0] - 1 ) * nCPV ; | |
239 | relid[2] = (Int_t) TMath::Ceil( id / GetNumberOfCPVPadsZ() ) ; | |
240 | relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfCPVPadsZ() ) ; | |
241 | } | |
242 | else { // this pad belons to PPSD | |
243 | id -= nCPV*GetNCPVModules(); | |
244 | relid[0] = (Int_t)TMath::Ceil( id / nPPSD ); | |
245 | id -= ( relid[0] - 1 ) * nPPSD ; | |
246 | relid[0] += GetNCPVModules(); | |
247 | relid[1] = (Int_t)TMath::Ceil( id / ( GetNumberOfPadsPhi() * GetNumberOfPadsZ() ) ) ; | |
248 | id -= ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; | |
249 | relid[2] = (Int_t)TMath::Ceil( id / GetNumberOfPadsPhi() ) ; | |
250 | relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfPadsPhi() ) ; | |
251 | } | |
52a36ffd | 252 | } |
d15a28e7 | 253 | } |
254 | else { // its a PW04 crystal | |
255 | ||
92862013 | 256 | relid[0] = phosmodulenumber ; |
257 | relid[1] = 0 ; | |
258 | id -= ( phosmodulenumber - 1 ) * GetNPhi() * GetNZ() ; | |
259 | relid[2] = (Int_t)TMath::Ceil( id / GetNPhi() ) ; | |
260 | relid[3] = (Int_t)( id - ( relid[2] - 1 ) * GetNPhi() ) ; | |
d15a28e7 | 261 | } |
262 | return rv ; | |
263 | } | |
52a36ffd | 264 | |
9f616d61 | 265 | //____________________________________________________________________________ |
7b7c1533 | 266 | void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt) const |
9f616d61 | 267 | { |
a4e98857 | 268 | // calculates the angular coverage in theta and phi of one EMC (=PHOS) module |
9f616d61 | 269 | |
270 | Double_t conv ; | |
cf0c2bc1 | 271 | if ( opt == Radian() ) |
9f616d61 | 272 | conv = 1. ; |
cf0c2bc1 | 273 | else if ( opt == Degre() ) |
9f616d61 | 274 | conv = 180. / TMath::Pi() ; |
275 | else { | |
276 | cout << "<I> AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ; | |
277 | conv = 1. ; | |
278 | } | |
279 | ||
280 | Float_t phi = GetPHOSAngle(mod) * (TMath::Pi() / 180.) ; | |
92862013 | 281 | Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() |
9f616d61 | 282 | + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; |
283 | ||
92862013 | 284 | Double_t angle = TMath::ATan( GetCrystalSize(0)*GetNPhi() / (2 * y0) ) ; |
9f616d61 | 285 | phi = phi + 1.5 * TMath::Pi() ; // to follow the convention of the particle generator(PHOS is between 230 and 310 deg.) |
92862013 | 286 | Double_t max = phi - angle ; |
287 | Double_t min = phi + angle ; | |
288 | pM = TMath::Max(max, min) * conv ; | |
289 | pm = TMath::Min(max, min) * conv ; | |
9f616d61 | 290 | |
92862013 | 291 | angle = TMath::ATan( GetCrystalSize(2)*GetNZ() / (2 * y0) ) ; |
292 | max = TMath::Pi() / 2. + angle ; // to follow the convention of the particle generator(PHOS is at 90 deg.) | |
293 | min = TMath::Pi() / 2. - angle ; | |
294 | tM = TMath::Max(max, min) * conv ; | |
295 | tm = TMath::Min(max, min) * conv ; | |
9f616d61 | 296 | |
297 | } | |
298 | ||
299 | //____________________________________________________________________________ | |
7b7c1533 | 300 | void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt) const |
9f616d61 | 301 | { |
a4e98857 | 302 | // calculates the angular coverage in theta and phi of a single crystal in a EMC(=PHOS) module |
9f616d61 | 303 | |
304 | Double_t conv ; | |
cf0c2bc1 | 305 | if ( opt == Radian() ) |
9f616d61 | 306 | conv = 1. ; |
cf0c2bc1 | 307 | else if ( opt == Degre() ) |
9f616d61 | 308 | conv = 180. / TMath::Pi() ; |
309 | else { | |
310 | cout << "<I> AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ; | |
311 | conv = 1. ; | |
312 | } | |
313 | ||
92862013 | 314 | Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() |
9f616d61 | 315 | + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; |
92862013 | 316 | theta = 2 * TMath::ATan( GetCrystalSize(2) / (2 * y0) ) * conv ; |
317 | phi = 2 * TMath::ATan( GetCrystalSize(0) / (2 * y0) ) * conv ; | |
9f616d61 | 318 | } |
319 | ||
320 | ||
321 | //____________________________________________________________________________ | |
52a36ffd | 322 | void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) const |
d15a28e7 | 323 | { |
a4e98857 | 324 | // Calculates the coordinates of a RecPoint and the error matrix in the ALICE global coordinate system |
b2a60966 | 325 | |
d15a28e7 | 326 | AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ; |
92862013 | 327 | TVector3 localposition ; |
d15a28e7 | 328 | |
329 | tmpPHOS->GetLocalPosition(gpos) ; | |
330 | ||
331 | ||
332 | if ( tmpPHOS->IsEmc() ) // it is a EMC crystal | |
333 | { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() + | |
334 | GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ; | |
335 | ||
336 | } | |
337 | else | |
338 | { // it is a PPSD pad | |
339 | AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ; | |
340 | if (tmpPpsd->GetUp() ) // it is an upper module | |
341 | { | |
342 | gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - | |
343 | GetLeadToMicro2Gap() - GetLeadConverterThickness() - | |
344 | GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ; | |
345 | } | |
346 | else // it is a lower module | |
347 | gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ; | |
348 | } | |
349 | ||
92862013 | 350 | Float_t phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ; |
351 | Double_t const kRADDEG = 180.0 / kPI ; | |
352 | Float_t rphi = phi / kRADDEG ; | |
d15a28e7 | 353 | |
92862013 | 354 | TRotation rot ; |
355 | rot.RotateZ(-rphi) ; // a rotation around Z by angle | |
d15a28e7 | 356 | |
92862013 | 357 | TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame |
358 | gpos.Transform(rot) ; // rotate the baby | |
6ad0bfa0 | 359 | |
d15a28e7 | 360 | } |
361 | ||
362 | //____________________________________________________________________________ | |
5cda30f6 | 363 | void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const |
d15a28e7 | 364 | { |
a4e98857 | 365 | // Calculates the coordinates of a RecPoint in the ALICE global coordinate system |
b2a60966 | 366 | |
d15a28e7 | 367 | AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ; |
92862013 | 368 | TVector3 localposition ; |
d15a28e7 | 369 | tmpPHOS->GetLocalPosition(gpos) ; |
370 | ||
371 | ||
372 | if ( tmpPHOS->IsEmc() ) // it is a EMC crystal | |
373 | { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() + | |
374 | GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ; | |
375 | } | |
376 | else | |
377 | { // it is a PPSD pad | |
378 | AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ; | |
379 | if (tmpPpsd->GetUp() ) // it is an upper module | |
380 | { | |
381 | gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - | |
382 | GetLeadToMicro2Gap() - GetLeadConverterThickness() - | |
383 | GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ; | |
384 | } | |
385 | else // it is a lower module | |
386 | gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ; | |
387 | } | |
388 | ||
92862013 | 389 | Float_t phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ; |
390 | Double_t const kRADDEG = 180.0 / kPI ; | |
391 | Float_t rphi = phi / kRADDEG ; | |
d15a28e7 | 392 | |
92862013 | 393 | TRotation rot ; |
394 | rot.RotateZ(-rphi) ; // a rotation around Z by angle | |
d15a28e7 | 395 | |
92862013 | 396 | TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame |
397 | gpos.Transform(rot) ; // rotate the baby | |
d15a28e7 | 398 | } |
399 | ||
400 | //____________________________________________________________________________ | |
7b7c1533 | 401 | void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) const |
d15a28e7 | 402 | { |
a4e98857 | 403 | // calculates the impact coordinates on PHOS of a neutral particle |
404 | // emitted in the direction theta and phi in the ALICE global coordinate system | |
d15a28e7 | 405 | |
52a36ffd | 406 | // searches for the PHOS EMC module |
407 | ModuleNumber = 0 ; | |
408 | Double_t tm, tM, pm, pM ; | |
409 | Int_t index = 1 ; | |
410 | while ( ModuleNumber == 0 && index <= GetNModules() ) { | |
411 | EmcModuleCoverage(index, tm, tM, pm, pM) ; | |
412 | if ( (theta >= tm && theta <= tM) && (phi >= pm && phi <= pM ) ) | |
413 | ModuleNumber = index ; | |
414 | index++ ; | |
d15a28e7 | 415 | } |
52a36ffd | 416 | if ( ModuleNumber != 0 ) { |
417 | Float_t phi0 = GetPHOSAngle(ModuleNumber) * (TMath::Pi() / 180.) + 1.5 * TMath::Pi() ; | |
418 | Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() | |
419 | + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; | |
420 | Double_t angle = phi - phi0; | |
421 | x = y0 * TMath::Tan(angle) ; | |
422 | angle = theta - TMath::Pi() / 2 ; | |
423 | z = y0 * TMath::Tan(angle) ; | |
d15a28e7 | 424 | } |
d15a28e7 | 425 | } |
426 | ||
427 | //____________________________________________________________________________ | |
7b7c1533 | 428 | Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId) const |
d15a28e7 | 429 | { |
b2a60966 | 430 | // Converts the relative numbering into the absolute numbering |
ed4205d8 | 431 | // EMCA crystals: |
432 | // AbsId = from 1 to fNModules * fNPhi * fNZ | |
433 | // PPSD gas cell: | |
434 | // AbsId = from N(total EMCA crystals) + 1 | |
435 | // to NCPVModules * fNumberOfCPVPadsPhi * fNumberOfCPVPadsZ + | |
436 | // fNModules * 2 * (fNumberOfModulesPhi * fNumberOfModulesZ) * fNumberOfPadsPhi * fNumberOfPadsZ | |
437 | // CPV pad: | |
438 | // AbsId = from N(total PHOS crystals) + 1 | |
439 | // to NCPVModules * fNumberOfCPVPadsPhi * fNumberOfCPVPadsZ | |
d15a28e7 | 440 | |
441 | Bool_t rv = kTRUE ; | |
442 | ||
ed4205d8 | 443 | if ( relid[1] > 0 && strcmp(fName,"GPS2")==0) { // it is a PPSD pad |
444 | AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from PPSD pads | |
445 | + ( relid[0] - 1 ) * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PPSD modules | |
d15a28e7 | 446 | * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2 |
ed4205d8 | 447 | + ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PPSD modules |
448 | + ( relid[2] - 1 ) * GetNumberOfPadsPhi() // the pads offset of a PPSD row | |
449 | + relid[3] ; // the column number | |
450 | } | |
451 | ||
452 | else if ( relid[1] > 0 && strcmp(fName,"MIXT")==0) { // it is a PPSD pad | |
453 | AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from PPSD pads | |
454 | + GetNCPVModules() * GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() // the pads offset of CPV modules if any | |
455 | + ( relid[0] - 1 - GetNCPVModules()) | |
456 | * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PPSD modules | |
457 | * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2 | |
458 | + ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PPSD modules | |
459 | + ( relid[2] - 1 ) * GetNumberOfPadsPhi() // the pads offset of a PPSD row | |
460 | + relid[3] ; // the column number | |
d15a28e7 | 461 | } |
52a36ffd | 462 | |
463 | else if ( relid[1] == 0 ) { // it is a Phos crystal | |
464 | AbsId = | |
465 | ( relid[0] - 1 ) * GetNPhi() * GetNZ() // the offset of PHOS modules | |
466 | + ( relid[2] - 1 ) * GetNPhi() // the offset of a xtal row | |
467 | + relid[3] ; // the column number | |
d15a28e7 | 468 | } |
469 | ||
52a36ffd | 470 | else if ( relid[1] == -1 ) { // it is a CPV pad |
471 | AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from CPV pads | |
ed4205d8 | 472 | + ( relid[0] - 1 ) * GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() // the pads offset of PHOS modules |
473 | + ( relid[2] - 1 ) * GetNumberOfCPVPadsZ() // the pads offset of a CPV row | |
52a36ffd | 474 | + relid[3] ; // the column number |
475 | } | |
476 | ||
d15a28e7 | 477 | return rv ; |
478 | } | |
479 | ||
480 | //____________________________________________________________________________ | |
481 | ||
7b7c1533 | 482 | void AliPHOSGeometry::RelPosInAlice(const Int_t id, TVector3 & pos ) const |
d15a28e7 | 483 | { |
a4e98857 | 484 | // Converts the absolute numbering into the global ALICE coordinate system |
ed4205d8 | 485 | // It works only for the GPS2 geometry |
b2a60966 | 486 | |
ed4205d8 | 487 | if (id > 0 && strcmp(fName,"GPS2")==0) { |
488 | ||
489 | Int_t relid[4] ; | |
490 | ||
491 | AbsToRelNumbering(id , relid) ; | |
492 | ||
493 | Int_t phosmodule = relid[0] ; | |
494 | ||
495 | Float_t y0 = 0 ; | |
496 | ||
497 | if ( relid[1] == 0 ) { // it is a PbW04 crystal | |
498 | y0 = -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() | |
499 | + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ; | |
500 | } | |
501 | if ( relid[1] > 0 ) { // its a PPSD pad | |
502 | if ( relid[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) { // its an bottom module | |
503 | y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ; | |
504 | } | |
505 | else // its an upper module | |
506 | y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - GetLeadToMicro2Gap() | |
507 | - GetLeadConverterThickness() - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0) ; | |
508 | } | |
509 | ||
510 | Float_t x, z ; | |
511 | RelPosInModule(relid, x, z) ; | |
512 | ||
513 | pos.SetX(x) ; | |
514 | pos.SetZ(z) ; | |
515 | pos.SetY( TMath::Sqrt(x*x + z*z + y0*y0) ) ; | |
516 | ||
517 | ||
518 | ||
519 | Float_t phi = GetPHOSAngle( phosmodule) ; | |
520 | Double_t const kRADDEG = 180.0 / kPI ; | |
521 | Float_t rphi = phi / kRADDEG ; | |
522 | ||
523 | TRotation rot ; | |
524 | rot.RotateZ(-rphi) ; // a rotation around Z by angle | |
525 | ||
526 | TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame | |
527 | ||
528 | pos.Transform(rot) ; // rotate the baby | |
d15a28e7 | 529 | } |
530 | else { | |
ed4205d8 | 531 | pos.SetX(0.); |
532 | pos.SetY(0.); | |
533 | pos.SetZ(0.); | |
534 | } | |
d15a28e7 | 535 | } |
536 | ||
537 | //____________________________________________________________________________ | |
7b7c1533 | 538 | void AliPHOSGeometry::RelPosInModule(const Int_t * relid, Float_t & x, Float_t & z) const |
d15a28e7 | 539 | { |
b2a60966 | 540 | // Converts the relative numbering into the local PHOS-module (x, z) coordinates |
52a36ffd | 541 | // Note: sign of z differs from that in the previous version (Yu.Kharlov, 12 Oct 2000) |
ed4205d8 | 542 | |
543 | Bool_t padOfCPV = (strcmp(fName,"IHEP")==0) || | |
544 | ((strcmp(fName,"MIXT")==0) && relid[0]<=GetNCPVModules()) ; | |
545 | Bool_t padOfPPSD = (strcmp(fName,"GPS2")==0) || | |
546 | ((strcmp(fName,"MIXT")==0) && relid[0]> GetNCPVModules()) ; | |
b2a60966 | 547 | |
92862013 | 548 | Int_t ppsdmodule ; |
a3dfe79c | 549 | Float_t x0,z0; |
52a36ffd | 550 | Int_t row = relid[2] ; //offset along x axiz |
551 | Int_t column = relid[3] ; //offset along z axiz | |
d15a28e7 | 552 | |
ed4205d8 | 553 | Float_t padsizeZ = 0; |
554 | Float_t padsizeX = 0; | |
555 | Int_t nOfPadsPhi = 0; | |
556 | Int_t nOfPadsZ = 0; | |
557 | if ( padOfPPSD ) { | |
558 | padsizeZ = GetPPSDModuleSize(2) / GetNumberOfPadsZ(); | |
559 | padsizeX = GetPPSDModuleSize(0) / GetNumberOfPadsPhi(); | |
560 | nOfPadsPhi = GetNumberOfPadsPhi(); | |
561 | nOfPadsZ = GetNumberOfPadsZ(); | |
562 | } | |
563 | else if ( padOfCPV ) { | |
564 | padsizeZ = GetPadSizeZ(); | |
565 | padsizeX = GetPadSizePhi(); | |
566 | nOfPadsPhi = GetNumberOfCPVPadsPhi(); | |
567 | nOfPadsZ = GetNumberOfCPVPadsZ(); | |
568 | } | |
569 | ||
92862013 | 570 | if ( relid[1] == 0 ) { // its a PbW04 crystal |
52a36ffd | 571 | x = - ( GetNPhi()/2. - row + 0.5 ) * GetCrystalSize(0) ; // position ox Xtal with respect |
572 | z = ( GetNZ() /2. - column + 0.5 ) * GetCrystalSize(2) ; // of center of PHOS module | |
573 | } | |
574 | else { | |
ed4205d8 | 575 | if ( padOfPPSD ) { |
576 | if ( relid[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) | |
577 | ppsdmodule = relid[1]-GetNumberOfModulesPhi() * GetNumberOfModulesZ(); | |
578 | else | |
579 | ppsdmodule = relid[1] ; | |
580 | Int_t modrow = 1+(Int_t)TMath::Ceil( (Float_t)ppsdmodule / GetNumberOfModulesPhi()-1. ) ; | |
581 | Int_t modcol = ppsdmodule - ( modrow - 1 ) * GetNumberOfModulesPhi() ; | |
a3dfe79c | 582 | x0 = ( GetNumberOfModulesPhi() / 2. - modrow + 0.5 ) * GetPPSDModuleSize(0) ; |
583 | z0 = ( GetNumberOfModulesZ() / 2. - modcol + 0.5 ) * GetPPSDModuleSize(2) ; | |
584 | } else { | |
585 | x0 = 0; | |
586 | z0 = 0; | |
587 | } | |
ed4205d8 | 588 | x = - ( nOfPadsPhi/2. - row - 0.5 ) * padsizeX + x0 ; // position of pad with respect |
589 | z = ( nOfPadsZ /2. - column - 0.5 ) * padsizeZ - z0 ; // of center of PHOS module | |
52a36ffd | 590 | } |
2f3366b6 | 591 | } |