FEDRA emulsion software from the OPERA Collaboration
EdbCell2 Class Reference

class to group 2-dim objects More...

#include <EdbCell2.h>

Inheritance diagram for EdbCell2:
Collaboration diagram for EdbCell2:

Public Member Functions

bool AddObject (float v[2], TObject *obj)
 
bool AddObject (float x, float y, TObject *obj)
 
bool AddObject (int ix, int iy, TObject *obj)
 
bool AddObject (int j, TObject *obj)
 
int CellLim ()
 
void Copy (const EdbCell2 &cell)
 
void Delete ()
 
 EdbCell2 ()
 
 EdbCell2 (const EdbCell2 &cell)
 
TObject * GetObject (float x, float y, int ientr) const
 
TObject * GetObject (int ix, int iy, int ientr) const
 
TObject * GetObject (int j, int ientr) const
 
int InitCell (EdbCell2 &c)
 
int InitCell (int maxpercell, int n[2], float min[2], float max[2])
 
int InitCell (int nx, float minx, float maxx, int ny, float miny, float maxy, int maxpercell)
 
void InitEPC ()
 
void PrintStat ()
 
void Reset ()
 
int SelectObjects (float min[2], float max[2], TObjArray &arr)
 
int SelectObjects (int min[2], int max[2], TObjArray &arr)
 
int SelectObjects (TObjArray &arr)
 
int SelectObjectsC (float v[2], float r, TObjArray &arr)
 
int SelectObjectsC (float v[2], int ir[2], TObjArray &arr)
 
int SelectObjectsC (int iv[2], int ir[2], TObjArray &arr)
 
int SelectObjectsCJ (int j, int ir, TObjArray &arr)
 
void Set0 ()
 
 ~EdbCell2 ()
 
- Public Member Functions inherited from EdbH2
void AddBin (int jcell, int n)
 
int Bin (float x, float y) const
 
int Bin (int iv[2]) const
 
int Bin (int ix, int iy) const
 
int Bin (int j) const
 
void CleanCells ()
 
void Copy (const EdbH2 &h)
 
void Delete ()
 
int DiscardHighCells (int nmax)
 
TH2F * DrawH2 (const char *name="plot2d", const char *title="EdbH2plot2D")
 
TH1I * DrawSpectrum (const char *name="plot1d", const char *title="EdbH2 DrawSpectrun")
 
 EdbH2 ()
 
 EdbH2 (const EdbH2 &h)
 
 EdbH2 (int nx, float minx, float maxx, int ny, float miny, float maxy)
 
int Fill (float x, float y)
 
int Fill (float x, float y, int n)
 
int InitH2 (const EdbH2 &h)
 
int InitH2 (int n[2], float min[2], float max[2])
 
int InitH2 (int nx, float minx, float maxx, int ny, float miny, float maxy)
 
Long_t Integral ()
 
Long_t Integral (int iv[2], int ir[2])
 
int IX (float x) const
 
int IX (int jcell) const
 
int IY (float y) const
 
int IY (int jcell) const
 
int Jcell (float v[2]) const
 
int Jcell (float x, float y) const
 
int Jcell (int ix, int iy) const
 
int MaxBin ()
 
Float_t Mean ()
 
int Ncell () const
 
int NX () const
 
int NY () const
 
void PrintStat ()
 
EdbH1ProjectionX ()
 
EdbH1ProjectionY ()
 
void Set0 ()
 
void SetBin (int ix, int iy, int n)
 
void SetBin (int j, int n)
 
float X (int ix) const
 
float Xbin () const
 
float Xj (int j) const
 
float Xmax () const
 
float XmaxA (float level=0)
 
float Xmin () const
 
float XminA (float level=0)
 
float Y (int iy) const
 
float Ybin () const
 
float Yj (int j) const
 
float Ymax () const
 
float YmaxA (float level=0)
 
float Ymin () const
 
float YminA (float level=0)
 
 ~EdbH2 ()
 

Private Attributes

Int_t eCapacity
 eNcell*eCellLim More...
 
Int_t eCellLim
 max number of entries into one cell (for memory allocation) More...
 
TObject *** epC
 [eNcell] pointers to cells More...
 
TObject ** epO
 [eCapasity] array of the pointers to objects More...
 

Additional Inherited Members

- Protected Attributes inherited from EdbH2
Float_t eBin [2]
 bin size More...
 
Float_t eMax [2]
 max More...
 
Float_t eMin [2]
 min More...
 
Int_t eN [2]
 divisions More...
 
Int_t * eNC
 [eNcell] number of objects/cell More...
 
Int_t eNcell
 eNx*eNy More...
 

Detailed Description

class to group 2-dim objects

Constructor & Destructor Documentation

◆ EdbCell2() [1/2]

EdbCell2::EdbCell2 ( )
568{
569 Set0();
570}
void Set0()
Definition: EdbCell2.cpp:573

◆ EdbCell2() [2/2]

EdbCell2::EdbCell2 ( const EdbCell2 cell)
inline
159{ Set0(); Copy(cell); }
void Copy(const EdbCell2 &cell)
Definition: EdbCell2.cpp:628

◆ ~EdbCell2()

EdbCell2::~EdbCell2 ( )
583{
584 Delete();
585}
void Delete()
Definition: EdbCell2.cpp:588

Member Function Documentation

◆ AddObject() [1/4]

bool EdbCell2::AddObject ( float  v[2],
TObject *  obj 
)
inline
173{ return AddObject(v[0],v[1],obj); }
bool AddObject(float v[2], TObject *obj)
Definition: EdbCell2.h:173

◆ AddObject() [2/4]

bool EdbCell2::AddObject ( float  x,
float  y,
TObject *  obj 
)
689{
690 int j = Jcell(x,y);
691 return AddObject(j, obj);
692}
int Jcell(int ix, int iy) const
Definition: EdbCell2.h:57

◆ AddObject() [3/4]

bool EdbCell2::AddObject ( int  ix,
int  iy,
TObject *  obj 
)
682{
683 int j = Jcell(ix,iy);
684 return AddObject(j, obj);
685}

◆ AddObject() [4/4]

bool EdbCell2::AddObject ( int  j,
TObject *  obj 
)
696{
697 if(!obj) return 0;
698 if(j>=eNcell) return 0;
699 if(j<0) return 0;
700 if( eNC[j] >= eCellLim ) return 0;
701 epC[j][eNC[j]] = obj;
702 eNC[j]++;
703 return 1;
704}
TObject *** epC
[eNcell] pointers to cells
Definition: EdbCell2.h:155
Int_t eCellLim
max number of entries into one cell (for memory allocation)
Definition: EdbCell2.h:152
Int_t * eNC
[eNcell] number of objects/cell
Definition: EdbCell2.h:29
Int_t eNcell
eNx*eNy
Definition: EdbCell2.h:28

◆ CellLim()

int EdbCell2::CellLim ( )
inline
166{ return eCellLim; }

◆ Copy()

void EdbCell2::Copy ( const EdbCell2 cell)
629{
630 EdbH2::Copy(cell);
631 eCellLim = cell.eCellLim;
632 eCapacity = cell.eCapacity;
633 for(int i=0; i<eNcell; i++)
634 for(int j=0; i<eCellLim; i++) AddObject(i, GetObject(i,j));
635}
Int_t eCapacity
eNcell*eCellLim
Definition: EdbCell2.h:153
TObject * GetObject(float x, float y, int ientr) const
Definition: EdbCell2.h:195
void Copy(const EdbH2 &h)
Definition: EdbCell2.cpp:45

◆ Delete()

void EdbCell2::Delete ( )
589{
590 if(epC) { delete [] epC; epC = 0; }
591 if(epO) { delete [] epO; epO = 0; }
592}
TObject ** epO
[eCapasity] array of the pointers to objects
Definition: EdbCell2.h:154

◆ GetObject() [1/3]

TObject * EdbCell2::GetObject ( float  x,
float  y,
int  ientr 
) const
inline
195{ return GetObject( Jcell(x,y), ientr); }

◆ GetObject() [2/3]

TObject * EdbCell2::GetObject ( int  ix,
int  iy,
int  ientr 
) const
inline
196{ return GetObject( Jcell(ix,iy), ientr); }

◆ GetObject() [3/3]

TObject * EdbCell2::GetObject ( int  j,
int  ientr 
) const
inline
197 {
198 if(j>=0&&j<eNcell&&ientr>=0&&ientr<eCellLim) return epC[j][ientr];
199 else return 0;
200 }

◆ InitCell() [1/3]

int EdbCell2::InitCell ( EdbCell2 c)
inline
167{ return InitCell(c.NX(),c.Xmin(),c.Xmax(),c.NY(),c.Ymin(),c.Ymax(), c.CellLim() ); }
int CellLim()
Definition: EdbCell2.h:166
int InitCell(EdbCell2 &c)
Definition: EdbCell2.h:167
float Xmax() const
Definition: EdbCell2.h:65
int NX() const
Definition: EdbCell2.h:50
float Ymin() const
Definition: EdbCell2.h:66
int NY() const
Definition: EdbCell2.h:51
float Xmin() const
Definition: EdbCell2.h:64
float Ymax() const
Definition: EdbCell2.h:67

◆ InitCell() [2/3]

int EdbCell2::InitCell ( int  maxpercell,
int  n[2],
float  min[2],
float  max[2] 
)
605{
606 Log(3,"EdbCell2::InitCell","%d %f %f %d %f %f", n[0],min[0],max[0],n[1],min[1],max[1] );
607 Delete();
608 InitH2(n, min, max);
609 Log(3,"EdbCell2::InitCell","reserve space for maxpercell(%d) * eNcell(%d) = %d objects",
610 maxpercell, eNcell, maxpercell*eNcell);
611 eCellLim = maxpercell;
613 epO = new TObject*[eCapacity]; //- pointers to objects
614 epC = new TObject**[eNcell]; //- pointers to cells
615 InitEPC();
616 return eNcell;
617}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
float min(TClonesArray *t)
Definition: bitview.cxx:275
void InitEPC()
Definition: EdbCell2.cpp:620
int InitH2(const EdbH2 &h)
Definition: EdbCell2.cpp:78
int max
Definition: check_shower.C:41

◆ InitCell() [3/3]

int EdbCell2::InitCell ( int  nx,
float  minx,
float  maxx,
int  ny,
float  miny,
float  maxy,
int  maxpercell 
)
596{
597 int n[2] = {nx,ny};
598 float min[2] = {minx,miny};
599 float max[2] = {maxx,maxy};
600 return InitCell(maxpercell, n, min, max);
601}

◆ InitEPC()

void EdbCell2::InitEPC ( )
621{
622 TObject **po = epO;
623 epC[0]=po;
624 for(int i=1; i<eNcell; i++) {po+=eCellLim; epC[i]=po;}
625}
TProfile * po
Definition: testChi2Ordering.C:29

◆ PrintStat()

void EdbCell2::PrintStat ( )
675{
676 printf("EdbCell2 limit = %4d\n",eCellLim);
677 ((EdbH2*)this)->PrintStat();
678}
fast 2-dim histogram class (used as a basis for EdbCell2)
Definition: EdbCell2.h:19

◆ Reset()

void EdbCell2::Reset ( )
inline
171{CleanCells(); Delete();}
void CleanCells()
Definition: EdbCell2.cpp:114

◆ SelectObjects() [1/3]

int EdbCell2::SelectObjects ( float  min[2],
float  max[2],
TObjArray &  arr 
)
716{
717 int mi[2] = { IX(min[0]), IY(min[1]) };
718 int ma[2] = { IX(max[0]), IY(max[1]) };
719 return SelectObjects(mi,ma, arr);
720}
int SelectObjects(TObjArray &arr)
Definition: EdbCell2.cpp:738
int IX(float x) const
Definition: EdbCell2.h:52
int IY(float y) const
Definition: EdbCell2.h:53

◆ SelectObjects() [2/3]

int EdbCell2::SelectObjects ( int  min[2],
int  max[2],
TObjArray &  arr 
)
724{
725 int nobj = 0;
726 int jcell = 0;
727 for(int ix = Max(0,min[0]); ix<=Min(eN[0]-1,max[0]); ix++)
728 for(int iy = Max(0,min[1]); iy<=Min(eN[1]-1,max[1]); iy++)
729 {
730 jcell = Jcell(ix,iy);
731 if(eNC[jcell]<1) continue;
732 for(int k=0; k<eNC[jcell]; k++) { arr.Add( epC[jcell][k] ); nobj++; }
733 }
734 return nobj;
735}
Int_t eN[2]
divisions
Definition: EdbCell2.h:23

◆ SelectObjects() [3/3]

int EdbCell2::SelectObjects ( TObjArray &  arr)

select all objects

739{
741 int nobj = 0;
742 for(int jcell=0; jcell<eNcell; jcell++) {
743 if(eNC[jcell]<1) continue;
744 for(int k=0; k<eNC[jcell]; k++) { arr.Add( epC[jcell][k] ); nobj++; }
745 }
746 return nobj;
747}

◆ SelectObjectsC() [1/3]

int EdbCell2::SelectObjectsC ( float  v[2],
float  r,
TObjArray &  arr 
)
inline
191 {
192 int ir[2] = { (int)(r/Xbin()) + 1, (int)(r/Ybin()) + 1 };
193 return SelectObjectsC(v, ir, arr);
194 };
int SelectObjectsC(int iv[2], int ir[2], TObjArray &arr)
Definition: EdbCell2.cpp:707
float Ybin() const
Definition: EdbCell2.h:78
float Xbin() const
Definition: EdbCell2.h:77
void r(int rid=2)
Definition: test.C:201

◆ SelectObjectsC() [2/3]

int EdbCell2::SelectObjectsC ( float  v[2],
int  ir[2],
TObjArray &  arr 
)
inline
187 {
188 int iv[2] = { IX(v[0]), IY(v[1]) };
189 return SelectObjectsC(iv, ir, arr);
190 }

◆ SelectObjectsC() [3/3]

int EdbCell2::SelectObjectsC ( int  iv[2],
int  ir[2],
TObjArray &  arr 
)
708{
709 int min[2] = {vcent[0]-vdiff[0],vcent[1]-vdiff[1]};
710 int max[2] = {vcent[0]+vdiff[0],vcent[1]+vdiff[1]};
711 return SelectObjects(min,max, arr);
712}

◆ SelectObjectsCJ()

int EdbCell2::SelectObjectsCJ ( int  j,
int  ir,
TObjArray &  arr 
)
inline
181 {
182 int iv[2] = { IX(j), IY(j) };
183 int irr[2] = { ir, ir };
184 return SelectObjectsC(iv, irr, arr);
185 }

◆ Set0()

void EdbCell2::Set0 ( )
574{
575 eCellLim=0;
576 eCapacity=0;
577 epO=0;
578 epC=0;
579}

Member Data Documentation

◆ eCapacity

Int_t EdbCell2::eCapacity
private

eNcell*eCellLim

◆ eCellLim

Int_t EdbCell2::eCellLim
private

max number of entries into one cell (for memory allocation)

◆ epC

TObject*** EdbCell2::epC
private

[eNcell] pointers to cells

◆ epO

TObject** EdbCell2::epO
private

[eCapasity] array of the pointers to objects


The documentation for this class was generated from the following files: