]>
Commit | Line | Data |
---|---|---|
2012850d | 1 | /************************************************************************** |
173558f2 | 2 | |
2012850d | 3 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * |
173558f2 | 4 | |
2012850d | 5 | * * |
173558f2 | 6 | |
2012850d | 7 | * Author: The ALICE Off-line Project. * |
173558f2 | 8 | |
2012850d | 9 | * Contributors are mentioned in the code where appropriate. * |
173558f2 | 10 | |
2012850d | 11 | * * |
173558f2 | 12 | |
2012850d | 13 | * Permission to use, copy, modify and distribute this software and its * |
173558f2 | 14 | |
2012850d | 15 | * documentation strictly for non-commercial purposes is hereby granted * |
173558f2 | 16 | |
2012850d | 17 | * without fee, provided that the above copyright notice appears in all * |
173558f2 | 18 | |
2012850d | 19 | * copies and that both the copyright notice and this permission notice * |
173558f2 | 20 | |
2012850d | 21 | * appear in the supporting documentation. The authors make no claims * |
173558f2 | 22 | |
2012850d | 23 | * about the suitability of this software for any purpose. It is * |
173558f2 | 24 | |
2012850d | 25 | * provided "as is" without express or implied warranty. * |
173558f2 | 26 | |
2012850d | 27 | **************************************************************************/ |
28 | ||
173558f2 | 29 | |
30 | ||
2012850d | 31 | /* $Id$*/ |
32 | ||
173558f2 | 33 | |
34 | ||
2012850d | 35 | //_________________________________________________________________________ |
173558f2 | 36 | |
2012850d | 37 | // Geometry class for EMCAL : singleton |
173558f2 | 38 | |
b13bbe81 | 39 | // EMCAL consists of layers of scintillator and lead |
173558f2 | 40 | |
ffa6d63b | 41 | // Places the the Barrel Geometry of The EMCAL at Midrapidity |
173558f2 | 42 | |
ffa6d63b | 43 | // between 0 and 120 degrees of Phi and |
173558f2 | 44 | |
ffa6d63b | 45 | // -0.7 to 0.7 in eta |
173558f2 | 46 | |
ffa6d63b | 47 | // Number of Modules and Layers may be controlled by |
173558f2 | 48 | |
ffa6d63b | 49 | // the name of the instance defined |
173558f2 | 50 | |
ffa6d63b | 51 | // EMCALArch2x has more modules along both phi and eta |
173558f2 | 52 | |
ffa6d63b | 53 | // EMCALArchxa has less Layers in the Radial Direction |
173558f2 | 54 | |
b13bbe81 | 55 | //*-- Author: Sahal Yacoob (LBL / UCT) |
173558f2 | 56 | |
b13bbe81 | 57 | // and : Yves Schutz (SUBATECH) |
173558f2 | 58 | |
b13bbe81 | 59 | // and : Jennifer Klay (LBL) |
2012850d | 60 | |
173558f2 | 61 | |
62 | ||
2012850d | 63 | // --- ROOT system --- |
64 | ||
173558f2 | 65 | |
66 | ||
2012850d | 67 | // --- Standard library --- |
68 | ||
173558f2 | 69 | |
70 | ||
70479d0e | 71 | #include <Riostream.h> |
bba4716c | 72 | #include <stdlib.h> |
2012850d | 73 | |
173558f2 | 74 | |
75 | ||
2012850d | 76 | // --- AliRoot header files --- |
173558f2 | 77 | |
ca8f5bd0 | 78 | #include <TMath.h> |
173558f2 | 79 | |
ca8f5bd0 | 80 | // -- ALICE Headers. |
173558f2 | 81 | |
2012850d | 82 | #include "AliConst.h" |
173558f2 | 83 | |
ca8f5bd0 | 84 | // --- EMCAL headers |
173558f2 | 85 | |
ca8f5bd0 | 86 | #include "AliEMCALGeometry.h" |
2012850d | 87 | |
173558f2 | 88 | |
89 | ||
b13bbe81 | 90 | ClassImp(AliEMCALGeometry); |
2012850d | 91 | |
173558f2 | 92 | |
93 | ||
b13bbe81 | 94 | AliEMCALGeometry *AliEMCALGeometry::fgGeom = 0; |
173558f2 | 95 | |
b13bbe81 | 96 | Bool_t AliEMCALGeometry::fgInit = kFALSE; |
2012850d | 97 | |
173558f2 | 98 | |
99 | ||
b13bbe81 | 100 | //______________________________________________________________________ |
173558f2 | 101 | |
b13bbe81 | 102 | AliEMCALGeometry::~AliEMCALGeometry(void){ |
173558f2 | 103 | |
b13bbe81 | 104 | // dtor |
173558f2 | 105 | |
2012850d | 106 | } |
173558f2 | 107 | |
b13bbe81 | 108 | //______________________________________________________________________ |
173558f2 | 109 | |
b13bbe81 | 110 | void AliEMCALGeometry::Init(void){ |
173558f2 | 111 | |
b13bbe81 | 112 | // Initializes the EMCAL parameters |
113 | ||
173558f2 | 114 | |
115 | ||
e908f07f | 116 | fgInit = kFALSE; // Assume failer untill proven otherwise. |
05a92d59 | 117 | |
173558f2 | 118 | |
119 | ||
05a92d59 | 120 | TString name(GetName()) ; |
173558f2 | 121 | |
05a92d59 | 122 | |
173558f2 | 123 | |
05a92d59 | 124 | if( name != "EMCALArch1a" && |
173558f2 | 125 | |
05a92d59 | 126 | name != "EMCALArch1b" && |
173558f2 | 127 | |
05a92d59 | 128 | name != "EMCALArch2a" && |
173558f2 | 129 | |
05a92d59 | 130 | name != "EMCALArch2b" ){ |
173558f2 | 131 | |
05a92d59 | 132 | cerr << "ERROR: " << ClassName() << "::Init -> " << name.Data() |
173558f2 | 133 | |
05a92d59 | 134 | << " is not a known geometry (choose among EMCALArch1a, EMCALArch1b, EMCALArch2a and EMCALArch2b)" |
173558f2 | 135 | |
05a92d59 | 136 | << endl ; |
173558f2 | 137 | |
05a92d59 | 138 | abort() ; |
173558f2 | 139 | |
b13bbe81 | 140 | } // end if |
173558f2 | 141 | |
e908f07f | 142 | // |
173558f2 | 143 | |
05a92d59 | 144 | if ( name == "EMCALArch1a" || |
173558f2 | 145 | |
05a92d59 | 146 | name == "EMCALArch1b" ) { |
173558f2 | 147 | |
b13bbe81 | 148 | fNZ = 96; |
173558f2 | 149 | |
b13bbe81 | 150 | fNPhi = 144; |
173558f2 | 151 | |
b13bbe81 | 152 | } // end if |
173558f2 | 153 | |
05a92d59 | 154 | if ( name == "EMCALArch2a" || |
173558f2 | 155 | |
05a92d59 | 156 | name, "EMCALArch2b" ) { |
173558f2 | 157 | |
b13bbe81 | 158 | fNZ = 112; |
173558f2 | 159 | |
b13bbe81 | 160 | fNPhi = 168; |
173558f2 | 161 | |
b13bbe81 | 162 | } // end if |
173558f2 | 163 | |
05a92d59 | 164 | if ( name == "EMCALArch1a" || |
173558f2 | 165 | |
05a92d59 | 166 | name == "EMCALArch2a" ) { |
173558f2 | 167 | |
b13bbe81 | 168 | fNLayers = 21; |
173558f2 | 169 | |
b13bbe81 | 170 | } // end if |
173558f2 | 171 | |
05a92d59 | 172 | if ( name == "EMCALArch1b" || |
173558f2 | 173 | |
05a92d59 | 174 | name == "EMCALArch2b" ) { |
173558f2 | 175 | |
b13bbe81 | 176 | fNLayers = 25; |
173558f2 | 177 | |
b13bbe81 | 178 | } // end if |
e908f07f | 179 | |
173558f2 | 180 | |
181 | ||
e908f07f | 182 | // geometry |
173558f2 | 183 | |
e908f07f | 184 | fAirGap = 5.0; // cm, air gap between EMCAL mother volume and |
173558f2 | 185 | |
e908f07f | 186 | // active material. |
173558f2 | 187 | |
e908f07f | 188 | fAlFrontThick = 3.18; // cm, Thickness of front Al layer |
173558f2 | 189 | |
e908f07f | 190 | fPbRadThickness = 0.5; // cm, Thickness of theh Pb radiators. |
173558f2 | 191 | |
e908f07f | 192 | fPreShowerSintThick = 0.6; // cm, Thickness of the sintilator for the |
173558f2 | 193 | |
e908f07f | 194 | // preshower part of the calorimeter |
173558f2 | 195 | |
e908f07f | 196 | fFullShowerSintThick = 0.5; // cm, Thickness of the sintilator for the |
173558f2 | 197 | |
e908f07f | 198 | // full shower part of the calorimeter |
173558f2 | 199 | |
6365f121 | 200 | fArm1PhiMin = 60.0; // degrees, Starting EMCAL Phi position |
173558f2 | 201 | |
6365f121 | 202 | fArm1PhiMax = 180.0; // degrees, Ending EMCAL Phi position |
173558f2 | 203 | |
e908f07f | 204 | fArm1EtaMin = -0.7; // pseudorapidity, Starting EMCAL Eta position |
173558f2 | 205 | |
e908f07f | 206 | fArm1EtaMax = +0.7; // pseudorapidity, Ending EMCAL Eta position |
173558f2 | 207 | |
e908f07f | 208 | fIPDistance = 454.0; // cm, Radial distance to inner surface of EMCAL |
173558f2 | 209 | |
e908f07f | 210 | fShellThickness = GetAlFrontThickness() + 2.*GetPreSintThick() + |
173558f2 | 211 | |
e908f07f | 212 | (fNLayers-2)*GetFullSintThick()+(fNLayers-1)*GetPbRadThick(); |
173558f2 | 213 | |
e908f07f | 214 | //below; cm, Z lenght of the EMCAL. |
173558f2 | 215 | |
e908f07f | 216 | fZLength = 2.*ZFromEtaR(fIPDistance+fShellThickness,fArm1EtaMax); |
173558f2 | 217 | |
e908f07f | 218 | fEnvelop[0] = fIPDistance; // mother volume inner radius |
173558f2 | 219 | |
e908f07f | 220 | fEnvelop[1] = fIPDistance + fShellThickness; // mother volume outer r. |
173558f2 | 221 | |
e908f07f | 222 | fEnvelop[2] = 1.00001*fZLength; // add some padding for mother volume. |
173558f2 | 223 | |
e908f07f | 224 | fGap2Active = 1.0; // cm, Gap between |
173558f2 | 225 | |
e908f07f | 226 | fgInit = kTRUE; |
173558f2 | 227 | |
2012850d | 228 | } |
173558f2 | 229 | |
b13bbe81 | 230 | //______________________________________________________________________ |
173558f2 | 231 | |
b13bbe81 | 232 | AliEMCALGeometry * AliEMCALGeometry::GetInstance(){ |
173558f2 | 233 | |
05a92d59 | 234 | // Returns the pointer of the unique instance |
173558f2 | 235 | |
05a92d59 | 236 | |
173558f2 | 237 | |
05a92d59 | 238 | return static_cast<AliEMCALGeometry *>( fgGeom ) ; |
173558f2 | 239 | |
2012850d | 240 | } |
173558f2 | 241 | |
b13bbe81 | 242 | //______________________________________________________________________ |
173558f2 | 243 | |
b13bbe81 | 244 | AliEMCALGeometry* AliEMCALGeometry::GetInstance(const Text_t* name, |
173558f2 | 245 | |
b13bbe81 | 246 | const Text_t* title){ |
173558f2 | 247 | |
b13bbe81 | 248 | // Returns the pointer of the unique instance |
249 | ||
173558f2 | 250 | |
251 | ||
b13bbe81 | 252 | AliEMCALGeometry * rv = 0; |
173558f2 | 253 | |
b13bbe81 | 254 | if ( fgGeom == 0 ) { |
173558f2 | 255 | |
b13bbe81 | 256 | if ( strcmp(name,"") == 0 ) rv = 0; |
173558f2 | 257 | |
b13bbe81 | 258 | else { |
173558f2 | 259 | |
b13bbe81 | 260 | fgGeom = new AliEMCALGeometry(name, title); |
173558f2 | 261 | |
b13bbe81 | 262 | if ( fgInit ) rv = (AliEMCALGeometry * ) fgGeom; |
173558f2 | 263 | |
b13bbe81 | 264 | else { |
173558f2 | 265 | |
b13bbe81 | 266 | rv = 0; |
173558f2 | 267 | |
b13bbe81 | 268 | delete fgGeom; |
173558f2 | 269 | |
b13bbe81 | 270 | fgGeom = 0; |
173558f2 | 271 | |
b13bbe81 | 272 | } // end if fgInit |
173558f2 | 273 | |
b13bbe81 | 274 | } // end if strcmp(name,"") |
173558f2 | 275 | |
b13bbe81 | 276 | }else{ |
173558f2 | 277 | |
b13bbe81 | 278 | if ( strcmp(fgGeom->GetName(), name) != 0 ) { |
173558f2 | 279 | |
b13bbe81 | 280 | cout << "AliEMCALGeometry <E> : current geometry is " |
173558f2 | 281 | |
b13bbe81 | 282 | << fgGeom->GetName() << endl |
173558f2 | 283 | |
b13bbe81 | 284 | << " you cannot call " << name |
173558f2 | 285 | |
b13bbe81 | 286 | << endl; |
173558f2 | 287 | |
b13bbe81 | 288 | }else{ |
173558f2 | 289 | |
b13bbe81 | 290 | rv = (AliEMCALGeometry *) fgGeom; |
173558f2 | 291 | |
b13bbe81 | 292 | } // end if |
173558f2 | 293 | |
b13bbe81 | 294 | } // end if fgGeom |
173558f2 | 295 | |
b13bbe81 | 296 | return rv; |
173558f2 | 297 | |
2012850d | 298 | } |
173558f2 | 299 | |
ca8f5bd0 | 300 | //______________________________________________________________________ |
173558f2 | 301 | |
a34b7b9f | 302 | Int_t AliEMCALGeometry::TowerIndex(Int_t ieta,Int_t iphi,Int_t ipre) const { |
173558f2 | 303 | |
ca8f5bd0 | 304 | // Returns the tower index number from the based on the Z and Phi |
173558f2 | 305 | |
ca8f5bd0 | 306 | // index numbers. There are 2 times the number of towers to separate |
173558f2 | 307 | |
ca8f5bd0 | 308 | // out the full towsers from the pre-towsers. |
173558f2 | 309 | |
ca8f5bd0 | 310 | // Inputs: |
173558f2 | 311 | |
e908f07f | 312 | // Int_t ieta // index allong z axis [1-fNZ] |
173558f2 | 313 | |
ca8f5bd0 | 314 | // Int_t iphi // index allong phi axis [1-fNPhi] |
173558f2 | 315 | |
ca8f5bd0 | 316 | // Int_t ipre // 0 = Full tower, 1 = Pre-shower tower only. [0,1] |
173558f2 | 317 | |
ca8f5bd0 | 318 | // Outputs: |
173558f2 | 319 | |
ca8f5bd0 | 320 | // none. |
173558f2 | 321 | |
ca8f5bd0 | 322 | // Returned |
173558f2 | 323 | |
ca8f5bd0 | 324 | // Int_t the absoulute tower index. [1-2*fNZ*fNPhi] |
173558f2 | 325 | |
ca8f5bd0 | 326 | Int_t index; |
327 | ||
173558f2 | 328 | |
329 | ||
e908f07f | 330 | if((ieta<=0 || ieta>GetNEta()) || (iphi<=0 || iphi>GetNPhi()) || |
173558f2 | 331 | |
ca8f5bd0 | 332 | (ipre<0 || ipre>1) ){ |
173558f2 | 333 | |
e908f07f | 334 | cout << "inputs out of range ieta=" << ieta << " [1-" << GetNEta(); |
173558f2 | 335 | |
e908f07f | 336 | cout << "] iphi=" << iphi << " [1-" << GetNPhi() << "] ipre="; |
173558f2 | 337 | |
ca8f5bd0 | 338 | cout << ipre << "[0,1]. returning -1" << endl; |
173558f2 | 339 | |
ca8f5bd0 | 340 | return -1; |
173558f2 | 341 | |
ca8f5bd0 | 342 | } // end if |
173558f2 | 343 | |
e908f07f | 344 | index = iphi + GetNPhi()*(ieta-1) + ipre*(GetNPhi()*GetNEta()); |
173558f2 | 345 | |
ca8f5bd0 | 346 | return index; |
173558f2 | 347 | |
ca8f5bd0 | 348 | } |
173558f2 | 349 | |
ca8f5bd0 | 350 | //______________________________________________________________________ |
173558f2 | 351 | |
e908f07f | 352 | void AliEMCALGeometry::TowerIndexes(Int_t index,Int_t &ieta,Int_t &iphi, |
173558f2 | 353 | |
a34b7b9f | 354 | Int_t &ipre) const { |
173558f2 | 355 | |
ca8f5bd0 | 356 | // given the tower index number it returns the based on the Z and Phi |
173558f2 | 357 | |
ca8f5bd0 | 358 | // index numbers and if it is for the full tower or the pre-tower number. |
173558f2 | 359 | |
ca8f5bd0 | 360 | // There are 2 times the number of towers to separate |
173558f2 | 361 | |
ca8f5bd0 | 362 | // out the full towsers from the pre-towsers. |
173558f2 | 363 | |
ca8f5bd0 | 364 | // Inputs: |
173558f2 | 365 | |
ca8f5bd0 | 366 | // Int_t index // Tower index number [1-2*fNZ*fNPhi] |
173558f2 | 367 | |
ca8f5bd0 | 368 | // Outputs: |
173558f2 | 369 | |
e908f07f | 370 | // Int_t ieta // index allong z axis [1-fNZ] |
173558f2 | 371 | |
ca8f5bd0 | 372 | // Int_t iphi // index allong phi axis [1-fNPhi] |
173558f2 | 373 | |
ca8f5bd0 | 374 | // Int_t ipre // 0 = Full tower, 1 = Pre-shower tower only. [0,1] |
173558f2 | 375 | |
ca8f5bd0 | 376 | // Returned |
173558f2 | 377 | |
ca8f5bd0 | 378 | // none. |
173558f2 | 379 | |
ca8f5bd0 | 380 | Int_t itowers; |
381 | ||
173558f2 | 382 | |
383 | ||
e908f07f | 384 | itowers = GetNEta()*GetNPhi(); |
173558f2 | 385 | |
ca8f5bd0 | 386 | if(index<1 || index>2*itowers){ |
173558f2 | 387 | |
ca8f5bd0 | 388 | cout << "index=" << index <<" is out of range [1-"; |
173558f2 | 389 | |
ca8f5bd0 | 390 | cout << 2*itowers << "], returning -1 for all." << endl; |
173558f2 | 391 | |
e908f07f | 392 | ieta = -1; iphi = -1; ipre = -1; |
173558f2 | 393 | |
ca8f5bd0 | 394 | return ; |
173558f2 | 395 | |
ca8f5bd0 | 396 | } // end if |
173558f2 | 397 | |
ca8f5bd0 | 398 | ipre = 0; |
173558f2 | 399 | |
ca8f5bd0 | 400 | if(index>itowers){ // pre shower indexs |
173558f2 | 401 | |
ca8f5bd0 | 402 | ipre = 1; |
173558f2 | 403 | |
ca8f5bd0 | 404 | index = index - itowers; |
173558f2 | 405 | |
ca8f5bd0 | 406 | } // end if |
173558f2 | 407 | |
4b988fd2 | 408 | ieta = 1+ (Int_t)((index-1)/GetNPhi()); |
173558f2 | 409 | |
4b988fd2 | 410 | iphi = index - GetNPhi()*(ieta-1); |
173558f2 | 411 | |
ca8f5bd0 | 412 | return; |
173558f2 | 413 | |
ca8f5bd0 | 414 | } |
173558f2 | 415 | |
ca8f5bd0 | 416 | //______________________________________________________________________ |
173558f2 | 417 | |
a34b7b9f | 418 | void AliEMCALGeometry::EtaPhiFromIndex(Int_t index,Float_t &eta,Float_t &phi) const { |
173558f2 | 419 | |
ca8f5bd0 | 420 | // given the tower index number it returns the based on the eta and phi |
173558f2 | 421 | |
ca8f5bd0 | 422 | // of the tower. |
173558f2 | 423 | |
ca8f5bd0 | 424 | // Inputs: |
173558f2 | 425 | |
ca8f5bd0 | 426 | // Int_t index // Tower index number [1-2*fNZ*fNPhi] |
173558f2 | 427 | |
ca8f5bd0 | 428 | // Outputs: |
173558f2 | 429 | |
ca8f5bd0 | 430 | // Float_t eta // eta of center of tower in pseudorapidity |
173558f2 | 431 | |
ca8f5bd0 | 432 | // Float_t phi // phi of center of tower in degrees |
173558f2 | 433 | |
ca8f5bd0 | 434 | // Returned |
173558f2 | 435 | |
ca8f5bd0 | 436 | // none. |
173558f2 | 437 | |
e908f07f | 438 | Int_t ieta,iphi,ipre; |
173558f2 | 439 | |
e908f07f | 440 | Double_t deta,dphi,phid; |
ca8f5bd0 | 441 | |
173558f2 | 442 | |
443 | ||
e908f07f | 444 | TowerIndexes(index,ieta,iphi,ipre); |
173558f2 | 445 | |
e908f07f | 446 | deta = (GetArm1EtaMax()-GetArm1EtaMin())/((Float_t)GetNEta()); |
173558f2 | 447 | |
e908f07f | 448 | eta = GetArm1EtaMin() + (((Float_t)ieta)-0.5)*deta; |
173558f2 | 449 | |
e908f07f | 450 | dphi = (GetArm1PhiMax() - GetArm1PhiMin())/((Float_t)GetNPhi()); // in degrees. |
173558f2 | 451 | |
e908f07f | 452 | phid = GetArm1PhiMin() + dphi*((Float_t)iphi -0.5);//iphi range [1-fNphi]. |
173558f2 | 453 | |
ca8f5bd0 | 454 | phi = phid; |
173558f2 | 455 | |
ca8f5bd0 | 456 | } |
173558f2 | 457 | |
ca8f5bd0 | 458 | //______________________________________________________________________ |
173558f2 | 459 | |
a34b7b9f | 460 | Int_t AliEMCALGeometry::TowerIndexFromEtaPhi(Float_t eta,Float_t phi) const { |
173558f2 | 461 | |
ca8f5bd0 | 462 | // returns the tower index number based on the eta and phi of the tower. |
173558f2 | 463 | |
ca8f5bd0 | 464 | // Inputs: |
173558f2 | 465 | |
ca8f5bd0 | 466 | // Float_t eta // eta of center of tower in pseudorapidity |
173558f2 | 467 | |
ca8f5bd0 | 468 | // Float_t phi // phi of center of tower in degrees |
173558f2 | 469 | |
ca8f5bd0 | 470 | // Outputs: |
173558f2 | 471 | |
ca8f5bd0 | 472 | // none. |
173558f2 | 473 | |
ca8f5bd0 | 474 | // Returned |
173558f2 | 475 | |
ca8f5bd0 | 476 | // Int_t index // Tower index number [1-fNZ*fNPhi] |
173558f2 | 477 | |
e908f07f | 478 | Int_t ieta,iphi; |
ca8f5bd0 | 479 | |
173558f2 | 480 | |
481 | ||
e908f07f | 482 | ieta = 1 + (Int_t)(((Float_t)GetNEta())*(eta-GetArm1EtaMin())/ |
173558f2 | 483 | |
e908f07f | 484 | (GetArm1EtaMax() - GetArm1EtaMin())); |
173558f2 | 485 | |
e908f07f | 486 | if(ieta<=0 || ieta>GetNEta()){ |
173558f2 | 487 | |
e908f07f | 488 | cout << "TowerIndexFromEtaPhi:"; |
173558f2 | 489 | |
e908f07f | 490 | cout << "ieta = "<< ieta << " eta=" << eta << " is outside of EMCAL. etamin="; |
173558f2 | 491 | |
e908f07f | 492 | cout << GetArm1EtaMin() << " to etamax=" << GetArm1EtaMax(); |
173558f2 | 493 | |
ca8f5bd0 | 494 | cout << " returning -1" << endl; |
173558f2 | 495 | |
ca8f5bd0 | 496 | return -1; |
173558f2 | 497 | |
ca8f5bd0 | 498 | } // end if |
173558f2 | 499 | |
e908f07f | 500 | iphi = 1 + (Int_t)(((Float_t)GetNPhi())*(phi-GetArm1PhiMin())/ |
173558f2 | 501 | |
e908f07f | 502 | ((Float_t)(GetArm1PhiMax() - GetArm1PhiMin()))); |
173558f2 | 503 | |
ca8f5bd0 | 504 | if(iphi<=0 || iphi>GetNPhi()){ |
173558f2 | 505 | |
e908f07f | 506 | cout << "TowerIndexFromEtaPhi:"; |
173558f2 | 507 | |
e908f07f | 508 | cout << "iphi=" << iphi << " phi=" << phi << " is outside of EMCAL."; |
173558f2 | 509 | |
ca8f5bd0 | 510 | cout << " Phimin=" << GetArm1PhiMin() << " PhiMax=" << GetArm1PhiMax(); |
173558f2 | 511 | |
ca8f5bd0 | 512 | cout << " returning -1" << endl; |
173558f2 | 513 | |
ca8f5bd0 | 514 | return -1; |
173558f2 | 515 | |
ca8f5bd0 | 516 | } // end if |
173558f2 | 517 | |
e908f07f | 518 | return TowerIndex(ieta,iphi,0); |
173558f2 | 519 | |
ca8f5bd0 | 520 | } |
173558f2 | 521 | |
ca8f5bd0 | 522 | //______________________________________________________________________ |
173558f2 | 523 | |
a34b7b9f | 524 | Int_t AliEMCALGeometry::PreTowerIndexFromEtaPhi(Float_t eta,Float_t phi) const { |
173558f2 | 525 | |
ca8f5bd0 | 526 | // returns the pretower index number based on the eta and phi of the tower. |
173558f2 | 527 | |
ca8f5bd0 | 528 | // Inputs: |
173558f2 | 529 | |
ca8f5bd0 | 530 | // Float_t eta // eta of center of tower in pseudorapidity |
173558f2 | 531 | |
ca8f5bd0 | 532 | // Float_t phi // phi of center of tower in degrees |
173558f2 | 533 | |
ca8f5bd0 | 534 | // Outputs: |
173558f2 | 535 | |
ca8f5bd0 | 536 | // none. |
173558f2 | 537 | |
ca8f5bd0 | 538 | // Returned |
173558f2 | 539 | |
ca8f5bd0 | 540 | // Int_t index // PreTower index number [fNZ*fNPhi-2*fNZ*fNPhi] |
541 | ||
173558f2 | 542 | |
543 | ||
e908f07f | 544 | return GetNEta()*GetNPhi()+TowerIndexFromEtaPhi(eta,phi); |
173558f2 | 545 | |
ca8f5bd0 | 546 | } |
173558f2 | 547 | |
ca8f5bd0 | 548 | //______________________________________________________________________ |
173558f2 | 549 | |
a34b7b9f | 550 | Bool_t AliEMCALGeometry::AbsToRelNumbering(Int_t AbsId, Int_t *relid) const { |
173558f2 | 551 | |
ca8f5bd0 | 552 | // Converts the absolute numbering into the following array/ |
173558f2 | 553 | |
5a9318ff | 554 | // relid[0] = EMCAL Arm number 1:1 |
173558f2 | 555 | |
ca8f5bd0 | 556 | // relid[1] = 0 Not in Pre Shower layers |
173558f2 | 557 | |
ca8f5bd0 | 558 | // = -1 In Pre Shower |
173558f2 | 559 | |
ca8f5bd0 | 560 | // relid[2] = Row number inside EMCAL |
173558f2 | 561 | |
ca8f5bd0 | 562 | // relid[3] = Column number inside EMCAL |
173558f2 | 563 | |
ca8f5bd0 | 564 | // Input: |
173558f2 | 565 | |
ca8f5bd0 | 566 | // Int_t AbsId // Tower index number [1-2*fNZ*fNPhi] |
173558f2 | 567 | |
ca8f5bd0 | 568 | // Outputs: |
173558f2 | 569 | |
ca8f5bd0 | 570 | // Int_t *relid // array of 5. Discribed above. |
173558f2 | 571 | |
ca8f5bd0 | 572 | Bool_t rv = kTRUE ; |
173558f2 | 573 | |
e908f07f | 574 | Int_t ieta=0,iphi=0,ipre=0,index=AbsId; |
ca8f5bd0 | 575 | |
173558f2 | 576 | |
577 | ||
e908f07f | 578 | TowerIndexes(index,ieta,iphi,ipre); |
173558f2 | 579 | |
ca8f5bd0 | 580 | relid[0] = 1; |
173558f2 | 581 | |
ca8f5bd0 | 582 | relid[1] = 0; |
173558f2 | 583 | |
5a9318ff | 584 | if(ipre==1) |
173558f2 | 585 | |
5a9318ff | 586 | relid[1] = -1; |
173558f2 | 587 | |
e908f07f | 588 | relid[2] = ieta; |
173558f2 | 589 | |
ca8f5bd0 | 590 | relid[3] = iphi; |
591 | ||
173558f2 | 592 | |
593 | ||
ca8f5bd0 | 594 | return rv; |
173558f2 | 595 | |
ca8f5bd0 | 596 | } |
173558f2 | 597 | |
ca8f5bd0 | 598 | //______________________________________________________________________ |
173558f2 | 599 | |
5a9318ff | 600 | void AliEMCALGeometry::PosInAlice(const Int_t *relid,Float_t &theta, |
173558f2 | 601 | |
a34b7b9f | 602 | Float_t &phi) const { |
173558f2 | 603 | |
5a9318ff | 604 | // Converts the relative numbering into the local EMCAL-module (x, z) |
173558f2 | 605 | |
ca8f5bd0 | 606 | // coordinates |
173558f2 | 607 | |
e908f07f | 608 | Int_t ieta = relid[2]; // offset along x axis |
173558f2 | 609 | |
ca8f5bd0 | 610 | Int_t iphi = relid[3]; // offset along z axis |
173558f2 | 611 | |
5a9318ff | 612 | Int_t ipre = relid[1]; // indicates -1 preshower, or 0 full tower. |
173558f2 | 613 | |
ca8f5bd0 | 614 | Int_t index; |
173558f2 | 615 | |
ca8f5bd0 | 616 | Float_t eta; |
617 | ||
173558f2 | 618 | |
619 | ||
ca8f5bd0 | 620 | if(ipre==-1) ipre = 1; |
173558f2 | 621 | |
e908f07f | 622 | index = TowerIndex(ieta,iphi,ipre); |
173558f2 | 623 | |
ca8f5bd0 | 624 | EtaPhiFromIndex(index,eta,phi); |
173558f2 | 625 | |
ca8f5bd0 | 626 | theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); |
627 | ||
173558f2 | 628 | |
629 | ||
ca8f5bd0 | 630 | return; |
173558f2 | 631 | |
ca8f5bd0 | 632 | } |
6119e5db | 633 | |
173558f2 | 634 | |
635 | ||
6119e5db | 636 | //______________________________________________________________________ |
173558f2 | 637 | |
6119e5db | 638 | void AliEMCALGeometry::XYZFromIndex(const Int_t *relid,Float_t &x,Float_t &y, Float_t &z) const { |
173558f2 | 639 | |
6119e5db | 640 | // given the tower relative number it returns the X, Y and Z |
173558f2 | 641 | |
6119e5db | 642 | // of the tower. |
173558f2 | 643 | |
6119e5db | 644 | |
173558f2 | 645 | |
6119e5db | 646 | // Outputs: |
173558f2 | 647 | |
6119e5db | 648 | // Float_t x // x of center of tower in cm |
173558f2 | 649 | |
6119e5db | 650 | // Float_t y // y of center of tower in cm |
173558f2 | 651 | |
6119e5db | 652 | // Float_t z // z of centre of tower in cm |
173558f2 | 653 | |
6119e5db | 654 | // Returned |
173558f2 | 655 | |
6119e5db | 656 | // none. |
173558f2 | 657 | |
6119e5db | 658 | |
173558f2 | 659 | |
6119e5db | 660 | Float_t eta,theta, phi,cyl_radius,kDeg2Rad; |
173558f2 | 661 | |
6119e5db | 662 | |
173558f2 | 663 | |
6119e5db | 664 | Int_t ieta = relid[2]; // offset along x axis |
173558f2 | 665 | |
6119e5db | 666 | Int_t iphi = relid[3]; // offset along z axis |
173558f2 | 667 | |
6119e5db | 668 | Int_t ipre = relid[1]; // indicates -1 preshower, or 0 full tower. |
173558f2 | 669 | |
6119e5db | 670 | Int_t index; |
173558f2 | 671 | |
6119e5db | 672 | |
673 | ||
173558f2 | 674 | |
675 | ||
6119e5db | 676 | if(ipre==-1) ipre = 1; |
173558f2 | 677 | |
6119e5db | 678 | index = TowerIndex(ieta,iphi,ipre); |
173558f2 | 679 | |
6119e5db | 680 | EtaPhiFromIndex(index,eta,phi); |
173558f2 | 681 | |
6119e5db | 682 | theta = 180.*(2.0*TMath::ATan(TMath::Exp(-eta)))/TMath::Pi(); |
683 | ||
173558f2 | 684 | |
685 | ||
6119e5db | 686 | |
173558f2 | 687 | |
6119e5db | 688 | |
173558f2 | 689 | |
6119e5db | 690 | kDeg2Rad = TMath::Pi() / static_cast<Double_t>(180) ; |
173558f2 | 691 | |
6119e5db | 692 | cyl_radius = GetIPDistance()+ GetAirGap() ; |
173558f2 | 693 | |
6119e5db | 694 | x = cyl_radius * TMath::Cos(phi * kDeg2Rad ) ; |
173558f2 | 695 | |
6119e5db | 696 | y = cyl_radius * TMath::Cos(phi * kDeg2Rad ) ; |
173558f2 | 697 | |
6119e5db | 698 | z = cyl_radius / TMath::Tan(theta * kDeg2Rad ) ; |
173558f2 | 699 | |
6119e5db | 700 | |
173558f2 | 701 | |
6119e5db | 702 | return; |
173558f2 | 703 | |
6119e5db | 704 | } |
705 | ||
173558f2 | 706 | |
707 | ||
ca8f5bd0 | 708 | //______________________________________________________________________ |
173558f2 | 709 | |
ca8f5bd0 | 710 | /* |
173558f2 | 711 | |
a34b7b9f | 712 | Boot_t AliEMCALGeometry::AreNeighbours(Int_t index1,Int_t index2) const { |
173558f2 | 713 | |
ca8f5bd0 | 714 | // Returns kTRUE if the two towers are neighbours or not, including |
173558f2 | 715 | |
ca8f5bd0 | 716 | // diagonals. Both indexes are required to be either towers or preshower. |
173558f2 | 717 | |
ca8f5bd0 | 718 | // Inputs: |
173558f2 | 719 | |
ca8f5bd0 | 720 | // Int_t index1 // index of tower 1 |
173558f2 | 721 | |
ca8f5bd0 | 722 | // Int_t index2 // index of tower 2 |
173558f2 | 723 | |
ca8f5bd0 | 724 | // Outputs: |
173558f2 | 725 | |
ca8f5bd0 | 726 | // none. |
173558f2 | 727 | |
ca8f5bd0 | 728 | // Returned |
173558f2 | 729 | |
ca8f5bd0 | 730 | // Boot_t kTRUE if the towers are neighbours otherwise false. |
173558f2 | 731 | |
ca8f5bd0 | 732 | Boot_t anb = kFALSE; |
173558f2 | 733 | |
e908f07f | 734 | Int_t ieta1 = 0, ieta2 = 0, iphi1 = 0, iphi2 = 0, ipre1 = 0, ipre2 = 0; |
ca8f5bd0 | 735 | |
173558f2 | 736 | |
737 | ||
e908f07f | 738 | TowerIndexes(index1,ieta1,iphi1,ipre1); |
173558f2 | 739 | |
e908f07f | 740 | TowerIndexes(index2,ieta2,iphi2,ipre2); |
173558f2 | 741 | |
ca8f5bd0 | 742 | if(ipre1!=ipre2) return anb; |
173558f2 | 743 | |
e908f07f | 744 | if((ieta1>=ieta2-1 && ieta1<=ieta2+1) && (iphi1>=iphi2-1 &&iphi1<=iphi2+1)) |
173558f2 | 745 | |
ca8f5bd0 | 746 | anb = kTRUE; |
173558f2 | 747 | |
ca8f5bd0 | 748 | return anb; |
173558f2 | 749 | |
ca8f5bd0 | 750 | } |
173558f2 | 751 | |
ca8f5bd0 | 752 | */ |
173558f2 | 753 |