KNOPythiaHadronization.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
9 
10  For the class documentation see the corresponding header file.
11 
12  Important revisions after version 2.0.0 :
13  @ Feb 10, 2011
14  Fixed a bug reported by Torben Ferber affecting the KNO -> PYTHIA
15  model transition (the order was reversed!)
16 
17 */
18 //____________________________________________________________________________
19 
20 #include <cstdlib>
21 
22 #include <TLorentzVector.h>
23 #include <TClonesArray.h>
24 #include <TH1D.h>
25 
34 
35 using namespace genie;
36 using namespace genie::constants;
37 
38 //____________________________________________________________________________
40 EventRecordVisitorI("genie::KNOPythiaHadronization")
41 {
42 
43 }
44 //____________________________________________________________________________
46 EventRecordVisitorI("genie::KNOPythiaHadronization", config)
47 {
48 
49 }
50 //____________________________________________________________________________
52 {
53 
54 }
55 //____________________________________________________________________________
56 // void KNOPythiaHadronization::Initialize(void) const
57 // {
58 //
59 // }
60 //____________________________________________________________________________
62 {
63 // Generate the hadronic system using either the KNO-based or PYTHIA/JETSET
64 // hadronization models according to the specified transition scheme
65  Interaction * interaction = event->Summary();
66 
67 
68  //-- Select hadronizer
69  const EventRecordVisitorI * hadronizer =
70  this->SelectHadronizer(interaction);
71 
72  //-- Run the selected hadronizer
73  hadronizer->ProcessEventRecord(event);
74 
75  // //-- Update the weight
76  // fWeight = hadronizer->Weight();
77 }
78 //____________________________________________________________________________
79 /*
80 PDGCodeList * KNOPythiaHadronization::SelectParticles(
81  const Interaction * interaction) const
82 {
83  //-- Select hadronizer
84  const EventRecordVisitorI * hadronizer = this->SelectHadronizer(interaction);
85 
86  //-- Run the selected hadronizer
87  PDGCodeList * pdgv = hadronizer->SelectParticles(interaction);
88 
89  return pdgv;
90 }
91 //____________________________________________________________________________
92 TH1D * KNOPythiaHadronization::MultiplicityProb(
93  const Interaction * interaction, Option_t * opt) const
94 {
95  //-- Select hadronizer
96  const EventRecordVisitorI * hadronizer = this->SelectHadronizer(interaction);
97 
98  //-- Run the selected hadronizer
99  TH1D * mprob = hadronizer->MultiplicityProb(interaction,opt);
100 
101  return mprob;
102 }
103 //____________________________________________________________________________
104 double KNOPythiaHadronization::Weight(void) const
105 {
106  return fWeight;
107 }
108 */
109 //____________________________________________________________________________
111  const Interaction * interaction) const
112 {
113  const EventRecordVisitorI * hadronizer = 0;
114  RandomGen * rnd = RandomGen::Instance();
115  double W = 0;
116 
117  switch(fMethod) {
118 
119  // ** KNO-only
120  case(0) :
121  hadronizer = fKNOHadronizer;
122  break;
123 
124  // ** PYTHIA/JETSET-only
125  case(1) :
126  hadronizer = fPythiaHadronizer;
127  break;
128 
129  // ** KNO-only @ W < Wmin
130  // ** PYTHIA/JETSET-only @ W > Wmax
131  // ** Smooth linear transition in [Wmin,Wmax]
132  case(2) :
133  W = interaction->Kine().W();
134  if (W <= fWminTrWindow) hadronizer = fKNOHadronizer;
135  else if (W > fWmaxTrWindow) hadronizer = fPythiaHadronizer;
136  else {
137  // Transition window
138  double R = rnd->RndHadro().Rndm();
140  if(R>f) hadronizer = fKNOHadronizer;
141  else hadronizer = fPythiaHadronizer;
142  }
143  break;
144 
145  default :
146  LOG("HybridHad", pFATAL)
147  << "Unspecified transition method: " << fMethod;
148  exit(1);
149  }
150 
151  if(!hadronizer) {
152  LOG("HybridHad", pFATAL) << "Null hadronizer!!";
153  exit(1);
154  }
155 
156  LOG("HybridHad", pINFO) << "Selected hadronizer: " << hadronizer->Id();
157  return hadronizer;
158 }
159 //____________________________________________________________________________
161 {
162  Algorithm::Configure(config);
163  this->LoadConfig();
164 }
165 //____________________________________________________________________________
167 {
168  Algorithm::Configure(config);
169  this->LoadConfig();
170 }
171 //____________________________________________________________________________
173 {
174 // Read configuration options or set defaults
175 
176  // Load the requested hadronizers
178  dynamic_cast<const EventRecordVisitorI *> (
179  this->SubAlg("KNO-Hadronizer"));
181  dynamic_cast<const EventRecordVisitorI *> (
182  this->SubAlg("PYTHIA-Hadronizer"));
183 
185 
186  // Get transition method
187  fMethod = 2 ;
188  GetParam( "TransMethod", fMethod, false ) ;
189 
190 
191  // Get transition scheme specific config
192  if(fMethod==2) {
193 
194  GetParam( "KNO2PYTHIA-Wmin", fWminTrWindow ) ;
195 
196  GetParam( "KNO2PYTHIA-Wmax", fWmaxTrWindow ) ;
197 
198  }
199 }
200 //____________________________________________________________________________
double W(bool selected=false) const
Definition: Kinematics.cxx:167
Basic constants.
int fMethod
KNO -> PYTHIA transition method.
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:26
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:79
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
#define pFATAL
Definition: Messenger.h:57
const EventRecordVisitorI * fPythiaHadronizer
PYTHIA Hadronizer.
virtual void Configure(const Registry &config)
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
const EventRecordVisitorI * fKNOHadronizer
KNO Hadronizer.
double fWminTrWindow
min W in transition region (pure KNO < Wmin)
Summary information for an interaction.
Definition: Interaction.h:55
double fWmaxTrWindow
max W in transition region (pure PYTHIA > Wmax)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
const EventRecordVisitorI * SelectHadronizer(const Interaction *) const
static Config * config
Definition: config.cpp:1054
const Kinematics & Kine(void) const
Definition: Interaction.h:70
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:71
#define pINFO
Definition: Messenger.h:63
void ProcessEventRecord(GHepRecord *event) const
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
Definition: RandomGen.h:54
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:98
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:66
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:46
Event finding and building.
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:354