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