AGKY2019.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7  University of Liverpool & STFC Rutherford Appleton Laboratory
8 */
9 //____________________________________________________________________________
10 
11 #include <cstdlib>
12 
13 #include <TLorentzVector.h>
14 #include <TClonesArray.h>
15 #include <TH1D.h>
16 
25 
26 using namespace genie;
27 using namespace genie::constants;
28 
29 //____________________________________________________________________________
31 EventRecordVisitorI("genie::AGKY2019")
32 {
33 
34 }
35 //____________________________________________________________________________
37 EventRecordVisitorI("genie::AGKY2019", config)
38 {
39 
40 }
41 //____________________________________________________________________________
43 {
44 
45 }
46 //____________________________________________________________________________
47 // void AGKY2019::Initialize(void) const
48 // {
49 //
50 // }
51 //____________________________________________________________________________
53 {
54 // Generate the hadronic system using either the KNO-based or PYTHIA/JETSET
55 // hadronization models according to the specified transition scheme
56  Interaction * interaction = event->Summary();
57 
58 
59  //-- Select hadronizer
60  const EventRecordVisitorI * hadronizer =
61  this->SelectHadronizer(interaction);
62 
63  //-- Run the selected hadronizer
64  hadronizer->ProcessEventRecord(event);
65 
66  // //-- Update the weight
67  // fWeight = hadronizer->Weight();
68 }
69 //____________________________________________________________________________
70 /*
71 PDGCodeList * AGKY2019::SelectParticles(
72  const Interaction * interaction) const
73 {
74  //-- Select hadronizer
75  const EventRecordVisitorI * hadronizer = this->SelectHadronizer(interaction);
76 
77  //-- Run the selected hadronizer
78  PDGCodeList * pdgv = hadronizer->SelectParticles(interaction);
79 
80  return pdgv;
81 }
82 //____________________________________________________________________________
83 TH1D * AGKY2019::MultiplicityProb(
84  const Interaction * interaction, Option_t * opt) const
85 {
86  //-- Select hadronizer
87  const EventRecordVisitorI * hadronizer = this->SelectHadronizer(interaction);
88 
89  //-- Run the selected hadronizer
90  TH1D * mprob = hadronizer->MultiplicityProb(interaction,opt);
91 
92  return mprob;
93 }
94 //____________________________________________________________________________
95 double AGKY2019::Weight(void) const
96 {
97  return fWeight;
98 }
99 */
100 //____________________________________________________________________________
102  const Interaction * interaction) const
103 {
104  const EventRecordVisitorI * hadronizer = 0;
105  RandomGen * rnd = RandomGen::Instance();
106  double W = 0;
107 
108  switch(fMethod) {
109 
110  // ** KNO-only
111  case(0) :
112  hadronizer = fKNOHadronizer;
113  break;
114 
115  // ** PYTHIA/JETSET-only
116  case(1) :
117  hadronizer = fPythiaHadronizer;
118  break;
119 
120  // ** KNO-only @ W < Wmin
121  // ** PYTHIA/JETSET-only @ W > Wmax
122  // ** Smooth linear transition in [Wmin,Wmax]
123  case(2) :
124  W = interaction->Kine().W();
125  if (W <= fWminTrWindow) hadronizer = fKNOHadronizer;
126  else if (W > fWmaxTrWindow) hadronizer = fPythiaHadronizer;
127  else {
128  // Transition window
129  double R = rnd->RndHadro().Rndm();
131  if(R>f) hadronizer = fKNOHadronizer;
132  else hadronizer = fPythiaHadronizer;
133  }
134  break;
135 
136  default :
137  LOG("HybridHad", pFATAL)
138  << "Unspecified transition method: " << fMethod;
139  exit(1);
140  }
141 
142  if(!hadronizer) {
143  LOG("HybridHad", pFATAL) << "Null hadronizer!!";
144  exit(1);
145  }
146 
147  LOG("HybridHad", pINFO) << "Selected hadronizer: " << hadronizer->Id();
148  return hadronizer;
149 }
150 //____________________________________________________________________________
152 {
153  Algorithm::Configure(config);
154  this->LoadConfig();
155 }
156 //____________________________________________________________________________
158 {
159  Algorithm::Configure(config);
160  this->LoadConfig();
161 }
162 //____________________________________________________________________________
164 {
165 // Read configuration options or set defaults
166 
167  // Load the requested hadronizers
169  dynamic_cast<const EventRecordVisitorI *> (
170  this->SubAlg("KNO-Hadronizer"));
172  dynamic_cast<const EventRecordVisitorI *> (
173  this->SubAlg("PYTHIA-Hadronizer"));
174 
176 
177  // Get transition method
178  fMethod = 2 ;
179  GetParam( "TransMethod", fMethod, false ) ;
180 
181 
182  // Get transition scheme specific config
183  if(fMethod==2) {
184 
185  GetParam( "KNO2PYTHIA-Wmin", fWminTrWindow ) ;
186 
187  GetParam( "KNO2PYTHIA-Wmax", fWmaxTrWindow ) ;
188 
189  }
190 }
191 //____________________________________________________________________________
double W(bool selected=false) const
Definition: Kinematics.cxx:157
Basic constants.
void LoadConfig(void)
Definition: AGKY2019.cxx:163
virtual void Configure(const Registry &config)
Definition: AGKY2019.cxx:151
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
virtual void ProcessEventRecord(GHepRecord *event_rec) const =0
static RandomGen * Instance()
Access instance.
Definition: RandomGen.cxx:71
Defines the EventRecordVisitorI interface. Concrete implementations of this interface use the &#39;Visito...
#define pFATAL
Definition: Messenger.h:56
virtual ~AGKY2019()
Definition: AGKY2019.cxx:42
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:29
const EventRecordVisitorI * fPythiaHadronizer
PYTHIA Hadronizer.
Definition: AGKY2019.h:54
Summary information for an interaction.
Definition: Interaction.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
double fWmaxTrWindow
max W in transition region (pure PYTHIA > Wmax)
Definition: AGKY2019.h:58
static Config * config
Definition: config.cpp:1054
const Kinematics & Kine(void) const
Definition: Interaction.h:71
virtual void Configure(const Registry &config)
Definition: Algorithm.cxx:62
#define pINFO
Definition: Messenger.h:62
const EventRecordVisitorI * fKNOHadronizer
KNO Hadronizer.
Definition: AGKY2019.h:53
TRandom3 & RndHadro(void) const
rnd number generator used by hadronization models
Definition: RandomGen.h:53
virtual const AlgId & Id(void) const
Get algorithm ID.
Definition: Algorithm.h:97
void ProcessEventRecord(GHepRecord *event) const
Definition: AGKY2019.cxx:52
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
const EventRecordVisitorI * SelectHadronizer(const Interaction *) const
Definition: AGKY2019.cxx:101
bool GetParam(const RgKey &name, T &p, bool is_top_call=true) const
GENIE&#39;s GHEP MC event record.
Definition: GHepRecord.h:45
int fMethod
KNO -> PYTHIA transition method.
Definition: AGKY2019.h:56
Event finding and building.
const Algorithm * SubAlg(const RgKey &registry_key) const
Definition: Algorithm.cxx:345
double fWminTrWindow
min W in transition region (pure KNO < Wmin)
Definition: AGKY2019.h:57