KaliVeda
Toolkit for HIC analysis
KVIntegerList Class Reference

Detailed Description

Handle a list of positive integers (partition)

Created by KVClassFactory on Mon Mar 29 14:58:00 2010 Author: bonnet

Values are sorted into decreasing order.

Two examples of filling a list:

Example 1

Fill() can be used to fill the list from an array of values and update relevant quantities:

int tab[] = {1,3,6,4,9,7,3,59,8,160};
ilist->Fill(tab,10);
ilist->Print();
Info in <KVIntegerList::Print>: 160 59 9 8 7 6 4 3(2) 1 : population 1
Handle a list of positive integers (partition)
Definition: KVIntegerList.h:68
void Print(Option_t *option="") const override
Classe dérivée de TNamed, Imprime la liste formattée et la population associée.
void Fill(Int_t *tab, Int_t mult)
void Fill(TArrayI* tab);
virtual void Info(const char *method, const char *msgfmt,...) const

Example 2

Les methodes de type Add(), remplit successivement la liste, avant d'utiliser les grandeurs reliées
l'utilisateur doit appeler la méthode CheckForUpdate(), pour que la mise a jour du nom soit faite
par contre le nombre d'elements est mis a jour automatiquement:

ilist->Add(23,6);
ilist->Add(12);
Int_t tab[3]={1,3,6};
ilist->Add(tab,3);
ilist->CheckForUpdate();
ilist->Print();
Info in <KVIntegerList::Print>: 23(6) 12 6 3 1 : population 1
ilist->Remove(23,3);
ilist->Print();
Info in <KVIntegerList::Print>: 23(6) 12 6 3 1 : population 1 !!! pour le nom RIEN A CHANGER
ilist->GetNbre();
(const Int_t)7 le nombre, lui est mis à jour
ilist->CheckForUpdate();
ilist->Print();
Info in <KVIntegerList::Print>: 23(3) 12 6 3 1 : population 1 OK : les modifs ont été prises en compte
ilist->GetNbre()
(const Int_t)7
int Int_t
void Add(TArrayI *tab)
void Fill(Double_t* tab,Int_t mult);
Int_t GetNbre() const
Bool_t Remove(Int_t val, Int_t freq)
KVIntegerList()
Default constructor.

Les methodes de type Remove(), retirent des valeurs de la liste, là encore l'utilisateur doit appeler la méthode CheckForUpdate(), pour que la mise a jour soit faite Les grandeurs disponibles sont:

  • le nombre d'entiers, ie la multiplicité GetNbre()
  • le nom de la partition definie comme suit : ent1(occ) ent2 ent3(occ3), où entre parenthèses sont notées les occurences aupérieures à 1 d'une valeur
  • la population GetPopulation(), permet de gérer un ensemble de partitions (KVPartitionManager)

Definition at line 68 of file KVIntegerList.h.

#include <KVIntegerList.h>

Inheritance diagram for KVIntegerList:

Public Types

enum  { kHastobeComputed = BIT(14) }
 
- Public Types inherited from TObject
enum  EDeprecatedStatusBits
 
enum  EStatusBits
 

Public Member Functions

 KVIntegerList ()
 Default constructor. More...
 
virtual ~KVIntegerList ()
 Destructor. More...
 
void Add (Double_t *tab, Int_t mult)
 Ajout d'un tableau de "mult" valeurs, version Double_t (Conversion Double_t -> Int_t (arrondi, TMath::Nint())) More...
 
void Add (Double_t val)
 Ajout de la valeur val version Double_t (Conversion Double_t -> Int_t (arrondi, TMath::Nint())) More...
 
void Add (Double_t val, Int_t freq)
 Ajout de "freq" fois la valeur val. More...
 
void Add (Int_t *tab, Int_t mult)
 Ajout d'un tableau d'entiers de "mult" valeurs. More...
 
void Add (Int_t val)
 Ajout de la valeur val (Int_t) More...
 
void Add (Int_t val, Int_t freq)
 Ajout de "freq" fois la valeur val. More...
 
void Add (TArrayI *tab)
 void Fill(Double_t* tab,Int_t mult); More...
 
void AddPopulation (Int_t pop)
 Incrémente la population de "pop" fois. More...
 
void CheckForUpdate ()
 
void Clear (Option_t *option="") override
 Classe dérivée de TNamed, Reinitialisation de l'object. More...
 
Int_t Compare (const TObject *obj) const override
 
Bool_t Contains (Int_t val) const
 
void Copy (TObject &named) const override
 Classe dérivée de TNamed, fait une copie vers l'objet obj. More...
 
Int_tCreateTableOfValues ()
 
TArrayICreateTArrayI ()
 
TNamedCreateTNamed ()
 KVPartition* CreateKVPartition(Int_t mom_max=5);. More...
 
void Fill (Int_t *tab, Int_t mult)
 void Fill(TArrayI* tab); More...
 
Int_t GetFrequency (Int_t val) const
 
Ssiz_t GetLengthName () const
 
Int_t GetNbre () const
 
Int_t GetPopulation () const
 
void Print (Option_t *option="") const override
 Classe dérivée de TNamed, Imprime la liste formattée et la population associée. More...
 
Bool_t Remove (Int_t val)
 
Bool_t Remove (Int_t val, Int_t freq)
 
Bool_t RemoveAll (Int_t val)
 
void ResetPopulation ()
 Remet à 1 la population (comme dans le ctor) More...
 
void SetPopulation (Int_t pop)
 Initialise la population à "pop". More...
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 
TObjectClone (const char *newname="") const override
 
virtual void FillBuffer (char *&buffer)
 
const char * GetName () const override
 
const char * GetTitle () const override
 
ULong_t Hash () const override
 
TClassIsA () const override
 
Bool_t IsSortable () const override
 
void ls (Option_t *option="") const override
 
TNamedoperator= (const TNamed &rhs)
 
virtual void SetName (const char *name)
 
virtual void SetNameTitle (const char *name, const char *title)
 
virtual void SetTitle (const char *title="")
 
virtual Int_t Sizeof () const
 
void Streamer (TBuffer &) override
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 
virtual ~TObject ()
 
void AbstractMethod (const char *method) const
 
virtual void AppendPad (Option_t *option="")
 
virtual void Browse (TBrowser *b)
 
ULong_t CheckedHash ()
 
virtual const char * ClassName () const
 
virtual void Delete (Option_t *option="")
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 
virtual void Draw (Option_t *option="")
 
virtual void DrawClass () const
 
virtual TObjectDrawClone (Option_t *option="") const
 
virtual void Dump () const
 
virtual void Error (const char *method, const char *msgfmt,...) const
 
virtual void Execute (const char *method, const char *params, Int_t *error=nullptr)
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr)
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 
virtual TObjectFindObject (const char *name) const
 
virtual TObjectFindObject (const TObject *obj) const
 
virtual Option_tGetDrawOption () const
 
virtual const char * GetIconName () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 
virtual Option_tGetOption () const
 
virtual UInt_t GetUniqueID () const
 
virtual Bool_t HandleTimer (TTimer *timer)
 
Bool_t HasInconsistentHash () const
 
virtual void Info (const char *method, const char *msgfmt,...) const
 
virtual Bool_t InheritsFrom (const char *classname) const
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 
virtual void Inspect () const
 
void InvertBit (UInt_t f)
 
Bool_t IsDestructed () const
 
virtual Bool_t IsEqual (const TObject *obj) const
 
virtual Bool_t IsFolder () const
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
void MayNotUse (const char *method) const
 
virtual Bool_t Notify ()
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *vp)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, void *vp)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 
virtual void Paint (Option_t *option="")
 
virtual void Pop ()
 
virtual Int_t Read (const char *name)
 
virtual void RecursiveRemove (TObject *obj)
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 
virtual void SetDrawOption (Option_t *option="")
 
virtual void SetUniqueID (UInt_t uid)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const
 

Additional Inherited Members

- Static Public Member Functions inherited from TNamed
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TObject
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Longptr_t GetDtorOnly ()
 
static Bool_t GetObjectStat ()
 
static void SetDtorOnly (void *obj)
 
static void SetObjectStat (Bool_t stat)
 
- Public Attributes inherited from TObject
 kBitMask
 
 kCanDelete
 
 kCannotPick
 
 kHasUUID
 
 kInconsistent
 
 kInvalidObject
 
 kIsOnHeap
 
 kIsReferenced
 
 kMustCleanup
 
 kNoContextMenu
 
 kNotDeleted
 
 kObjInCanvas
 
 kOverwrite
 
 kSingleKey
 
 kWriteDelete
 
 kZombie
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 
void MakeZombie ()
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 
- Protected Attributes inherited from TObject
 kOnlyPrepStep
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
kHastobeComputed 

Definition at line 94 of file KVIntegerList.h.

Constructor & Destructor Documentation

◆ KVIntegerList()

KVIntegerList::KVIntegerList ( )

Default constructor.

Definition at line 34 of file KVIntegerList.cpp.

◆ ~KVIntegerList()

KVIntegerList::~KVIntegerList ( )
virtual

Destructor.

Definition at line 45 of file KVIntegerList.cpp.

Member Function Documentation

◆ Add() [1/7]

void KVIntegerList::Add ( Double_t tab,
Int_t  mult 
)

Ajout d'un tableau de "mult" valeurs, version Double_t (Conversion Double_t -> Int_t (arrondi, TMath::Nint()))

Definition at line 340 of file KVIntegerList.cpp.

◆ Add() [2/7]

void KVIntegerList::Add ( Double_t  val)

Ajout de la valeur val version Double_t (Conversion Double_t -> Int_t (arrondi, TMath::Nint()))

Definition at line 363 of file KVIntegerList.cpp.

◆ Add() [3/7]

void KVIntegerList::Add ( Double_t  val,
Int_t  freq 
)

Ajout de "freq" fois la valeur val.

Definition at line 374 of file KVIntegerList.cpp.

◆ Add() [4/7]

void KVIntegerList::Add ( Int_t tab,
Int_t  mult 
)

Ajout d'un tableau d'entiers de "mult" valeurs.

Definition at line 315 of file KVIntegerList.cpp.

◆ Add() [5/7]

void KVIntegerList::Add ( Int_t  val)

Ajout de la valeur val (Int_t)

Definition at line 352 of file KVIntegerList.cpp.

◆ Add() [6/7]

void KVIntegerList::Add ( Int_t  val,
Int_t  freq 
)

Ajout de "freq" fois la valeur val.

Definition at line 303 of file KVIntegerList.cpp.

◆ Add() [7/7]

void KVIntegerList::Add ( TArrayI tab)

void Fill(Double_t* tab,Int_t mult);

Ajout de valeurs via un TArrayI.

Definition at line 327 of file KVIntegerList.cpp.

◆ AddPopulation()

void KVIntegerList::AddPopulation ( Int_t  pop)

Incrémente la population de "pop" fois.

Definition at line 509 of file KVIntegerList.cpp.

◆ CheckForUpdate()

void KVIntegerList::CheckForUpdate ( )

Methode permettant de mettre à jour la liste, elle est a appeler si l'utilisateur a appelé précédemment une méthode Add ou Remove

Definition at line 162 of file KVIntegerList.cpp.

◆ Clear()

void KVIntegerList::Clear ( Option_t option = "")
overridevirtual

Classe dérivée de TNamed, Reinitialisation de l'object.

Reimplemented from TNamed.

Reimplemented in KVPartition.

Definition at line 72 of file KVIntegerList.cpp.

◆ Compare()

Int_t KVIntegerList::Compare ( const TObject obj) const
overridevirtual

Classe dérivée de TNamed Compare deux objets de type KVIntegerList, le premier test concerne la longueur du nom (KVIntegerList::GetLengthName()) Si elle est identique, on test caractere par caractere, les deux noms TNamed::GetName() Retourne 0 si les noms des deux KVIntegerList sont exactement les memes, -1 sinon;

Reimplemented from TNamed.

Definition at line 624 of file KVIntegerList.cpp.

◆ Contains()

Bool_t KVIntegerList::Contains ( Int_t  val) const

Retourne kTRUE si la valeur "val" est dans la liste, kFALSE sinon dans la liste retourne -1

Definition at line 667 of file KVIntegerList.cpp.

◆ Copy()

void KVIntegerList::Copy ( TObject named) const
overridevirtual

Classe dérivée de TNamed, fait une copie vers l'objet obj.

Reimplemented from TNamed.

Reimplemented in KVPartition.

Definition at line 87 of file KVIntegerList.cpp.

◆ CreateTableOfValues()

Int_t * KVIntegerList::CreateTableOfValues ( )

Cree un objet tableau d'entier de dimension fMult ( KVIntegerList::GetNbre() ) et rempli par ordre decroissant toutes les valeurs de la partition L'objet cree doit etre effacé après utilisation par l'utilisateur

Definition at line 598 of file KVIntegerList.cpp.

◆ CreateTArrayI()

TArrayI * KVIntegerList::CreateTArrayI ( )

Cree un objet TArrayI de dimension fMult ( KVIntegerList::GetNbre() ) et rempli par ordre decroissant toutes les valeurs de la partition L'objet cree doit etre effacé après utilisation par l'utilisateur

Definition at line 575 of file KVIntegerList.cpp.

◆ CreateTNamed()

TNamed * KVIntegerList::CreateTNamed ( )

KVPartition* CreateKVPartition(Int_t mom_max=5);.

Cree un objet TNamed le nom de la partition est le champ TNamed::fName et la population de la partition dans le champ TNamed::fTitle voir TNamed L'objet cree doit etre effacé après utilisation par l'utilisateur

Definition at line 558 of file KVIntegerList.cpp.

◆ Fill()

void KVIntegerList::Fill ( Int_t tab,
Int_t  mult 
)

void Fill(TArrayI* tab);

La liste est re initialisée via KVIntegerList::Clear() remplie, puis mise à jour KVIntegerList::Update()

Definition at line 221 of file KVIntegerList.cpp.

◆ GetFrequency()

Int_t KVIntegerList::GetFrequency ( Int_t  val) const

Retourne l'occurence de la valeur "val", si elle n'est pas présente dans la liste retourne -1

Definition at line 653 of file KVIntegerList.cpp.

◆ GetLengthName()

Ssiz_t KVIntegerList::GetLengthName ( ) const

Retourne la longueur du nom de la partition formatée GetName() utilisée dans la methode Compare

Definition at line 681 of file KVIntegerList.cpp.

◆ GetNbre()

Int_t KVIntegerList::GetNbre ( ) const

Definition at line 530 of file KVIntegerList.cpp.

◆ GetPopulation()

Int_t KVIntegerList::GetPopulation ( ) const

Definition at line 499 of file KVIntegerList.cpp.

◆ Print()

void KVIntegerList::Print ( Option_t option = "") const
overridevirtual

Classe dérivée de TNamed, Imprime la liste formattée et la population associée.

Reimplemented from TNamed.

Reimplemented in KVPartition.

Definition at line 101 of file KVIntegerList.cpp.

◆ Remove() [1/2]

Bool_t KVIntegerList::Remove ( Int_t  val)

On retire 1 fois la valeur val la methode retourne kTRUE si cette valeur etait effectivement presente, kFALSE sinon Le bit kHastobeComputed es mis à 1 pour indiquer la nécéssité de mettre a jour la partition voir KVIntegerList::CheckForUpdate()

Definition at line 450 of file KVIntegerList.cpp.

◆ Remove() [2/2]

Bool_t KVIntegerList::Remove ( Int_t  val,
Int_t  freq 
)

On retire "freq" fois la valeur val la methode retourne kTRUE si cette valeur etait effectivement presente, kFALSE sinon Si freq > la frequence initiale ( KVIntegerList::GetFrequency(Int_t ) )de la valeur, on la retire complétement

Definition at line 431 of file KVIntegerList.cpp.

◆ RemoveAll()

Bool_t KVIntegerList::RemoveAll ( Int_t  val)

Reture completement la valeur val la methode retourne kTRUE si cette valeur etait effectivement presente, kFALSE sinon

Le bit kHastobeComputed es mis à 1 pour indiquer la nécéssité de mettre a jour la partition voir KVIntegerList::CheckForUpdate()

Definition at line 472 of file KVIntegerList.cpp.

◆ ResetPopulation()

void KVIntegerList::ResetPopulation ( )

Remet à 1 la population (comme dans le ctor)

Definition at line 489 of file KVIntegerList.cpp.

◆ SetPopulation()

void KVIntegerList::SetPopulation ( Int_t  pop)

Initialise la population à "pop".

Definition at line 520 of file KVIntegerList.cpp.