 |
Belle II Software
release-05-02-19
|
11 #include <generators/modules/trepsinput/TrepsInputModule.h>
14 #include <boost/filesystem.hpp>
34 setDescription(
"Input from TREPS generator (No-tag), Input from TREPS generator for ee->ee hadrons");
37 addParam(
"ParameterFile", m_parameterFile,
38 "parameter file for TREPS input", std::string(
"treps_par.dat"));
39 addParam(
"DifferentialCrossSectionFile", m_differentialCrossSectionFile,
40 "file name for differential cross section table input. If UseDiscreteAndSortedW is true, the file is used",
41 std::string(
"pipidcs.dat"));
42 addParam(
"WListTableFile", m_wListTableFile,
43 "file name for W-List table input. If UseDiscreteAndSortedW is false (default), the file is used", std::string(
"wlist_table.dat"));
44 addParam(
"UseDiscreteAndSortedW", m_useDiscreteAndSortedW,
45 "if true, use WListTable for discrete and sorted W. if false (default), use DifferentialCrossSection",
false);
47 addParam(
"MaximalQ2", m_maximalQ2,
48 "Maximal :math:`Q^2 = -q^2`, where q is the difference between the initial "
49 "and final electron or positron momenta. Negative means no cut.",
51 addParam(
"MaximalAbsCosTheta", m_maximalAbsCosTheta,
52 "Maximal :math:`|\\cos(\\theta)|`, where :math:`\\theta` is the final-state particle "
53 "polar angle.", 1.01);
54 addParam(
"ApplyCosThetaCutCharged", m_applyCosThetaCutCharged,
55 "Whether to apply cut on :math:`|cos(theta)|` for charged particles only.",
57 addParam(
"MinimalTransverseMomentum", m_minimalTransverseMomentum,
58 "Minimal transverse momentum of the final-state particles.", 0.0);
59 addParam(
"ApplyTransverseMomentumCutCharged",
60 m_applyTransverseMomentumCutCharged,
61 "Whether to apply cut on the minimal transverse momentum for "
62 "charged particles only.",
true);
81 B2INFO(
"Initialized the TREPS generator!");
83 B2FATAL(
"TrepsInputModule::event(): BeamParameters have changed within "
84 "a job, this is not supported for TREPS!");
116 electron.setMomentum(
m_generator.getElectronMomentum());
134 p.setPDG(part[i].part_prop.icode);
135 p.set4Vector(part[i].p);
136 p.setMass(part[i].part_prop.pmass);
138 p.setProductionVertex(vertex);
139 p.setValidVertex(
true);
147 p1.setProductionVertex(vertex);
148 p1.setValidVertex(
true);
155 p2.setProductionVertex(vertex);
156 p2.setValidVertex(
true);
171 B2FATAL(
"Cross Section Table is empty !!!");
176 auto it_upper =
m_generator.diffCrossSectionOfW.lower_bound(W);
177 auto it_lower = it_upper;
180 return (it_upper->second - it_lower->second) / (it_upper->first - it_lower->first) * (W - it_lower->first) + it_lower->second;
187 double crossSectionForMC = gRandom->Uniform(0.0,
m_generator.totalCrossSectionForMC);
189 auto it_upper =
m_generator.WOfCrossSectionForMC.lower_bound(crossSectionForMC);
190 auto it_lower = it_upper;
193 double diffCrossSectionAtUpper =
m_generator.diffCrossSectionOfW.at(it_upper->second);
194 double diffCrossSectionAtLower =
m_generator.diffCrossSectionOfW.at(it_lower->second);
195 double limit = (diffCrossSectionAtUpper > diffCrossSectionAtLower) ? diffCrossSectionAtUpper * 1.01 : diffCrossSectionAtLower *
199 double W = (crossSectionForMC - it_lower->first) / limit + it_lower->second ;
200 if (W <
m_generator.diffCrossSectionOfW.begin()->first or W >
m_generator.diffCrossSectionOfW.rbegin()->first)
201 B2FATAL(
"W has to be in [" <<
m_generator.diffCrossSectionOfW.begin()->first <<
", "
203 <<
"] !!! W = " << W <<
", crossSectionForMC = " << crossSectionForMC);
205 double trial = gRandom->Uniform(0.0, limit);
208 if (trial < crossSection)
235 p3 = nominalBeam.
getHER().Vect();
237 p3 = nominalBeam.
getLER().Vect();
248 B2INFO(
"Discrete W-list is used !!!");
void generateList(const std::string &name="", int options=c_setNothing)
Generates the MCParticle list and stores it in the StoreArray with the given name.
const TLorentzVector & getLER() const
Get 4vector of the low energy beam.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
const BeamParameters & getBeamParameters() const
Return reference to nominal beam parameters.
const TLorentzVector & getHER() const
Get 4vector of the high energy beam.
@ c_setDecayInfo
Set decay time and vertex.
This class contains the initial state for the given event.
double getMass() const
Get the invariant mass of the collision (= energy in CMS)
Abstract base class for different kinds of events.
void setPDG(int pdg)
Set PDG code of the particle.
@ c_Initial
bit 5: Particle is initial such as e+ or e- and not going to Geant4
GraphParticle & addParticle()
Add new particle to the graph.
void addStatus(unsigned short int bitmask)
Add bitmask to current status.
const TVector3 & getVertex() const
Get the position of the collision.
@ c_StableInGenerator
bit 1: Particle is stable, i.e., not decaying in the generator.
void setEnergy(float energy)
Set energy.
void initialize()
function to be executed on initialize()
void setMass(float mass)
Set particle mass.
void initg()
initialization of Pparametrization of pi+pi- partial waves
MCInitialParticles & generate()
Generate a new event.
void clear()
Reset particles and decay information to make the class reusable.
void setMomentum(const TVector3 &momentum)
Set particle momentum.
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
Class to represent Particle data in graph.
@ c_PrimaryParticle
bit 0: Particle is primary particle.