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