9 #ifndef ThePEG_HepMCTraits_H 10 #define ThePEG_HepMCTraits_H 12 #include "HepMC/GenEvent.h" 42 template <
typename HepMCEventT,
typename HepMCParticleT,
43 typename HepMCVertexT,
typename HepMCPolarizationT,
44 typename HepMCPdfInfoT>
64 static EventT *
newEvent(
long evno,
double weight,
65 const map<string,double>& optionalWeights) {
66 EventT * e =
new EventT();
67 e->set_event_number(evno);
68 e->weights().push_back(weight);
69 for ( map<string,double>::const_iterator w = optionalWeights.begin();
70 w != optionalWeights.end(); ++w ) {
71 #ifdef HEPMC_HAS_NAMED_WEIGHTS 72 e->weights()[w->first] = w->second;
74 e->weights().push_back(w->second);
81 static void resetEvent(EventT * e,
long evno,
double weight,
82 const map<string,double>& optionalWeights) {
83 e->set_event_number(evno);
85 e->weights().push_back(weight);
86 for ( map<string,double>::const_iterator w = optionalWeights.begin();
87 w != optionalWeights.end(); ++w ) {
88 #ifdef HEPMC_HAS_NAMED_WEIGHTS 89 e->weights()[w->first] = w->second;
91 e->weights().push_back(w->second);
100 #ifdef HEPMC_HAS_UNITS 111 #ifndef HEPMC_HAS_UNITS 114 return HepMC::Units::default_momentum_unit() == HepMC::Units::GEV? GeV: MeV;
122 #ifndef HEPMC_HAS_UNITS 125 return HepMC::Units::default_length_unit() == HepMC::Units::MM?
126 millimeter: 10.0*millimeter;
135 #ifdef HEPMC_HAS_UNITS 136 return e.momentum_unit() == HepMC::Units::MEV? MeV: GeV;
147 #ifdef HEPMC_HAS_UNITS 148 return e.length_unit() == HepMC::Units::CM? centimeter: millimeter;
158 #ifdef HEPMC_HAS_UNITS 159 static void setUnits(EventT & e,
Energy momu,
Length lenu) {
160 e.use_units(momu == MeV? HepMC::Units::MEV: HepMC::Units::GEV,
161 lenu == centimeter? HepMC::Units::CM: HepMC::Units::MM);
172 double aS,
double aEM,
Energy unit) {
173 e.set_event_scale(sqrt(scale)/unit);
180 e.set_signal_process_vertex(v);
193 long id,
int status,
Energy unit) {
197 ParticleT * genp =
new ParticleT(p_scalar,
id, status);
198 genp->setGeneratedMass(p.
mass()/unit);
205 genp.set_polarization(PolarizationT(the, phi));
211 p.set_flow(indx, coline);
216 return new VertexT();
221 v.add_particle_in(p);
226 v.add_particle_out(p);
233 v.set_position(p_scaled);
238 e.set_beam_particles(p1,p2);
244 #ifdef HEPMC_HAS_PDF_INFO 245 static void setPdfInfo(EventT & e,
int id1,
int id2,
double x1,
double x2,
246 double scale,
double xf1,
double xf2) {
247 e.set_pdf_info(PdfInfoT(id1, id2, x1, x2, scale, xf1, xf2));
251 double,
double,
double) {}
255 #ifdef HEPMC_HAS_CROSS_SECTION 256 static void setCrossSection(EventT & ev,
double xs,
double xserr) {
257 HepMC::GenCrossSection x;
258 x.set_cross_section(xs, xserr);
259 ev.set_cross_section(x);
280 template <
typename HepMCEventT>
static void resetEvent(EventT *e, long evno, double weight, const map< string, double > &optionalWeights)
Reset event weight and number of a re-used GenEvent.
static Length defaultLengthUnit()
Return the length unit used in the installed version of HepMC.
static void setPosition(VertexT &v, const LorentzPoint &p, Length unit)
Set the position p for the vertex, v.
A 4-component Lorentz vector.
static VertexT * newVertex()
Create a new vertex.
static void setPdfInfo(EventT &, int, int, double, double, double, double, double)
Set the PDF info for the event.
HepMCVertexT VertexT
Typedef of the vertex class.
static ParticleT * newParticle(const Lorentz5Momentum &p, long id, int status, Energy unit)
Create a new particle object with momentum p, PDG number id and status code status.
static EventT * newEvent(long evno, double weight, const map< string, double > &optionalWeights)
Create an event object with number evno and weight.
static void addOutgoing(VertexT &v, ParticleT *p)
Add an outgoing particle, p, to the vertex, v.
static bool hasUnits()
Return true if this version of HepMC accept user-defined units.
static Energy defaultEnergyUnit()
Return the energy unit used in the installed version of HepMC.
HepMCPolarizationT PolarizationT
Typedef of the polarization class.
This is the main namespace within which all identifiers in ThePEG are declared.
HepMCParticleT ParticleT
Typedef of the particle class.
HepMCPdfInfoT PdfInfoT
Typedef of the PdfInfo class.
static Length lengthUnit(const EventT &e)
Return the length unit used by a given GenEvent object.
QTY< 0, 1, 0 >::Type Energy
Energy.
static void setCrossSection(EventT &, double, double)
Set the cross section info for the event.
static void addVertex(EventT &e, VertexT *v)
Set a vertex, v, for the event e.
static void addIncoming(VertexT &v, ParticleT *p)
Add an incoming particle, p, to the vertex, v.
QTY< 1, 0, 0 >::Type Length
Length.
Value mass() const
Mass/invariant length component.
HepMCTraitsBase is a convenient base class for specializing the HepMCTraits class to deal with differ...
static Energy momentumUnit(const EventT &e)
Return the momentum unit used by a given GenEvent object.
HepMCEventT EventT
Typedef of the event class.
The HepMCTraits class is used to deal with different flavours of HepMC in the HepMCConverter class...
static void setSignalProcessVertex(EventT &e, VertexT *v)
Set the primary vertex, v, for the event e.
static void setBeamParticles(EventT &e, ParticleT *p1, ParticleT *p2)
Set the beam particles for the event.
static void setPolarization(ParticleT &genp, double the, double phi)
Set the polarization directions, the and phi, for particle p.
static void setColourLine(ParticleT &p, int indx, int coline)
Set the colour line (with index indx) to coline for particle p.
static void setUnits(EventT &, Energy, Length)
Set the units to be used by the given GenEvent object.
static void setScaleAndAlphas(EventT &e, Energy2 scale, double aS, double aEM, Energy unit)
Set the scale, (aS) and (aEM) for the event e.