11 #include <generators/modules/phokharainput/PhokharaInputModule.h>
13 #include <framework/datastore/StoreArray.h>
14 #include <framework/utilities/FileSystem.h>
15 #include <framework/utilities/IOIntercept.h>
31 setDescription(
"Generates radiative return events with PHOKHARA.");
34 addParam(
"FinalState", m_finalState,
35 "Final state: mu+mu-(0, default), pi+pi-(1), 2pi0pi+pi-(2), 2pi+2pi-(3), ppbar(4), nnbar(5), K+K-(6), K0K0bar(7), pi+pi-pi0(8), lamb(->pi-p)lambbar(->pi+pbar)(9), eta pi+ pi- (10)",
37 addParam(
"ReplaceMuonsByVirtualPhoton", m_replaceMuonsByVirtualPhoton,
38 "Replace muons by a virtual photon (for FinalState == 0 only).",
40 addParam(
"SearchMax", m_nSearchMax,
"Number of events used to search for maximum of differential cross section", 100000);
41 addParam(
"Epsilon", m_epsilon,
"Soft/hard photon separator", 0.0001);
42 addParam(
"nMaxTrials", m_nMaxTrials,
"Maximum trials per event", 10000);
44 addParam(
"LO", m_LO,
"LO: 1ph(0, default), Born: 0ph(1), only Born: 0ph(-1)", 0);
45 addParam(
"NLO", m_NLO,
"NLO, for 1ph only: off(0, default), on(1)", 0);
46 addParam(
"QED", m_QED,
"ISR only(0, default), ISR+FSR(1), ISR+INT+FSR(2)", 0);
47 addParam(
"NLOIFI", m_NLOIFI,
"IFI, NLO only: off(0, default), on(1)", 0);
48 addParam(
"Alpha", m_alpha,
"Vacuum polarization switch: off (0), on (1,[by Fred Jegerlehner], default), on (2,[by Thomas Teubner])",
50 addParam(
"PionFF", m_pionff,
"Pion FF: KS PionFormFactor(0, default), GS old 1), GS new(2)", 0);
51 addParam(
"PionStructure", m_pionstructure,
52 "For pi+pi- only: f0+f0(600): K+K- model(0, default), no structure model(1), no f0+f0(600)(2), f0 KLOE(3)", 0);
53 addParam(
"KaonFF", m_kaonff,
54 "Kaon FF: KaonFormFactor constrained(0, default), KaonFormFactor unconstrained(1) KaonFormFactor old(2)", 0);
55 addParam(
"NarrowRes", m_narres,
"Only for m_finalState = 0,1,6,7: No narrow resonances (0, default), J/Psi (1) and Psi(2S) (2)", 0);
56 addParam(
"ProtonFF", m_protonff,
"ProtonFormFactor old(0), ProtonFormFactor new(1)", 1);
58 addParam(
"ScatteringAngleRangePhoton", m_ScatteringAngleRangePhoton,
59 "Min [0] and Max [1] value for the scattering angle of photons [deg], default (0, 180)", make_vector(0.0, 180.0));
60 addParam(
"ScatteringAngleRangeFinalStates", m_ScatteringAngleRangeFinalStates,
61 "Min [0] and Max [1] value for the scattering angle of pions(muons,nucleons,kaons) [deg], default (0, 180)", make_vector(0.0,
64 addParam(
"MinInvMassHadronsGamma", m_MinInvMassHadronsGamma,
"Minimal hadrons/muons-gamma invariant mass squared [GeV^2]", 0.0);
65 addParam(
"MinInvMassHadrons", m_MinInvMassHadrons,
"Minimal hadrons/muons invariant mass squared [GeV^2]", 0.2);
66 addParam(
"ForceMinInvMassHadronsCut", m_ForceMinInvMassHadronsCut,
67 "Force application of the MinInvMassHadrons cut "
68 "It is ignored by PHOKHARA with LO = 1, NLO = 1.",
70 addParam(
"MaxInvMassHadrons", m_MaxInvMassHadrons,
"Maximal hadrons/muons invariant mass squared [GeV^2]", 112.0);
71 addParam(
"MinEnergyGamma", m_MinEnergyGamma,
"Minimal photon energy/missing energy, must be greater than 0.0098 * CMS energy [GeV]",
74 addParam(
"ParameterFile", m_ParameterFile,
"File that contain particle properties",
75 FileSystem::findFile(
"/data/generators/phokhara/const_and_model_paramall9.1.dat"));
76 addParam(
"BeamEnergySpread", m_BeamEnergySpread,
77 "Simulate beam-energy spread (initializes PHOKHARA for every "
78 "event - very slow).",
false);
86 PhokharaInputModule::~PhokharaInputModule()
94 void PhokharaInputModule::initialize()
97 mcparticle.registerInDataStore();
99 if (m_replaceMuonsByVirtualPhoton) {
100 if (m_finalState != 0) {
101 B2FATAL(
"You requested to replace muons by a virtual photon, but the "
102 "final state is not mu+ mu-.");
105 B2FATAL(
"You requested to replace muons by a virtual photon. In this "
106 "mode, PHOKHARA works as an ISR generator. The parameter QED "
107 "should be set to 0 (ISR only). If FSR is taken into account "
108 "(QED = 1 or 2), the results will be incorrect.");
111 B2FATAL(
"You requested to replace muons by a virtual photon. In this "
112 "mode, PHOKHARA works as an ISR generator. The parameter NLOIFI "
113 "should be set to 0 (off). If simultaneous emission of initial "
114 "and final-state photons is taken into account (NLOIFI = 1), "
115 "the results will be incorrect.");
119 if (m_BeamEnergySpread) {
120 m_initial.setAllowedFlags(BeamParameters::c_smearVertex |
121 BeamParameters::c_smearBeam);
123 m_initial.initialize();
130 void PhokharaInputModule::event()
134 if (m_beamParams.hasChanged()) {
135 if (!m_initialized) {
136 initializeGenerator();
138 B2FATAL(
"PhokharaInputModule::event(): BeamParameters have changed within a job, this is not supported for PHOKHARA!");
152 if (m_BeamEnergySpread) {
156 "PHOKHARA", LogConfig::c_Debug, LogConfig::c_Debug, 100, 100);
157 initLogCapture.
start();
158 m_generator.setCMSEnergy(initial.
getMass());
159 m_generator.init(m_ParameterFile);
162 m_generator.generateEvent(m_mcGraph, vertex, boost);
163 m_mcGraph.generateList(
"", MCParticleGraph::c_setDecayInfo | MCParticleGraph::c_checkCyclic);
171 void PhokharaInputModule::terminate()
177 void PhokharaInputModule::initializeGenerator()
181 m_cmsEnergy = nominal.getMass();
183 m_generator.setCMSEnergy(m_cmsEnergy);
185 m_generator.setNSearchMax(m_nSearchMax);
186 m_generator.setFinalState(m_finalState);
187 m_generator.setReplaceMuonsByVirtualPhoton(m_replaceMuonsByVirtualPhoton);
188 m_generator.setNMaxTrials(m_nMaxTrials);
189 m_generator.setEpsilon(m_epsilon);
190 m_generator.setLO(m_LO);
191 m_generator.setNLO(m_NLO);
192 m_generator.setQED(m_QED);
193 m_generator.setNLOIFI(m_NLOIFI);
194 m_generator.setAlpha(m_alpha);
195 m_generator.setPionFF(m_pionff);
196 m_generator.setKaonFF(m_kaonff);
197 m_generator.setPionStructure(m_pionstructure);
198 m_generator.setNarrowRes(m_narres);
199 m_generator.setProtonFF(m_protonff);
201 m_generator.setMinInvMassHadronsGamma(m_MinInvMassHadronsGamma);
202 m_generator.setm_MinInvMassHadrons(m_MinInvMassHadrons);
203 m_generator.setForceMinInvMassHadronsCut(m_ForceMinInvMassHadronsCut);
204 m_generator.setm_MaxInvMassHadrons(m_MaxInvMassHadrons);
205 m_generator.setMinEnergyGamma(m_MinEnergyGamma);
206 m_generator.setScatteringAngleRangePhoton(vectorToPair(m_ScatteringAngleRangePhoton,
"ScatteringAngleRangePhoton"));
207 m_generator.setScatteringAngleRangeFinalStates(vectorToPair(m_ScatteringAngleRangeFinalStates,
"ScatteringAngleRangeFinalStates"));
209 m_generator.init(m_ParameterFile);
211 m_initialized =
true;