9#include <generators/modules/aafhinput/AafhInputModule.h>
10#include <generators/utilities/scaleParticleEnergies.h>
11#include <framework/logging/Logger.h>
13#include <Math/Vector3D.h>
29 setDescription(
"AAFH Generator to generate non-radiative two-photon events like e+e- -> e+e-e+e-");
33 "decay mode to generate."
34 " 1: e+e- -> mu+mu-L+L-,"
35 " 2: e+e- -> mu+mu-mu+mu-,"
36 " 3: e+e- -> e+e-mu+mu-,"
37 " 4: e+e- -> e+e-L+L-,"
38 " 5: e+e- -> e+e-e+e-. "
39 "L is a user defined particle (default: tau)",
43 " 1: apply once for the final event weight,"
44 " 2: apply for the subgenerator weight and for the final weight",
47 "Maximum tries for event generation (ITOT)",
50 "maximum expected final weight for rejection scheme (ESFT)",
53 "maximum expected subgenerator weight for rejection scheme (ESWE)",
56 "relative weights of the subgenerators: this must be a list of four "
57 "or eight values (first four are interpreted as WAP, rest as WBP) "
58 "which specify the relativ weights for each of the "
59 "four sub generators. The orginial code states that it the program "
60 "run most efficient when the maximum weight is equal in all sub "
61 "generators and that if one wants to be sure that all peaks in the "
62 "differential cross section are accounted the chance to enter each "
63 "sub generator should be equal. Values which try to fullfill both "
64 "conditions are printed at after generation when the output level "
68 "suppression limits for the matrix element calculations. This must "
69 "be a list of four values, [FACE, FACM, FACL, PROC]. For FACE, FACM "
70 "and FACL these specify the size of the propagator for which the "
71 "corresponding spin configurations will be omitted. A value of 1e3 "
72 "will calculate the dominat part correctly and a very large value "
73 "compared to the mass (i.e. 1e50) will calculate it exactly. PROC "
74 "specifies that feynman diagrams which contribute less than 1/PROC "
75 "of the biggest contribution are omitted. For exact calculation it "
76 "should be very big but 1e9 should be considerably faster without "
77 "affecting the result very much",
80 "minimum invariant mass of generated fermion pair. Will "
81 "automatically be set to at least 2 times the generated particle "
85 "name of the generated particle for mode 1 and 4",
105 B2FATAL(
"AafhInputModule::event(): BeamParameters have changed within a job, this is not supported for AAFH!");
113 ROOT::Math::LorentzRotation boost = initial.
getCMSToLab();
116 ROOT::Math::XYZVector vertex = initial.
getVertex();
127 for (
size_t i = 0; i < mpg.
size(); ++i) {
128 mpg[i].set4Vector(boost * mpg[i].get4Vector());
130 ROOT::Math::XYZVector v3 = mpg[i].getProductionVertex();
132 mpg[i].setProductionVertex(v3);
133 mpg[i].setValidVertex(
true);
148 const double beamEnergy = nominal.getMass() / 2.;
151 if (m_mode < 1 || m_mode > 5) {
152 B2ERROR(
"AafhInputModule::initializeGenerator: 'mode' must be a value between 1 and 5");
154 if (m_rejection < 1 || m_rejection > 2) {
155 B2ERROR(
"AafhInputModule::initializeGenerator: 'rejection' must be a value between 1 and 2");
double getMaxSubGeneratorWeight() const
Get the maximum expected final weight for the rejection method.
ERejection
Rejection mode.
void setMinimumMass(double minMass)
Set the minimum invariant mass for the generated event.
void finish()
calculate total cross section
void generateEvent(MCParticleGraph &mpg)
generate one event and add it to the graph in CMS
void initialize(double beamEnergy, EMode mode, ERejection rejection)
initialize the generator
void setMaxWeights(double subgeneratorWeight, double finalWeight)
Set the maximum expected weights for the rejection method.
std::string getParticle() const
Get the particle type for modes c_MuonParticle and c_ElectronParticle.
void setMaxTries(int tries)
Set the maximum number of tries to generate an event.
std::vector< double > getSuppressionLimits() const
Get suppression limits.
void setSupressionLimits(std::vector< double > limits)
Set the suppression limits when calculation the matrix elements.
void setParticle(const std::string &particle)
Set the particle type for modes c_MuonParticle and c_ElectronParticle.
int getMaxTries() const
Get the maximum number of tries to generate an event.
void setGeneratorWeights(const std::vector< double > &weights)
Set the relative weights for the sub generators.
double getMaxFinalWeight() const
Get the maximum expected subgenerator weight for the rejection method.
std::vector< double > getGeneratorWeights() const
Get the relative weights for the sub generators.
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
The base module for generator modules, which sets the generator information as EventExtraInfo.
const BeamParameters & getBeamParameters() const
Return reference to nominal beam parameters.
This class contains the initial state for the given event.
const ROOT::Math::LorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
const ROOT::Math::XYZVector & getVertex() const
Get the position of the collision.
double getMass() const
Get the invariant mass of the collision (= energy in CMS)
Class to build, validate and sort a particle decay chain.
@ c_setDecayInfo
Set decay time and vertex.
size_t size() const
Return the number of particles in the graph.
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
void setDescription(const std::string &description)
Sets the description of the module.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
void initialize()
function to be executed on initialize()
void scaleParticleEnergies(MCParticleGraph &mpg, double EcmsTarget)
Scale momenta of the particles by a constant factor such that total energy is changed to EcmsTarget.
MCInitialParticles & generate()
Generate a new event.
Abstract base class for different kinds of events.