Pluto v6.3.0
Loading...
Searching...
No Matches
PDistribution.h
Go to the documentation of this file.
1// Author: I. Froehlich
2// Written: 3.7.2006
3// Revised:
4// Base class for common distributions
5
6#ifndef _PDISTRIBUTION_H_
7#define _PDISTRIBUTION_H_
8
9#define MAX_PARTICLE_LIST 10
10#define PARTICLE_LIST_DAUGHTER 1
11#define PARTICLE_LIST_PARENT 2
12#define PARTICLE_LIST_GRANDPARENT 4
13#define PARTICLE_LIST_GRANDGRANDPARENT 8
14#define PARTICLE_LIST_GRANDDAUGHTER 16
15#define PARTICLE_LIST_SIBLING 128
16
17#define DISTRIBUTION_QUASI_PID 1000
18#define DISTRIBUTION_SOMETHING_PID 2000
19#define DISTRIBUTION_NUCLEON_PID 3000
20
21//Flags for sampling, generator, etc.
22#define VERSION_SAMPLING 1
23#define VERSION_WEIGHTING 2
24#define VERSION_INVERT_WEIGHTING 4
25#define VERSION_MASS_SAMPLING 128
26#define VERSION_IS_PRIMARY 256
27#define VERSION_GENERATOR_MC 512
28#define VERSION_NO_PHASE_SPACE 1024
29#define VERSION_FORCE_NO_PARTIAL_WIDTH 2048
30
31#include "TF1.h"
32#include "TF2.h"
33#include "PParticle.h"
34#include "PData.h"
35#include "PUtils.h"
36
37
38class PDistribution : public TF1 {
39
40 public:
41
43 PDistribution(const Char_t *id, const Char_t *de);
44 virtual ~PDistribution();
45
46 virtual PDistribution* Clone(const char *delme=NULL) const;
47
48 Int_t Add(const Char_t *opt);
49 Int_t Add(const Char_t *name, int flag,
50 const Char_t *pflag); //Adds a particle placehoulder to the list
51
52 Int_t Add(const Char_t *name, const Char_t *flag1,
53 const Char_t *flag2 = NULL, const Char_t *flag3 = NULL);
54 //Helper function
55
56 Int_t Set(const Char_t *opt);
57 Int_t Set(const Char_t *name, const Char_t *pflag); //Like Add(), but rather replace it
58
59 void Reset(void);
60
61 Int_t SetParticle(PParticle *part, int pid, int flag);
62 //Replaces the pointer for the given particle
63 //This function should be called from PChannel
64
65 void ResetRelatives(Int_t flag = 0);
66 const char *GetGroupID(void) { //Some wish where I want to go to...
67 return group;
68 };
69 void SetGroupID(const char *gr) {
70 group=gr;
71 }
72
73 PParticle *GetParticle(const Char_t *pflag=NULL); //get the particly with the private flag
74
75 Int_t GetStatus(void); //returns 0 if all particles are set
76 Int_t CheckDaughters(void) ; //returns 0 if all daughters are set
77 void NoDaughters(void) {no_daughters=1;};
78 void ResetStatus(void); //Clean setted particles
79
80 virtual void Print(const Option_t *delme=NULL) const ; //Debug info
81 void BasePrint(void) const ; //Debug info
82 const Char_t *OptString(void) {return opt_string;};
83 virtual void SubPrint(Int_t opt) const ; //Print sub-models
84 const Char_t *Path(void) const; //print path for models
85
86 const Char_t *GetIdentifier(void) {return identifier;};
87 const Char_t *GetDescription(void) {return description;};
88
89 void SetEnable(Int_t en) {enable=en;};
90 Int_t GetEnable(void) {return enable;};
91 void SetActivated(Int_t en) {is_activated=en;};
92 Int_t GetActivated(void) {return is_activated;};
93
94 void SetVersionFlag(Int_t f) {version_flag |= f;};
95 void ClearVersionFlag(Int_t f) {version_flag &= (~f);};
96 UInt_t GetVersionFlag(UInt_t f = 0xffffffff) const {
97 return version_flag & f;
98 };
99
100
101 /* the following tool functions set different versions */
102 void DisableSampling(void) {
104 }; //No Sampling in the GenBod
105
106 void EnableGenerator(void) {
109 }; //Use distribution as a generator
110
111 void EnableWeighting(void) {
114 }; //Use distribution as a generator
115
116 virtual Bool_t FreezeOut(void);
117
118 virtual Bool_t Init(void);
119
120 virtual Bool_t Prepare(void);
121
122 virtual Bool_t SampleMass(void);
123
124 virtual Bool_t SampleMomentum(void);
125
126 virtual Bool_t SampleAngle(void);
127
128 virtual Bool_t IsNotRejected(void);
129
130 virtual Bool_t CheckAbort(void);
131
132 virtual Bool_t Finalize(void);
133
134 virtual Bool_t EndOfChain(void);
135
136 virtual Double_t GetWeight(void);
137
138 virtual Bool_t WriteDebugInfo(PParticle *par);
139
140 Int_t GetKey(void) {
141 return primary_key;
142 };
143 void SetDecayIdx(Int_t opt) {didx_option=opt;};
144
145 virtual int GetDepth(int i=0);
146
147 int LinkDBdone(void) {return linkdbdone;};
148 void LinkDBdone(int i) {linkdbdone=i;};
149
150 void IncrementWeightSum(Double_t w, Double_t sc=1.) {
151// if (w_num && (sc>(w_num *1.1))) return;
152
153 w_sum += w*sc;
154 w_num += sc;
155 };
156
158 //For PChannelModels: ExpectedWeightMean is set to the
159 //static branching ratio
160
161 return exp_w_mean;
162 };
163
164 void SetExpectedWeightMean(Double_t w) {
165 exp_w_mean = w;
166 };
167
168 Double_t CalcWeightMean() {
169 return w_sum/w_num;
170 }
171
172 void SetWeightMax(Double_t w) {
173 w_max = w;
174 }
175
176 Double_t GetWeightMax(void) {
177 return w_max;
178 }
179
180 Double_t GetDynamicRange() {
181 //Used to get the Delta_x for the Monte-Carlo Integral
182 return dynamic_range;
183 };
184
185 Bool_t Exec(const char * command);
186 virtual Bool_t ExecCommand(const char *command, Double_t value);
187
189
191
192 void SetDrawScaling(Double_t my_draw_scaling) {draw_scaling = my_draw_scaling;};
193
194 protected:
195
196 const Char_t *identifier, *description;
198 char *parse[4]; //Option strings
199 Int_t parse_s; //max 4 options
200
202 const Char_t *names[MAX_PARTICLE_LIST];
205 const Char_t *opt_string;
208
209 Int_t primary_key; //Model coupled to data base key
210 Int_t model_def_key; //Model type definition key
211 Int_t sec_key; //Key if secondary model (tmp)
212
213 Int_t didx_option; //Model has target didx
214
215 Int_t preliminary_particles; //Used for auto-Adds in PChannelModel
216
217 Int_t GetFlag(const Char_t *flag);
218 const Char_t *group; //Group ID
222
223 Double_t w_sum, exp_w_mean, w_num, dynamic_range; //For weighting method
224 Double_t w_max;
225 Double_t draw_scaling;
226
227 ClassDef(PDistribution,0) //Base class for all distributions
228
229};
230
231#endif
232
233
234
#define MAX_PARTICLE_LIST
#define VERSION_WEIGHTING
#define VERSION_INVERT_WEIGHTING
#define VERSION_SAMPLING
TFile * f
Definition analyze_g12C.C:8
PParticle * par[11]
virtual Bool_t Prepare(void)
virtual Bool_t EndOfChain(void)
char * parse[4]
const Char_t * opt_string
const char * GetGroupID(void)
Double_t GetDynamicRange()
Int_t GetStatus(void)
Int_t Set(const Char_t *name, const Char_t *pflag)
virtual Bool_t FreezeOut(void)
virtual Bool_t SampleAngle(void)
Int_t Add(const Char_t *name, int flag, const Char_t *pflag)
void SetDrawScaling(Double_t my_draw_scaling)
Int_t Add(const Char_t *name, const Char_t *flag1, const Char_t *flag2=NULL, const Char_t *flag3=NULL)
const Char_t * group
virtual int GetDepth(int i=0)
Int_t preliminary_particles
Int_t CheckDaughters(void)
const Char_t * description
void BasePrint(void) const
void ResetRelatives(Int_t flag=0)
Double_t draw_scaling
PParticle * particle[MAX_PARTICLE_LIST]
Bool_t Exec(const char *command)
virtual Bool_t SampleMass(void)
Int_t Add(const Char_t *opt)
const Char_t * GetIdentifier(void)
void LinkDBdone(int i)
virtual PDistribution * Clone(const char *delme=NULL) const
void NoDaughters(void)
PParticle * GetParticle(const Char_t *pflag=NULL)
virtual Bool_t ExecCommand(const char *command, Double_t value)
Int_t particle_flag[MAX_PARTICLE_LIST]
virtual Double_t GetWeight(void)
virtual Bool_t WriteDebugInfo(PParticle *par)
virtual Bool_t IsNotRejected(void)
Int_t GetFlag(const Char_t *flag)
void SetDecayIdx(Int_t opt)
Double_t CalcWeightMean()
const Char_t * GetDescription(void)
int LinkDBdone(void)
Int_t GetKey(void)
void PreParticles(void)
Double_t GetExpectedWeightMean()
const Char_t * Path(void) const
UInt_t GetVersionFlag(UInt_t f=0xffffffff) const
const Char_t * OptString(void)
Double_t dynamic_range
virtual void SubPrint(Int_t opt) const
void IncrementWeightSum(Double_t w, Double_t sc=1.)
void EnableGenerator(void)
Int_t pid[MAX_PARTICLE_LIST]
void SetActivated(Int_t en)
virtual void Print(const Option_t *delme=NULL) const
void ClearVersionFlag(Int_t f)
void ResetStatus(void)
void SetGroupID(const char *gr)
void SetVersionFlag(Int_t f)
Double_t GetWeightMax(void)
void SetWeightMax(Double_t w)
void Reset(void)
Int_t GetEnable(void)
PDistribution(const Char_t *id, const Char_t *de)
const Char_t * private_flag[MAX_PARTICLE_LIST]
Int_t Set(const Char_t *opt)
UInt_t relative_warning
virtual ~PDistribution()
virtual Bool_t CheckAbort(void)
void SetExpectedWeightMean(Double_t w)
Int_t SetParticle(PParticle *part, int pid, int flag)
const Char_t * private_flag_int[MAX_PARTICLE_LIST]
virtual Bool_t Init(void)
virtual Bool_t SampleMomentum(void)
const Char_t * identifier
const Char_t * names[MAX_PARTICLE_LIST]
void SetEnable(Int_t en)
Int_t GetActivated(void)
void DisableSampling(void)
void EnableWeighting(void)
virtual Bool_t Finalize(void)
Double_t exp_w_mean
PParticle * w