23#define KVEVENT_PART_INDEX_OOB "Particle index %d out of bounds [1,%d]"
32#include "KVTemplateParticleCondition.h"
33#include "KVNameValueList.h"
36#include <KVFrameTransform.h>
37#include <KVIntegerList.h>
90template <
typename Particle>
154 return static_cast<Particle*
>(*fIter);
176 if (!
e->GetParticleArray()->GetClass()->InheritsFrom(Particle::Class())) {
177 ::Warning(
"KVTemplateEvent::Iterator",
"KVTemplateEvent<%s>::Iterator for %s particles requested for event containing %s particles. Iteration is aborted.",
178 Particle::Class()->
GetName(), Particle::Class()->
GetName(),
e->GetParticleArray()->GetClass()->GetName());
193 if (!
e.GetParticleArray()->GetClass()->InheritsFrom(Particle::Class())) {
194 ::Warning(
"KVTemplateEvent::Iterator",
"KVTemplateEvent<%s>::Iterator for %s particles requested for event containing %s particles. Iteration is aborted.",
195 Particle::Class()->
GetName(), Particle::Class()->
GetName(),
e.GetParticleArray()->GetClass()->GetName());
209 if (!
e->GetParticleArray()->GetClass()->InheritsFrom(Particle::Class())) {
210 ::Warning(
"KVTemplateEvent::Iterator",
"KVTemplateEvent<%s>::Iterator for %s particles requested for event containing %s particles. Iteration is aborted.",
211 Particle::Class()->
GetName(), Particle::Class()->
GetName(),
e->GetParticleArray()->GetClass()->GetName());
221 return n->BelongsToGroup(grp);
235 if (!
e.GetParticleArray()->GetClass()->InheritsFrom(Particle::Class())) {
236 ::Warning(
"KVTemplateEvent::Iterator",
"KVTemplateEvent<%s>::Iterator for %s particles requested for event containing %s particles. Iteration is aborted.",
237 Particle::Class()->
GetName(), Particle::Class()->
GetName(),
e.GetParticleArray()->GetClass()->GetName());
247 return n->BelongsToGroup(grp);
262 template<
typename Po
interType = Particle>
265 return dynamic_cast<PointerType*
>(
current());
267 template<
typename ReferenceType = Particle>
270 return dynamic_cast<ReferenceType&
>(*
current());
272 template<
typename Po
interType = Particle>
275 return dynamic_cast<const PointerType*
>(
current());
277 template<
typename ReferenceType = Particle>
280 return dynamic_cast<const ReferenceType&
>(*
current());
342 return n->BelongsToGroup(grp);
377#ifdef __WITHOUT_TCA_CONSTRUCTED_AT
378 Particle* tmp = (Particle*) ConstructedAt(mult,
"C");
383 Error(
"AddParticle",
"Allocation failure, Mult=%d", mult);
393 Error(
"GetParticle", KVEVENT_PART_INDEX_OOB, npart,
398 return (Particle*)((*fParticles)[npart - 1]);
424 if (A > 0)
return (
Int_t)
GetSum(
"IsIsotope",
"int,int",
Form(
"%d,%d", Z, A), opt);
441 std::unique_ptr<TObjArray> spec(species.
Tokenize(
", "));
442 Int_t nspec = spec->GetEntries();
443 memset(mult, 0, nspec *
sizeof(
Int_t));
445 for (
int i = 0; i < nspec; i++) {
446 if (((
TObjString*)(*spec)[i])->String() == (*it).GetSymbol()) mult[i] += 1;
468 for (; it !=
end(); ++it) {
476 for (; it !=
end(); ++it) {
503 for (; it !=
end(); ++it) {
511 for (; it !=
end(); ++it) {
537 for (; it !=
end(); ++it) {
545 for (; it !=
end(); ++it) {
568 for (; it !=
end(); ++it) {
576 for (; it !=
end(); ++it) {
589 std::cout <<
"\nKVEvent with " <<
GetMult(t) <<
" particles :" << std::endl;
590 std::cout <<
"------------------------------------" << std::endl;
612 if (!tmp)
Warning(
"GetParticle",
"Particle not found: %s", group_name);
659 Bool_t ok_iter = (Opt ==
"OK");
665 return &(*(
fIter++));
699 (*it).AddGroup(groupname);
709 if (cond->
Test(it.get_const_pointer()))(*it).AddGroup(groupname, from);
721 for (
auto& part : *
this) {
722 part.SetFrame(frame, ft);
737 for (
auto& part : *
this) {
738 part.SetFrame(newframe, oldframe, ft);
750 for (
auto& part : *
this) {
751 part.ChangeFrame(ft,
name);
763 for (
auto& part : *
this) {
764 part.ChangeDefaultFrame(newdef, defname);
775 for (
auto& part : *
this) {
776 part.UpdateAllFrames();
780 template<
typename U = Particle>
781 typename std::enable_if<std::is_base_of<KVNucleus, U>::value>::type
806 template<
typename U = Particle>
807 typename std::enable_if<std::is_base_of<KVNucleus, U>::value>::type
815 for (
Iterator it =
begin(); it !=
end(); ++it) mass[i++] = (*it).GetMassGS();
818 template<
typename U = Particle>
819 typename std::enable_if<std::is_base_of<KVNucleus, U>::value,
Double_t>::type
840 for (
int i = 1; i <= M; i++) {
844 return CN.GetMassGS() - sumM;
846 template<
typename U = Particle>
847 typename std::enable_if < !std::is_base_of<KVNucleus, U>::value,
Double_t >::type
857 template<
typename U = Particle>
858 typename std::enable_if<std::is_base_of<KVNucleus, U>::value,
Double_t>::type
877 for (
int i = 1; i <= M; i++) {
881 return CN.GetMassGS() - sumM;
883 template<
typename U = Particle>
884 typename std::enable_if<std::is_base_of<KVNucleus, U>::value,
KVString>::type
900 TString st = (*it).GetSymbol();
907 if (pop == 1) partition += nvl.
GetNameAt(ii);
909 if (ii < nvl.
GetEntries() - 1) partition +=
" ";
914 template<
typename U = Particle>
915 typename std::enable_if < !std::is_base_of<KVNucleus, U>::value,
KVString >::type
937 (*it).SetFrameName(
name);
994 Bool_t ok_iter = (Opt ==
"OK");
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void on
char * Form(const char *fmt,...)
Abstract base class container for multi-particle events.
KVNameValueList fParameters
general-purpose list of parameters
TClonesArray * fParticles
array of particles in event
virtual Int_t GetMult(Option_t *opt="") const
void SetParameter(const Char_t *name, ValType value) const
const TClonesArray * GetParticleArray() const
Handle a list of positive integers (partition)
void Add(TArrayI *tab)
void Fill(Double_t* tab,Int_t mult);
void Clear(Option_t *option="")
Classe dérivée de TNamed, Reinitialisation de l'object.
void SetPopulation(Int_t pop)
Initialise la population à "pop".
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
virtual void Print(Option_t *opt="") const
Int_t GetIntValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
const Char_t * GetNameAt(Int_t idx) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Class used for iterating over particles in events.
Iterator(const KVEvent *e, const KVTemplateParticleCondition< Particle > &selection)
Particle * current() const
Bool_t IsIterating() const
std::forward_iterator_tag iterator_category
Iterator(const Iterator &i)
const ReferenceType & get_const_reference() const
Iterator(const KVEvent &e, Type t=Type::All, TString grp="")
std::ptrdiff_t difference_type
Iterator(const KVEvent &e, const KVTemplateParticleCondition< Particle > &selection)
ReferenceType & get_reference() const
KVTemplateParticleCondition< Particle > fSelection
Bool_t operator==(const Iterator &it) const
const Iterator & operator++()
Particle & operator*() const
Iterator & operator=(const Iterator &rhs)
Iterator(const KVEvent *e, Type t=Type::All, TString grp="")
Bool_t operator!=(const Iterator &it) const
Bool_t AcceptableIteration()
void Reset(Type t=Type::Null, TString grp="")
void SetIsIterating(Bool_t on=kTRUE)
PointerType * get_pointer() const
const PointerType * get_const_pointer() const
Base class for event classes (containers for different types of particle objects)
EventIterator ConditionalIterator(const KVTemplateParticleCondition< Particle > &c)
void ResetGetNextParticle() const
void ChangeFrame(const KVFrameTransform &ft, const KVString &name="")
void GetMasses(std::vector< Double_t > &mass)
virtual void ls(Option_t *t="") const
Particle * GetParticle(const Char_t *group_name) const
std::enable_if<!std::is_base_of< KVNucleus, U >::value, Double_t >::type get_channel_qvalue() const
std::enable_if<!std::is_base_of< KVNucleus, U >::value, KVString >::type get_partition_name()
Particle * GetParticleWithName(const Char_t *name) const
std::enable_if< std::is_base_of< KVNucleus, U >::value >::type GetGSMasses(std::vector< Double_t > &mass)
void DefineGroup(const Char_t *groupname, const Char_t *from="")
Int_t GetMultiplicity(Int_t Z, Int_t A=0, Option_t *opt="")
void SetFrame(const Char_t *newframe, const Char_t *oldframe, const KVFrameTransform &ft)
Particle * GetParticle(Int_t npart) const
Iterator GetNextParticleIterator(Option_t *opt) const
KVString GetPartitionName()
Particle * GetNextParticle(Option_t *opt="") const
std::enable_if< std::is_base_of< KVNucleus, U >::value, Double_t >::type GetGSChannelQValue() const
KVTemplateEvent(Int_t mult=50)
internal iterator used by GetNextParticle()
void FillHisto(TH1 *h, const Char_t *Nucleus_method, const Char_t *method_prototype, const Char_t *args, Option_t *opt="")
Double_t GetSum(const Char_t *Nucleus_method, Option_t *opt="")
std::enable_if< std::is_base_of< KVNucleus, U >::value, KVString >::type get_partition_name()
void SetFrame(const Char_t *frame, const KVFrameTransform &ft)
std::enable_if< std::is_base_of< KVNucleus, U >::value, Double_t >::type get_channel_qvalue() const
void DefineGroup(const Char_t *groupname, KVTemplateParticleCondition< Particle > *cond, const Char_t *from="")
void SetFrameName(const KVString &name)
Double_t GetChannelQValue() const
void GetMultiplicities(Int_t mult[], const TString &species, Option_t *opt="")
void FillHisto(TH1 *h, const Char_t *Nucleus_method, Option_t *opt="")
virtual Int_t GetMult(Option_t *opt="") const
void ChangeDefaultFrame(const Char_t *newdef, const Char_t *defname="")
Double_t GetSum(const Char_t *Nucleus_method, const Char_t *method_prototype, const Char_t *args, Option_t *opt="")
std::enable_if< std::is_base_of< KVNucleus, U >::value >::type FillIntegerList(KVIntegerList *IL, Option_t *opt)
virtual void Print(Option_t *t="") const
An object for handling particle selection.
Bool_t Test(const ParticleType *nuc) const
void Set(const KVString &name, const LambdaFunc &F)
void Sort(Int_t upto=kMaxInt) override
TObject * ConstructedAt(Int_t idx)
virtual Int_t Fill(const char *name, Double_t w)
static const EReturnType kLong
void InitWithPrototype(const char *function, const char *proto, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
static const EReturnType kDouble
const char * GetName() const override
Int_t GetEntriesFast() const
TObject * FindObject(const char *name) const override
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
const char * Data() const
TObjArray * Tokenize(const TString &delim) const
Double_t Max(Double_t a, Double_t b)
EventGroupIterator(const KVEvent &event, const TString &grp)
EventGroupIterator(const KVEvent *event, const TString &grp)
EventIterator(const KVEvent &event, typename Iterator::Type t=Iterator::Type::All, const TString &grp="")
EventIterator(const KVEvent *event, typename Iterator::Type t=Iterator::Type::All, const TString &grp="")
EventIterator(const KVEvent *event, const KVTemplateParticleCondition< Particle > &selection)
EventIterator(const KVEvent &event, const KVTemplateParticleCondition< Particle > &selection)
EventOKIterator(const KVEvent &event)
EventOKIterator(const KVEvent *event)