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