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