10 #ifndef __KVTEMPLATEPARTICLECONDITION_H
11 #define __KVTEMPLATEPARTICLECONDITION_H
65 template<
typename ParticleType>
69 using LambdaFunc = std::function<bool(
const ParticleType*)>;
132 cf->
AddMethod(
"optimized_test",
"Bool_t",
"public",
false,
true);
137 KVString body(
" //Optimized Test method for particle condition\n");
161 Error(
"Optimize",
" *** Optimization failed for KVParticleCondition : %s",
fCondition.
Data());
162 Error(
"Optimize",
" *** Use method AddExtraInclude(const Char_t*) to give the names of all necessary header files for compilation of your condition.");
163 Fatal(
"Optimize",
" *** THIS CONDITION WILL BE EVALUATED AS kFALSE FOR ALL PARTICLES!!!");
180 Error(
"Optimize",
" *** Optimization failed for KVParticleCondition : %s",
fCondition.
Data());
181 Error(
"Optimize",
" *** Use method AddExtraInclude(const Char_t*) to give the names of all necessary header files for compilation of your condition.");
182 Fatal(
"Optimize",
" *** THIS CONDITION WILL BE EVALUATED AS kFALSE FOR ALL PARTICLES!!!");
193 Info(
"Optimize",
"Success");
211 new_class.
Prepend(
"KVParticleCondition_");
228 :
KVBase(
"KVParticleCondition",
"Particle selection criteria")
238 :
KVBase(cond,
"KVParticleCondition")
267 :
KVBase(cond,
"KVParticleCondition")
296 :
KVBase(
"KVParticleCondition",
"Particle selection criteria")
494 if (&obj !=
this) obj.
Copy(*
this);
562 ::Error(
"KVTemplateParticleCondition::operator&&",
"Both KVParticleCondition objects must use lambda captures in order to do this");
608 ::Error(
"operator&&",
"Both KVParticleCondition objects must use lambda captures in order to do this");
646 Info(
"Print",
"object name = %s, address = %p",
GetName(),
this);
649 std::cout <<
" * fOptimal = " <<
fOptimal << std::endl;
650 std::cout <<
" * fNUsing = " <<
fNUsing << std::endl;
652 std::cout <<
" * classfactory :" << std::endl;
657 std::cout <<
GetName() << std::endl;
677 template<
typename ParticleClass>
#define ClassDef(name, id)
char * Form(const char *fmt,...)
Base class for KaliVeda framework.
virtual void Copy(TObject &) const
Make a copy of this object.
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Factory class for generating skeleton files for new classes.
void Print(Option_t *opt="") const
Print infos on object.
void GenerateCode()
Generate header and implementation file for currently-defined class.
void SetInheritAllConstructors(Bool_t yes=kTRUE)
const Char_t * GetImpFileName() const
void AddHeaderIncludeFile(const Char_t *filename)
void Copy(TObject &obj) const
Copy the state of this KVClassFactory to the one referenced by 'obj'.
void AddImplIncludeFile(const Char_t *filename)
const Char_t * GetClassName() const
void AddMethodBody(const Char_t *method_name, const KVString &body)
void AddMethodArgument(const Char_t *method_name, const Char_t *argument_type, const Char_t *argument_name="", const Char_t *default_value="")
KVClassMethod * AddMethod(const Char_t *name, const Char_t *return_type, const Char_t *access="public", Bool_t isVirtual=kFALSE, Bool_t isConst=kFALSE)
Extended version of ROOT THashList.
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from list.
virtual TObject * FindObject(const char *name) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
An object for handling particle selection.
friend KVTemplateParticleCondition operator||(const KVTemplateParticleCondition &A, const KVTemplateParticleCondition &B)
LambdaFunc fLambdaCondition
void Copy(TObject &obj) const
Make a copy of this object.
KVTemplateParticleCondition & operator&=(const KVTemplateParticleCondition &other)
void CreateClassFactory() const
void Set(const KVString &cond)
KVTemplateParticleCondition(const Char_t *cond)
void SetClassFactory(KVClassFactory *CF)
friend KVTemplateParticleCondition operator&&(const KVTemplateParticleCondition &A, const KVTemplateParticleCondition &B)
Bool_t Test(const ParticleType *nuc) const
KVTemplateParticleCondition()
KVTemplateParticleCondition(const KVTemplateParticleCondition &obj)
Bool_t Test(const ParticleType &nuc) const
void Set(const KVString &name, const LambdaFunc &F)
virtual bool optimized_test(const ParticleType *) const
void AddExtraInclude(const Char_t *inc_file)
~KVTemplateParticleCondition()
KVTemplateParticleCondition & operator=(const KVTemplateParticleCondition &obj)
KVTemplateParticleCondition(const KVString &cond)
void SetParticleClassName(const Char_t *cl)
const KVTemplateParticleCondition * fOptimal
void Optimize() const
false if optimisation failed (can't load generated code)
KVString fOptimizedClassName
used to generate code for optimisation
static KVHashList fgOptimized
Bool_t fOptOK
name of generated class used for optimisation
KVTemplateParticleCondition & operator=(const KVString &sel)
KVString fCondition_brackets
static void PrintOptimizedList()
std::function< bool(const ParticleType *)> LambdaFunc
number of classes using this as an optimized condition
void logical_operator_lambda_condition_test() const
KVTemplateParticleCondition(const KVString &name, const LambdaFunc &F)
KVTemplateParticleCondition & operator=(const LambdaFunc &f)
void Print(Option_t *opt="") const
enum KVTemplateParticleCondition::LogOp fOpType
KVTemplateParticleCondition & operator|=(const KVTemplateParticleCondition &other)
virtual void Print(Option_t *option, const char *wildcard, Int_t recurse=1) const
virtual const char * GetName() const
virtual void SetName(const char *name)
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Fatal(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
Longptr_t ExecPlugin(int nargs, const T &... params)
TSubString Strip(EStripType s=kTrailing, char c=' ') const
const char * Data() const
TString & Prepend(char c, Ssiz_t rep=1)
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
TString & ReplaceAll(const char *s1, const char *s2)
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
const char * AsString() const