]>
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 | |
b13bbe81 | 26 | //*-- Author: Sahal Yacoob (LBL / UCT) |
27 | // and : Yves Schutz (SUBATECH) | |
28 | // and : Jennifer Klay (LBL) | |
1963b290 | 29 | // SHASHLYK : Aleksei Pavlinov (WSU) |
c63c3c5d | 30 | // SuperModules -> module(or tower) -> cell |
2012850d | 31 | |
2012850d | 32 | // --- AliRoot header files --- |
1ceeec56 | 33 | #include <assert.h> |
e52475ed | 34 | #include "Riostream.h" |
35 | ||
ca8f5bd0 | 36 | #include <TMath.h> |
116cbefd | 37 | #include <TVector3.h> |
e52475ed | 38 | #include <TArrayD.h> |
c63c3c5d | 39 | #include <TObjArray.h> |
e52475ed | 40 | #include <TGeoManager.h> |
41 | #include <TGeoNode.h> | |
42 | #include <TGeoMatrix.h> | |
f0377b23 | 43 | #include <TMatrixD.h> |
d434833b | 44 | #include <TObjString.h> |
f0377b23 | 45 | #include <TClonesArray.h> |
173558f2 | 46 | |
ca8f5bd0 | 47 | // -- ALICE Headers. |
d64c959b | 48 | //#include "AliConst.h" |
e5a93224 | 49 | #include "AliLog.h" |
173558f2 | 50 | |
ca8f5bd0 | 51 | // --- EMCAL headers |
52 | #include "AliEMCALGeometry.h" | |
e52475ed | 53 | #include "AliEMCALShishKebabTrd1Module.h" |
e52475ed | 54 | #include "AliEMCALRecPoint.h" |
f0377b23 | 55 | #include "AliEMCALDigit.h" |
d434833b | 56 | #include "AliEMCALHistoUtilities.h" |
57 | #include "AliEMCALAlignData.h" | |
2012850d | 58 | |
925e6570 | 59 | ClassImp(AliEMCALGeometry) |
2012850d | 60 | |
d434833b | 61 | // these initialisations are needed for a singleton |
62 | AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0; | |
63 | Bool_t AliEMCALGeometry::fgInit = kFALSE; | |
64 | AliEMCALAlignData *AliEMCALGeometry::fgAlignData = 0; | |
65 | ||
b13bbe81 | 66 | //______________________________________________________________________ |
67 | AliEMCALGeometry::~AliEMCALGeometry(void){ | |
68 | // dtor | |
2012850d | 69 | } |
395c7ba2 | 70 | //______________________________________________________________________ |
71 | void AliEMCALGeometry::Init(void){ | |
72 | // Initializes the EMCAL parameters | |
fdebddeb | 73 | // naming convention : GUV_WX_N_ gives the composition of a tower |
395c7ba2 | 74 | // WX inform about the composition of the EM calorimeter section: |
fdebddeb | 75 | // thickness in mm of Pb radiator (W) and of scintillator (X), and number of scintillator layers (N) |
76 | // New geometry: EMCAL_55_25 | |
1963b290 | 77 | // 24-aug-04 for shish-kebab |
78 | // SHISH_25 or SHISH_62 | |
c63c3c5d | 79 | // 11-oct-05 - correction for pre final design |
80 | // Feb 06,2006 - decrease the weight of EMCAL | |
fc575e27 | 81 | |
b44d5aa4 | 82 | fAdditionalOpts[0] = "nl="; // number of sampling layers (fNECLayers) |
83 | fAdditionalOpts[1] = "pbTh="; // cm, Thickness of the Pb (fECPbRadThick) | |
84 | fAdditionalOpts[2] = "scTh="; // cm, Thickness of the Sc (fECScintThick) | |
85 | fAdditionalOpts[3] = "latSS="; // cm, Thickness of lateral steel strip (fLateralSteelStrip) | |
fc575e27 | 86 | |
87 | fNAdditionalOpts = sizeof(fAdditionalOpts) / sizeof(char*); | |
88 | ||
fdebddeb | 89 | fgInit = kFALSE; // Assume failed until proven otherwise. |
fc575e27 | 90 | fGeoName = GetName(); |
91 | fGeoName.ToUpper(); | |
d87bd045 | 92 | fKey110DEG = 0; |
fc575e27 | 93 | if(fGeoName.Contains("110DEG")) fKey110DEG = 1; // for GetAbsCellId |
e52475ed | 94 | fShishKebabTrd1Modules = 0; |
95 | fTrd2AngleY = f2Trd2Dy2 = fEmptySpace = fTubsR = fTubsTurnAngle = 0; | |
1963b290 | 96 | |
97 | fNZ = 114; // granularity along Z (eta) | |
98 | fNPhi = 168; // granularity in phi (azimuth) | |
99 | fArm1PhiMin = 60.0; // degrees, Starting EMCAL Phi position | |
100 | fArm1PhiMax = 180.0; // degrees, Ending EMCAL Phi position | |
101 | fArm1EtaMin = -0.7; // pseudorapidity, Starting EMCAL Eta position | |
102 | fArm1EtaMax = +0.7; // pseudorapidity, Ending EMCAL Eta position | |
103 | fIPDistance = 454.0; // cm, Radial distance to inner surface of EMCAL | |
905263da | 104 | fPhiGapForSM = 0.; // cm, only for final TRD1 geometry |
e52475ed | 105 | for(int i=0; i<12; i++) fMatrixOfSM[i] = 0; |
1963b290 | 106 | |
107 | // geometry | |
fc575e27 | 108 | if(fGeoName.Contains("SHISH")){ // Only shahslyk now |
905263da | 109 | // 7-sep-05; integration issue |
110 | fArm1PhiMin = 80.0; // 60 -> 80 | |
c01485dd | 111 | fArm1PhiMax = 180.0; // 180 -> 190 |
905263da | 112 | |
113 | fNumberOfSuperModules = 10; // 12 = 6 * 2 (6 in phi, 2 in Z); | |
1963b290 | 114 | fSteelFrontThick = 2.54; // 9-sep-04 |
115 | fIPDistance = 460.0; | |
116 | fFrontSteelStrip = fPassiveScintThick = 0.0; // 13-may-05 | |
117 | fLateralSteelStrip = 0.025; // before MAY 2005 | |
118 | fPhiModuleSize = fEtaModuleSize = 11.4; | |
119 | fPhiTileSize = fEtaTileSize = 5.52; // (11.4-5.52*2)/2. = 0.18 cm (wall thickness) | |
120 | fNPhi = 14; | |
121 | fNZ = 30; | |
122 | fAlFrontThick = fGap2Active = 0; | |
123 | fNPHIdiv = fNETAdiv = 2; | |
124 | ||
125 | fNECLayers = 62; | |
126 | fECScintThick = fECPbRadThickness = 0.2; | |
127 | fSampling = 1.; // 30-aug-04 - should be calculated | |
fc575e27 | 128 | if(fGeoName.Contains("TWIST")) { // all about EMCAL module |
1963b290 | 129 | fNZ = 27; // 16-sep-04 |
fc575e27 | 130 | } else if(fGeoName.Contains("TRD")) { |
1963b290 | 131 | fIPDistance = 428.0; // 11-may-05 |
132 | fSteelFrontThick = 0.0; // 3.17 -> 0.0; 28-mar-05 : no stell plate | |
133 | fNPhi = 12; | |
134 | fSampling = 12.327; | |
135 | fPhiModuleSize = fEtaModuleSize = 12.26; | |
136 | fNZ = 26; // 11-oct-04 | |
137 | fTrd1Angle = 1.3; // in degree | |
138 | // 18-nov-04; 1./0.08112=12.327 | |
139 | // http://pdsfweb01.nersc.gov/~pavlinov/ALICE/SHISHKEBAB/RES/linearityAndResolutionForTRD1.html | |
fc575e27 | 140 | if(fGeoName.Contains("TRD1")) { // 30-jan-05 |
1963b290 | 141 | // for final design |
905263da | 142 | fPhiGapForSM = 2.; // cm, only for final TRD1 geometry |
fc575e27 | 143 | if(fGeoName.Contains("MAY05") || fGeoName.Contains("WSUC") || fGeoName.Contains("FINAL")){ |
1963b290 | 144 | fNumberOfSuperModules = 12; // 20-may-05 |
fc575e27 | 145 | if(fGeoName.Contains("WSUC")) fNumberOfSuperModules = 1; // 27-may-05 |
1963b290 | 146 | fNECLayers = 77; // (13-may-05 from V.Petrov) |
147 | fPhiModuleSize = 12.5; // 20-may-05 - rectangular shape | |
148 | fEtaModuleSize = 11.9; | |
149 | fECScintThick = fECPbRadThickness = 0.16;// (13-may-05 from V.Petrov) | |
150 | fFrontSteelStrip = 0.025;// 0.025cm = 0.25mm (13-may-05 from V.Petrov) | |
151 | fLateralSteelStrip = 0.01; // 0.01cm = 0.1mm (13-may-05 from V.Petrov) - was 0.025 | |
152 | fPassiveScintThick = 0.8; // 0.8cm = 8mm (13-may-05 from V.Petrov) | |
153 | fNZ = 24; | |
154 | fTrd1Angle = 1.5; // 1.3 or 1.5 | |
905263da | 155 | |
fc575e27 | 156 | if(fGeoName.Contains("FINAL")) { // 9-sep-05 |
905263da | 157 | fNumberOfSuperModules = 10; |
fc575e27 | 158 | if(fGeoName.Contains("110DEG")) { |
d87bd045 | 159 | fNumberOfSuperModules = 12;// last two modules have size 10 degree in phi (180<phi<190) |
160 | fArm1PhiMax = 200.0; // for XEN1 and turn angle of super modules | |
161 | } | |
905263da | 162 | fPhiModuleSize = 12.26 - fPhiGapForSM / Float_t(fNPhi); // first assumption |
163 | fEtaModuleSize = fPhiModuleSize; | |
fc575e27 | 164 | if(fGeoName.Contains("HUGE")) fNECLayers *= 3; // 28-oct-05 for analysing leakage |
905263da | 165 | } |
1963b290 | 166 | } |
fc575e27 | 167 | } else if(fGeoName.Contains("TRD2")) { // 30-jan-05 |
1963b290 | 168 | fSteelFrontThick = 0.0; // 11-mar-05 |
169 | fIPDistance+= fSteelFrontThick; // 1-feb-05 - compensate absence of steel plate | |
170 | fTrd1Angle = 1.64; // 1.3->1.64 | |
171 | fTrd2AngleY = fTrd1Angle; // symmetric case now | |
172 | fEmptySpace = 0.2; // 2 mm | |
173 | fTubsR = fIPDistance; // 31-jan-05 - as for Fred case | |
174 | ||
175 | fPhiModuleSize = fTubsR*2.*TMath::Tan(fTrd2AngleY*TMath::DegToRad()/2.); | |
176 | fPhiModuleSize -= fEmptySpace/2.; // 11-mar-05 | |
177 | fEtaModuleSize = fPhiModuleSize; // 20-may-05 | |
178 | fTubsTurnAngle = 3.; | |
179 | } | |
180 | fNPHIdiv = fNETAdiv = 2; // 13-oct-04 - division again | |
fc575e27 | 181 | if(fGeoName.Contains("3X3")) { // 23-nov-04 |
1963b290 | 182 | fNPHIdiv = fNETAdiv = 3; |
fc575e27 | 183 | } else if(fGeoName.Contains("4X4")) { |
1963b290 | 184 | fNPHIdiv = fNETAdiv = 4; |
185 | } | |
186 | } | |
fc575e27 | 187 | if(fGeoName.Contains("25")){ |
1963b290 | 188 | fNECLayers = 25; |
189 | fECScintThick = fECPbRadThickness = 0.5; | |
190 | } | |
fc575e27 | 191 | if(fGeoName.Contains("WSUC")){ // 18-may-05 - about common structure |
1963b290 | 192 | fShellThickness = 30.; // should be change |
193 | fNPhi = fNZ = 4; | |
194 | } | |
c63c3c5d | 195 | |
fc575e27 | 196 | CheckAdditionalOptions(); |
c63c3c5d | 197 | |
31b39a2e | 198 | fPhiTileSize = fPhiModuleSize/2. - fLateralSteelStrip; // 13-may-05 |
199 | fEtaTileSize = fEtaModuleSize/2. - fLateralSteelStrip; // 13-may-05 | |
200 | ||
1963b290 | 201 | // constant for transition absid <--> indexes |
202 | fNCellsInTower = fNPHIdiv*fNETAdiv; | |
203 | fNCellsInSupMod = fNCellsInTower*fNPhi*fNZ; | |
204 | fNCells = fNCellsInSupMod*fNumberOfSuperModules; | |
fc575e27 | 205 | if(fGeoName.Contains("110DEG")) fNCells -= fNCellsInSupMod; |
1963b290 | 206 | |
207 | fLongModuleSize = fNECLayers*(fECScintThick + fECPbRadThickness); | |
fc575e27 | 208 | if(fGeoName.Contains("MAY05")) fLongModuleSize += (fFrontSteelStrip + fPassiveScintThick); |
1963b290 | 209 | |
210 | // 30-sep-04 | |
fc575e27 | 211 | if(fGeoName.Contains("TRD")) { |
1963b290 | 212 | f2Trd1Dx2 = fEtaModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd1Angle*TMath::DegToRad()/2.); |
fc575e27 | 213 | if(fGeoName.Contains("TRD2")) { // 27-jan-05 |
1963b290 | 214 | f2Trd2Dy2 = fPhiModuleSize + 2.*fLongModuleSize*TMath::Tan(fTrd2AngleY*TMath::DegToRad()/2.); |
215 | } | |
216 | } | |
fc575e27 | 217 | } else Fatal("Init", "%s is an undefined geometry!", fGeoName.Data()) ; |
fdebddeb | 218 | |
1963b290 | 219 | fNPhiSuperModule = fNumberOfSuperModules/2; |
220 | if(fNPhiSuperModule<1) fNPhiSuperModule = 1; | |
fdebddeb | 221 | //There is always one more scintillator than radiator layer because of the first block of aluminium |
222 | fShellThickness = fAlFrontThick + fGap2Active + fNECLayers*GetECScintThick()+(fNECLayers-1)*GetECPbRadThick(); | |
fc575e27 | 223 | if(fGeoName.Contains("SHISH")) { |
1963b290 | 224 | fShellThickness = fSteelFrontThick + fLongModuleSize; |
fc575e27 | 225 | if(fGeoName.Contains("TWIST")) { // 13-sep-04 |
1963b290 | 226 | fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + fPhiModuleSize*fEtaModuleSize); |
227 | fShellThickness += fSteelFrontThick; | |
fc575e27 | 228 | } else if(fGeoName.Contains("TRD")) { // 1-oct-04 |
1963b290 | 229 | fShellThickness = TMath::Sqrt(fLongModuleSize*fLongModuleSize + f2Trd1Dx2*f2Trd1Dx2); |
230 | fShellThickness += fSteelFrontThick; | |
e52475ed | 231 | // Local coordinates |
232 | fParSM[0] = GetShellThickness()/2.; | |
233 | fParSM[1] = GetPhiModuleSize() * GetNPhi()/2.; | |
234 | fParSM[2] = 350./2.; | |
1963b290 | 235 | } |
236 | } | |
fdebddeb | 237 | |
395c7ba2 | 238 | fZLength = 2.*ZFromEtaR(fIPDistance+fShellThickness,fArm1EtaMax); // Z coverage |
239 | fEnvelop[0] = fIPDistance; // mother volume inner radius | |
240 | fEnvelop[1] = fIPDistance + fShellThickness; // mother volume outer r. | |
241 | fEnvelop[2] = 1.00001*fZLength; // add some padding for mother volume. | |
242 | ||
d434833b | 243 | if(fgAlignData != NULL) { |
244 | // Number of modules is read from Alignment DB if exists | |
245 | fNumberOfSuperModules = fgAlignData->GetNSuperModules(); | |
246 | } | |
247 | ||
395c7ba2 | 248 | fgInit = kTRUE; |
249 | ||
e5a93224 | 250 | if (AliDebugLevel()>=2) { |
fc575e27 | 251 | printf("Init: geometry of EMCAL named %s is as follows:\n", fGeoName.Data()); |
e52475ed | 252 | printf( " ECAL : %d x (%f cm Pb, %f cm Sc) \n", |
253 | GetNECLayers(), GetECPbRadThick(), GetECScintThick() ) ; | |
254 | printf(" fSampling %5.2f \n", fSampling ); | |
fc575e27 | 255 | if(fGeoName.Contains("SHISH")){ |
1963b290 | 256 | printf(" fIPDistance %6.3f cm \n", fIPDistance); |
257 | if(fSteelFrontThick>0.) | |
258 | printf(" fSteelFrontThick %6.3f cm \n", fSteelFrontThick); | |
259 | printf(" fNPhi %i | fNZ %i \n", fNPhi, fNZ); | |
d87bd045 | 260 | printf(" fNCellsInTower %i : fNCellsInSupMod %i : fNCells %i\n",fNCellsInTower, fNCellsInSupMod, fNCells); |
fc575e27 | 261 | if(fGeoName.Contains("MAY05")){ |
1963b290 | 262 | printf(" fFrontSteelStrip %6.4f cm (thickness of front steel strip)\n", |
263 | fFrontSteelStrip); | |
264 | printf(" fLateralSteelStrip %6.4f cm (thickness of lateral steel strip)\n", | |
265 | fLateralSteelStrip); | |
266 | printf(" fPassiveScintThick %6.4f cm (thickness of front passive Sc tile)\n", | |
267 | fPassiveScintThick); | |
268 | } | |
c63c3c5d | 269 | printf(" X:Y module size %6.3f , %6.3f cm \n", fPhiModuleSize, fEtaModuleSize); |
270 | printf(" X:Y tile size %6.3f , %6.3f cm \n", fPhiTileSize, fEtaTileSize); | |
271 | printf(" #of sampling layers %i(fNECLayers) \n", fNECLayers); | |
272 | printf(" fLongModuleSize %6.3f cm \n", fLongModuleSize); | |
1963b290 | 273 | printf(" #supermodule in phi direction %i \n", fNPhiSuperModule ); |
274 | } | |
fc575e27 | 275 | if(fGeoName.Contains("TRD")) { |
1963b290 | 276 | printf(" fTrd1Angle %7.4f\n", fTrd1Angle); |
277 | printf(" f2Trd1Dx2 %7.4f\n", f2Trd1Dx2); | |
fc575e27 | 278 | if(fGeoName.Contains("TRD2")) { |
1963b290 | 279 | printf(" fTrd2AngleY %7.4f\n", fTrd2AngleY); |
280 | printf(" f2Trd2Dy2 %7.4f\n", f2Trd2Dy2); | |
905263da | 281 | printf(" fTubsR %7.2f cm\n", fTubsR); |
1963b290 | 282 | printf(" fTubsTurnAngle %7.4f\n", fTubsTurnAngle); |
905263da | 283 | printf(" fEmptySpace %7.4f cm\n", fEmptySpace); |
fc575e27 | 284 | } else if(fGeoName.Contains("TRD1") && fGeoName.Contains("FINAL")){ |
e52475ed | 285 | printf("SM dimensions(TRD1) : dx %7.2f dy %7.2f dz %7.2f (SMOD, BOX)\n", |
286 | fParSM[0],fParSM[1],fParSM[2]); | |
905263da | 287 | printf(" fPhiGapForSM %7.4f cm \n", fPhiGapForSM); |
fc575e27 | 288 | if(fGeoName.Contains("110DEG"))printf(" Last two modules have size 10 degree in phi (180<phi<190)\n"); |
1963b290 | 289 | } |
290 | } | |
88cb7938 | 291 | printf("Granularity: %d in eta and %d in phi\n", GetNZ(), GetNPhi()) ; |
1963b290 | 292 | printf("Layout: phi = (%7.1f, %7.1f), eta = (%5.2f, %5.2f), IP = %7.2f\n", |
293 | GetArm1PhiMin(), GetArm1PhiMax(),GetArm1EtaMin(), GetArm1EtaMax(), GetIPDistance() ); | |
88cb7938 | 294 | } |
f0377b23 | 295 | //TRU parameters. These parameters values are not the final ones. |
296 | fNTRU = 3 ; | |
297 | fNTRUEta = 3 ; | |
298 | fNTRUPhi = 1 ; | |
2012850d | 299 | } |
173558f2 | 300 | |
c63c3c5d | 301 | //______________________________________________________________________ |
302 | ||
fc575e27 | 303 | void AliEMCALGeometry::CheckAdditionalOptions() |
304 | { | |
305 | // Feb 06,2006 | |
306 | //Additional options that | |
307 | //can be used to select | |
308 | //the specific geometry of | |
309 | //EMCAL to run | |
310 | ||
c63c3c5d | 311 | fArrayOpts = new TObjArray; |
fc575e27 | 312 | Int_t nopt = AliEMCALHistoUtilities::ParseString(fGeoName, *fArrayOpts); |
c63c3c5d | 313 | if(nopt==1) { // no aditional option(s) |
314 | fArrayOpts->Delete(); | |
315 | delete fArrayOpts; | |
316 | fArrayOpts = 0; | |
317 | return; | |
318 | } | |
319 | for(Int_t i=1; i<nopt; i++){ | |
320 | TObjString *o = (TObjString*)fArrayOpts->At(i); | |
321 | ||
322 | TString addOpt = o->String(); | |
323 | Int_t indj=-1; | |
fc575e27 | 324 | for(Int_t j=0; j<fNAdditionalOpts; j++) { |
325 | TString opt = fAdditionalOpts[j]; | |
c63c3c5d | 326 | if(addOpt.Contains(opt,TString::kIgnoreCase)) { |
327 | indj = j; | |
328 | break; | |
329 | } | |
330 | } | |
331 | if(indj<0) { | |
e5a93224 | 332 | AliDebug(2,Form("<E> option |%s| unavailable : ** look to the file AliEMCALGeometry.h **\n", |
333 | addOpt.Data())); | |
c63c3c5d | 334 | assert(0); |
335 | } else { | |
e5a93224 | 336 | AliDebug(2,Form("<I> option |%s| is valid : number %i : |%s|\n", |
337 | addOpt.Data(), indj, fAdditionalOpts[indj])); | |
c63c3c5d | 338 | if (addOpt.Contains("NL=",TString::kIgnoreCase)) {// number of sampling layers |
339 | sscanf(addOpt.Data(),"NL=%i", &fNECLayers); | |
e5a93224 | 340 | AliDebug(2,Form(" fNECLayers %i (new) \n", fNECLayers)); |
b44d5aa4 | 341 | } else if(addOpt.Contains("PBTH=",TString::kIgnoreCase)) {//Thickness of the Pb(fECPbRadThicknes) |
c63c3c5d | 342 | sscanf(addOpt.Data(),"PBTH=%f", &fECPbRadThickness); |
b44d5aa4 | 343 | } else if(addOpt.Contains("SCTH=",TString::kIgnoreCase)) {//Thickness of the Sc(fECScintThick) |
c63c3c5d | 344 | sscanf(addOpt.Data(),"SCTH=%f", &fECScintThick); |
b44d5aa4 | 345 | } else if(addOpt.Contains("LATSS=",TString::kIgnoreCase)) {// Thickness of lateral steel strip (fLateralSteelStrip) |
346 | sscanf(addOpt.Data(),"LATSS=%f", &fLateralSteelStrip); | |
347 | AliDebug(2,Form(" fLateralSteelStrip %f (new) \n", fLateralSteelStrip)); | |
c63c3c5d | 348 | } |
349 | } | |
350 | } | |
351 | } | |
352 | ||
f0377b23 | 353 | //____________________________________________________________________________ |
356fd0a9 | 354 | void AliEMCALGeometry::FillTRU(const TClonesArray * digits, TClonesArray * ampmatrix, TClonesArray * timeRmatrix) { |
f0377b23 | 355 | |
356 | ||
356fd0a9 | 357 | // Orders digits ampitudes list in fNTRU TRUs (384 cells) per supermodule. |
358 | // Each TRU is a TMatrixD, and they are kept in TClonesArrays. The number of | |
359 | // TRU in phi is fNTRUPhi, and the number of TRU in eta is fNTRUEta. | |
360 | // Last 2 modules are half size in Phi, I considered that the number of TRU | |
361 | // is maintained for the last modules but decision not taken. If different, | |
362 | // then this must be changed. | |
363 | ||
f0377b23 | 364 | |
365 | //Check data members | |
366 | ||
367 | if(fNTRUEta*fNTRUPhi != fNTRU) | |
368 | Error("FillTRU"," Wrong number of TRUS per Eta or Phi"); | |
369 | ||
356fd0a9 | 370 | //Initilize and declare variables |
f0377b23 | 371 | //List of TRU matrices initialized to 0. |
356fd0a9 | 372 | Int_t nCellsPhi = fNPhi*2/fNTRUPhi; |
373 | Int_t nCellsPhi2 = fNPhi/fNTRUPhi; //HalfSize modules | |
374 | Int_t nCellsEta = fNZ*2/fNTRUEta; | |
f0377b23 | 375 | Int_t id = -1; |
376 | Float_t amp = -1; | |
356fd0a9 | 377 | Float_t timeR = -1; |
f0377b23 | 378 | Int_t iSupMod = -1; |
379 | Int_t nTower = -1; | |
380 | Int_t nIphi = -1; | |
381 | Int_t nIeta = -1; | |
382 | Int_t iphi = -1; | |
383 | Int_t ieta = -1; | |
356fd0a9 | 384 | |
385 | //List of TRU matrices initialized to 0. | |
386 | for(Int_t k = 0; k < fNTRU*fNumberOfSuperModules; k++){ | |
387 | TMatrixD * amptrus = new TMatrixD(nCellsPhi,nCellsEta) ; | |
388 | TMatrixD * timeRtrus = new TMatrixD(nCellsPhi,nCellsEta) ; | |
389 | for(Int_t i = 0; i < nCellsPhi; i++){ | |
390 | for(Int_t j = 0; j < nCellsEta; j++){ | |
391 | (*amptrus)(i,j) = 0.0; | |
392 | (*timeRtrus)(i,j) = 0.0; | |
393 | } | |
394 | } | |
395 | new((*ampmatrix)[k]) TMatrixD(*amptrus) ; | |
396 | new((*timeRmatrix)[k]) TMatrixD(*timeRtrus) ; | |
397 | } | |
398 | ||
399 | AliEMCALDigit * dig ; | |
f0377b23 | 400 | |
401 | //Digits loop to fill TRU matrices with amplitudes. | |
f0377b23 | 402 | for(Int_t idig = 0 ; idig < digits->GetEntriesFast() ; idig++){ |
403 | ||
404 | dig = dynamic_cast<AliEMCALDigit *>(digits->At(idig)) ; | |
356fd0a9 | 405 | amp = dig->GetAmp() ; // Energy of the digit (arbitrary units) |
406 | id = dig->GetId() ; // Id label of the cell | |
407 | timeR = dig->GetTimeR() ; // Earliest time of the digit | |
f0377b23 | 408 | |
409 | //Get eta and phi cell position in supermodule | |
410 | Bool_t bCell = GetCellIndex(id, iSupMod, nTower, nIphi, nIeta) ; | |
411 | if(!bCell) | |
412 | Error("FillTRU","Wrong cell id number") ; | |
413 | ||
414 | GetCellPhiEtaIndexInSModule(iSupMod,nTower,nIphi, nIeta,iphi,ieta); | |
415 | ||
416 | //Check to which TRU in the supermodule belongs the cell. | |
417 | //Supermodules are divided in a TRU matrix of dimension | |
418 | //(fNTRUPhi,fNTRUEta). | |
419 | //Each TRU is a cell matrix of dimension (nCellsPhi,nCellsEta) | |
420 | ||
421 | //First calculate the row and column in the supermodule | |
422 | //of the TRU to which the cell belongs. | |
f0377b23 | 423 | Int_t col = (ieta-1)/nCellsEta+1; |
424 | Int_t row = (iphi-1)/nCellsPhi+1; | |
356fd0a9 | 425 | if(iSupMod > 10) |
426 | row = (iphi-1)/nCellsPhi2+1; | |
427 | //Calculate label number of the TRU | |
428 | Int_t itru = (row-1) + (col-1)*fNTRUPhi + (iSupMod-1)*fNTRU ; | |
f0377b23 | 429 | |
430 | //Fill TRU matrix with cell values | |
356fd0a9 | 431 | TMatrixD * amptrus = dynamic_cast<TMatrixD *>(ampmatrix->At(itru)) ; |
432 | TMatrixD * timeRtrus = dynamic_cast<TMatrixD *>(timeRmatrix->At(itru)) ; | |
f0377b23 | 433 | |
356fd0a9 | 434 | //Calculate row and column of the cell inside the TRU with number itru |
435 | Int_t irow = (iphi-1) - (row-1) * nCellsPhi; | |
436 | if(iSupMod > 10) | |
437 | irow = (iphi-1) - (row-1) * nCellsPhi2; | |
f0377b23 | 438 | Int_t icol = (ieta-1) - (col-1) * nCellsEta; |
439 | ||
356fd0a9 | 440 | (*amptrus)(irow,icol) = amp ; |
441 | (*timeRtrus)(irow,icol) = timeR ; | |
f0377b23 | 442 | |
443 | } | |
f0377b23 | 444 | } |
445 | ||
356fd0a9 | 446 | //______________________________________________________________________ |
447 | void AliEMCALGeometry::GetCellPhiEtaIndexInSModuleFromTRUIndex(const Int_t itru, const Int_t iphitru, const Int_t ietatru, Int_t &iphiSM, Int_t &ietaSM) const | |
448 | { | |
449 | ||
450 | // This method transforms the (eta,phi) index of a cells in a | |
451 | // TRU matrix into Super Module (eta,phi) index. | |
452 | ||
453 | // Calculate in which row and column in which the TRU are | |
454 | // ordered in the SM | |
455 | ||
456 | Int_t col = itru/ fNTRUPhi + 1; | |
457 | Int_t row = itru - (col-1)*fNTRUPhi + 1; | |
458 | ||
459 | //Calculate the (eta,phi) index in SM | |
460 | Int_t nCellsPhi = fNPhi*2/fNTRUPhi; | |
461 | Int_t nCellsEta = fNZ*2/fNTRUEta; | |
462 | ||
463 | iphiSM = nCellsPhi*(row-1) + iphitru + 1 ; | |
464 | ietaSM = nCellsEta*(col-1) + ietatru + 1 ; | |
465 | } | |
f0377b23 | 466 | |
b13bbe81 | 467 | //______________________________________________________________________ |
468 | AliEMCALGeometry * AliEMCALGeometry::GetInstance(){ | |
05a92d59 | 469 | // Returns the pointer of the unique instance |
470 | ||
e52475ed | 471 | AliEMCALGeometry * rv = static_cast<AliEMCALGeometry *>( fgGeom ); |
472 | return rv; | |
2012850d | 473 | } |
173558f2 | 474 | |
b13bbe81 | 475 | //______________________________________________________________________ |
476 | AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name, | |
477 | const Text_t* title){ | |
478 | // Returns the pointer of the unique instance | |
479 | ||
480 | AliEMCALGeometry * rv = 0; | |
481 | if ( fgGeom == 0 ) { | |
482 | if ( strcmp(name,"") == 0 ) rv = 0; | |
e5a93224 | 483 | else { |
b13bbe81 | 484 | fgGeom = new AliEMCALGeometry(name, title); |
485 | if ( fgInit ) rv = (AliEMCALGeometry * ) fgGeom; | |
486 | else { | |
487 | rv = 0; | |
488 | delete fgGeom; | |
489 | fgGeom = 0; | |
490 | } // end if fgInit | |
491 | } // end if strcmp(name,"") | |
492 | }else{ | |
e5a93224 | 493 | if ( strcmp(fgGeom->GetName(), name) != 0) { |
494 | printf("\ncurrent geometry is %s : ", fgGeom->GetName()); | |
495 | printf(" you cannot call %s ", name); | |
b13bbe81 | 496 | }else{ |
9859bfc0 | 497 | rv = (AliEMCALGeometry *) fgGeom; |
e52475ed | 498 | } // end |
b13bbe81 | 499 | } // end if fgGeom |
500 | return rv; | |
2012850d | 501 | } |
173558f2 | 502 | |
c63c3c5d | 503 | // These methods are obsolete but use in AliEMCALRecPoint - keep it now |
ca8f5bd0 | 504 | //______________________________________________________________________ |
395c7ba2 | 505 | Int_t AliEMCALGeometry::TowerIndex(Int_t ieta,Int_t iphi) const { |
506 | // Returns the tower index number from the based on the Z and Phi | |
fdebddeb | 507 | // index numbers. |
395c7ba2 | 508 | // Inputs: |
fdebddeb | 509 | // Int_t ieta // index along z axis [1-fNZ] |
510 | // Int_t iphi // index along phi axis [1-fNPhi] | |
395c7ba2 | 511 | // Outputs: |
512 | // none. | |
513 | // Returned | |
514 | // Int_t index // Tower index number | |
515 | ||
516 | if ( (ieta <= 0 || ieta>GetNEta()) || | |
f1da4a27 | 517 | (iphi <= 0 || iphi>GetNPhi())) { |
518 | Error("TowerIndex", "Unexpected parameters eta = %d phi = %d!", ieta, iphi) ; | |
519 | return -1; | |
520 | } | |
395c7ba2 | 521 | return ( (iphi - 1)*GetNEta() + ieta ); |
ca8f5bd0 | 522 | } |
173558f2 | 523 | |
ca8f5bd0 | 524 | //______________________________________________________________________ |
fdebddeb | 525 | void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &ieta,Int_t &iphi) const { |
395c7ba2 | 526 | // Inputs: |
fdebddeb | 527 | // Int_t index // Tower index number [1-fNZ*fNPhi] |
395c7ba2 | 528 | // Outputs: |
529 | // Int_t ieta // index allong z axis [1-fNZ] | |
530 | // Int_t iphi // index allong phi axis [1-fNPhi] | |
395c7ba2 | 531 | // Returned |
532 | // none. | |
395c7ba2 | 533 | |
fdebddeb | 534 | Int_t nindex = 0; |
395c7ba2 | 535 | |
fdebddeb | 536 | if ( IsInECA(index) ) { // ECAL index |
395c7ba2 | 537 | nindex = index ; |
395c7ba2 | 538 | } |
f1da4a27 | 539 | else { |
540 | Error("TowerIndexes", "Unexpected Id number!") ; | |
541 | ieta = -1; | |
542 | iphi = -1; | |
543 | return; | |
544 | } | |
545 | ||
395c7ba2 | 546 | if (nindex%GetNZ()) |
547 | iphi = nindex / GetNZ() + 1 ; | |
548 | else | |
549 | iphi = nindex / GetNZ() ; | |
550 | ieta = nindex - (iphi - 1) * GetNZ() ; | |
551 | ||
e5a93224 | 552 | AliDebug(2,Form("TowerIndexes: index=%d,%d, ieta=%d, iphi = %d", index, nindex,ieta, iphi)); |
395c7ba2 | 553 | return; |
554 | ||
ca8f5bd0 | 555 | } |
173558f2 | 556 | |
ca8f5bd0 | 557 | //______________________________________________________________________ |
a34b7b9f | 558 | void AliEMCALGeometry::EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi) const { |
ca8f5bd0 | 559 | // given the tower index number it returns the based on the eta and phi |
560 | // of the tower. | |
561 | // Inputs: | |
fdebddeb | 562 | // Int_t index // Tower index number [1-fNZ*fNPhi] |
ca8f5bd0 | 563 | // Outputs: |
564 | // Float_t eta // eta of center of tower in pseudorapidity | |
565 | // Float_t phi // phi of center of tower in degrees | |
566 | // Returned | |
567 | // none. | |
fdebddeb | 568 | Int_t ieta, iphi; |
395c7ba2 | 569 | Float_t deta, dphi ; |
ca8f5bd0 | 570 | |
fdebddeb | 571 | TowerIndexes(index,ieta,iphi); |
395c7ba2 | 572 | |
e5a93224 | 573 | AliDebug(2,Form("EtaPhiFromIndex: index = %d, ieta = %d, iphi = %d", index, ieta, iphi)); |
395c7ba2 | 574 | |
575 | deta = (GetArm1EtaMax()-GetArm1EtaMin())/(static_cast<Float_t>(GetNEta())); | |
576 | eta = GetArm1EtaMin() + ((static_cast<Float_t>(ieta) - 0.5 ))*deta; | |
577 | ||
578 | dphi = (GetArm1PhiMax() - GetArm1PhiMin())/(static_cast<Float_t>(GetNPhi())); // in degrees. | |
579 | phi = GetArm1PhiMin() + dphi*(static_cast<Float_t>(iphi) - 0.5);//iphi range [1-fNphi]. | |
ca8f5bd0 | 580 | } |
173558f2 | 581 | |
ca8f5bd0 | 582 | //______________________________________________________________________ |
a34b7b9f | 583 | Int_t AliEMCALGeometry::TowerIndexFromEtaPhi(Float_t eta,Float_t phi) const { |
ca8f5bd0 | 584 | // returns the tower index number based on the eta and phi of the tower. |
585 | // Inputs: | |
586 | // Float_t eta // eta of center of tower in pseudorapidity | |
587 | // Float_t phi // phi of center of tower in degrees | |
588 | // Outputs: | |
589 | // none. | |
590 | // Returned | |
591 | // Int_t index // Tower index number [1-fNZ*fNPhi] | |
395c7ba2 | 592 | |
e908f07f | 593 | Int_t ieta,iphi; |
ca8f5bd0 | 594 | |
395c7ba2 | 595 | ieta = static_cast<Int_t> ( 1 + (static_cast<Float_t>(GetNEta()) * (eta - GetArm1EtaMin()) / (GetArm1EtaMax() - GetArm1EtaMin())) ) ; |
596 | ||
597 | if( ieta <= 0 || ieta > GetNEta() ) { | |
598 | Error("TowerIndexFromEtaPhi", "Unexpected (eta, phi) = (%f, %f) value, outside of EMCAL!", eta, phi) ; | |
599 | return -1 ; | |
600 | } | |
601 | ||
602 | iphi = static_cast<Int_t> ( 1 + (static_cast<Float_t>(GetNPhi()) * (phi - GetArm1PhiMin()) / (GetArm1PhiMax() - GetArm1PhiMin())) ) ; | |
603 | ||
604 | if( iphi <= 0 || iphi > GetNPhi() ) { | |
605 | Error("TowerIndexFromEtaPhi", "Unexpected (eta, phi) = (%f, %f) value, outside of EMCAL!", eta, phi) ; | |
606 | return -1 ; | |
607 | } | |
608 | ||
609 | return TowerIndex(ieta,iphi); | |
ca8f5bd0 | 610 | } |
173558f2 | 611 | |
ca8f5bd0 | 612 | //______________________________________________________________________ |
a34b7b9f | 613 | Bool_t AliEMCALGeometry::AbsToRelNumbering(Int_t AbsId, Int_t *relid) const { |
ca8f5bd0 | 614 | // Converts the absolute numbering into the following array/ |
2608a1fc | 615 | // relid[0] = Row number inside EMCAL |
616 | // relid[1] = Column number inside EMCAL | |
ca8f5bd0 | 617 | // Input: |
618 | // Int_t AbsId // Tower index number [1-2*fNZ*fNPhi] | |
619 | // Outputs: | |
2608a1fc | 620 | // Int_t *relid // array of 2. Described above. |
ca8f5bd0 | 621 | Bool_t rv = kTRUE ; |
fdebddeb | 622 | Int_t ieta=0,iphi=0,index=AbsId; |
ca8f5bd0 | 623 | |
fdebddeb | 624 | TowerIndexes(index,ieta,iphi); |
2608a1fc | 625 | relid[0] = ieta; |
626 | relid[1] = iphi; | |
ca8f5bd0 | 627 | |
628 | return rv; | |
629 | } | |
173558f2 | 630 | |
ca8f5bd0 | 631 | //______________________________________________________________________ |
395c7ba2 | 632 | void AliEMCALGeometry::PosInAlice(const Int_t *relid, Float_t &theta, Float_t &phi) const |
633 | { | |
634 | // Converts the relative numbering into the local EMCAL-module (x, z) | |
635 | // coordinates | |
2608a1fc | 636 | Int_t ieta = relid[0]; // offset along x axis |
637 | Int_t iphi = relid[1]; // offset along z axis | |
395c7ba2 | 638 | Int_t index; |
639 | Float_t eta; | |
640 | ||
641 | index = TowerIndex(ieta,iphi); | |
642 | EtaPhiFromIndex(index,eta,phi); | |
fdebddeb | 643 | //theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); |
644 | theta = 2.0*TMath::ATan(TMath::Exp(-eta)); | |
395c7ba2 | 645 | |
fdebddeb | 646 | // correct for distance to IP |
647 | Float_t d = GetIP2ECASection() - GetIPDistance() ; | |
395c7ba2 | 648 | |
649 | Float_t correction = 1 + d/GetIPDistance() ; | |
650 | Float_t tantheta = TMath::Tan(theta) * correction ; | |
651 | theta = TMath::ATan(tantheta) * TMath::RadToDeg() ; | |
652 | if (theta < 0 ) | |
653 | theta += 180. ; | |
654 | ||
655 | return; | |
656 | } | |
ca8f5bd0 | 657 | |
395c7ba2 | 658 | //______________________________________________________________________ |
09884213 | 659 | void AliEMCALGeometry::PosInAlice(Int_t absid, Float_t &theta, Float_t &phi) const |
395c7ba2 | 660 | { |
661 | // Converts the relative numbering into the local EMCAL-module (x, z) | |
662 | // coordinates | |
2608a1fc | 663 | Int_t relid[2] ; |
395c7ba2 | 664 | AbsToRelNumbering(absid, relid) ; |
2608a1fc | 665 | Int_t ieta = relid[0]; // offset along x axis |
666 | Int_t iphi = relid[1]; // offset along z axis | |
395c7ba2 | 667 | Int_t index; |
668 | Float_t eta; | |
669 | ||
670 | index = TowerIndex(ieta,iphi); | |
671 | EtaPhiFromIndex(index,eta,phi); | |
672 | theta = 2.0*TMath::ATan(TMath::Exp(-eta)) ; | |
673 | ||
fdebddeb | 674 | // correct for distance to IP |
395c7ba2 | 675 | Float_t d = 0. ; |
fdebddeb | 676 | if (IsInECA(absid)) |
88cb7938 | 677 | d = GetIP2ECASection() - GetIPDistance() ; |
f1da4a27 | 678 | else { |
679 | Error("PosInAlice", "Unexpected id # %d!", absid) ; | |
680 | return; | |
681 | } | |
395c7ba2 | 682 | |
683 | Float_t correction = 1 + d/GetIPDistance() ; | |
684 | Float_t tantheta = TMath::Tan(theta) * correction ; | |
685 | theta = TMath::ATan(tantheta) * TMath::RadToDeg() ; | |
686 | if (theta < 0 ) | |
687 | theta += 180. ; | |
688 | ||
689 | return; | |
ca8f5bd0 | 690 | } |
6119e5db | 691 | |
692 | //______________________________________________________________________ | |
693 | void AliEMCALGeometry::XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Float_t &z) const { | |
694 | // given the tower relative number it returns the X, Y and Z | |
695 | // of the tower. | |
696 | ||
697 | // Outputs: | |
698 | // Float_t x // x of center of tower in cm | |
699 | // Float_t y // y of center of tower in cm | |
700 | // Float_t z // z of centre of tower in cm | |
701 | // Returned | |
702 | // none. | |
703 | ||
fdebddeb | 704 | Float_t eta,theta, phi,cylradius=0. ; |
6119e5db | 705 | |
2608a1fc | 706 | Int_t ieta = relid[0]; // offset along x axis |
707 | Int_t iphi = relid[1]; // offset along z axis. | |
6119e5db | 708 | Int_t index; |
709 | ||
395c7ba2 | 710 | index = TowerIndex(ieta,iphi); |
6119e5db | 711 | EtaPhiFromIndex(index,eta,phi); |
712 | theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); | |
6119e5db | 713 | |
fdebddeb | 714 | cylradius = GetIP2ECASection() ; |
a97849a9 | 715 | |
395c7ba2 | 716 | Double_t kDeg2Rad = TMath::DegToRad() ; |
fdebddeb | 717 | x = cylradius * TMath::Cos(phi * kDeg2Rad ) ; |
718 | y = cylradius * TMath::Sin(phi * kDeg2Rad ) ; | |
719 | z = cylradius / TMath::Tan(theta * kDeg2Rad ) ; | |
6119e5db | 720 | |
721 | return; | |
722 | } | |
723 | ||
395c7ba2 | 724 | //______________________________________________________________________ |
09884213 | 725 | void AliEMCALGeometry::XYZFromIndex(Int_t absid, TVector3 &v) const { |
395c7ba2 | 726 | // given the tower relative number it returns the X, Y and Z |
727 | // of the tower. | |
728 | ||
729 | // Outputs: | |
730 | // Float_t x // x of center of tower in cm | |
731 | // Float_t y // y of center of tower in cm | |
732 | // Float_t z // z of centre of tower in cm | |
733 | // Returned | |
734 | // none. | |
735 | ||
fdebddeb | 736 | Float_t theta, phi,cylradius=0. ; |
395c7ba2 | 737 | |
738 | PosInAlice(absid, theta, phi) ; | |
739 | ||
88cb7938 | 740 | if ( IsInECA(absid) ) |
fdebddeb | 741 | cylradius = GetIP2ECASection() ; |
f1da4a27 | 742 | else { |
743 | Error("XYZFromIndex", "Unexpected Tower section") ; | |
744 | return; | |
745 | } | |
395c7ba2 | 746 | |
747 | Double_t kDeg2Rad = TMath::DegToRad() ; | |
fdebddeb | 748 | v.SetX(cylradius * TMath::Cos(phi * kDeg2Rad ) ); |
749 | v.SetY(cylradius * TMath::Sin(phi * kDeg2Rad ) ); | |
750 | v.SetZ(cylradius / TMath::Tan(theta * kDeg2Rad ) ) ; | |
395c7ba2 | 751 | |
752 | return; | |
753 | } | |
ab37d09c | 754 | |
755 | Bool_t AliEMCALGeometry::IsInEMCAL(Double_t x, Double_t y, Double_t z) const { | |
756 | // Checks whether point is inside the EMCal volume | |
757 | // | |
758 | // Code uses cylindrical approximation made of inner radius (for speed) | |
759 | // | |
760 | // Points behind EMCAl, i.e. R > outer radius, but eta, phi in acceptance | |
761 | // are considered to inside | |
762 | ||
763 | Double_t r=sqrt(x*x+y*y); | |
764 | ||
765 | if ( r > fEnvelop[0] ) { | |
766 | Double_t theta; | |
767 | theta = TMath::ATan2(r,z); | |
768 | Double_t eta; | |
769 | if(theta == 0) | |
770 | eta = 9999; | |
771 | else | |
772 | eta = -TMath::Log(TMath::Tan(theta/2.)); | |
773 | if (eta < fArm1EtaMin || eta > fArm1EtaMax) | |
774 | return 0; | |
775 | ||
776 | Double_t phi = TMath::ATan2(y,x) * 180./TMath::Pi(); | |
777 | if (phi > fArm1PhiMin && phi < fArm1PhiMax) | |
778 | return 1; | |
779 | } | |
780 | return 0; | |
781 | } | |
c63c3c5d | 782 | // == |
1963b290 | 783 | |
784 | // | |
785 | // == Shish-kebab cases == | |
786 | // | |
e52475ed | 787 | Int_t AliEMCALGeometry::GetAbsCellId(Int_t nSupMod, Int_t nTower, Int_t nIphi, Int_t nIeta) const |
d87bd045 | 788 | { // 27-aug-04; |
789 | // corr. 21-sep-04; | |
790 | // 13-oct-05; 110 degree case | |
791 | // 1 <= nSupMod <= fNumberOfSuperModules | |
792 | // 1 <= nTower <= fNPHI * fNZ ( fNPHI * fNZ/2 for fKey110DEG=1) | |
793 | // 1 <= nIphi <= fNPHIdiv | |
794 | // 1 <= nIeta <= fNETAdiv | |
795 | // 1 <= absid <= fNCells | |
796 | static Int_t id=0; // have to change from 1 to fNCells | |
797 | if(fKey110DEG == 1 && nSupMod > 10) { // 110 degree case; last two supermodules | |
798 | id = fNCellsInSupMod*10 + (fNCellsInSupMod/2)*(nSupMod-11); | |
799 | } else { | |
800 | id = fNCellsInSupMod*(nSupMod-1); | |
801 | } | |
1963b290 | 802 | id += fNCellsInTower *(nTower-1); |
803 | id += fNPHIdiv *(nIphi-1); | |
804 | id += nIeta; | |
805 | if(id<=0 || id > fNCells) { | |
500aeccc | 806 | // printf(" wrong numerations !!\n"); |
807 | // printf(" id %6i(will be force to -1)\n", id); | |
808 | // printf(" fNCells %6i\n", fNCells); | |
809 | // printf(" nSupMod %6i\n", nSupMod); | |
810 | // printf(" nTower %6i\n", nTower); | |
811 | // printf(" nIphi %6i\n", nIphi); | |
812 | // printf(" nIeta %6i\n", nIeta); | |
d87bd045 | 813 | id = -TMath::Abs(id); |
1963b290 | 814 | } |
815 | return id; | |
816 | } | |
817 | ||
e52475ed | 818 | Bool_t AliEMCALGeometry::CheckAbsCellId(Int_t ind) const |
fc575e27 | 819 | { |
820 | // 17-nov-04 - analog of IsInECA | |
821 | if(fGeoName.Contains("TRD")) { | |
1963b290 | 822 | if(ind<=0 || ind > fNCells) return kFALSE; |
823 | else return kTRUE; | |
824 | } else return IsInECA(ind); | |
825 | } | |
826 | ||
e52475ed | 827 | Bool_t AliEMCALGeometry::GetCellIndex(Int_t absId,Int_t &nSupMod,Int_t &nTower,Int_t &nIphi,Int_t &nIeta) const |
fc575e27 | 828 | { |
829 | // 21-sep-04 | |
d87bd045 | 830 | // 19-oct-05; |
831 | static Int_t tmp=0, sm10=0; | |
1963b290 | 832 | if(absId<=0 || absId>fNCells) { |
500aeccc | 833 | // Info("GetCellIndex"," wrong abs Id %i !! \n", absId); |
1963b290 | 834 | return kFALSE; |
835 | } | |
d87bd045 | 836 | sm10 = fNCellsInSupMod*10; |
837 | if(fKey110DEG == 1 && absId > sm10) { // 110 degree case; last two supermodules | |
838 | nSupMod = (absId-1-sm10) / (fNCellsInSupMod/2) + 11; | |
839 | tmp = (absId-1-sm10) % (fNCellsInSupMod/2); | |
840 | } else { | |
841 | nSupMod = (absId-1) / fNCellsInSupMod + 1; | |
842 | tmp = (absId-1) % fNCellsInSupMod; | |
843 | } | |
1963b290 | 844 | |
845 | nTower = tmp / fNCellsInTower + 1; | |
846 | tmp = tmp % fNCellsInTower; | |
d87bd045 | 847 | nIphi = tmp / fNPHIdiv + 1; |
848 | nIeta = tmp % fNPHIdiv + 1; | |
1963b290 | 849 | |
850 | return kTRUE; | |
851 | } | |
852 | ||
e52475ed | 853 | void AliEMCALGeometry::GetTowerPhiEtaIndexInSModule(Int_t nSupMod, Int_t nTower, int &iphit, int &ietat) const |
fc575e27 | 854 | { |
855 | // added nSupMod; have to check - 19-oct-05 ! | |
d87bd045 | 856 | static Int_t nphi; |
857 | ||
858 | if(fKey110DEG == 1 && nSupMod>=11) nphi = fNPhi/2; | |
859 | else nphi = fNPhi; | |
860 | ||
861 | ietat = (nTower-1)/nphi + 1; // have to change from 1 to fNZ | |
d87bd045 | 862 | iphit = (nTower-1)%nphi + 1; // have to change from 1 to fNPhi |
863 | } | |
864 | ||
eb0b1051 | 865 | void AliEMCALGeometry::GetCellPhiEtaIndexInSModule(Int_t nSupMod, Int_t nTower, Int_t nIphi, Int_t nIeta, |
e52475ed | 866 | int &iphi, int &ieta) const |
fc575e27 | 867 | { |
868 | // added nSupMod; Nov 25, 05 | |
c01485dd | 869 | static Int_t iphit, ietat; |
870 | ||
871 | GetTowerPhiEtaIndexInSModule(nSupMod,nTower, iphit, ietat); | |
872 | // have to change from 1 to fNZ*fNETAdiv | |
873 | ieta = (ietat-1)*fNETAdiv + (3-nIeta); // x(module) = -z(SM) | |
874 | // iphi - have to change from 1 to fNPhi*fNPHIdiv | |
875 | iphi = (iphit-1)*fNPHIdiv + nIphi; // y(module) = y(SM) | |
1963b290 | 876 | } |
e52475ed | 877 | |
878 | Int_t AliEMCALGeometry::GetSuperModuleNumber(Int_t absId) const | |
879 | { | |
fc575e27 | 880 | //return the number of the |
881 | //supermodule given the absolute | |
882 | //ALICE numbering | |
883 | ||
e52475ed | 884 | static Int_t nSupMod, nTower, nIphi, nIeta; |
885 | GetCellIndex(absId, nSupMod, nTower, nIphi, nIeta); | |
886 | return nSupMod; | |
887 | } | |
888 | ||
889 | // Methods for AliEMCALRecPoint - Feb 19, 2006 | |
890 | Bool_t AliEMCALGeometry::RelPosCellInSModule(Int_t absId, Double_t &xr, Double_t &yr, Double_t &zr) | |
891 | { | |
fc575e27 | 892 | //Look to see what the relative |
893 | //position inside a given cell is | |
894 | //for a recpoint. | |
895 | ||
e52475ed | 896 | static Int_t nSupMod, nTower, nIphi, nIeta, iphi, ieta; |
897 | if(!CheckAbsCellId(absId)) return kFALSE; | |
898 | ||
899 | GetCellIndex(absId, nSupMod, nTower, nIphi, nIeta); | |
900 | GetCellPhiEtaIndexInSModule(nSupMod,nTower,nIphi,nIeta, iphi, ieta); | |
901 | ||
902 | xr = fXCentersOfCells->At(ieta-1); | |
903 | zr = fEtaCentersOfCells->At(ieta-1); | |
904 | ||
905 | yr = fPhiCentersOfCells->At(iphi-1); | |
906 | ||
907 | // cout<<" absId "<<absId<<" iphi "<<iphi<<"ieta"<<ieta; | |
908 | // cout<< " xr " << xr << " yr " << yr << " zr " << zr <<endl; | |
909 | return kTRUE; | |
910 | } | |
911 | ||
912 | void AliEMCALGeometry::CreateListOfTrd1Modules() | |
913 | { | |
fc575e27 | 914 | //Generate the list of Trd1 modules |
915 | //which will make up the EMCAL | |
916 | //geometry | |
917 | ||
e5a93224 | 918 | AliDebug(2,Form(" AliEMCALGeometry::CreateListOfTrd1Modules() started ")); |
919 | ||
e52475ed | 920 | AliEMCALShishKebabTrd1Module *mod=0, *mTmp=0; // current module |
921 | if(fShishKebabTrd1Modules == 0) { | |
922 | fShishKebabTrd1Modules = new TList; | |
923 | for(int iz=0; iz< GetNZ(); iz++) { | |
924 | if(iz==0) { | |
925 | mod = new AliEMCALShishKebabTrd1Module(TMath::Pi()/2.,this); | |
926 | } else { | |
927 | mTmp = new AliEMCALShishKebabTrd1Module(*mod); | |
928 | mod = mTmp; | |
929 | } | |
930 | fShishKebabTrd1Modules->Add(mod); | |
931 | } | |
932 | } else { | |
e5a93224 | 933 | AliDebug(2,Form(" Already exits : ")); |
e52475ed | 934 | } |
e5a93224 | 935 | AliDebug(2,Form(" fShishKebabTrd1Modules has %i modules \n", |
936 | fShishKebabTrd1Modules->GetSize())); | |
e52475ed | 937 | // Feb 20,2006; |
938 | // define grid for cells in eta(z) and x directions in local coordinates system of SM | |
939 | fEtaCentersOfCells = new TArrayD(fNZ *fNETAdiv); | |
940 | fXCentersOfCells = new TArrayD(fNZ *fNETAdiv); | |
e5a93224 | 941 | AliDebug(2,Form(" Cells grid in eta directions : size %i\n", fEtaCentersOfCells->GetSize())); |
e52475ed | 942 | Int_t iphi=0, ieta=0, nTower=0; |
943 | Double_t xr, zr; | |
944 | for(Int_t it=0; it<fNZ; it++) { // array index | |
945 | AliEMCALShishKebabTrd1Module *trd1 = GetShishKebabModule(it); | |
946 | nTower = fNPhi*it + 1; | |
947 | for(Int_t ic=0; ic<fNETAdiv; ic++) { // array index | |
948 | trd1->GetCenterOfCellInLocalCoordinateofSM(ic+1, xr, zr); | |
949 | GetCellPhiEtaIndexInSModule(1, nTower, 1, ic+1, iphi, ieta); // don't depend from phi | |
950 | fXCentersOfCells->AddAt(float(xr) - fParSM[0],ieta-1); | |
951 | fEtaCentersOfCells->AddAt(float(zr) - fParSM[2],ieta-1); | |
952 | } | |
953 | } | |
954 | for(Int_t i=0; i<fEtaCentersOfCells->GetSize(); i++) { | |
e5a93224 | 955 | AliDebug(2,Form(" ind %2.2i : z %8.3f : x %8.3f", i+1, |
956 | fEtaCentersOfCells->At(i),fXCentersOfCells->At(i))); | |
e52475ed | 957 | } |
e5a93224 | 958 | |
e52475ed | 959 | // define grid for cells in phi(y) direction in local coordinates system of SM |
960 | fPhiCentersOfCells = new TArrayD(fNPhi*fNPHIdiv); | |
e5a93224 | 961 | AliDebug(2,Form(" Cells grid in phi directions : size %i\n", fPhiCentersOfCells->GetSize())); |
e52475ed | 962 | Int_t ind=0; |
963 | for(Int_t it=0; it<fNPhi; it++) { // array index | |
964 | Float_t ytLeftCenterModule = -fParSM[1] + fPhiModuleSize*(2*it+1)/2; // module | |
965 | for(Int_t ic=0; ic<fNPHIdiv; ic++) { // array index | |
966 | Float_t ytLeftCenterCell = ytLeftCenterModule + fPhiTileSize *(2*ic-1)/2.; // tower(cell) | |
967 | fPhiCentersOfCells->AddAt(ytLeftCenterCell,ind); | |
e5a93224 | 968 | AliDebug(2,Form(" ind %2.2i : y %8.3f ", ind, fPhiCentersOfCells->At(ind))); |
969 | ind++; | |
e52475ed | 970 | } |
971 | } | |
e52475ed | 972 | } |
973 | ||
974 | void AliEMCALGeometry::GetTransformationForSM() | |
975 | { | |
fc575e27 | 976 | //Uses the geometry manager to |
977 | //load the transformation matrix | |
978 | //for the supermodules | |
979 | ||
e52475ed | 980 | static Bool_t transInit=kFALSE; |
981 | if(transInit) return; | |
982 | ||
983 | int i=0; | |
984 | if(gGeoManager == 0) { | |
985 | Info("CreateTransformationForSM() "," Load geometry : TGeoManager::Import()"); | |
986 | assert(0); | |
987 | } | |
988 | TGeoNode *tn = gGeoManager->GetTopNode(); | |
fc575e27 | 989 | TGeoNode *node=0, *xen1 = 0; |
e52475ed | 990 | for(i=0; i<tn->GetNdaughters(); i++) { |
991 | node = tn->GetDaughter(i); | |
992 | TString ns(node->GetName()); | |
993 | if(ns.Contains(GetNameOfEMCALEnvelope())) { | |
fc575e27 | 994 | xen1 = node; |
e52475ed | 995 | break; |
996 | } | |
997 | } | |
fc575e27 | 998 | if(!xen1) { |
e52475ed | 999 | Info("CreateTransformationForSM() "," geometry has not EMCAL envelope with name %s", |
1000 | GetNameOfEMCALEnvelope()); | |
1001 | assert(0); | |
1002 | } | |
fc575e27 | 1003 | printf(" i %i : EMCAL Envelope is %s : #SM %i \n", i, xen1->GetName(), xen1->GetNdaughters()); |
1004 | for(i=0; i<xen1->GetNdaughters(); i++) { | |
1005 | TGeoNodeMatrix *sm = (TGeoNodeMatrix*)xen1->GetDaughter(i); | |
e52475ed | 1006 | fMatrixOfSM[i] = sm->GetMatrix(); |
64942713 | 1007 | //Compiler doesn't like this syntax... |
1008 | // printf(" %i : matrix %x \n", i, fMatrixOfSM[i]); | |
e52475ed | 1009 | } |
1010 | transInit = kTRUE; | |
1011 | } | |
1012 | ||
1013 | void AliEMCALGeometry::GetGlobal(const Double_t *loc, Double_t *glob, int nsm) const | |
1014 | { | |
fc575e27 | 1015 | //Figure out the global numbering |
1016 | //of a given supermodule from the | |
1017 | //local numbering | |
1018 | ||
e52475ed | 1019 | // if(fMatrixOfSM[0] == 0) GetTransformationForSM(); |
1020 | static int ind; | |
1021 | ind = nsm-1; | |
1022 | if(ind>=0 && ind < GetNumberOfSuperModules()) { | |
1023 | fMatrixOfSM[ind]->LocalToMaster(loc, glob); | |
1024 | } | |
1025 | } | |
1026 | ||
21cf2b24 | 1027 | void AliEMCALGeometry::GetGlobal(Int_t /* absId */, TVector3 & /* vglob */) const |
e52475ed | 1028 | { // have to be defined |
1029 | } | |
1030 | ||
1031 | void AliEMCALGeometry::GetGlobal(const TVector3 &vloc, TVector3 &vglob, int nsm) const | |
1032 | { | |
fc575e27 | 1033 | //Figure out the global numbering |
1034 | //of a given supermodule from the | |
1035 | //local numbering given a 3-vector location | |
1036 | ||
e52475ed | 1037 | static Double_t tglob[3], tloc[3]; |
1038 | vloc.GetXYZ(tloc); | |
1039 | GetGlobal(tloc, tglob, nsm); | |
1040 | vglob.SetXYZ(tglob[0], tglob[1], tglob[2]); | |
1041 | } | |
1042 | ||
1043 | void AliEMCALGeometry::GetGlobal(const AliRecPoint *rp, TVector3 &vglob) const | |
1044 | { | |
fc575e27 | 1045 | //Figure out the global numbering |
1046 | //of a given supermodule from the | |
1047 | //local numbering for RecPoints | |
1048 | ||
e52475ed | 1049 | static TVector3 vloc; |
1050 | static Int_t nSupMod, nTower, nIphi, nIeta; | |
1051 | ||
1052 | AliRecPoint *rpTmp = (AliRecPoint*)rp; // const_cast ?? | |
1053 | if(!rpTmp) return; | |
1054 | AliEMCALRecPoint *rpEmc = (AliEMCALRecPoint*)rpTmp; | |
1055 | ||
1056 | GetCellIndex(rpEmc->GetAbsId(0), nSupMod, nTower, nIphi, nIeta); | |
1057 | rpTmp->GetLocalPosition(vloc); | |
1058 | GetGlobal(vloc, vglob, nSupMod); | |
1059 | } | |
1060 | ||
fc575e27 | 1061 | AliEMCALShishKebabTrd1Module* AliEMCALGeometry::GetShishKebabModule(Int_t neta=0) |
1062 | { | |
1063 | //This method was too long to be | |
1064 | //included in the header file - the | |
1065 | //rule checker complained about it's | |
1066 | //length, so we move it here. It returns the | |
1067 | //shishkebabmodule at a given eta index point. | |
1068 | ||
1069 | static AliEMCALShishKebabTrd1Module* trd1=0; | |
1070 | if(fShishKebabTrd1Modules && neta>=0 && neta<fShishKebabTrd1Modules->GetSize()) { | |
1071 | trd1 = (AliEMCALShishKebabTrd1Module*)fShishKebabTrd1Modules->At(neta); | |
1072 | } else trd1 = 0; | |
1073 | return trd1; | |
1074 | } |