FEDRA emulsion software from the OPERA Collaboration
EdbCell1 Class Reference

class to group 2-dim objects More...

#include <EdbCell1.h>

Inheritance diagram for EdbCell1:
Collaboration diagram for EdbCell1:

Public Member Functions

bool AddObject (float x, TObject *obj)
 
bool AddObject (int j, TObject *obj)
 
void Delete ()
 
 EdbCell1 ()
 
TObject * GetObject (int j, int ientr) const
 
int InitCell (int maxpercell, int n, float min, float max)
 
void PrintStat ()
 
void Reset ()
 
int SelectObjects (float min, float max, TObjArray &arr)
 
int SelectObjects (int min, int max, TObjArray &arr)
 
int SelectObjects (TObjArray &arr)
 
int SelectObjectsC (float v, int ir, TObjArray &arr)
 
int SelectObjectsC (int iv, int ir, TObjArray &arr)
 
 ~EdbCell1 ()
 
- Public Member Functions inherited from EdbH1
void AddBin (int jcell, int n)
 
int Bin (int ix) const
 
void CleanCells ()
 
void Copy (const EdbH1 &h)
 
void Delete ()
 
int DiscardHighCells (int nmax)
 
TH1F * DrawH1 (const char *name="EdbH1plot", const char *title="EdbH1plot1D")
 
TH1I * DrawSpectrum (const char *name="EdbH1spectrun")
 
 EdbH1 ()
 
 EdbH1 (const EdbH1 &h)
 
 EdbH1 (int n, float min, float max)
 
int Fill (float x)
 
int Fill (float x, int n)
 
int InitH1 (const EdbH1 &h)
 
int InitH1 (int n, float min, float max)
 
Long_t Integral ()
 
Long_t Integral (int iv, int ir)
 
int IX (float x) const
 
int Jcell (float x) const
 
int Jcell (int ix) const
 
int MaxBin ()
 
Float_t Mean ()
 
int N () const
 
int Ncell () const
 
void Print ()
 
void PrintStat ()
 
void Set0 ()
 
void SetBin (int ix, int n)
 
float X (int i) const
 
float Xbin () const
 
float Xmax () const
 
float XmaxA (float level=0)
 
float Xmin () const
 
float XminA (float level=0)
 
 ~EdbH1 ()
 

Private Attributes

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

Additional Inherited Members

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

Detailed Description

class to group 2-dim objects

Constructor & Destructor Documentation

◆ EdbCell1()

EdbCell1::EdbCell1 ( )
477{
478 eCellLim=0;
479 epO=0;
480 epC=0;
481}
TObject ** epO
pointers to objects [eNcell*eCellLim]
Definition: EdbCell1.h:122
Int_t eCellLim
max number of entries into one cell (for memory allocation)
Definition: EdbCell1.h:121
TObject *** epC
pointers to cells [eNcell]
Definition: EdbCell1.h:123

◆ ~EdbCell1()

EdbCell1::~EdbCell1 ( )
485{
486 Delete();
487}
void Delete()
Definition: EdbCell1.cpp:497

Member Function Documentation

◆ AddObject() [1/2]

bool EdbCell1::AddObject ( float  x,
TObject *  obj 
)
520{
521 int j = Jcell(x);
522 return AddObject(j, obj);
523}
bool AddObject(float x, TObject *obj)
Definition: EdbCell1.cpp:519
int Jcell(int ix) const
Definition: EdbCell1.h:51

◆ AddObject() [2/2]

bool EdbCell1::AddObject ( int  j,
TObject *  obj 
)
527{
528 if(j>=eNcell) return 0;
529 if(j<0) return 0;
530 if(eNC[j]>=eCellLim) return 0;
531 if(!obj) return 0;
532 epC[j][eNC[j]] = obj;
533 eNC[j]++;
534 return 1;
535}
Int_t eNcell
eN
Definition: EdbCell1.h:26
Int_t * eNC
[eNcell] number of objects/cell
Definition: EdbCell1.h:27

◆ Delete()

void EdbCell1::Delete ( )
498{
499 if(epC) { delete [] epC; epC = 0; }
500 if(epO) { delete [] epO; epO = 0; }
501}

◆ GetObject()

TObject * EdbCell1::GetObject ( int  j,
int  ientr 
) const
inline
142 {
143 if(j>=0&&j<eNcell&&ientr>=0&&ientr<eCellLim) return epC[j][ientr];
144 else return 0;
145 }

◆ InitCell()

int EdbCell1::InitCell ( int  maxpercell,
int  n,
float  min,
float  max 
)
505{
506 InitH1(n, min, max);
507 Log(3,"EdbCell1::InitCell","reserve space for maxpercell(%d) * eNcell(%d) = %d objects",
508 maxpercell, eNcell, maxpercell*eNcell);
509 eCellLim = maxpercell;
510 epO = new TObject*[eNcell*eCellLim]; //- pointers to objects
511 epC = new TObject**[eNcell]; //- pointers to cells
512 TObject **po = epO;
513 epC[0]=po;
514 for(int i=1; i<eNcell; i++) {po+=eCellLim; epC[i]=po;}
515 return eNcell;
516}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
float min(TClonesArray *t)
Definition: bitview.cxx:275
int InitH1(const EdbH1 &h)
Definition: EdbCell1.h:38
int max
Definition: check_shower.C:41
TProfile * po
Definition: testChi2Ordering.C:29

◆ PrintStat()

void EdbCell1::PrintStat ( )
491{
492 printf("EdbCell1 limit = %4d\n",eCellLim);
493 ((EdbH1*)this)->PrintStat();
494}
fast 2-dim histogram class (used as a basis for EdbCell1)
Definition: EdbCell1.h:17

◆ Reset()

void EdbCell1::Reset ( )
inline
131{CleanCells(); Delete();}
void CleanCells()
Definition: EdbCell1.cpp:85

◆ SelectObjects() [1/3]

int EdbCell1::SelectObjects ( float  min,
float  max,
TObjArray &  arr 
)
547{
548 return SelectObjects( IX(min), IX(max), arr);
549}
int SelectObjects(TObjArray &arr)
Definition: EdbCell1.cpp:566
int IX(float x) const
Definition: EdbCell1.h:50

◆ SelectObjects() [2/3]

int EdbCell1::SelectObjects ( int  min,
int  max,
TObjArray &  arr 
)
553{
554 int nobj = 0;
555 int jcell = 0;
556 for(int ix = Max(0,min); ix<=Min(eN-1,max); ix++)
557 {
558 jcell = Jcell(ix);
559 if(eNC[jcell]<1) continue;
560 for(int k=0; k<eNC[jcell]; k++) { arr.Add( epC[jcell][k] ); nobj++; }
561 }
562 return nobj;
563}
Int_t eN
divisions
Definition: EdbCell1.h:21

◆ SelectObjects() [3/3]

int EdbCell1::SelectObjects ( TObjArray &  arr)

select all objects

567{
569 int nobj = 0;
570 for(int i = 0; i<eNcell; i++)
571 {
572 if(eNC[i]<1) continue;
573 for(int k=0; k<eNC[i]; k++) { arr.Add( epC[i][k] ); nobj++; }
574 }
575 return nobj;
576}

◆ SelectObjectsC() [1/2]

int EdbCell1::SelectObjectsC ( float  v,
int  ir,
TObjArray &  arr 
)
inline
140{ return SelectObjectsC( IX(v), ir, arr); }
int SelectObjectsC(int iv, int ir, TObjArray &arr)
Definition: EdbCell1.cpp:538

◆ SelectObjectsC() [2/2]

int EdbCell1::SelectObjectsC ( int  iv,
int  ir,
TObjArray &  arr 
)
539{
540 int min = vcent-vdiff;
541 int max = vcent+vdiff;
542 return SelectObjects(min,max, arr);
543}

Member Data Documentation

◆ eCellLim

Int_t EdbCell1::eCellLim
private

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

◆ epC

TObject*** EdbCell1::epC
private

pointers to cells [eNcell]

◆ epO

TObject** EdbCell1::epO
private

pointers to objects [eNcell*eCellLim]


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