GENIEGenerator
Loading...
Searching...
No Matches
PetersonFragm.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, 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
11#include <TROOT.h>
12
15
16using namespace genie;
17
18//___________________________________________________________________________
20FragmentationFunctionI("genie::PetersonFragm")
21{
22
23}
24//___________________________________________________________________________
26FragmentationFunctionI("genie::PetersonFragm", config)
27{
28 this->BuildFunction();
29}
30//___________________________________________________________________________
35//___________________________________________________________________________
36double PetersonFragm::Value(double z) const
37{
38// Evaluate the fragmentation function
39
40 if(z<0 || z>1) return 0;
41 return fFunc->Eval(z);
42}
43//___________________________________________________________________________
44double PetersonFragm::GenerateZ(void) const
45{
46// Return a random number using the fragmentation function as PDF
47
48 return fFunc->GetRandom();
49}
50//___________________________________________________________________________
52{
54 this->BuildFunction();
55}
56//___________________________________________________________________________
57void PetersonFragm::Configure(string config)
58{
60 this->BuildFunction();
61}
62//___________________________________________________________________________
64{
65 fFunc = new TF1("fFunc",genie::utils::frgmfunc::peterson_func,0,1,2);
66
67 fFunc->SetParNames("Norm","Epsilon");
68 // stop ROOT from deleting this object of its own volition
69 gROOT->GetListOfFunctions()->Remove(fFunc);
70
71 double N = -1. ;
72 GetParam( "PetFrag-Norm", N, false ) ;
73
74 //The xml files says that Epsilon is not optional, while the
75 //orignal behaviour of this function assigned a 0 default value
76 //if the xml file was not providing such a number.
77 // Original behaviour maintained
78 double e = 0. ;
79 GetParam( "PetFrag-Epsilon", e, false ) ;
80
81 // if the normalization parameter was left negative, explicitly normalize
82 // the fragmentation function
83 if(N<0) {
84 N=1;
85 fFunc->SetParameters(N,e);
86 double I = fFunc->Integral(0,1);
87 assert(I>0);
88 N = 1./I;
89 }
90 fFunc->SetParameters(N,e);
91}
92//___________________________________________________________________________
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
virtual void Configure(const Registry &config)
Definition Algorithm.cxx:62
void Configure(const Registry &config)
double Value(double z) const
implement the FragmentationFunctionI interface
double GenerateZ(void) const
A registry. Provides the container for algorithm configuration parameters.
Definition Registry.h:65
const double e
double peterson_func(double *x, double *par)
The Peterson fragmentation function.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25