Pluto v6.3.0
Loading...
Searching...
No Matches
useAngularDistribution.C
Go to the documentation of this file.
1//TITLE <b>Angular distribution interface:</b> Add user-defined angular distributions
2
3double f_my_function(double *x, double * par)
4{
5 // (1+x*x)/2
6 return (1+x[0]*x[0])/2;
7 // It is important that the test fuction does not exceed 1 (but comes close to it)
8}
9
10
12
13 //define the angular function
14 //it should not exceed 1!!
15 //This can be a parsed TF1 object:
16 TF1 *angles1 = new TF1("angles1", "(1+x*x)/2", -1, 1);
17 //or a hand-made function:
18 TF1 *angles2 = new TF1("angles2", f_my_function, -1, 1, 1);
19 //or based on a TGraph:
20 const Int_t n = 3;
21 Double_t x[n], y[n];
22 for (Int_t i=0; i<n; i++) {
23 x[i] = i*(1./Double_t(n-1));
24 y[i] = (1+x[i]*x[i])/2;
25 }
26 //another idea:
27 y[0]=1.;
28 y[1]=0.;
29 y[2]=1.;
30
31 TGraph *angles3 = new TGraph(n, x, y);
32
33 PAngularDistribution *ang = new PAngularDistribution("my_angle", "My angular dist");
34 ang->Add("q,parent,reference");
35 ang->Add("p,daughter");
36 ang->Add("NP11+,daughter,primary");
37
38 //uncomment here one version
39 //ang->SetAngleFunction(angles1);
40 //ang->SetAngleFunction(angles2);
41 ang->SetAngleFunction(angles3, kTRUE, kTRUE);
42 //ang->SetAngleFunction(angles3,kFALSE,kTRUE);
43 //options for TGraph version: useSpline, useSymmetry
44 ang->Print();
45
47
48 PReaction my_reaction (3, "p", "p", "p NP11+ [p pi0]", "angular_distribution", 1, 0, 0, 0);
49
51 my_reaction.Print();
52 ang->Draw();
53 my_reaction.Loop(10000);
54}
PDistributionManager * makeDistributionManager()
PParticle * par[11]
void Print(const Option_t *delme=NULL) const
void Print(const Option_t *delme="root") const
int Add(PDistribution *dist)
Int_t Add(const Char_t *opt)
Int_t n
Definition etap+omeg.C:21
double f_my_function(double *x, double *par)
PReaction my_reaction("3.5","p","7Li","p (n) phi [K+ K-] (6Li)","delme")
void useAngularDistribution(void)
double f_my_function(double *x, double *par)