Adding includes for EMCAL_Utils and OADB PATH (A. Shabetai)
[u/mrichter/AliRoot.git] / JETAN / AliJetGrid.cxx
CommitLineData
4a01bb2c 1/**************************************************************************
2 * Copyright(c) 2001-2002, 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: AliJetGrid.cxx,v 1.0 07/09/2006 */
17
18//=========================================================================
19// *** 07 September 2006
20// This class allows to fill a really general grid in (eta,phi)
21// Two types of grid can be setted :
22// if fGrid==0 -> the complete acceptance of a rectangular detector acceptance is filled
23// if fGrid==1 -> the previous grid - an other rectangular detector acceptance is filled
24// A (eta,phi(rad)) position can be extracted from an index value without looping over all entries
25// An index position can be extracted from a (eta,phi(rad)) position without looping over all entries
26//
27// How to run it :
28// > AliJetGrid *grid = new AliJetGrid((NbinPhi-1),(NbinEta-1),PhiMin,PhiMax,EtaMin,EtaMax);
29// > grid->SetGridType(...); // 0 or 1 for the moment
30// > grid->SetMatrixIndexes();
31// > grid->SetIndexIJ();
32//
8838ab7a 33// Author : magali.estienne@subatech.in2p3.fr
4a01bb2c 34//=========================================================================
35
36// Standard headers
37#include <Riostream.h>
38// Root headers
37b09b91 39#include <TMath.h>
4a01bb2c 40#include <TMatrixD.h>
41#include <TArrayD.h>
42#include <TArrayI.h>
43// AliRoot headers
44#include "AliJetGrid.h"
45
87f40625 46ClassImp(AliJetGrid)
4a01bb2c 47
b92e2ccf 48//__________________________________________________________
49AliJetGrid::AliJetGrid():
8838ab7a 50 fGrid(0),
51 fNphi(0),
52 fNeta(0),
53 fPhi(0),
54 fEta(0),
55 fIndex(0),
56 fIndexI(0),
57 fIndexJ(0),
58 fPhiMin(0),
59 fPhiMax(0),
60 fEtaMin(0),
61 fEtaMax(0),
62 fEtaBinInTPCAcc(0),
63 fPhiBinInTPCAcc(0),
64 fEtaBinInEMCalAcc(0),
65 fPhiBinInEMCalAcc(0),
66 fNbinEta(0),
67 fNbinPhi(0),
68 fMaxPhi(0),
69 fMinPhi(0),
70 fMaxEta(0),
71 fMinEta(0),
72 fDebug(1)
73{
4a01bb2c 74 // Default constructor
4a01bb2c 75}
76
77//__________________________________________________________
b92e2ccf 78AliJetGrid::AliJetGrid(Int_t nphi,Int_t neta,Double_t phiMin,Double_t phiMax,Double_t etaMin,Double_t etaMax):
8838ab7a 79 fGrid(0),
80 fNphi(nphi),
81 fNeta(neta),
82 fPhi(0),
83 fEta(0),
84 fIndex(0),
85 fIndexI(0),
86 fIndexJ(0),
87 fPhiMin(0),
88 fPhiMax(0),
89 fEtaMin(0),
90 fEtaMax(0),
91 fEtaBinInTPCAcc(0),
92 fPhiBinInTPCAcc(0),
93 fEtaBinInEMCalAcc(0),
94 fPhiBinInEMCalAcc(0),
95 fNbinEta(0),
96 fNbinPhi(0),
97 fMaxPhi(phiMax),
98 fMinPhi(phiMin),
99 fMaxEta(etaMax),
100 fMinEta(etaMin),
101 fDebug(1)
102{
4a01bb2c 103 // Standard constructor
b92e2ccf 104 fPhi = new TArrayD(fNphi+1);
105 fEta = new TArrayD(fNeta+1);
4a01bb2c 106 fIndexI = new TArrayI((fNeta+1)*(fNphi+1)+1);
107 fIndexJ = new TArrayI((fNeta+1)*(fNphi+1)+1);
b92e2ccf 108
8838ab7a 109 for(Int_t i=0; i<fNphi+1; i++) {
110 if(fNphi!=0) (*fPhi)[i] = (phiMax-phiMin)/fNphi*i+phiMin;
111 else (*fPhi)[i] = phiMin+(phiMax-phiMin)/2;
112 }
113 for(Int_t i=0; i<fNeta+1; i++) {
114 if(fNeta!=0) (*fEta)[i] = (etaMax-etaMin)/fNeta*i+etaMin;
115 else (*fEta)[i] = etaMin+(etaMax-etaMin)/2;
116 }
b92e2ccf 117
4a01bb2c 118 if(fDebug > 3){
b92e2ccf 119 for(Int_t i=0; i<(fNphi+1); i++) cout << (*fPhi)[i] << endl;
120 for(Int_t i=0; i<(fNeta+1); i++) cout << (*fEta)[i] << endl;
4a01bb2c 121 }
b92e2ccf 122
4a01bb2c 123 fIndex = new TMatrixD(fNphi+1,fNeta+1);
b92e2ccf 124
4a01bb2c 125}
126
127//__________________________________________________________
8838ab7a 128AliJetGrid::AliJetGrid(const AliJetGrid& grid) :
129 TNamed(grid),
130 fGrid(grid.fGrid),
131 fNphi(grid.fNphi),
132 fNeta(grid.fNeta),
133 fPhi(0),
134 fEta(0),
135 fIndex(0),
136 fIndexI(grid.fIndexI),
137 fIndexJ(grid.fIndexJ),
138 fPhiMin(grid.fPhiMin),
139 fPhiMax(grid.fPhiMax),
140 fEtaMin(grid.fEtaMin),
141 fEtaMax(grid.fEtaMax),
142 fEtaBinInTPCAcc(grid.fEtaBinInTPCAcc),
143 fPhiBinInTPCAcc(grid.fPhiBinInTPCAcc),
144 fEtaBinInEMCalAcc(grid.fEtaBinInEMCalAcc),
145 fPhiBinInEMCalAcc(grid.fPhiBinInEMCalAcc),
146 fNbinEta(grid.fNbinEta),
147 fNbinPhi(grid.fNbinPhi),
148 fMaxPhi(grid.fMaxPhi),
149 fMinPhi(grid.fMinPhi),
150 fMaxEta(grid.fMaxEta),
151 fMinEta(grid.fMinEta),
152 fDebug(grid.fDebug)
9e4cc50d 153{
4a01bb2c 154
155 // Copy constructor
156
4a01bb2c 157 fPhi = new TArrayD(fNphi+1);
158 for(Int_t i=0; i<fNphi+1; i++) (*fPhi)[i] = grid.fPhi->At(i);
159 fEta = new TArrayD(fNeta+1);
160 for(Int_t i=0; i<fNeta+1; i++) (*fEta)[i] = grid.fEta->At(i);
161
162 fIndex = new TMatrixD(fNphi+1,fNeta+1);
163 for(Int_t i=0; i<fNphi+1; i++) {
164 for(Int_t j=0; j<fNeta+1; j++) (*fIndex)(i,j)=(*grid.fIndex)(i,j);
165 }
166}
167
9e4cc50d 168
169AliJetGrid& AliJetGrid::operator=(const AliJetGrid& other)
170{
8838ab7a 171 // Assignment
172 fGrid = other.fGrid;
173 fNphi = other.fNphi;
174 fNeta = other.fNeta;
175 fPhi = 0;
176 fEta = 0;
177 fIndex = 0;
178 fIndexI = other.fIndexI;
179 fIndexJ = other.fIndexJ;
180 fPhiMin = other.fPhiMin;
181 fPhiMax = other.fPhiMax;
182 fEtaMin = other.fEtaMin;
183 fEtaMax = other.fEtaMax;
184 fEtaBinInTPCAcc = other.fEtaBinInTPCAcc;
185 fPhiBinInTPCAcc = other.fPhiBinInTPCAcc;
186 fEtaBinInEMCalAcc = other.fEtaBinInEMCalAcc;
187 fPhiBinInEMCalAcc = other.fPhiBinInEMCalAcc;
188 fNbinEta = other.fNbinEta;
189 fNbinPhi = other.fNbinPhi;
190 fMaxPhi = other.fMaxPhi;
191 fMinPhi = other.fMinPhi;
192 fMaxEta = other.fMaxEta;
193 fMinEta = other.fMinEta;
194 fDebug = other.fDebug;
195 fPhi = new TArrayD(fNphi+1);
196 for(Int_t i=0; i<fNphi+1; i++) (*fPhi)[i] = other.fPhi->At(i);
197 fEta = new TArrayD(fNeta+1);
198 for(Int_t i=0; i<fNeta+1; i++) (*fEta)[i] = other.fEta->At(i);
199
200 fIndex = new TMatrixD(fNphi+1,fNeta+1);
201 for(Int_t i=0; i<fNphi+1; i++) {
202 for(Int_t j=0; j<fNeta+1; j++) (*fIndex)(i,j)=(*other.fIndex)(i,j);
203 }
204 return *this;
9e4cc50d 205}
206
4a01bb2c 207//__________________________________________________________
208AliJetGrid::~AliJetGrid() {
209
210 // Destructor
211 delete fPhi;
212 delete fEta;
213 delete fIndexI;
214 delete fIndexJ;
215 delete fIndex;
216}
217
218//__________________________________________________________
219void AliJetGrid::InitParams(Double_t phiMinCal,Double_t phiMaxCal,Double_t etaMinCal,Double_t etaMaxCal)
d980dfdb 220{
221// To set initial parameters
4a01bb2c 222
223 fPhiMin = phiMinCal; // rad
224 fPhiMax = phiMaxCal; // rad
225 fEtaMin = etaMinCal;
226 fEtaMax = etaMaxCal;
227 fNbinPhi = static_cast<int>(fPhiMin/(2*TMath::Pi()/fNphi));
228
229 // Define some binning numbers
230 if(fGrid==0){
231 for(Int_t i=0; i<fNphi+1; i++) fPhiBinInTPCAcc++;
232 fPhiBinInEMCalAcc = 0;
233
234 for(Int_t i=0; i<fNeta+1; i++) fEtaBinInTPCAcc++;
235 fEtaBinInEMCalAcc = 0;
236 }
237
238 if(fGrid==1){
239 for(Int_t i=0; i<fNphi+1; i++) {
240 fPhiBinInTPCAcc++;
241 if(fPhi->At(i) >= fPhiMin &&
242 fPhi->At(i) <= fPhiMax)
243 fPhiBinInEMCalAcc++;
244 }
245 for(Int_t i=0; i<fNeta+1; i++) {
246 fEtaBinInTPCAcc++;
247 if((fEta->At(i) >= fEtaMin) &&
248 (fEta->At(i) <= fEtaMax))
249 fEtaBinInEMCalAcc++;
250 }
251 }
252
253}
254
255//__________________________________________________________
256TArrayD* AliJetGrid::GetArrayEta()
d980dfdb 257{
258// Returns an array with the eta points
4a01bb2c 259
260 return fEta;
261
262}
263
264//__________________________________________________________
265TArrayD* AliJetGrid::GetArrayPhi()
d980dfdb 266{
267// Returns an array with the phi points
4a01bb2c 268
269 return fPhi;
270
271}
272
273//__________________________________________________________
274TMatrixD* AliJetGrid::GetIndexObject()
d980dfdb 275{
276// Returns a pointer to the matrix
4a01bb2c 277
278 return fIndex;
279
280}
281
282//__________________________________________________________
283void AliJetGrid::GetAccParam(Int_t &nphi, Int_t &neta, Float_t &minphi, Float_t &maxphi,
d980dfdb 284 Float_t &mineta, Float_t &maxeta) const
285{
286// Returns EMCAL acceptance initially setted
4a01bb2c 287
288 nphi = fNphi;
289 neta = fNeta;
290 minphi = fPhiMin;
291 maxphi = fPhiMax;
292 mineta = fEtaMin;
293 maxeta = fEtaMax;
294}
295
296//__________________________________________________________
297void AliJetGrid::GetBinParam(Int_t &phibintpc, Int_t &etabintpc,
d980dfdb 298 Int_t &phibinemc, Int_t &etabinemc, Int_t &nbinphi) const
299{
300// Returns number of bins in TPC and EMCAL geometry
4a01bb2c 301
302 etabintpc = fEtaBinInTPCAcc;
303 phibintpc = fPhiBinInTPCAcc;
304 etabinemc = fEtaBinInEMCalAcc;
305 phibinemc = fPhiBinInEMCalAcc;
306 nbinphi = fNbinPhi;
307}
308
309//__________________________________________________________
310Int_t AliJetGrid::GetIndexFromEtaPhi(Double_t phi,Double_t eta) const
d980dfdb 311{
312// Tells the index value of a corresponding (eta,phi) real position
313// Loop over all entries -> takes time.
314// Used one time at the begining to fill the grids
4a01bb2c 315
316 /* this is how bins are numbered
317
318 in all TPC or in TPC - EMCAL
319 ... ... ... ..
320 ---------------
321 ... ... . 10 | | | 11
322 ---+---+--- ---------------
323 ^ 6 | 7 | 8 or 8 | | | 9
324 | ---+---+--- ---------------
325 3 | 4 | 5 4 | 5 | 6 | 7
326 phi ---+---+--- ---------------
327 0 | 1 | 2 0 | 1 | 2 | 3
328
329
330 eta ->
331 */
332
333 Int_t etaBin=0,phiBin=0,absID=0;
334 Int_t etaBin2=0,etaBin3=0;
335
336 // Fill all the grid in eta/phi (all TPC acceptance)
337 //-----------------------------------------------------
338 if(fGrid==0){
339 if(eta <= fEta->At(0)) {
340 etaBin = 0;
341 } else if(eta >= fEta->At(fNeta)) {
342 etaBin = fNeta;
343 } else {
344 for(Int_t i=0; i<fNeta+1; i++) {
345 if(eta < fEta->At(i)) {
346 etaBin = i-1;
347 break;
348 }
349 }
350 }
351 if(phi <= fPhi->At(0)) {
352 phiBin = 0;
353 } else if(phi >= fPhi->At(fNphi)) {
354 phiBin = fNphi;
355 } else {
356 for(Int_t i=0; i<fNphi+1; i++) {
357 if(phi < fPhi->At(i)) {
358 phiBin = i-1;
359 break;
360 }
361 }
362 }
363
364 // Calculate absolute id
365 absID = phiBin*(fNeta+1) + etaBin;
366
367 }
368
369 // Fill the grid but do not count id in EMCal acceptance
370 //------------------------------------------------------
371 if((eta >= fEtaMin && eta <= fEtaMax) &&
372 (phi >= fPhiMin && phi <= fPhiMax)){
373 etaBin = etaBin2 = etaBin3 = -1;
374 phiBin = -1;
375 }
376
377 if(fGrid == 1){
378 if(phi<fPhiMin) {
379 if(eta <= fEta->At(0)) {
380 etaBin = 0;
381 } else if(eta >= fEta->At(fNeta)) {
382 etaBin = fNeta;
383 } else {
384 for(Int_t i=0; i<fNeta+1; i++) {
385 if(eta < fEta->At(i)) {
386 etaBin = i-1;
387 break;
388 }
389 }
390 }
391 }
392 else {
393 if((phi>=fPhiMin) && (phi<=fPhiMax)) {
394 if(eta <= fEta->At(0)) {
395 etaBin2 = 0;
396 } else if(eta >= fEta->At(fNeta)) {
397 etaBin2 = fNeta-fEtaBinInEMCalAcc;
398 } else {
399 for(Int_t i=0; i<fNeta+1; i++) {
400 if(eta < fEta->At(i) && ((fEta->At(0)<eta && eta<fEtaMin) ||
401 (fEtaMax<eta && eta<fEta->At(fNeta)))) {
402 // cout << "i : " << i << endl;
403 if(eta<fEtaMin)
404 etaBin2 = i-1;
405 else etaBin2 = i-1-fEtaBinInEMCalAcc;
406 break;
407 }
408 }
409 }
410 }
411 else {
412 if(eta <= fEta->At(0)) {
413 etaBin3 = 0;
414 } else if(eta >= fEta->At(fNeta)) {
415 etaBin3 = fNeta;
416 } else {
417 for(Int_t i=0; i<fNeta+1; i++) {
418 if(eta < fEta->At(i)) {
419 etaBin3 = i-1;
420 break;
421 }
422 }
423 }
424 }
425 }
426
427 if(phi <= fPhi->At(0)) {
428 phiBin = 0;
429 } else if(phi >= fPhi->At(fNphi)) {
430 phiBin = fNphi;
431 } else {
432 for(Int_t i=0; i<fNphi+1; i++) {
433 if(phi < fPhi->At(i)) {
434 phiBin = i-1;
435 break;
436 }
437 }
438 }
439
440 // Calculate absID
441 //-------------------------------------------------------
442 if(phi<fPhiMin)
443 absID = phiBin*(fNeta+1) + etaBin;
444 if(phi>=fPhiMin && phi<=fPhiMax) {
445 if(eta >= fEtaMin && eta <= fEtaMax) absID = -1;
446 else{
447 absID = (fNbinPhi+1)*(fNeta+1)
448 + (phiBin-fNbinPhi-1)*((fEtaBinInTPCAcc-fEtaBinInEMCalAcc))
449 + etaBin2;
450 }
451 }
452 if(phi>fPhiMax)
453 absID = (fNbinPhi+1)*(fNeta+1)
454 + fPhiBinInEMCalAcc*((fEtaBinInTPCAcc-fEtaBinInEMCalAcc))
455 + (phiBin-(fNbinPhi+1+fPhiBinInEMCalAcc))*(fNeta+1)
456 + etaBin3;
457
458 } // END OPTION==1
459
460 return absID;
461
462}
463
464//__________________________________________________________
465void AliJetGrid::GetEtaPhiFromIndex(Int_t index, Float_t &eta, Float_t &phi)
d980dfdb 466{
467// Get (eta,phi) position for a given index BUT loop over all entries (takes time)
4a01bb2c 468
469 for(Int_t j=0; j<fNphi+1; j++) {
470 for(Int_t i=0; i<fNeta+1; i++) {
471
472 // TPC grid only
473 //-------------------------------------
474 if(fGrid==0) {
475 if(j*(fNeta+1)+i == index) {
476 eta = fEta->At(i);
477 phi = fPhi->At(j);
478 }
479 }
480
481 // TPC-EMCAL grid
482 //-------------------------------------
483 Int_t ii = 0;
484 if(i==0) ii = 0;
485 if(i>0 && i<(fEtaBinInTPCAcc-fEtaBinInEMCalAcc)/2) ii = i;
486 if(i>=(fEtaBinInTPCAcc+fEtaBinInEMCalAcc)/2 && i<fNeta+1) ii = i-fEtaBinInEMCalAcc;
487
488 if(fGrid==1) {
489 if(j<(fNbinPhi+1) && j*(fNeta+1)+i == index) {
490 eta = fEta->At(i);
491 phi = fPhi->At(j);
492 }
493
494 if((j>=(fNbinPhi+1) && j<(fNbinPhi+1+fPhiBinInEMCalAcc)) &&
495 ((fNbinPhi+1)*(fNeta+1) + (j-fNbinPhi-1)*(fEtaBinInTPCAcc-fEtaBinInEMCalAcc) + ii)== index ) {
496 if(ii==0) {Int_t ind = 0; eta = fEta->At(ind);}
497 else eta = fEta->At(i);
498 phi = fPhi->At(j);
499 }
500
501 if(j>=(fNbinPhi+1+fPhiBinInEMCalAcc) &&
502 ((fNbinPhi+1)*(fNeta+1)+fPhiBinInEMCalAcc*((fEtaBinInTPCAcc-fEtaBinInEMCalAcc))
503 +(j-(fNbinPhi+1+fPhiBinInEMCalAcc))*(fNeta+1)+i == index)) {
504 eta = fEta->At(i);
505 phi = fPhi->At(j);
506 }
507 }
508 }
509 }
510}
511
512//__________________________________________________________
513Int_t AliJetGrid::GetIndex(Double_t phi, Double_t eta)
d980dfdb 514{
515// Get index value for a (eta,phi) position - Direct value
4a01bb2c 516
517 Int_t ieta = GetIndexJFromEta(eta);
518 Int_t iphi = GetIndexIFromPhi(phi);
519
520 Int_t index = GetMatrixIndex(iphi,ieta);
521
522 if(fDebug>10){
523 cout << "(phi,eta) : " << phi << ", " << eta << endl;
524 cout << "index : " << index << endl;
525 }
526 return index;
527
528}
529
530//__________________________________________________________
531Int_t AliJetGrid::GetIndexJFromEta(Double_t eta)
d980dfdb 532{
533// Get eta id
534// Eta discretized
4a01bb2c 535
536 Int_t idEta =0;
537 Double_t temp = (eta+fMaxEta)/(fMaxEta-fMinEta)*fNeta;
538 if(fDebug>20)
539 {
540 cout << "eta : " << eta << endl;
541 cout << "fMaxEta : " << fMaxEta << endl;
542 cout << "fMinEta : " << fMinEta << endl;
543 cout << "fNeta : " << fNeta << endl;
544 cout << "temp eta before cast : " << temp << endl;
545 }
546 idEta = static_cast<Int_t>(temp+0.5);
547 if(fDebug>20) cout << "temp eta after cast : " << idEta << endl;
548 return idEta;
549}
550//__________________________________________________________
551Int_t AliJetGrid::GetIndexIFromPhi(Double_t phi)
d980dfdb 552{
553// Get phi id
554// Phi discretized
4a01bb2c 555
556 Int_t idPhi = 0;
557 Double_t temp = 0.;
558 if(fMinPhi==0) temp = phi/(fMaxPhi-fMinPhi)*fNphi;
559 else temp = (phi-fMinPhi)/(fMaxPhi-fMinPhi)*fNphi;
560
561 if(fDebug>20)
562 {
563 cout << "phi : " << phi << endl;
564 cout << "fMaxPhi : " << fMaxPhi << endl;
565 cout << "fMinPhi : " << fMinPhi << endl;
566 cout << "fNphi : " << fNphi << endl;
567 cout << "temp phi before cast : " << temp << endl;
568 }
569 idPhi = static_cast<Int_t>(temp+0.5);
570 if(fDebug>20) cout << "temp phi after cast : " << idPhi << endl;
571 return idPhi;
572
573
574}
575
576//__________________________________________________________
577void AliJetGrid::SetMatrixIndex(Int_t i,Double_t par)
d980dfdb 578{
579// Allows to set parameters using only one index (if fGrid==0) !!
580// Not used !
4a01bb2c 581
582 Int_t iphi = (Int_t)i/fNeta;
583 Int_t ieta = i-iphi*fNeta;
584 SetMatrixIndex(iphi,ieta,par);
585
586 return;
587}
588
589//__________________________________________________________
590void AliJetGrid::SetMatrixIndexes()
d980dfdb 591{
592// Fill the final matrix object with the corresponding index in eta/phi
4a01bb2c 593
594 for(Int_t i=0; i<fNphi+1; i++){
595 for(Int_t j=0; j<fNeta+1; j++){
596 (*fIndex)(i,j) = GetIndexFromEtaPhi(fPhi->At(i),fEta->At(j))+1;
597 if(fDebug>2){
598 cout << "(*fIndex)(" << i << "," << j << ") : " << (*fIndex)(i,j) <<
599 ", phi : " << fPhi->At(i) << ", eta : " << fEta->At(j) << endl;
600 }
601 }
602 }
603 printf("##########################################################\n");
604 printf("TMatrix object filled !\n");
605 printf("Size of the object : phi x eta = (fNphi+1) x (fNeta+1) = %d\n",(fNphi+1)*(fNeta+1));
606 printf("##########################################################\n");
607}
608
609//__________________________________________________________
610void AliJetGrid::SetIndexIJ()
d980dfdb 611{
612// Set the grid index
4a01bb2c 613
614 for(Int_t i=0; i<fNphi+1; i++){
615 for(Int_t j=0; j<fNeta+1; j++){
616 Int_t id = static_cast<Int_t>((*fIndex)(i,j));
617
618 if(id!=-1)
619 {
620 (*fIndexI)[id] = i;
621 (*fIndexJ)[id] = j;
622 }
623 }
624 }
625
626 printf("##########################################################\n");
627 printf(" In SetIndexIJ - Grid indexes setted !\n");
628 printf("##########################################################\n");
629}
630
631//__________________________________________________________
69f1d947 632void AliJetGrid::GetIJFromIndex(Int_t index, Int_t& i, Int_t& j) const
d980dfdb 633{
634// Returns i position id of eta and j position id of phi for a given grid index
4a01bb2c 635 i = (*fIndexI)[index];
636 j = (*fIndexJ)[index];
637}
638
639//__________________________________________________________
640void AliJetGrid::GetEtaPhiFromIndex2(Int_t index, Float_t &phi, Float_t &eta)
d980dfdb 641{
642// Returns eta, phi values for a given grid index
4a01bb2c 643
644 phi = fPhi->At((*fIndexI)[index]);
645 eta = fEta->At((*fIndexJ)[index]);
646}
647
648//__________________________________________________________
649Int_t AliJetGrid::GetNEntries()
d980dfdb 650{
651// Returns the number of entries of the grid
4a01bb2c 652
653 if(fDebug>20){
654 cout << "fMaxPhi : " << fMaxPhi << endl;
655 cout << "fMaxEta : " << fMaxEta << endl;
656 }
657
658 Int_t indexNum = GetIndex(fMaxPhi,fMaxEta);
659 if(fDebug>20) cout << "indexNum : " << indexNum << endl;
660 return indexNum;
661
662}
663
664//__________________________________________________________
665Int_t AliJetGrid::GetNEntries2()
d980dfdb 666{
667// Returns the number of entries of the grid
4a01bb2c 668
669 Int_t indexNum = GetIndex(fMaxPhi-1.,fMaxEta-0.5);
670 if(fDebug>20) cout << "indexNum : " << indexNum << endl;
671 return indexNum;
672
673}
674
675
676
677
678
679