GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CollinsSpillerFragm.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2024, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <c.andreopoulos \at cern.ch>
7  University of Liverpool
8 */
9 //____________________________________________________________________________
10 
13 
14 using namespace genie;
15 
16 //___________________________________________________________________________
18 FragmentationFunctionI("genie::CollinsSpillerFragm")
19 {
20 
21 }
22 //___________________________________________________________________________
24 FragmentationFunctionI("genie::CollinsSpillerFragm", config)
25 {
26 
27 }
28 //___________________________________________________________________________
30 {
31  delete fFunc;
32 }
33 //___________________________________________________________________________
34 double CollinsSpillerFragm::Value(double z) const
35 {
36 // Evaluate the fragmentation function
37 
38  if(z<0 || z>1) return 0;
39  return fFunc->Eval(z);
40 }
41 //___________________________________________________________________________
43 {
44 // Return a random number using the fragmentation function as PDF
45 
46  return fFunc->GetRandom();
47 }
48 //___________________________________________________________________________
50 {
51  Algorithm::Configure(config);
52  this->BuildFunction();
53 }
54 //___________________________________________________________________________
55 void CollinsSpillerFragm::Configure(string config)
56 {
57  Algorithm::Configure(config);
58  this->BuildFunction();
59 }
60 //___________________________________________________________________________
62 {
63  fFunc = new TF1("fFunc",genie::utils::frgmfunc::collins_spiller_func,0,1,2);
64 
65  fFunc->SetParNames("Norm","Epsilon");
66 
67  double N = -1. ;
68  GetParam( "CSFrag-Norm", N, false ) ;
69 
70  double e = 0. ;
71  GetParam( "CSFrag-Epsilon", e, false ) ;
72 
73  // if the normalization parameter was left negative, explicitly normalize
74  // the fragmentation function
75  if(N<0) {
76  N=1;
77  fFunc->SetParameters(N,e);
78  double I = fFunc->Integral(0,1);
79  assert(I>0);
80  N = 1./I;
81  }
82  fFunc->SetParameters(N,e);
83 }
84 //___________________________________________________________________________
double Value(double z) const
implements the FragmentationFunctionI interface
double collins_spiller_func(double *x, double *par)
The Collins-Spiller fragmentation function.
void Configure(const Registry &config)
const double e
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
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:65
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const