CollinsSpillerFragm.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2019, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5  or see $GENIE/LICENSE
6 
7  Author: Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
8  University of Liverpool & STFC Rutherford Appleton Lab - June 15, 2004
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13 
14 */
15 //____________________________________________________________________________
16 
19 
20 using namespace genie;
21 
22 //___________________________________________________________________________
24 FragmentationFunctionI("genie::CollinsSpillerFragm")
25 {
26 
27 }
28 //___________________________________________________________________________
30 FragmentationFunctionI("genie::CollinsSpillerFragm", config)
31 {
32 
33 }
34 //___________________________________________________________________________
36 {
37  delete fFunc;
38 }
39 //___________________________________________________________________________
40 double CollinsSpillerFragm::Value(double z) const
41 {
42 // Evaluate the fragmentation function
43 
44  if(z<0 || z>1) return 0;
45  return fFunc->Eval(z);
46 }
47 //___________________________________________________________________________
49 {
50 // Return a random number using the fragmentation function as PDF
51 
52  return fFunc->GetRandom();
53 }
54 //___________________________________________________________________________
56 {
57  Algorithm::Configure(config);
58  this->BuildFunction();
59 }
60 //___________________________________________________________________________
62 {
63  Algorithm::Configure(config);
64  this->BuildFunction();
65 }
66 //___________________________________________________________________________
68 {
69  fFunc = new TF1("fFunc",genie::utils::frgmfunc::collins_spiller_func,0,1,2);
70 
71  fFunc->SetParNames("Norm","Epsilon");
72 
73  double N = -1. ;
74  GetParam( "CSFrag-Norm", N, false ) ;
75 
76  double e = 0. ;
77  GetParam( "CSFrag-Epsilon", e, false ) ;
78 
79  // if the normalization parameter was left negative, explicitly normalize
80  // the fragmentation function
81  if(N<0) {
82  N=1;
83  fFunc->SetParameters(N,e);
84  double I = fFunc->Integral(0,1);
85  assert(I>0);
86  N = 1./I;
87  }
88  fFunc->SetParameters(N,e);
89 }
90 //___________________________________________________________________________
91 
92 
93 
double Value(double z) const
implements the FragmentationFunctionI interface
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
double collins_spiller_func(double *x, double *par)
The Collins-Spiller fragmentation function.
Definition: config.py:1
void Configure(const Registry &config)
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:70
z
Definition: test.py:28
Pure abstract base class. Defines the FragmentationFunctionI interface to be implemented by any algor...
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
assert(nhit_max >=nhit_nbins)
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
Float_t e
Definition: plot.C:35