#ifndef _PDISTRIBUTION_H_
#define _PDISTRIBUTION_H_
#define MAX_PARTICLE_LIST 10
#define PARTICLE_LIST_DAUGHTER 1
#define PARTICLE_LIST_PARENT 2
#define PARTICLE_LIST_GRANDPARENT 4
#define PARTICLE_LIST_GRANDGRANDPARENT 8
#define PARTICLE_LIST_GRANDDAUGHTER 16
#define PARTICLE_LIST_SIBLING 128
#define DISTRIBUTION_QUASI_PID 1000
#define DISTRIBUTION_SOMETHING_PID 2000
#define DISTRIBUTION_NUCLEON_PID 3000
#define VERSION_SAMPLING 1
#define VERSION_WEIGHTING 2
#define VERSION_INVERT_WEIGHTING 4
#define VERSION_MASS_SAMPLING 128
#define VERSION_IS_PRIMARY 256
#define VERSION_GENERATOR_MC 512
#define VERSION_NO_PHASE_SPACE 1024
#define VERSION_FORCE_NO_PARTIAL_WIDTH 2048
#include "TF1.h"
#include "TF2.h"
#include "PParticle.h"
#include "PData.h"
#include "PUtils.h"
class PDistribution : public TF1 {
public:
PDistribution();
PDistribution(const Char_t *id, const Char_t *de);
virtual ~PDistribution();
virtual PDistribution* Clone(const char *delme=NULL) const;
Int_t Add(const Char_t *opt);
Int_t Add(const Char_t *name, int flag,
const Char_t *pflag);
Int_t Add(const Char_t *name, const Char_t *flag1,
const Char_t *flag2 = NULL, const Char_t *flag3 = NULL);
Int_t Set(const Char_t *opt);
Int_t Set(const Char_t *name, const Char_t *pflag);
void Reset(void);
Int_t SetParticle(PParticle *part, int pid, int flag);
void ResetRelatives(Int_t flag = 0);
const char *GetGroupID(void) {
return group;
};
void SetGroupID(const char *gr) {
group=gr;
}
PParticle *GetParticle(const Char_t *pflag=NULL);
Int_t GetStatus(void);
Int_t CheckDaughters(void) ;
void NoDaughters(void) {no_daughters=1;};
void ResetStatus(void);
virtual void Print(const Option_t *delme=NULL) const ;
void BasePrint(void) const ;
const Char_t *OptString(void) {return opt_string;};
virtual void SubPrint(Int_t opt) const ;
const Char_t *Path(void) const;
const Char_t *GetIdentifier(void) {return identifier;};
const Char_t *GetDescription(void) {return description;};
void SetEnable(Int_t en) {enable=en;};
Int_t GetEnable(void) {return enable;};
void SetActivated(Int_t en) {is_activated=en;};
Int_t GetActivated(void) {return is_activated;};
void SetVersionFlag(Int_t f) {version_flag |= f;};
void ClearVersionFlag(Int_t f) {version_flag &= (~f);};
UInt_t GetVersionFlag(UInt_t f = 0xffffffff) const {
return version_flag & f;
};
void DisableSampling(void) {
ClearVersionFlag(VERSION_SAMPLING);
};
void EnableGenerator(void) {
ClearVersionFlag(VERSION_WEIGHTING);
SetVersionFlag(VERSION_INVERT_WEIGHTING);
};
void EnableWeighting(void) {
ClearVersionFlag(VERSION_SAMPLING);
SetVersionFlag(VERSION_WEIGHTING);
};
virtual Bool_t FreezeOut(void);
virtual Bool_t Init(void);
virtual Bool_t Prepare(void);
virtual Bool_t SampleMass(void);
virtual Bool_t SampleMomentum(void);
virtual Bool_t SampleAngle(void);
virtual Bool_t IsNotRejected(void);
virtual Bool_t CheckAbort(void);
virtual Bool_t Finalize(void);
virtual Bool_t EndOfChain(void);
virtual Double_t GetWeight(void);
virtual Bool_t WriteDebugInfo(PParticle *par);
Int_t GetKey(void) {
return primary_key;
};
void SetDecayIdx(Int_t opt) {didx_option=opt;};
virtual int GetDepth(int i=0);
int LinkDBdone(void) {return linkdbdone;};
void LinkDBdone(int i) {linkdbdone=i;};
void IncrementWeightSum(Double_t w, Double_t sc=1.) {
w_sum += w*sc;
w_num += sc;
};
Double_t GetExpectedWeightMean() {
return exp_w_mean;
};
void SetExpectedWeightMean(Double_t w) {
exp_w_mean = w;
};
Double_t CalcWeightMean() {
return w_sum/w_num;
}
void SetWeightMax(Double_t w) {
w_max = w;
}
Double_t GetWeightMax(void) {
return w_max;
}
Double_t GetDynamicRange() {
return dynamic_range;
};
Bool_t Exec(const char * command);
virtual Bool_t ExecCommand(const char *command, Double_t value);
Int_t debug_flag;
void PreParticles(void) {preliminary_particles = 1;};
void SetDrawScaling(Double_t my_draw_scaling) {draw_scaling = my_draw_scaling;};
protected:
const Char_t *identifier, *description;
Int_t enable, is_activated;
char *parse[4];
Int_t parse_s;
PParticle *particle[MAX_PARTICLE_LIST];
const Char_t *names[MAX_PARTICLE_LIST];
const Char_t *private_flag[MAX_PARTICLE_LIST];
const Char_t *private_flag_int[MAX_PARTICLE_LIST];
const Char_t *opt_string;
Int_t particle_flag[MAX_PARTICLE_LIST], pid[MAX_PARTICLE_LIST];
Int_t position, current_flag;
Int_t primary_key;
Int_t model_def_key;
Int_t sec_key;
Int_t didx_option;
Int_t preliminary_particles;
Int_t GetFlag(const Char_t *flag);
const Char_t *group;
Int_t linkdbdone;
Int_t no_daughters;
UInt_t version_flag, relative_warning;
Double_t w_sum, exp_w_mean, w_num, dynamic_range;
Double_t w_max;
Double_t draw_scaling;
ClassDef(PDistribution,0)
};
#endif