]>
Commit | Line | Data |
---|---|---|
e5a93224 | 1 | /************************************************************************** |
2012850d | 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 | ||
16 | /* $Id$*/ | |
17 | ||
18 | //_________________________________________________________________________ | |
19 | // Geometry class for EMCAL : singleton | |
b13bbe81 | 20 | // EMCAL consists of layers of scintillator and lead |
ffa6d63b | 21 | // Places the the Barrel Geometry of The EMCAL at Midrapidity |
d87bd045 | 22 | // between 80 and 180(or 190) degrees of Phi and |
ffa6d63b | 23 | // -0.7 to 0.7 in eta |
24 | // Number of Modules and Layers may be controlled by | |
25 | // the name of the instance defined | |
1d46d1f6 | 26 | // EMCAL geometry tree: |
2bb3725c | 27 | // EMCAL -> superModule -> module -> tower(cell) |
1d46d1f6 | 28 | // Indexes |
2bb3725c | 29 | // absId -> nSupMod -> nModule -> (nIphi,nIeta) |
1d46d1f6 | 30 | // |
b13bbe81 | 31 | //*-- Author: Sahal Yacoob (LBL / UCT) |
32 | // and : Yves Schutz (SUBATECH) | |
33 | // and : Jennifer Klay (LBL) | |
85327f24 | 34 | // SHASHLYK : Aleksei Pavlinov (WSU) |
1d46d1f6 | 35 | // |
090026bf | 36 | |
1ceeec56 | 37 | #include <assert.h> |
e52475ed | 38 | |
090026bf | 39 | // --- AliRoot header files --- |
40 | #include <Riostream.h> | |
41 | #include <TBrowser.h> | |
42 | #include <TClonesArray.h> | |
e52475ed | 43 | #include <TGeoManager.h> |
e52475ed | 44 | #include <TGeoMatrix.h> |
090026bf | 45 | #include <TGeoNode.h> |
7ca4655f | 46 | #include <TList.h> |
f0377b23 | 47 | #include <TMatrixD.h> |
090026bf | 48 | #include <TObjArray.h> |
d434833b | 49 | #include <TObjString.h> |
1ae500a2 | 50 | #include <TVector2.h> |
090026bf | 51 | #include <TVector3.h> |
173558f2 | 52 | |
ca8f5bd0 | 53 | // -- ALICE Headers. |
e5a93224 | 54 | #include "AliLog.h" |
173558f2 | 55 | |
ca8f5bd0 | 56 | // --- EMCAL headers |
57 | #include "AliEMCALGeometry.h" | |
e52475ed | 58 | #include "AliEMCALShishKebabTrd1Module.h" |
e52475ed | 59 | #include "AliEMCALRecPoint.h" |
f0377b23 | 60 | #include "AliEMCALDigit.h" |
d434833b | 61 | #include "AliEMCALHistoUtilities.h" |
2012850d | 62 | |
925e6570 | 63 | ClassImp(AliEMCALGeometry) |
2012850d | 64 | |
d434833b | 65 | // these initialisations are needed for a singleton |
66 | AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0; | |
67 | Bool_t AliEMCALGeometry::fgInit = kFALSE; | |
89557f6d | 68 | Char_t* AliEMCALGeometry::fgDefaultGeometryName = "SHISH_77_TRD1_2X2_FINAL_110DEG"; |
69 | // | |
70 | // Usage: | |
71 | // You can create the AliEMCALGeometry object independently from anything. | |
72 | // You have to use just the correct name of geometry. If name is empty string the | |
73 | // default name of geometry will be used. | |
74 | // | |
75 | // AliEMCALGeometry* g = AliEMCALGeometry::GetInstance(name,title); // first time | |
76 | // .. | |
77 | // g = AliEMCALGeometry::GetInstance(); // after first time | |
78 | // | |
76855a3c | 79 | // MC: If you work with MC data you have to get geometry the next way: |
80 | // == ============================= | |
81 | // AliRunLoader *rl = AliRunLoader::GetRunLoader(); | |
82 | // AliEMCALGeometry *geom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry(); | |
83 | ||
dc7da436 | 84 | |
9cff4509 | 85 | AliEMCALGeometry::AliEMCALGeometry() |
86 | : AliGeometry(), | |
87 | fGeoName(0),fArrayOpts(0),fAlFrontThick(0.),fECPbRadThickness(0.),fECScintThick(0.), | |
88 | fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.), | |
89 | fShellThickness(0.),fZLength(0.),fGap2Active(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0), | |
90 | fSteelFrontThick(0.),fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.), | |
91 | fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),fNPHIdiv(0),fNETAdiv(0), | |
9946f2fe | 92 | fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),fNTRUEta(0),fNTRUPhi(0), |
93 | fNCellsInTRUEta(0), fNCellsInTRUPhi(0), fTrd1Angle(0.),f2Trd1Dx2(0.), | |
1d46d1f6 | 94 | fPhiGapForSM(0.),fKey110DEG(0),fPhiBoundariesOfSM(0), fPhiCentersOfSM(0),fEtaMaxOfTRD1(0), |
95 | fTrd2AngleY(0.),f2Trd2Dy2(0.),fEmptySpace(0.),fTubsR(0.),fTubsTurnAngle(0.),fCentersOfCellsEtaDir(0), | |
96 | fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),fEtaCentersOfCells(0),fPhiCentersOfCells(0), | |
89557f6d | 97 | fShishKebabTrd1Modules(0), fNAdditionalOpts(0), |
98 | fILOSS(-1), fIHADR(-1) | |
dc7da436 | 99 | { |
100 | // default ctor only for internal usage (singleton) | |
101 | // must be kept public for root persistency purposes, but should never be called by the outside world | |
102 | // CreateListOfTrd1Modules(); | |
103 | AliDebug(2, "AliEMCALGeometry : default ctor "); | |
104 | } | |
105 | //______________________________________________________________________ | |
9cff4509 | 106 | AliEMCALGeometry::AliEMCALGeometry(const Text_t* name, const Text_t* title) |
107 | : AliGeometry(name, title), | |
108 | fGeoName(0),fArrayOpts(0),fAlFrontThick(0.),fECPbRadThickness(0.),fECScintThick(0.), | |
109 | fNECLayers(0),fArm1PhiMin(0.),fArm1PhiMax(0.),fArm1EtaMin(0.),fArm1EtaMax(0.),fIPDistance(0.), | |
110 | fShellThickness(0.),fZLength(0.),fGap2Active(0.),fNZ(0),fNPhi(0),fSampling(0.),fNumberOfSuperModules(0), | |
111 | fSteelFrontThick(0.),fFrontSteelStrip(0.),fLateralSteelStrip(0.),fPassiveScintThick(0.),fPhiModuleSize(0.), | |
112 | fEtaModuleSize(0.),fPhiTileSize(0.),fEtaTileSize(0.),fLongModuleSize(0.),fNPhiSuperModule(0),fNPHIdiv(0),fNETAdiv(0), | |
9946f2fe | 113 | fNCells(0),fNCellsInSupMod(0),fNCellsInModule(0),fNTRUEta(0),fNTRUPhi(0), |
114 | fNCellsInTRUEta(0), fNCellsInTRUPhi(0), fTrd1Angle(0.),f2Trd1Dx2(0.), | |
1d46d1f6 | 115 | fPhiGapForSM(0.),fKey110DEG(0),fPhiBoundariesOfSM(0), fPhiCentersOfSM(0), fEtaMaxOfTRD1(0), |
116 | fTrd2AngleY(0.),f2Trd2Dy2(0.),fEmptySpace(0.),fTubsR(0.),fTubsTurnAngle(0.),fCentersOfCellsEtaDir(0), | |
117 | fCentersOfCellsXDir(0),fCentersOfCellsPhiDir(0),fEtaCentersOfCells(0),fPhiCentersOfCells(0), | |
89557f6d | 118 | fShishKebabTrd1Modules(0),fNAdditionalOpts(0), |
119 | fILOSS(-1), fIHADR(-1) | |
9cff4509 | 120 | { |
121 | // ctor only for internal usage (singleton) | |
dc7da436 | 122 | AliDebug(2, Form("AliEMCALGeometry(%s,%s) ", name,title)); |
1d46d1f6 | 123 | |
dc7da436 | 124 | Init(); |
1d46d1f6 | 125 | |
dc7da436 | 126 | CreateListOfTrd1Modules(); |
1d46d1f6 | 127 | |
128 | if (AliDebugLevel()>=2) { | |
129 | PrintGeometry(); | |
130 | } | |
131 | ||
dc7da436 | 132 | } |
0a4cb131 | 133 | //______________________________________________________________________ |
9cff4509 | 134 | AliEMCALGeometry::AliEMCALGeometry(const AliEMCALGeometry& geom) |
135 | : AliGeometry(geom), | |
136 | fGeoName(geom.fGeoName), | |
137 | fArrayOpts(geom.fArrayOpts), | |
138 | fAlFrontThick(geom.fAlFrontThick), | |
139 | fECPbRadThickness(geom.fECPbRadThickness), | |
140 | fECScintThick(geom.fECScintThick), | |
141 | fNECLayers(geom.fNECLayers), | |
142 | fArm1PhiMin(geom.fArm1PhiMin), | |
143 | fArm1PhiMax(geom.fArm1PhiMax), | |
144 | fArm1EtaMin(geom.fArm1EtaMin), | |
145 | fArm1EtaMax(geom.fArm1EtaMax), | |
146 | fIPDistance(geom.fIPDistance), | |
147 | fShellThickness(geom.fShellThickness), | |
148 | fZLength(geom.fZLength), | |
149 | fGap2Active(geom.fGap2Active), | |
150 | fNZ(geom.fNZ), | |
151 | fNPhi(geom.fNPhi), | |
152 | fSampling(geom.fSampling), | |
153 | fNumberOfSuperModules(geom.fNumberOfSuperModules), | |
154 | fSteelFrontThick(geom.fSteelFrontThick), | |
155 | fFrontSteelStrip(geom.fFrontSteelStrip), | |
156 | fLateralSteelStrip(geom.fLateralSteelStrip), | |
157 | fPassiveScintThick(geom.fPassiveScintThick), | |
158 | fPhiModuleSize(geom.fPhiModuleSize), | |
159 | fEtaModuleSize(geom.fEtaModuleSize), | |
160 | fPhiTileSize(geom.fPhiTileSize), | |
161 | fEtaTileSize(geom.fEtaTileSize), | |
162 | fLongModuleSize(geom.fLongModuleSize), | |
163 | fNPhiSuperModule(geom.fNPhiSuperModule), | |
164 | fNPHIdiv(geom.fNPHIdiv), | |
165 | fNETAdiv(geom.fNETAdiv), | |
166 | fNCells(geom.fNCells), | |
167 | fNCellsInSupMod(geom.fNCellsInSupMod), | |
2bb3725c | 168 | fNCellsInModule(geom.fNCellsInModule), |
9cff4509 | 169 | fNTRUEta(geom.fNTRUEta), |
170 | fNTRUPhi(geom.fNTRUPhi), | |
9946f2fe | 171 | fNCellsInTRUEta(geom.fNCellsInTRUEta), |
172 | fNCellsInTRUPhi(geom.fNCellsInTRUPhi), | |
9cff4509 | 173 | fTrd1Angle(geom.fTrd1Angle), |
174 | f2Trd1Dx2(geom.f2Trd1Dx2), | |
175 | fPhiGapForSM(geom.fPhiGapForSM), | |
176 | fKey110DEG(geom.fKey110DEG), | |
1d46d1f6 | 177 | fPhiBoundariesOfSM(geom.fPhiBoundariesOfSM), |
178 | fPhiCentersOfSM(geom.fPhiCentersOfSM), | |
179 | fEtaMaxOfTRD1(geom.fEtaMaxOfTRD1), | |
9cff4509 | 180 | fTrd2AngleY(geom.fTrd2AngleY), |
181 | f2Trd2Dy2(geom.f2Trd2Dy2), | |
182 | fEmptySpace(geom.fEmptySpace), | |
183 | fTubsR(geom.fTubsR), | |
184 | fTubsTurnAngle(geom.fTubsTurnAngle), | |
1d46d1f6 | 185 | fCentersOfCellsEtaDir(geom.fCentersOfCellsEtaDir), |
186 | fCentersOfCellsXDir(geom.fCentersOfCellsXDir), | |
187 | fCentersOfCellsPhiDir(geom.fCentersOfCellsPhiDir), | |
9cff4509 | 188 | fEtaCentersOfCells(geom.fEtaCentersOfCells), |
9cff4509 | 189 | fPhiCentersOfCells(geom.fPhiCentersOfCells), |
190 | fShishKebabTrd1Modules(geom.fShishKebabTrd1Modules), | |
89557f6d | 191 | fNAdditionalOpts(geom.fNAdditionalOpts), |
192 | fILOSS(geom.fILOSS), fIHADR(geom.fIHADR) | |
9cff4509 | 193 | { |
0a4cb131 | 194 | //copy ctor |
0a4cb131 | 195 | } |
196 | ||
b13bbe81 | 197 | //______________________________________________________________________ |
198 | AliEMCALGeometry::~AliEMCALGeometry(void){ | |
199 | // dtor | |
2012850d | 200 | } |
395c7ba2 | 201 | //______________________________________________________________________ |
202 | void AliEMCALGeometry::Init(void){ | |
203 | // Initializes the EMCAL parameters | |
fdebddeb | 204 | // naming convention : GUV_WX_N_ gives the composition of a tower |
395c7ba2 | 205 | // WX inform about the composition of the EM calorimeter section: |
fdebddeb | 206 | // thickness in mm of Pb radiator (W) and of scintillator (X), and number of scintillator layers (N) |
207 | // New geometry: EMCAL_55_25 | |
1963b290 | 208 | // 24-aug-04 for shish-kebab |
209 | // SHISH_25 or SHISH_62 | |
c63c3c5d | 210 | // 11-oct-05 - correction for pre final design |
211 | // Feb 06,2006 - decrease the weight of EMCAL | |
1d46d1f6 | 212 | // |
213 | // Oct 30,2006 - SHISH_TRD1_CURRENT_1X1, SHISH_TRD1_CURRENT_2X2 or SHISH_TRD1_CURRENT_3X3; | |
214 | // | |
fc575e27 | 215 | |
89557f6d | 216 | fAdditionalOpts[0] = "nl="; // number of sampling layers (fNECLayers) |
217 | fAdditionalOpts[1] = "pbTh="; // cm, Thickness of the Pb (fECPbRadThick) | |
218 | fAdditionalOpts[2] = "scTh="; // cm, Thickness of the Sc (fECScintThick) | |
219 | fAdditionalOpts[3] = "latSS="; // cm, Thickness of lateral steel strip (fLateralSteelStrip) | |
220 | fAdditionalOpts[4] = "allILOSS="; // = 0,1,2,3,4 (4 - energy loss without fluctuation) | |
221 | fAdditionalOpts[5] = "allIHADR="; // = 0,1,2 (0 - no hadronic interaction) | |
fc575e27 | 222 | |
223 | fNAdditionalOpts = sizeof(fAdditionalOpts) / sizeof(char*); | |
224 | ||
fdebddeb | 225 | fgInit = kFALSE; // Assume failed until proven otherwise. |
fc575e27 | 226 | fGeoName = GetName(); |
227 | fGeoName.ToUpper(); | |
d87bd045 | 228 | fKey110DEG = 0; |
1d46d1f6 | 229 | if(fGeoName.Contains("110DEG") || fGeoName.Contains("CURRENT")) fKey110DEG = 1; // for GetAbsCellId |
e52475ed | 230 | fShishKebabTrd1Modules = 0; |
231 | fTrd2AngleY = f2Trd2Dy2 = fEmptySpace = fTubsR = fTubsTurnAngle = 0; | |
1963b290 | 232 | |
233 | fNZ = 114; // granularity along Z (eta) | |
234 | fNPhi = 168; // granularity in phi (azimuth) | |
1d46d1f6 | 235 | fArm1PhiMin = 80.0; // degrees, Starting EMCAL Phi position |
236 | fArm1PhiMax = 190.0; // degrees, Ending EMCAL Phi position | |
1963b290 | 237 | fArm1EtaMin = -0.7; // pseudorapidity, Starting EMCAL Eta position |
238 | fArm1EtaMax = +0.7; // pseudorapidity, Ending EMCAL Eta position | |
239 | fIPDistance = 454.0; // cm, Radial distance to inner surface of EMCAL | |
905263da | 240 | fPhiGapForSM = 0.; // cm, only for final TRD1 geometry |
1963b290 | 241 | |
242 | // geometry | |
fc575e27 | 243 | if(fGeoName.Contains("SHISH")){ // Only shahslyk now |
905263da | 244 | // 7-sep-05; integration issue |
245 | fArm1PhiMin = 80.0; // 60 -> 80 | |
c01485dd | 246 | fArm1PhiMax = 180.0; // 180 -> 190 |
905263da | 247 | |
248 | fNumberOfSuperModules = 10; // 12 = 6 * 2 (6 in phi, 2 in Z); | |
1963b290 | 249 | fSteelFrontThick = 2.54; // 9-sep-04 |
250 | fIPDistance = 460.0; | |
251 | fFrontSteelStrip = fPassiveScintThick = 0.0; // 13-may-05 | |
252 | fLateralSteelStrip = 0.025; // before MAY 2005 | |
253 | fPhiModuleSize = fEtaModuleSize = 11.4; | |
254 | fPhiTileSize = fEtaTileSize = 5.52; // (11.4-5.52*2)/2. = 0.18 cm (wall thickness) | |
255 | fNPhi = 14; | |
256 | fNZ = 30; | |
257 | fAlFrontThick = fGap2Active = 0; | |
258 | fNPHIdiv = fNETAdiv = 2; | |
259 | ||
260 | fNECLayers = 62; | |
261 | fECScintThick = fECPbRadThickness = 0.2; | |
262 | fSampling = 1.; // 30-aug-04 - should be calculated | |
fc575e27 | 263 | if(fGeoName.Contains("TWIST")) { // all about EMCAL module |
1963b290 | 264 | fNZ = 27; // 16-sep-04 |
fc575e27 | 265 | } else if(fGeoName.Contains("TRD")) { |
1963b290 | 266 | fIPDistance = 428.0; // 11-may-05 |
267 | fSteelFrontThick = 0.0; // 3.17 -> 0.0; 28-mar-05 : no stell plate | |
268 | fNPhi = 12; | |
269 | fSampling = 12.327; | |
270 | fPhiModuleSize = fEtaModuleSize = 12.26; | |
271 | fNZ = 26; // 11-oct-04 | |
272 | fTrd1Angle = 1.3; // in degree | |
273 | // 18-nov-04; 1./0.08112=12.327 | |
274 | // http://pdsfweb01.nersc.gov/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html | |
fc575e27 | 275 | if(fGeoName.Contains("TRD1")) { // 30-jan-05 |
1963b290 | 276 | // for final design |
905263da | 277 | fPhiGapForSM = 2.; // cm, only for final TRD1 geometry |
1d46d1f6 | 278 | if(fGeoName.Contains("MAY05") || fGeoName.Contains("WSUC") || fGeoName.Contains("FINAL") || fGeoName.Contains("CURRENT")){ |
1963b290 | 279 | fNumberOfSuperModules = 12; // 20-may-05 |
fc575e27 | 280 | if(fGeoName.Contains("WSUC")) fNumberOfSuperModules = 1; // 27-may-05 |
1963b290 | 281 | fNECLayers = 77; // (13-may-05 from V.Petrov) |
282 | fPhiModuleSize = 12.5; // 20-may-05 - rectangular shape | |
283 | fEtaModuleSize = 11.9; | |
284 | fECScintThick = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov) | |
285 | fFrontSteelStrip = 0.025;// 0.025cm = 0.25mm (13-may-05 from V.Petrov) | |
286 | fLateralSteelStrip = 0.01; // 0.01cm = 0.1mm (13-may-05 from V.Petrov) - was 0.025 | |
287 | fPassiveScintThick = 0.8; // 0.8cm = 8mm (13-may-05 from V.Petrov) | |
288 | fNZ = 24; | |
289 | fTrd1Angle = 1.5; // 1.3 or 1.5 | |
905263da | 290 | |
1d46d1f6 | 291 | if(fGeoName.Contains("FINAL") || fGeoName.Contains("CURRENT")) { // 9-sep-05 |
905263da | 292 | fNumberOfSuperModules = 10; |
1d46d1f6 | 293 | if(GetKey110DEG()) { |
d87bd045 | 294 | fNumberOfSuperModules = 12;// last two modules have size 10 degree in phi (180<phi<190) |
1d46d1f6 | 295 | fArm1PhiMax = 200.0; // for XEN1 and turn angle of super modules |
296 | } | |
297 | if(fGeoName.Contains("FINAL")) { | |
298 | fPhiModuleSize = 12.26 - fPhiGapForSM / Float_t(fNPhi); // first assumption | |
299 | } else if(fGeoName.Contains("CURRENT")) { | |
300 | fECScintThick = 0.176; // 10% of weight reduction | |
301 | fECPbRadThickness = 0.144; // | |
302 | fLateralSteelStrip = 0.015; // 0.015cm = 0.15mm (Oct 30, from Fred) | |
303 | fPhiModuleSize = 12.00; | |
304 | fPhiGapForSM = (12.26 - fPhiModuleSize)*fNPhi; // have to check | |
d87bd045 | 305 | } |
905263da | 306 | fEtaModuleSize = fPhiModuleSize; |
fc575e27 | 307 | if(fGeoName.Contains("HUGE")) fNECLayers *= 3; // 28-oct-05 for analysing leakage |
905263da | 308 | } |
1963b290 | 309 | } |
fc575e27 | 310 | } else if(fGeoName.Contains("TRD2")) { // 30-jan-05 |
1963b290 | 311 | fSteelFrontThick = 0.0; // 11-mar-05 |
312 | fIPDistance+= fSteelFrontThick; // 1-feb-05 - compensate absence of steel plate | |
313 | fTrd1Angle = 1.64; // 1.3->1.64 | |
314 | fTrd2AngleY = fTrd1Angle; // symmetric case now | |
315 | fEmptySpace = 0.2; // 2 mm | |
316 | fTubsR = fIPDistance; // 31-jan-05 - as for Fred case | |
317 | ||
318 | fPhiModuleSize = fTubsR*2.*TMath::Tan(fTrd2AngleY*TMath::DegToRad()/2.); | |
319 | fPhiModuleSize -= fEmptySpace/2.; // 11-mar-05 | |
320 | fEtaModuleSize = fPhiModuleSize; // 20-may-05 | |
321 | fTubsTurnAngle = 3.; | |
322 | } | |
323 | fNPHIdiv = fNETAdiv = 2; // 13-oct-04 - division again | |
fc575e27 | 324 | if(fGeoName.Contains("3X3")) { // 23-nov-04 |
1963b290 | 325 | fNPHIdiv = fNETAdiv = 3; |
fc575e27 | 326 | } else if(fGeoName.Contains("4X4")) { |
1963b290 | 327 | fNPHIdiv = fNETAdiv = 4; |
d25f2c54 | 328 | } else if(fGeoName.Contains("1X1")) { |
329 | fNPHIdiv = fNETAdiv = 1; | |
1963b290 | 330 | } |
331 | } | |
fc575e27 | 332 | if(fGeoName.Contains("25")){ |
1963b290 | 333 | fNECLayers = 25; |
334 | fECScintThick = fECPbRadThickness = 0.5; | |
335 | } | |
fc575e27 | 336 | if(fGeoName.Contains("WSUC")){ // 18-may-05 - about common structure |
1ae500a2 | 337 | fShellThickness = 30.; // should be change |
1963b290 | 338 | fNPhi = fNZ = 4; |
339 | } | |
c63c3c5d | 340 | |
fc575e27 | 341 | CheckAdditionalOptions(); |
25b033cf | 342 | DefineSamplingFraction(); |
c63c3c5d | 343 | |
1d46d1f6 | 344 | fPhiTileSize = fPhiModuleSize/double(fNPHIdiv) - fLateralSteelStrip; // 13-may-05 |
345 | fEtaTileSize = fEtaModuleSize/double(fNETAdiv) - fLateralSteelStrip; // 13-may-05 | |
31b39a2e | 346 | |
1963b290 | 347 | // constant for transition absid <--> indexes |
2bb3725c | 348 | fNCellsInModule = fNPHIdiv*fNETAdiv; |
349 | fNCellsInSupMod = fNCellsInModule*fNPhi*fNZ; | |
1963b290 | 350 | fNCells = fNCellsInSupMod*fNumberOfSuperModules; |
1d46d1f6 | 351 | if(GetKey110DEG()) fNCells -= fNCellsInSupMod; |
1963b290 | 352 | |
353 | fLongModuleSize = fNECLayers*(fECScintThick + fECPbRadThickness); | |
fc575e27 | 354 | if(fGeoName.Contains("MAY05")) fLongModuleSize += (fFrontSteelStrip + fPassiveScintThick); |
1963b290 | 355 | |
356 | // 30-sep-04 | |
fc575e27 | 357 | if(fGeoName.Contains("TRD")) { |
1963b290 | 358 | f2Trd1Dx2 = fEtaModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd1Angle*TMath::DegToRad()/2.); |
fc575e27 | 359 | if(fGeoName.Contains("TRD2")) { // 27-jan-05 |
1963b290 | 360 | f2Trd2Dy2 = fPhiModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd2AngleY*TMath::DegToRad()/2.); |
361 | } | |
362 | } | |
fc575e27 | 363 | } else Fatal("Init", "%s is an undefined geometry!", fGeoName.Data()) ; |
fdebddeb | 364 | |
1963b290 | 365 | fNPhiSuperModule = fNumberOfSuperModules/2; |
366 | if(fNPhiSuperModule<1) fNPhiSuperModule = 1; | |
1d46d1f6 | 367 | |
fdebddeb | 368 | fShellThickness = fAlFrontThick + fGap2Active + fNECLayers*GetECScintThick()+(fNECLayers-1)*GetECPbRadThick(); |
fc575e27 | 369 | if(fGeoName.Contains("SHISH")) { |
1963b290 | 370 | fShellThickness = fSteelFrontThick + fLongModuleSize; |
fc575e27 | 371 | if(fGeoName.Contains("TWIST")) { // 13-sep-04 |
1963b290 | 372 | fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + fPhiModuleSize*fEtaModuleSize); |
373 | fShellThickness += fSteelFrontThick; | |
fc575e27 | 374 | } else if(fGeoName.Contains("TRD")) { // 1-oct-04 |
1963b290 | 375 | fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + f2Trd1Dx2*f2Trd1Dx2); |
376 | fShellThickness += fSteelFrontThick; | |
e52475ed | 377 | // Local coordinates |
378 | fParSM[0] = GetShellThickness()/2.; | |
379 | fParSM[1] = GetPhiModuleSize() * GetNPhi()/2.; | |
380 | fParSM[2] = 350./2.; | |
1963b290 | 381 | } |
382 | } | |
fdebddeb | 383 | |
395c7ba2 | 384 | fZLength = 2.*ZFromEtaR(fIPDistance+fShellThickness,fArm1EtaMax); // Z coverage |
385 | fEnvelop[0] = fIPDistance; // mother volume inner radius | |
386 | fEnvelop[1] = fIPDistance + fShellThickness; // mother volume outer r. | |
387 | fEnvelop[2] = 1.00001*fZLength; // add some padding for mother volume. | |
9cff4509 | 388 | |
389 | fNumberOfSuperModules = 12; | |
1d46d1f6 | 390 | |
391 | // SM phi boundaries - (0,1),(2,3) .. (10,11) - has the same boundaries; Nov 7, 2006 | |
392 | fPhiBoundariesOfSM.Set(fNumberOfSuperModules); | |
393 | fPhiCentersOfSM.Set(fNumberOfSuperModules/2); | |
394 | fPhiBoundariesOfSM[0] = TMath::PiOver2() - TMath::ATan2(fParSM[1] , fIPDistance); // 1th and 2th modules) | |
395 | fPhiBoundariesOfSM[1] = TMath::PiOver2() + TMath::ATan2(fParSM[1] , fIPDistance); | |
396 | fPhiCentersOfSM[0] = TMath::PiOver2(); | |
397 | for(int i=1; i<=4; i++) { // from 2th ro 9th | |
398 | fPhiBoundariesOfSM[2*i] = fPhiBoundariesOfSM[0] + 20.*TMath::DegToRad()*i; | |
399 | fPhiBoundariesOfSM[2*i+1] = fPhiBoundariesOfSM[1] + 20.*TMath::DegToRad()*i; | |
400 | fPhiCentersOfSM[i] = fPhiCentersOfSM[0] + 20.*TMath::DegToRad()*i; | |
401 | } | |
402 | fPhiBoundariesOfSM[11] = 190.*TMath::DegToRad(); | |
403 | fPhiBoundariesOfSM[10] = fPhiBoundariesOfSM[11] - TMath::ATan2((fParSM[1]) , fIPDistance); | |
404 | fPhiCentersOfSM[5] = (fPhiBoundariesOfSM[10]+fPhiBoundariesOfSM[11])/2.; | |
405 | ||
f0377b23 | 406 | //TRU parameters. These parameters values are not the final ones. |
f0377b23 | 407 | fNTRUEta = 3 ; |
408 | fNTRUPhi = 1 ; | |
9946f2fe | 409 | fNCellsInTRUEta = 16 ; |
410 | fNCellsInTRUPhi = 24 ; | |
1d46d1f6 | 411 | |
1ae500a2 | 412 | if(fGeoName.Contains("WSUC")) fNumberOfSuperModules = 1; // Jul 12, 2007 |
413 | ||
89557f6d | 414 | fgInit = kTRUE; |
415 | AliInfo(" is ended"); | |
2012850d | 416 | } |
173558f2 | 417 | |
1d46d1f6 | 418 | void AliEMCALGeometry::PrintGeometry() |
419 | { | |
420 | // Separate routine is callable from broswer; Nov 7,2006 | |
89557f6d | 421 | printf("\nInit: geometry of EMCAL named %s :\n", fGeoName.Data()); |
422 | if(fArrayOpts) { | |
423 | for(Int_t i=0; i<fArrayOpts->GetEntries(); i++){ | |
424 | TObjString *o = (TObjString*)fArrayOpts->At(i); | |
425 | printf(" %i : %s \n", i, o->String().Data()); | |
426 | } | |
427 | } | |
1d46d1f6 | 428 | printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ; |
429 | printf("Layout: phi = (%7.1f, %7.1f), eta = (%5.2f, %5.2f), IP = %7.2f -> for EMCAL envelope only\n", | |
430 | GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() ); | |
c63c3c5d | 431 | |
1d46d1f6 | 432 | printf( " ECAL : %d x (%f cm Pb, %f cm Sc) \n", |
433 | GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ; | |
434 | printf(" fSampling %5.2f \n", fSampling ); | |
435 | if(fGeoName.Contains("SHISH")){ | |
436 | printf(" fIPDistance %6.3f cm \n", fIPDistance); | |
437 | if(fSteelFrontThick>0.) | |
438 | printf(" fSteelFrontThick %6.3f cm \n", fSteelFrontThick); | |
439 | printf(" fNPhi %i | fNZ %i \n", fNPhi, fNZ); | |
2bb3725c | 440 | printf(" fNCellsInModule %i : fNCellsInSupMod %i : fNCells %i\n",fNCellsInModule, fNCellsInSupMod, fNCells); |
1d46d1f6 | 441 | if(fGeoName.Contains("MAY05")){ |
442 | printf(" fFrontSteelStrip %6.4f cm (thickness of front steel strip)\n", | |
443 | fFrontSteelStrip); | |
444 | printf(" fLateralSteelStrip %6.4f cm (thickness of lateral steel strip)\n", | |
445 | fLateralSteelStrip); | |
446 | printf(" fPassiveScintThick %6.4f cm (thickness of front passive Sc tile)\n", | |
447 | fPassiveScintThick); | |
448 | } | |
449 | printf(" X:Y module size %6.3f , %6.3f cm \n", fPhiModuleSize, fEtaModuleSize); | |
450 | printf(" X:Y tile size %6.3f , %6.3f cm \n", fPhiTileSize, fEtaTileSize); | |
451 | printf(" #of sampling layers %i(fNECLayers) \n", fNECLayers); | |
452 | printf(" fLongModuleSize %6.3f cm \n", fLongModuleSize); | |
453 | printf(" #supermodule in phi direction %i \n", fNPhiSuperModule ); | |
454 | } | |
89557f6d | 455 | printf(" fILOSS %i : fIHADR %i \n", fILOSS, fIHADR); |
1d46d1f6 | 456 | if(fGeoName.Contains("TRD")) { |
457 | printf(" fTrd1Angle %7.4f\n", fTrd1Angle); | |
458 | printf(" f2Trd1Dx2 %7.4f\n", f2Trd1Dx2); | |
459 | if(fGeoName.Contains("TRD2")) { | |
460 | printf(" fTrd2AngleY %7.4f\n", fTrd2AngleY); | |
461 | printf(" f2Trd2Dy2 %7.4f\n", f2Trd2Dy2); | |
462 | printf(" fTubsR %7.2f cm\n", fTubsR); | |
463 | printf(" fTubsTurnAngle %7.4f\n", fTubsTurnAngle); | |
464 | printf(" fEmptySpace %7.4f cm\n", fEmptySpace); | |
465 | } else if(fGeoName.Contains("TRD1")){ | |
466 | printf("SM dimensions(TRD1) : dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", | |
467 | fParSM[0],fParSM[1],fParSM[2]); | |
468 | printf(" fPhiGapForSM %7.4f cm (%7.4f <- phi size in degree)\n", | |
469 | fPhiGapForSM, TMath::ATan2(fPhiGapForSM,fIPDistance)*TMath::RadToDeg()); | |
470 | if(GetKey110DEG()) printf(" Last two modules have size 10 degree in phi (180<phi<190)\n"); | |
471 | printf(" phi SM boundaries \n"); | |
472 | for(int i=0; i<fPhiBoundariesOfSM.GetSize()/2.; i++) { | |
473 | printf(" %i : %7.5f(%7.2f) -> %7.5f(%7.2f) : center %7.5f(%7.2f) \n", i, | |
474 | fPhiBoundariesOfSM[2*i], fPhiBoundariesOfSM[2*i]*TMath::RadToDeg(), | |
475 | fPhiBoundariesOfSM[2*i+1], fPhiBoundariesOfSM[2*i+1]*TMath::RadToDeg(), | |
476 | fPhiCentersOfSM[i], fPhiCentersOfSM[i]*TMath::RadToDeg()); | |
477 | } | |
478 | printf(" fShishKebabTrd1Modules has %i modules : max eta %5.4f \n", | |
479 | fShishKebabTrd1Modules->GetSize(),fEtaMaxOfTRD1); | |
480 | ||
481 | printf("\n Cells grid in eta directions : size %i\n", fCentersOfCellsEtaDir.GetSize()); | |
482 | for(Int_t i=0; i<fCentersOfCellsEtaDir.GetSize(); i++) { | |
483 | printf(" ind %2.2i : z %8.3f : x %8.3f \n", i, | |
484 | fCentersOfCellsEtaDir.At(i),fCentersOfCellsXDir.At(i)); | |
485 | int ind=0; // Nov 21,2006 | |
486 | for(Int_t iphi=0; iphi<fCentersOfCellsPhiDir.GetSize(); iphi++) { | |
487 | ind = iphi*fCentersOfCellsEtaDir.GetSize() + i; | |
488 | printf("%6.4f ", fEtaCentersOfCells[ind]); | |
489 | if((iphi+1)%12 == 0) printf("\n"); | |
490 | } | |
491 | printf("\n"); | |
89557f6d | 492 | |
493 | } | |
1d46d1f6 | 494 | |
495 | printf("\n Cells grid in phi directions : size %i\n", fCentersOfCellsPhiDir.GetSize()); | |
496 | for(Int_t i=0; i<fCentersOfCellsPhiDir.GetSize(); i++) { | |
497 | double phi=fPhiCentersOfCells.At(i); | |
498 | printf(" ind %2.2i : y %8.3f : phi %7.5f(%6.2f) \n", i, fCentersOfCellsPhiDir.At(i), | |
499 | phi, phi*TMath::RadToDeg()); | |
500 | } | |
501 | } | |
502 | } | |
89557f6d | 503 | cout<<endl; |
1d46d1f6 | 504 | } |
505 | ||
506 | void AliEMCALGeometry::PrintCellIndexes(Int_t absId, int pri, char *tit) | |
507 | { | |
508 | // Service methods | |
2bb3725c | 509 | Int_t nSupMod, nModule, nIphi, nIeta; |
1d46d1f6 | 510 | Int_t iphi, ieta; |
511 | TVector3 vg; | |
512 | ||
2bb3725c | 513 | GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta); |
514 | printf(" %s | absId : %i -> nSupMod %i nModule %i nIphi %i nIeta %i \n", tit, absId, nSupMod, nModule, nIphi, nIeta); | |
1d46d1f6 | 515 | if(pri>0) { |
2bb3725c | 516 | GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi,ieta); |
1d46d1f6 | 517 | printf(" local SM index : iphi %i : ieta %i \n", iphi,ieta); |
518 | GetGlobal(absId, vg); | |
519 | printf(" vglob : mag %7.2f : perp %7.2f : z %7.2f : eta %6.4f : phi %6.4f(%6.2f) \n", | |
520 | vg.Mag(), vg.Perp(), vg.Z(), vg.Eta(), vg.Phi(), vg.Phi()*TMath::RadToDeg()); | |
521 | } | |
522 | } | |
523 | ||
524 | //______________________________________________________________________ | |
fc575e27 | 525 | void AliEMCALGeometry::CheckAdditionalOptions() |
526 | { | |
527 | // Feb 06,2006 | |
89557f6d | 528 | // Additional options that |
529 | // can be used to select | |
530 | // the specific geometry of | |
531 | // EMCAL to run | |
532 | // Dec 27,2006 | |
533 | // adeed allILOSS= and allIHADR= for MIP investigation | |
c63c3c5d | 534 | fArrayOpts = new TObjArray; |
fc575e27 | 535 | Int_t nopt = AliEMCALHistoUtilities::ParseString(fGeoName, *fArrayOpts); |
c63c3c5d | 536 | if(nopt==1) { // no aditional option(s) |
537 | fArrayOpts->Delete(); | |
538 | delete fArrayOpts; | |
539 | fArrayOpts = 0; | |
540 | return; | |
541 | } | |
542 | for(Int_t i=1; i<nopt; i++){ | |
543 | TObjString *o = (TObjString*)fArrayOpts->At(i); | |
544 | ||
545 | TString addOpt = o->String(); | |
546 | Int_t indj=-1; | |
fc575e27 | 547 | for(Int_t j=0; j<fNAdditionalOpts; j++) { |
548 | TString opt = fAdditionalOpts[j]; | |
c63c3c5d | 549 | if(addOpt.Contains(opt,TString::kIgnoreCase)) { |
550 | indj = j; | |
551 | break; | |
552 | } | |
553 | } | |
554 | if(indj<0) { | |
e5a93224 | 555 | AliDebug(2,Form("<E> option |%s| unavailable : ** look to the file AliEMCALGeometry.h **\n", |
556 | addOpt.Data())); | |
c63c3c5d | 557 | assert(0); |
558 | } else { | |
e5a93224 | 559 | AliDebug(2,Form("<I> option |%s| is valid : number %i : |%s|\n", |
560 | addOpt.Data(), indj, fAdditionalOpts[indj])); | |
c63c3c5d | 561 | if (addOpt.Contains("NL=",TString::kIgnoreCase)) {// number of sampling layers |
562 | sscanf(addOpt.Data(),"NL=%i", &fNECLayers); | |
e5a93224 | 563 | AliDebug(2,Form(" fNECLayers %i (new) \n", fNECLayers)); |
b44d5aa4 | 564 | } else if(addOpt.Contains("PBTH=",TString::kIgnoreCase)) {//Thickness of the Pb(fECPbRadThicknes) |
c63c3c5d | 565 | sscanf(addOpt.Data(),"PBTH=%f", &fECPbRadThickness); |
b44d5aa4 | 566 | } else if(addOpt.Contains("SCTH=",TString::kIgnoreCase)) {//Thickness of the Sc(fECScintThick) |
c63c3c5d | 567 | sscanf(addOpt.Data(),"SCTH=%f", &fECScintThick); |
b44d5aa4 | 568 | } else if(addOpt.Contains("LATSS=",TString::kIgnoreCase)) {// Thickness of lateral steel strip (fLateralSteelStrip) |
569 | sscanf(addOpt.Data(),"LATSS=%f", &fLateralSteelStrip); | |
570 | AliDebug(2,Form(" fLateralSteelStrip %f (new) \n", fLateralSteelStrip)); | |
89557f6d | 571 | } else if(addOpt.Contains("ILOSS=",TString::kIgnoreCase)) {// As in Geant |
572 | sscanf(addOpt.Data(),"ALLILOSS=%i", &fILOSS); | |
573 | AliDebug(2,Form(" fILOSS %i \n", fILOSS)); | |
574 | } else if(addOpt.Contains("IHADR=",TString::kIgnoreCase)) {// As in Geant | |
575 | sscanf(addOpt.Data(),"ALLIHADR=%i", &fIHADR); | |
576 | AliDebug(2,Form(" fIHADR %i \n", fIHADR)); | |
c63c3c5d | 577 | } |
578 | } | |
579 | } | |
580 | } | |
581 | ||
25b033cf | 582 | void AliEMCALGeometry::DefineSamplingFraction() |
583 | { | |
584 | // Jun 05,2006 | |
585 | // Look http://rhic.physics.wayne.edu/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html | |
586 | // Keep for compatibilty | |
587 | // | |
588 | if(fNECLayers == 69) { // 10% layer reduction | |
589 | fSampling = 12.55; | |
590 | } else if(fNECLayers == 61) { // 20% layer reduction | |
591 | fSampling = 12.80; | |
592 | } else if(fNECLayers == 77) { | |
593 | if (fECScintThick>0.175 && fECScintThick<0.177) { // 10% Pb thicknes reduction | |
594 | fSampling = 10.5; // fECScintThick = 0.176, fECPbRadThickness=0.144; | |
595 | } else if(fECScintThick>0.191 && fECScintThick<0.193) { // 20% Pb thicknes reduction | |
596 | fSampling = 8.93; // fECScintThick = 0.192, fECPbRadThickness=0.128; | |
597 | } | |
598 | } | |
599 | } | |
600 | ||
356fd0a9 | 601 | //______________________________________________________________________ |
602 | void AliEMCALGeometry::GetCellPhiEtaIndexInSModuleFromTRUIndex(const Int_t itru, const Int_t iphitru, const Int_t ietatru, Int_t &iphiSM, Int_t &ietaSM) const | |
603 | { | |
604 | ||
33d0b833 | 605 | // This method transforms the (eta,phi) index of cells in a |
356fd0a9 | 606 | // TRU matrix into Super Module (eta,phi) index. |
607 | ||
33d0b833 | 608 | // Calculate in which row and column where the TRU are |
356fd0a9 | 609 | // ordered in the SM |
610 | ||
33d0b833 | 611 | Int_t col = itru/ fNTRUPhi ; |
612 | Int_t row = itru - col*fNTRUPhi ; | |
356fd0a9 | 613 | |
9946f2fe | 614 | iphiSM = fNCellsInTRUPhi*row + iphitru ; |
615 | ietaSM = fNCellsInTRUEta*col + ietatru ; | |
356fd0a9 | 616 | } |
f0377b23 | 617 | |
b13bbe81 | 618 | //______________________________________________________________________ |
619 | AliEMCALGeometry * AliEMCALGeometry::GetInstance(){ | |
05a92d59 | 620 | // Returns the pointer of the unique instance |
621 | ||
e52475ed | 622 | AliEMCALGeometry * rv = static_cast<AliEMCALGeometry *>( fgGeom ); |
623 | return rv; | |
2012850d | 624 | } |
173558f2 | 625 | |
b13bbe81 | 626 | //______________________________________________________________________ |
627 | AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name, | |
628 | const Text_t* title){ | |
629 | // Returns the pointer of the unique instance | |
630 | ||
631 | AliEMCALGeometry * rv = 0; | |
632 | if ( fgGeom == 0 ) { | |
89557f6d | 633 | if ( strcmp(name,"") == 0 ) { // get default geometry |
634 | fgGeom = new AliEMCALGeometry(fgDefaultGeometryName, title); | |
635 | } else { | |
636 | fgGeom = new AliEMCALGeometry(name, title); | |
637 | } // end if strcmp(name,"") | |
638 | if ( fgInit ) rv = (AliEMCALGeometry * ) fgGeom; | |
639 | else { | |
640 | rv = 0; | |
641 | delete fgGeom; | |
642 | fgGeom = 0; | |
643 | } // end if fgInit | |
b13bbe81 | 644 | }else{ |
e5a93224 | 645 | if ( strcmp(fgGeom->GetName(), name) != 0) { |
646 | printf("\ncurrent geometry is %s : ", fgGeom->GetName()); | |
647 | printf(" you cannot call %s ", name); | |
b13bbe81 | 648 | }else{ |
9859bfc0 | 649 | rv = (AliEMCALGeometry *) fgGeom; |
e52475ed | 650 | } // end |
b13bbe81 | 651 | } // end if fgGeom |
652 | return rv; | |
2012850d | 653 | } |
173558f2 | 654 | |
ab37d09c | 655 | Bool_t AliEMCALGeometry::IsInEMCAL(Double_t x, Double_t y, Double_t z) const { |
dc7da436 | 656 | // Checks whether point is inside the EMCal volume, used in AliEMCALv*.cxx |
ab37d09c | 657 | // |
658 | // Code uses cylindrical approximation made of inner radius (for speed) | |
659 | // | |
660 | // Points behind EMCAl, i.e. R > outer radius, but eta, phi in acceptance | |
661 | // are considered to inside | |
662 | ||
663 | Double_t r=sqrt(x*x+y*y); | |
664 | ||
665 | if ( r > fEnvelop[0] ) { | |
666 | Double_t theta; | |
667 | theta = TMath::ATan2(r,z); | |
668 | Double_t eta; | |
669 | if(theta == 0) | |
670 | eta = 9999; | |
671 | else | |
672 | eta = -TMath::Log(TMath::Tan(theta/2.)); | |
673 | if (eta < fArm1EtaMin || eta > fArm1EtaMax) | |
674 | return 0; | |
675 | ||
676 | Double_t phi = TMath::ATan2(y,x) * 180./TMath::Pi(); | |
2038074b | 677 | if (phi < 0) phi += 360; // phi should go from 0 to 360 in this case |
ab37d09c | 678 | if (phi > fArm1PhiMin && phi < fArm1PhiMax) |
679 | return 1; | |
680 | } | |
681 | return 0; | |
682 | } | |
c63c3c5d | 683 | // == |
1963b290 | 684 | |
685 | // | |
686 | // == Shish-kebab cases == | |
687 | // | |
2bb3725c | 688 | Int_t AliEMCALGeometry::GetAbsCellId(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta) const |
dc7da436 | 689 | { |
690 | // 27-aug-04; | |
d87bd045 | 691 | // corr. 21-sep-04; |
692 | // 13-oct-05; 110 degree case | |
dc7da436 | 693 | // May 31, 2006; ALICE numbering scheme: |
694 | // 0 <= nSupMod < fNumberOfSuperModules | |
2bb3725c | 695 | // 0 <= nModule < fNPHI * fNZ ( fNPHI * fNZ/2 for fKey110DEG=1) |
dc7da436 | 696 | // 0 <= nIphi < fNPHIdiv |
697 | // 0 <= nIeta < fNETAdiv | |
698 | // 0 <= absid < fNCells | |
699 | static Int_t id=0; // have to change from 0 to fNCells-1 | |
700 | if(fKey110DEG == 1 && nSupMod >= 10) { // 110 degree case; last two supermodules | |
701 | id = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-10); | |
d87bd045 | 702 | } else { |
dc7da436 | 703 | id = fNCellsInSupMod*nSupMod; |
d87bd045 | 704 | } |
2bb3725c | 705 | id += fNCellsInModule *nModule; |
dc7da436 | 706 | id += fNPHIdiv *nIphi; |
1963b290 | 707 | id += nIeta; |
dc7da436 | 708 | if(id<0 || id >= fNCells) { |
500aeccc | 709 | // printf(" wrong numerations !!\n"); |
710 | // printf(" id %6i(will be force to -1)\n", id); | |
711 | // printf(" fNCells %6i\n", fNCells); | |
712 | // printf(" nSupMod %6i\n", nSupMod); | |
2bb3725c | 713 | // printf(" nModule %6i\n", nModule); |
500aeccc | 714 | // printf(" nIphi %6i\n", nIphi); |
715 | // printf(" nIeta %6i\n", nIeta); | |
dc7da436 | 716 | id = -TMath::Abs(id); // if negative something wrong |
1963b290 | 717 | } |
718 | return id; | |
719 | } | |
720 | ||
dc7da436 | 721 | Bool_t AliEMCALGeometry::CheckAbsCellId(Int_t absId) const |
fc575e27 | 722 | { |
dc7da436 | 723 | // May 31, 2006; only trd1 now |
724 | if(absId<0 || absId >= fNCells) return kFALSE; | |
725 | else return kTRUE; | |
1963b290 | 726 | } |
727 | ||
2bb3725c | 728 | Bool_t AliEMCALGeometry::GetCellIndex(Int_t absId,Int_t &nSupMod,Int_t &nModule,Int_t &nIphi,Int_t &nIeta) const |
fc575e27 | 729 | { |
dc7da436 | 730 | // 21-sep-04; 19-oct-05; |
731 | // May 31, 2006; ALICE numbering scheme: | |
4bba84bd | 732 | // |
733 | // In: | |
734 | // absId - cell is as in Geant, 0<= absId < fNCells; | |
735 | // Out: | |
736 | // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules; | |
2bb3725c | 737 | // nModule - module number in SM, 0<= nModule < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th); |
4bba84bd | 738 | // nIphi - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv; |
739 | // nIeta - cell number in eta driection inside module; 0<= nIeta < fNETAdiv; | |
740 | // | |
d87bd045 | 741 | static Int_t tmp=0, sm10=0; |
dc7da436 | 742 | if(!CheckAbsCellId(absId)) return kFALSE; |
743 | ||
d87bd045 | 744 | sm10 = fNCellsInSupMod*10; |
dc7da436 | 745 | if(fKey110DEG == 1 && absId >= sm10) { // 110 degree case; last two supermodules |
746 | nSupMod = (absId-sm10) / (fNCellsInSupMod/2) + 10; | |
747 | tmp = (absId-sm10) % (fNCellsInSupMod/2); | |
d87bd045 | 748 | } else { |
dc7da436 | 749 | nSupMod = absId / fNCellsInSupMod; |
750 | tmp = absId % fNCellsInSupMod; | |
d87bd045 | 751 | } |
1963b290 | 752 | |
2bb3725c | 753 | nModule = tmp / fNCellsInModule; |
754 | tmp = tmp % fNCellsInModule; | |
dc7da436 | 755 | nIphi = tmp / fNPHIdiv; |
756 | nIeta = tmp % fNPHIdiv; | |
1963b290 | 757 | |
758 | return kTRUE; | |
759 | } | |
760 | ||
2bb3725c | 761 | void AliEMCALGeometry::GetModulePhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, int &iphim, int &ietam) const |
fc575e27 | 762 | { |
1d46d1f6 | 763 | // added nSupMod; - 19-oct-05 ! |
dc7da436 | 764 | // Alice numbering scheme - Jun 01,2006 |
1d46d1f6 | 765 | // ietam, iphi - indexes of module in two dimensional grid of SM |
766 | // ietam - have to change from 0 to fNZ-1 | |
767 | // iphim - have to change from 0 to nphi-1 (fNPhi-1 or fNPhi/2-1) | |
d87bd045 | 768 | static Int_t nphi; |
769 | ||
dc7da436 | 770 | if(fKey110DEG == 1 && nSupMod>=10) nphi = fNPhi/2; |
d87bd045 | 771 | else nphi = fNPhi; |
772 | ||
2bb3725c | 773 | ietam = nModule/nphi; |
774 | iphim = nModule%nphi; | |
d87bd045 | 775 | } |
776 | ||
2bb3725c | 777 | void AliEMCALGeometry::GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nModule, Int_t nIphi, Int_t nIeta, |
e52475ed | 778 | int &iphi, int &ieta) const |
fc575e27 | 779 | { |
1d46d1f6 | 780 | // |
781 | // Added nSupMod; Nov 25, 05 | |
782 | // Alice numbering scheme - Jun 01,2006 | |
4bba84bd | 783 | // IN: |
784 | // nSupMod - super module(SM) number, 0<= nSupMod < fNumberOfSuperModules; | |
2bb3725c | 785 | // nModule - module number in SM, 0<= nModule < fNCellsInSupMod/fNCellsInSupMod or(/2) for tow last SM (10th and 11th); |
4bba84bd | 786 | // nIphi - cell number in phi driection inside module; 0<= nIphi < fNPHIdiv; |
787 | // nIeta - cell number in eta driection inside module; 0<= nIeta < fNETAdiv; | |
788 | // | |
789 | // OUT: | |
1d46d1f6 | 790 | // ieta, iphi - indexes of cell(tower) in two dimensional grid of SM |
791 | // ieta - have to change from 0 to (fNZ*fNETAdiv-1) | |
792 | // iphi - have to change from 0 to (fNPhi*fNPHIdiv-1 or fNPhi*fNPHIdiv/2-1) | |
793 | // | |
dc7da436 | 794 | static Int_t iphim, ietam; |
795 | ||
2bb3725c | 796 | GetModulePhiEtaIndexInSModule(nSupMod,nModule, iphim, ietam); |
1d46d1f6 | 797 | // ieta = ietam*fNETAdiv + (1-nIeta); // x(module) = -z(SM) |
798 | ieta = ietam*fNETAdiv + (fNETAdiv - 1 - nIeta); // x(module) = -z(SM) | |
dc7da436 | 799 | iphi = iphim*fNPHIdiv + nIphi; // y(module) = y(SM) |
1d46d1f6 | 800 | |
801 | if(iphi<0 || ieta<0) | |
2bb3725c | 802 | AliDebug(1,Form(" nSupMod %i nModule %i nIphi %i nIeta %i => ieta %i iphi %i\n", |
803 | nSupMod, nModule, nIphi, nIeta, ieta, iphi)); | |
1963b290 | 804 | } |
e52475ed | 805 | |
806 | Int_t AliEMCALGeometry::GetSuperModuleNumber(Int_t absId) const | |
807 | { | |
1d46d1f6 | 808 | // Return the number of the supermodule given the absolute |
809 | // ALICE numbering id | |
fc575e27 | 810 | |
2bb3725c | 811 | static Int_t nSupMod, nModule, nIphi, nIeta; |
812 | GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta); | |
e52475ed | 813 | return nSupMod; |
814 | } | |
815 | ||
1d46d1f6 | 816 | void AliEMCALGeometry::GetModuleIndexesFromCellIndexesInSModule(Int_t nSupMod, Int_t iphi, Int_t ieta, |
2bb3725c | 817 | Int_t &iphim, Int_t &ietam, Int_t &nModule) const |
1d46d1f6 | 818 | { |
2bb3725c | 819 | // Transition from cell indexes (ieta,iphi) to module indexes (ietam,iphim, nModule) |
1d46d1f6 | 820 | static Int_t nphi; |
821 | nphi = GetNumberOfModuleInPhiDirection(nSupMod); | |
822 | ||
823 | ietam = ieta/fNETAdiv; | |
824 | iphim = iphi/fNPHIdiv; | |
2bb3725c | 825 | nModule = ietam * nphi + iphim; |
1d46d1f6 | 826 | } |
827 | ||
828 | Int_t AliEMCALGeometry::GetAbsCellIdFromCellIndexes(Int_t nSupMod, Int_t iphi, Int_t ieta) const | |
829 | { | |
830 | // Transition from super module number(nSupMod) and cell indexes (ieta,iphi) to absId | |
2bb3725c | 831 | static Int_t ietam, iphim, nModule; |
1d46d1f6 | 832 | static Int_t nIeta, nIphi; // cell indexes in module |
833 | ||
2bb3725c | 834 | GetModuleIndexesFromCellIndexesInSModule(nSupMod, iphi, ieta, ietam, iphim, nModule); |
1d46d1f6 | 835 | |
836 | nIeta = ieta%fNETAdiv; | |
837 | nIeta = fNETAdiv - 1 - nIeta; | |
838 | nIphi = iphi%fNPHIdiv; | |
839 | ||
2bb3725c | 840 | return GetAbsCellId(nSupMod, nModule, nIphi, nIeta); |
1d46d1f6 | 841 | } |
842 | ||
843 | ||
e52475ed | 844 | // Methods for AliEMCALRecPoint - Feb 19, 2006 |
14e75ea7 | 845 | Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) const |
e52475ed | 846 | { |
1933eff2 | 847 | // Look to see what the relative |
848 | // position inside a given cell is | |
849 | // for a recpoint. | |
850 | // Alice numbering scheme - Jun 08, 2006 | |
4bba84bd | 851 | // In: |
852 | // absId - cell is as in Geant, 0<= absId < fNCells; | |
853 | // OUT: | |
854 | // xr,yr,zr - x,y,z coordinates of cell with absId inside SM | |
fc575e27 | 855 | |
d25f2c54 | 856 | // Shift index taking into account the difference between standard SM |
857 | // and SM of half size in phi direction | |
858 | const Int_t phiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2 | |
2bb3725c | 859 | static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta; |
e52475ed | 860 | if(!CheckAbsCellId(absId)) return kFALSE; |
861 | ||
2bb3725c | 862 | GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta); |
863 | GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta); | |
e52475ed | 864 | |
1d46d1f6 | 865 | xr = fCentersOfCellsXDir.At(ieta); |
866 | zr = fCentersOfCellsEtaDir.At(ieta); | |
e52475ed | 867 | |
1933eff2 | 868 | if(nSupMod<10) { |
1d46d1f6 | 869 | yr = fCentersOfCellsPhiDir.At(iphi); |
1933eff2 | 870 | } else { |
1d46d1f6 | 871 | yr = fCentersOfCellsPhiDir.At(iphi + phiIndexShift); |
1933eff2 | 872 | } |
d25f2c54 | 873 | AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr)); |
e52475ed | 874 | |
e52475ed | 875 | return kTRUE; |
876 | } | |
877 | ||
14e75ea7 | 878 | Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t loc[3]) const |
879 | { | |
880 | // Alice numbering scheme - Jun 03, 2006 | |
881 | loc[0] = loc[1] = loc[2]=0.0; | |
882 | if(RelPosCellInSModule(absId, loc[0],loc[1],loc[2])) { | |
883 | return kTRUE; | |
884 | } | |
885 | return kFALSE; | |
886 | } | |
887 | ||
888 | Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, TVector3 &vloc) const | |
889 | { | |
890 | static Double_t loc[3]; | |
891 | if(RelPosCellInSModule(absId,loc)) { | |
892 | vloc.SetXYZ(loc[0], loc[1], loc[2]); | |
893 | return kTRUE; | |
894 | } else { | |
895 | vloc.SetXYZ(0,0,0); | |
896 | return kFALSE; | |
897 | } | |
898 | // Alice numbering scheme - Jun 03, 2006 | |
899 | } | |
900 | ||
1ae500a2 | 901 | Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t distEff, Double_t &xr, Double_t &yr, Double_t &zr) const |
902 | { | |
903 | // Jul 30, 2007 - taking into account position of shower max | |
904 | // Look to see what the relative | |
905 | // position inside a given cell is | |
906 | // for a recpoint. | |
907 | // In: | |
908 | // absId - cell is as in Geant, 0<= absId < fNCells; | |
909 | // e - cluster energy | |
910 | // OUT: | |
911 | // xr,yr,zr - x,y,z coordinates of cell with absId inside SM | |
912 | ||
913 | // Shift index taking into account the difference between standard SM | |
914 | // and SM of half size in phi direction | |
915 | const Int_t phiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2 | |
916 | static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta; | |
917 | static Int_t iphim, ietam; | |
918 | static AliEMCALShishKebabTrd1Module *mod = 0; | |
919 | static TVector2 v; | |
920 | if(!CheckAbsCellId(absId)) return kFALSE; | |
921 | ||
922 | GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta); | |
923 | GetModulePhiEtaIndexInSModule(nSupMod, nModule, iphim, ietam); | |
924 | GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta); | |
925 | ||
926 | mod = GetShishKebabModule(ietam); | |
927 | mod->GetPositionAtCenterCellLine(nIeta, distEff, v); | |
928 | xr = v.Y() - fParSM[0]; | |
929 | zr = v.X() - fParSM[2]; | |
930 | ||
931 | if(nSupMod<10) { | |
932 | yr = fCentersOfCellsPhiDir.At(iphi); | |
933 | } else { | |
934 | yr = fCentersOfCellsPhiDir.At(iphi + phiIndexShift); | |
935 | } | |
936 | AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr)); | |
937 | ||
938 | return kTRUE; | |
939 | } | |
940 | ||
941 | Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Int_t maxAbsId, Double_t distEff, Double_t &xr, Double_t &yr, Double_t &zr) const | |
942 | { | |
943 | // Jul 31, 2007 - taking into account position of shower max and apply coor2. | |
944 | // Look to see what the relative | |
945 | // position inside a given cell is | |
946 | // for a recpoint. | |
947 | // In: | |
948 | // absId - cell is as in Geant, 0<= absId < fNCells; | |
949 | // maxAbsId - abs id of cell with highest energy | |
950 | // e - cluster energy | |
951 | // OUT: | |
952 | // xr,yr,zr - x,y,z coordinates of cell with absId inside SM | |
953 | ||
954 | // Shift index taking into account the difference between standard SM | |
955 | // and SM of half size in phi direction | |
956 | const Int_t phiIndexShift = fCentersOfCellsPhiDir.GetSize()/4; // Nov 22, 2006; was 6 for cas 2X2 | |
957 | static Int_t nSupMod, nModule, nIphi, nIeta, iphi, ieta; | |
958 | static Int_t iphim, ietam; | |
959 | static AliEMCALShishKebabTrd1Module *mod = 0; | |
960 | static TVector2 v; | |
961 | ||
962 | static Int_t nSupModM, nModuleM, nIphiM, nIetaM, iphiM, ietaM; | |
963 | static Int_t iphimM, ietamM, maxAbsIdCopy=-1; | |
964 | static AliEMCALShishKebabTrd1Module *modM = 0; | |
965 | static Double_t distCorr; | |
966 | ||
967 | if(!CheckAbsCellId(absId)) return kFALSE; | |
968 | ||
969 | GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta); | |
970 | GetModulePhiEtaIndexInSModule(nSupMod, nModule, iphim, ietam); | |
971 | GetCellPhiEtaIndexInSModule(nSupMod,nModule,nIphi,nIeta, iphi, ieta); | |
972 | mod = GetShishKebabModule(ietam); | |
973 | ||
974 | if(absId != maxAbsId) { | |
975 | distCorr = 0.; | |
976 | if(maxAbsIdCopy != maxAbsId) { | |
977 | GetCellIndex(maxAbsId, nSupModM, nModuleM, nIphiM, nIetaM); | |
978 | GetModulePhiEtaIndexInSModule(nSupModM, nModuleM, iphimM, ietamM); | |
979 | GetCellPhiEtaIndexInSModule(nSupModM,nModuleM,nIphiM,nIetaM, iphiM, ietaM); | |
980 | modM = GetShishKebabModule(ietamM); // do I need this ? | |
981 | maxAbsIdCopy = maxAbsId; | |
982 | } | |
983 | if(ietamM !=0) { | |
984 | distCorr = GetEtaModuleSize()*(ietam-ietamM)/TMath::Tan(modM->GetTheta()); // Stay here | |
985 | //printf(" distCorr %f | dist %f | ietam %i -> etamM %i\n", distCorr, dist, ietam, ietamM); | |
986 | } | |
987 | // distEff += distCorr; | |
988 | } | |
989 | // Bad resolution in this case, strong bias vs phi | |
990 | // distEff = 0.0; | |
991 | mod->GetPositionAtCenterCellLine(nIeta, distEff, v); // Stay here | |
992 | xr = v.Y() - fParSM[0]; | |
993 | zr = v.X() - fParSM[2]; | |
994 | ||
995 | if(nSupMod<10) { | |
996 | yr = fCentersOfCellsPhiDir.At(iphi); | |
997 | } else { | |
998 | yr = fCentersOfCellsPhiDir.At(iphi + phiIndexShift); | |
999 | } | |
1000 | AliDebug(1,Form("absId %i nSupMod %i iphi %i ieta %i xr %f yr %f zr %f ",absId,nSupMod,iphi,ieta,xr,yr,zr)); | |
1001 | ||
1002 | return kTRUE; | |
1003 | } | |
1004 | ||
e52475ed | 1005 | void AliEMCALGeometry::CreateListOfTrd1Modules() |
1006 | { | |
1d46d1f6 | 1007 | // Generate the list of Trd1 modules |
1008 | // which will make up the EMCAL | |
1009 | // geometry | |
fc575e27 | 1010 | |
e5a93224 | 1011 | AliDebug(2,Form(" AliEMCALGeometry::CreateListOfTrd1Modules() started ")); |
1012 | ||
e52475ed | 1013 | AliEMCALShishKebabTrd1Module *mod=0, *mTmp=0; // current module |
1014 | if(fShishKebabTrd1Modules == 0) { | |
1015 | fShishKebabTrd1Modules = new TList; | |
1d46d1f6 | 1016 | fShishKebabTrd1Modules->SetName("ListOfTRD1"); |
e52475ed | 1017 | for(int iz=0; iz< GetNZ(); iz++) { |
1018 | if(iz==0) { | |
1019 | mod = new AliEMCALShishKebabTrd1Module(TMath::Pi()/2.,this); | |
1020 | } else { | |
1021 | mTmp = new AliEMCALShishKebabTrd1Module(*mod); | |
1022 | mod = mTmp; | |
1023 | } | |
1024 | fShishKebabTrd1Modules->Add(mod); | |
1025 | } | |
1026 | } else { | |
e5a93224 | 1027 | AliDebug(2,Form(" Already exits : ")); |
e52475ed | 1028 | } |
1d46d1f6 | 1029 | mod = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(fShishKebabTrd1Modules->GetSize()-1); |
1030 | fEtaMaxOfTRD1 = mod->GetMaxEtaOfModule(0); | |
1031 | ||
1032 | AliDebug(2,Form(" fShishKebabTrd1Modules has %i modules : max eta %5.4f \n", | |
1033 | fShishKebabTrd1Modules->GetSize(),fEtaMaxOfTRD1)); | |
e52475ed | 1034 | // Feb 20,2006; |
dc7da436 | 1035 | // Jun 01, 2006 - ALICE numbering scheme |
e52475ed | 1036 | // define grid for cells in eta(z) and x directions in local coordinates system of SM |
1d46d1f6 | 1037 | // Works just for 2x2 case only -- ?? start here |
1038 | // | |
1039 | // | |
1040 | // Define grid for cells in phi(y) direction in local coordinates system of SM | |
1041 | // as for 2X2 as for 3X3 - Nov 8,2006 | |
1042 | // | |
1043 | AliDebug(2,Form(" Cells grid in phi directions : size %i\n", fCentersOfCellsPhiDir.GetSize())); | |
1044 | Int_t ind=0; // this is phi index | |
85327f24 | 1045 | Int_t ieta=0, nModule=0, iphiTemp; |
1d46d1f6 | 1046 | Double_t xr, zr, theta, phi, eta, r, x,y; |
1047 | TVector3 vglob; | |
85327f24 | 1048 | Double_t ytCenterModule=0.0, ytCenterCell=0.0; |
1d46d1f6 | 1049 | |
1050 | fCentersOfCellsPhiDir.Set(fNPhi*fNPHIdiv); | |
1051 | fPhiCentersOfCells.Set(fNPhi*fNPHIdiv); | |
1052 | ||
1053 | Double_t R0 = GetIPDistance() + GetLongModuleSize()/2.; | |
1054 | for(Int_t it=0; it<fNPhi; it++) { // cycle on modules | |
1055 | ytCenterModule = -fParSM[1] + fPhiModuleSize*(2*it+1)/2; // center of module | |
1056 | for(Int_t ic=0; ic<fNPHIdiv; ic++) { // cycle on cells in module | |
1057 | if(fNPHIdiv==2) { | |
1058 | ytCenterCell = ytCenterModule + fPhiTileSize *(2*ic-1)/2.; | |
1059 | } else if(fNPHIdiv==3){ | |
1060 | ytCenterCell = ytCenterModule + fPhiTileSize *(ic-1); | |
d25f2c54 | 1061 | } else if(fNPHIdiv==1){ |
1062 | ytCenterCell = ytCenterModule; | |
1d46d1f6 | 1063 | } |
1064 | fCentersOfCellsPhiDir.AddAt(ytCenterCell,ind); | |
1065 | // Define grid on phi direction | |
1066 | // Grid is not the same for different eta bin; | |
1067 | // Effect is small but is still here | |
1068 | phi = TMath::ATan2(ytCenterCell, R0); | |
1069 | fPhiCentersOfCells.AddAt(phi, ind); | |
1070 | ||
1071 | AliDebug(2,Form(" ind %2.2i : y %8.3f ", ind, fCentersOfCellsPhiDir.At(ind))); | |
1072 | ind++; | |
1073 | } | |
1074 | } | |
1075 | ||
1076 | fCentersOfCellsEtaDir.Set(fNZ *fNETAdiv); | |
1077 | fCentersOfCellsXDir.Set(fNZ *fNETAdiv); | |
1078 | fEtaCentersOfCells.Set(fNZ *fNETAdiv * fNPhi*fNPHIdiv); | |
1079 | AliDebug(2,Form(" Cells grid in eta directions : size %i\n", fCentersOfCellsEtaDir.GetSize())); | |
1080 | for(Int_t it=0; it<fNZ; it++) { | |
e52475ed | 1081 | AliEMCALShishKebabTrd1Module *trd1 = GetShishKebabModule(it); |
2bb3725c | 1082 | nModule = fNPhi*it; |
1d46d1f6 | 1083 | for(Int_t ic=0; ic<fNETAdiv; ic++) { |
1084 | if(fNPHIdiv==2) { | |
d25f2c54 | 1085 | trd1->GetCenterOfCellInLocalCoordinateofSM(ic, xr, zr); // case of 2X2 |
2bb3725c | 1086 | GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta); |
1d46d1f6 | 1087 | } if(fNPHIdiv==3) { |
1088 | trd1->GetCenterOfCellInLocalCoordinateofSM_3X3(ic, xr, zr); // case of 3X3 | |
2bb3725c | 1089 | GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta); |
d25f2c54 | 1090 | } if(fNPHIdiv==1) { |
1091 | trd1->GetCenterOfCellInLocalCoordinateofSM_1X1(xr, zr); // case of 1X1 | |
2bb3725c | 1092 | GetCellPhiEtaIndexInSModule(0, nModule, 0, ic, iphiTemp, ieta); |
1d46d1f6 | 1093 | } |
d25f2c54 | 1094 | fCentersOfCellsXDir.AddAt(float(xr) - fParSM[0],ieta); |
1095 | fCentersOfCellsEtaDir.AddAt(float(zr) - fParSM[2],ieta); | |
1d46d1f6 | 1096 | // Define grid on eta direction for each bin in phi |
1097 | for(int iphi=0; iphi<fCentersOfCellsPhiDir.GetSize(); iphi++) { | |
1098 | x = xr + trd1->GetRadius(); | |
1099 | y = fCentersOfCellsPhiDir[iphi]; | |
1100 | r = TMath::Sqrt(x*x + y*y + zr*zr); | |
1101 | theta = TMath::ACos(zr/r); | |
1102 | eta = AliEMCALShishKebabTrd1Module::ThetaToEta(theta); | |
1103 | // ind = ieta*fCentersOfCellsPhiDir.GetSize() + iphi; | |
1104 | ind = iphi*fCentersOfCellsEtaDir.GetSize() + ieta; | |
1105 | fEtaCentersOfCells.AddAt(eta, ind); | |
1106 | } | |
1107 | //printf(" ieta %i : xr + trd1->GetRadius() %f : zr %f : eta %f \n", ieta, xr + trd1->GetRadius(), zr, eta); | |
e52475ed | 1108 | } |
1109 | } | |
1d46d1f6 | 1110 | for(Int_t i=0; i<fCentersOfCellsEtaDir.GetSize(); i++) { |
e5a93224 | 1111 | AliDebug(2,Form(" ind %2.2i : z %8.3f : x %8.3f", i+1, |
1d46d1f6 | 1112 | fCentersOfCellsEtaDir.At(i),fCentersOfCellsXDir.At(i))); |
e52475ed | 1113 | } |
e5a93224 | 1114 | |
e52475ed | 1115 | } |
1116 | ||
14e75ea7 | 1117 | void AliEMCALGeometry::GetGlobal(const Double_t *loc, Double_t *glob, int ind) const |
e52475ed | 1118 | { |
14e75ea7 | 1119 | // Figure out the global numbering |
1120 | // of a given supermodule from the | |
b8b0f8c2 | 1121 | // local numbering and the transformation |
1122 | // matrix stored by the geometry manager (allows for misaligned | |
1123 | // geometry) | |
14e75ea7 | 1124 | |
e52475ed | 1125 | if(ind>=0 && ind < GetNumberOfSuperModules()) { |
b8b0f8c2 | 1126 | TString volpath = "ALIC_1/XEN1_1/SMOD_"; |
9aa6a5f6 | 1127 | volpath += ind+1; |
b8b0f8c2 | 1128 | |
1129 | if(GetKey110DEG() && ind>=10) { | |
1130 | volpath = "ALIC_1/XEN1_1/SM10_"; | |
9aa6a5f6 | 1131 | volpath += ind-10+1; |
b8b0f8c2 | 1132 | } |
1133 | ||
1134 | if(!gGeoManager->cd(volpath.Data())) | |
9aa6a5f6 | 1135 | AliFatal(Form("AliEMCALGeometry::GeoManager cannot find path %s!",volpath.Data())); |
b8b0f8c2 | 1136 | |
1137 | TGeoHMatrix* m = gGeoManager->GetCurrentMatrix(); | |
1138 | if(m) { | |
1139 | m->LocalToMaster(loc, glob); | |
1140 | } else { | |
1141 | AliFatal("Geo matrixes are not loaded \n") ; | |
1142 | } | |
e52475ed | 1143 | } |
1144 | } | |
1145 | ||
25b033cf | 1146 | void AliEMCALGeometry::GetGlobal(const TVector3 &vloc, TVector3 &vglob, int ind) const |
1147 | { | |
1148 | //Figure out the global numbering | |
1149 | //of a given supermodule from the | |
1150 | //local numbering given a 3-vector location | |
1151 | ||
1152 | static Double_t tglob[3], tloc[3]; | |
1153 | vloc.GetXYZ(tloc); | |
1154 | GetGlobal(tloc, tglob, ind); | |
1155 | vglob.SetXYZ(tglob[0], tglob[1], tglob[2]); | |
1156 | } | |
1157 | ||
14e75ea7 | 1158 | void AliEMCALGeometry::GetGlobal(Int_t absId , double glob[3]) const |
1159 | { | |
1160 | // Alice numbering scheme - Jun 03, 2006 | |
1161 | static Int_t nSupMod, nModule, nIphi, nIeta; | |
1162 | static double loc[3]; | |
1163 | ||
1164 | glob[0]=glob[1]=glob[2]=0.0; // bad case | |
1165 | if(RelPosCellInSModule(absId, loc)) { | |
1166 | GetCellIndex(absId, nSupMod, nModule, nIphi, nIeta); | |
b8b0f8c2 | 1167 | |
1168 | TString volpath = "ALIC_1/XEN1_1/SMOD_"; | |
1169 | volpath += (nSupMod+1); | |
1170 | ||
1171 | if(GetKey110DEG() && nSupMod>=10) { | |
1172 | volpath = "ALIC_1/XEN1_1/SM10_"; | |
1173 | volpath += (nSupMod-10+1); | |
1174 | } | |
1175 | if(!gGeoManager->cd(volpath.Data())) | |
1176 | AliFatal(Form("GeoManager cannot find path %s!",volpath.Data())); | |
1177 | ||
1178 | TGeoHMatrix* m = gGeoManager->GetCurrentMatrix(); | |
1179 | if(m) { | |
1180 | m->LocalToMaster(loc, glob); | |
1181 | } else { | |
1182 | AliFatal("Geo matrixes are not loaded \n") ; | |
1183 | } | |
14e75ea7 | 1184 | } |
e52475ed | 1185 | } |
1186 | ||
9aa6a5f6 | 1187 | //___________________________________________________________________ |
14e75ea7 | 1188 | void AliEMCALGeometry::GetGlobal(Int_t absId , TVector3 &vglob) const |
1189 | { | |
1190 | // Alice numbering scheme - Jun 03, 2006 | |
1191 | static Double_t glob[3]; | |
1192 | ||
1193 | GetGlobal(absId, glob); | |
1194 | vglob.SetXYZ(glob[0], glob[1], glob[2]); | |
1195 | ||
1196 | } | |
1197 | ||
9aa6a5f6 | 1198 | //____________________________________________________________________________ |
1199 | void AliEMCALGeometry::GetGlobal(const AliRecPoint* /*rp*/, TVector3& /* vglob */) const | |
1200 | { | |
1201 | AliFatal(Form("Please use GetGlobalEMCAL(recPoint,gpos) instead of GetGlobal!")); | |
1202 | } | |
1203 | ||
1204 | //_________________________________________________________________________________ | |
1205 | void AliEMCALGeometry::GetGlobalEMCAL(const AliEMCALRecPoint *rp, TVector3 &vglob) const | |
e52475ed | 1206 | { |
664bfd66 | 1207 | // Figure out the global numbering |
1208 | // of a given supermodule from the | |
1209 | // local numbering for RecPoints | |
fc575e27 | 1210 | |
e52475ed | 1211 | static TVector3 vloc; |
14e75ea7 | 1212 | static Int_t nSupMod, nModule, nIphi, nIeta; |
e52475ed | 1213 | |
9aa6a5f6 | 1214 | const AliEMCALRecPoint *rpTmp = rp; |
1215 | const AliEMCALRecPoint *rpEmc = rpTmp; | |
e52475ed | 1216 | |
14e75ea7 | 1217 | GetCellIndex(rpEmc->GetAbsId(0), nSupMod, nModule, nIphi, nIeta); |
e52475ed | 1218 | rpTmp->GetLocalPosition(vloc); |
1219 | GetGlobal(vloc, vglob, nSupMod); | |
1220 | } | |
1221 | ||
1d46d1f6 | 1222 | void AliEMCALGeometry::EtaPhiFromIndex(Int_t absId,Double_t &eta,Double_t &phi) const |
664bfd66 | 1223 | { |
1d46d1f6 | 1224 | // Nov 16, 2006- float to double |
1225 | // version for TRD1 only | |
664bfd66 | 1226 | static TVector3 vglob; |
1227 | GetGlobal(absId, vglob); | |
1228 | eta = vglob.Eta(); | |
1229 | phi = vglob.Phi(); | |
1230 | } | |
1231 | ||
1d46d1f6 | 1232 | void AliEMCALGeometry::EtaPhiFromIndex(Int_t absId,Float_t &eta,Float_t &phi) const |
1233 | { | |
1234 | // Nov 16,2006 - should be discard in future | |
1235 | static TVector3 vglob; | |
1236 | GetGlobal(absId, vglob); | |
1237 | eta = float(vglob.Eta()); | |
1238 | phi = float(vglob.Phi()); | |
1239 | } | |
1240 | ||
1241 | Bool_t AliEMCALGeometry::GetPhiBoundariesOfSM(Int_t nSupMod, Double_t &phiMin, Double_t &phiMax) const | |
1242 | { | |
1243 | // 0<= nSupMod <=11; phi in rad | |
1244 | static int i; | |
1245 | if(nSupMod<0 || nSupMod >11) return kFALSE; | |
1246 | i = nSupMod/2; | |
1247 | phiMin = fPhiBoundariesOfSM[2*i]; | |
1248 | phiMax = fPhiBoundariesOfSM[2*i+1]; | |
1249 | return kTRUE; | |
1250 | } | |
1251 | ||
1252 | Bool_t AliEMCALGeometry::GetPhiBoundariesOfSMGap(Int_t nPhiSec, Double_t &phiMin, Double_t &phiMax) const | |
1253 | { | |
1254 | // 0<= nPhiSec <=4; phi in rad | |
1255 | // 0; gap boundaries between 0th&2th | 1th&3th SM | |
1256 | // 1; gap boundaries between 2th&4th | 3th&5th SM | |
1257 | // 2; gap boundaries between 4th&6th | 5th&7th SM | |
1258 | // 3; gap boundaries between 6th&8th | 7th&9th SM | |
1259 | // 4; gap boundaries between 8th&10th | 9th&11th SM | |
1260 | if(nPhiSec<0 || nPhiSec >4) return kFALSE; | |
1261 | phiMin = fPhiBoundariesOfSM[2*nPhiSec+1]; | |
1262 | phiMax = fPhiBoundariesOfSM[2*nPhiSec+2]; | |
1263 | return kTRUE; | |
1264 | } | |
1265 | ||
1266 | Bool_t AliEMCALGeometry::SuperModuleNumberFromEtaPhi(Double_t eta, Double_t phi, Int_t &nSupMod) const | |
1267 | { | |
1268 | // Return false if phi belongs a phi cracks between SM | |
1269 | ||
1270 | static Int_t i; | |
1271 | ||
1272 | if(TMath::Abs(eta) > fEtaMaxOfTRD1) return kFALSE; | |
1273 | ||
1274 | phi = TVector2::Phi_0_2pi(phi); // move phi to (0,2pi) boundaries | |
1275 | for(i=0; i<6; i++) { | |
1276 | if(phi>=fPhiBoundariesOfSM[2*i] && phi<=fPhiBoundariesOfSM[2*i+1]) { | |
1277 | nSupMod = 2*i; | |
1278 | if(eta < 0.0) nSupMod++; | |
d25f2c54 | 1279 | AliDebug(1,Form("eta %f phi %f(%5.2f) : nSupMod %i : #bound %i", eta,phi,phi*TMath::RadToDeg(), nSupMod,i)); |
1d46d1f6 | 1280 | return kTRUE; |
1281 | } | |
1282 | } | |
1d46d1f6 | 1283 | return kFALSE; |
1284 | } | |
1285 | ||
1286 | Bool_t AliEMCALGeometry::GetAbsCellIdFromEtaPhi(Double_t eta, Double_t phi, Int_t &absId) const | |
1287 | { | |
1288 | // Nov 17,2006 | |
1289 | // stay here - phi problem as usual | |
1290 | static Int_t nSupMod, i, ieta, iphi, etaShift, nphi; | |
1291 | static Double_t absEta=0.0, d=0.0, dmin=0.0, phiLoc; | |
1292 | absId = nSupMod = - 1; | |
1293 | if(SuperModuleNumberFromEtaPhi(eta, phi, nSupMod)) { | |
1294 | // phi index first | |
1295 | phi = TVector2::Phi_0_2pi(phi); | |
1296 | phiLoc = phi - fPhiCentersOfSM[nSupMod/2]; | |
1297 | nphi = fPhiCentersOfCells.GetSize(); | |
1298 | if(nSupMod>=10) { | |
1299 | phiLoc = phi - 190.*TMath::DegToRad(); | |
1300 | nphi /= 2; | |
1301 | } | |
1302 | ||
1303 | dmin = TMath::Abs(fPhiCentersOfCells[0]-phiLoc); | |
1304 | iphi = 0; | |
1305 | for(i=1; i<nphi; i++) { | |
1306 | d = TMath::Abs(fPhiCentersOfCells[i] - phiLoc); | |
1307 | if(d < dmin) { | |
1308 | dmin = d; | |
1309 | iphi = i; | |
1310 | } | |
1311 | // printf(" i %i : d %f : dmin %f : fPhiCentersOfCells[i] %f \n", i, d, dmin, fPhiCentersOfCells[i]); | |
1312 | } | |
1313 | // odd SM are turned with respect of even SM - reverse indexes | |
1314 | AliDebug(2,Form(" iphi %i : dmin %f (phi %f, phiLoc %f ) ", iphi, dmin, phi, phiLoc)); | |
1315 | // eta index | |
1316 | absEta = TMath::Abs(eta); | |
1317 | etaShift = iphi*fCentersOfCellsEtaDir.GetSize(); | |
1318 | dmin = TMath::Abs(fEtaCentersOfCells[etaShift]-absEta); | |
1319 | ieta = 0; | |
1320 | for(i=1; i<fCentersOfCellsEtaDir.GetSize(); i++) { | |
1321 | d = TMath::Abs(fEtaCentersOfCells[i+etaShift] - absEta); | |
1322 | if(d < dmin) { | |
1323 | dmin = d; | |
1324 | ieta = i; | |
1325 | } | |
1326 | } | |
1327 | AliDebug(2,Form(" ieta %i : dmin %f (eta=%f) : nSupMod %i ", ieta, dmin, eta, nSupMod)); | |
1328 | ||
1329 | if(eta<0) iphi = (nphi-1) - iphi; | |
1330 | absId = GetAbsCellIdFromCellIndexes(nSupMod, iphi, ieta); | |
1331 | ||
1332 | return kTRUE; | |
1333 | } | |
1334 | return kFALSE; | |
1335 | } | |
1336 | ||
1ae500a2 | 1337 | AliEMCALShishKebabTrd1Module* AliEMCALGeometry::GetShishKebabModule(Int_t neta) const |
fc575e27 | 1338 | { |
1339 | //This method was too long to be | |
1340 | //included in the header file - the | |
1341 | //rule checker complained about it's | |
1342 | //length, so we move it here. It returns the | |
1343 | //shishkebabmodule at a given eta index point. | |
1344 | ||
1345 | static AliEMCALShishKebabTrd1Module* trd1=0; | |
1346 | if(fShishKebabTrd1Modules && neta>=0 && neta<fShishKebabTrd1Modules->GetSize()) { | |
1347 | trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(neta); | |
1348 | } else trd1 = 0; | |
1349 | return trd1; | |
1350 | } | |
1d46d1f6 | 1351 | |
1352 | void AliEMCALGeometry::Browse(TBrowser* b) | |
1353 | { | |
1354 | if(fShishKebabTrd1Modules) b->Add(fShishKebabTrd1Modules); | |
1355 | } | |
1356 | ||
1357 | Bool_t AliEMCALGeometry::IsFolder() const | |
1358 | { | |
1359 | if(fShishKebabTrd1Modules) return kTRUE; | |
1360 | else return kFALSE; | |
1361 | } | |
9aa6a5f6 | 1362 | |
1363 | Double_t AliEMCALGeometry::GetPhiCenterOfSM(Int_t nsupmod) const | |
1364 | { | |
1365 | static int i = nsupmod/2; | |
1366 | return fPhiCentersOfSM[i]; | |
1367 | ||
1368 | } |