9#include <generators/teegg/Teegg.h>
10#include <framework/gearbox/Unit.h>
11#include <framework/logging/Logger.h>
12#include <framework/dataobjects/EventMetaData.h>
13#include <framework/dataobjects/EventExtraInfo.h>
15#include <framework/datastore/StoreObjPtr.h>
17#include <TDatabasePDG.h>
18#include <Math/Vector4D.h>
57 void teegg_rndmarr_(
double* drvec,
const int* lengt)
59 for (
int i = 0; i < *lengt; ++i) {
60 double rr = gRandom->Rndm();
65 double teegg_rndm_(
int*)
67 double r = gRandom->Rndm();
72 void teeggm_(
int* mode,
double* xpar,
int* npar);
75 void teegg_warning_generic_(
const double* weight,
const double* max)
77 B2WARNING(
"TEEGG: Maximum weight " << *max <<
" to small, increase fmax to at least " << *weight);
81 void report_() { B2FATAL(
"Teegg: report_() is not implemented"); }
83 void golife_() { B2FATAL(
"Teegg: golife_() is not implemented"); }
85 void golint_() { B2FATAL(
"Teegg: golint_() is not implemented"); }
90 for (
int i = 0; i < 100; ++i) {
107 m_pi = 3.1415926535897932384626433832795029;
166 storeParticle(mcGraph, momset_.tq2, 11, vertex, boost,
false,
false);
167 storeParticle(mcGraph, momset_.tp2, -11, vertex, boost,
false,
false);
170 for (
int iPhot = 0; iPhot < momset_.tnphot; ++iPhot) {
171 double photMom[4] = {momset_.tphot[0][iPhot], momset_.tphot[1][iPhot], momset_.tphot[2][iPhot], momset_.tphot[3][iPhot]};
172 storeParticle(mcGraph, photMom, 22, vertex, boost,
false,
false);
176 m_t = teeggextra_.tt;
177 m_w2 = teeggextra_.tw2;
179 m_vp2 = teeggextra_.tvp2;
183 eventMetaDataPtr->setGeneratedWeight(
m_weight);
187 if (not eventExtraInfo.isValid())
188 eventExtraInfo.create();
189 if (eventExtraInfo->hasExtraInfo(
"GeneratorVP2")) {
190 B2WARNING(
"EventExtraInfo with given name is already set! I won't set it again!");
192 eventExtraInfo->addExtraInfo(
"GeneratorVP2",
m_vp2);
202 B2RESULT(
"Cross-section (nb) = " << teeggresults_.rescross / 1.e3 <<
" +/- " << teeggresults_.rescrosserr / 1.e3 <<
"");
203 B2RESULT(
"Events (unweighted) = " << teeggresults_.resngen);
204 B2RESULT(
"Trials = " << teeggresults_.resntrials);
205 B2RESULT(
"Efficiency = " << 100.*teeggresults_.reseff <<
" %");
206 B2RESULT(
"Average Q2 = " << teeggresults_.avgq2);
257 double toRad = TMath::DegToRad();
282 ROOT::Math::LorentzRotation boost,
283 bool isVirtual,
bool isInitial)
289 }
else if (isInitial) {
308 part.
setMomentum(ROOT::Math::XYZVector(mom[0], mom[1], mom[2]));
309 part.
setMass(TDatabasePDG::Instance()->GetParticle(pdg)->Mass());
313 ROOT::Math::PxPyPzEVector p4 = part.
get4Vector();
314 p4.SetPz(-1.0 * p4.Pz());
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
Class to represent Particle data in graph.
void setFirstDaughter(int daughter)
Set the 1-based index of the first daughter, 0 means no daughters.
void setLastDaughter(int daughter)
Set the 1-based index of the last daughter, 0 means no daughters.
Class to build, validate and sort a particle decay chain.
@ c_IsFSRPhoton
bit 7: Particle is from finial state radiation
@ 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_IsVirtual
bit 4: Particle is virtual and not going to Geant4.
@ c_StableInGenerator
bit 1: Particle is stable, i.e., not decaying in the generator.
@ c_IsISRPhoton
bit 6: Particle is from initial state radiation
void setMass(float mass)
Set particle mass.
void addStatus(unsigned short int bitmask)
Add bitmask to current status.
void setEnergy(float energy)
Set energy.
ROOT::Math::XYZVector getProductionVertex() const
Return production vertex position.
void setValidVertex(bool valid)
Set indication wether vertex and time information is valid or just default.
void setProductionVertex(const ROOT::Math::XYZVector &vertex)
Set production vertex position.
ROOT::Math::PxPyPzEVector get4Vector() const
Return 4Vector of particle.
void setPDG(int pdg)
Set PDG code of the particle.
void set4Vector(const ROOT::Math::PxPyPzEVector &p4)
Sets the 4Vector of particle.
void setMomentum(const ROOT::Math::XYZVector &momentum)
Set particle momentum.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Type-safe access to single objects in the data store.
int m_MTRXGG
specifies which eegg matrix element (EPADC BEEGG or MEEGG)
void init()
Initialize generator.
void generateEvent(MCParticleGraph &mcGraph, ROOT::Math::XYZVector vertex, ROOT::Math::LorentzRotation boost)
Generates one single event.
double m_EGVETO
minimum energy to veto(etron/gamma config with hard rad corr)
double m_vp2
vacuum polarization squared (multiply with this to correcty for VP)
double m_alphaQED0
QED coupling constant at Q=0.
double m_TEVETO
maximum theta of e+ in final state (in radians)
int m_npar[100]
Integer parameters for Teegg.
double m_conversionFactor
Conversion factor for hbarc to nb.
double m_EEVETO
minimum energy to veto(gamma config with hard rad corr)
void storeParticle(MCParticleGraph &mcGraph, const double *mom, int pdg, ROOT::Math::XYZVector vertex, ROOT::Math::LorentzRotation boost, bool isVirtual=false, bool isInitial=false)
Store a single generated particle into the MonteCarlo graph.
void setDefaultSettings()
Sets the default settings for the TEEGG Fortran generator.
double m_cmsEnergy
CMS Energy = 2*Ebeam [GeV].
double m_WGHTMX
maximum weight for the trial events
int m_CONFIG
specifies the event configuration (EGAMMA GAMMA or ETRON)
double m_EGMIN
minimum energy of the gamma (egamma & gamma configurations)
int m_UNWGHT
logical variable.
std::string m_sMATRIX
specifies which eeg matrix element (BK BKM2 TCHAN or EPA)
void term()
Terminates the generator.
double m_weight
weight per event
int m_MATRIX
specifies which eeg matrix element (BK BKM2 TCHAN or EPA)
double m_WGHT1M
maximum weight for generation of QP0, cos(theta QP)
double m_PHVETO
minimum phi sep to veto(etron/gamma config with hard rad corr
std::string m_sCONFIG
specifies the event configuration (EGAMMA GAMMA or ETRON)
int m_VACPOL
vacuum polarization: off, nsk (Novosibirsk) or hlmnt (Teubner).
std::string m_sMTRXGG
specifies which eegg matrix element (EPADC BEEGG or MEEGG)
double m_xpar[100]
Double parameters for Teegg.
int m_RADCOR
specifies radiative correction (NONE SOFT or HARD)
double m_TGVETO
maximum angle between the gamma and -z axis(etron conf.
std::string m_sRADCOR
specifies radiative correction (NONE SOFT or HARD)
double m_massElectron
muon mass.
double m_EEMIN
minimum energy of the e- (egamma & etron configurations)
double m_CUTOFF
cutoff energy for radiative corrections (in CM frame)
double m_TGMIN
minimum angle between the gamma and -z axis
std::string m_sVACPOL
vacuum polarization: off, nsk (Novosibirsk) or hlmnt (Teubner).
double m_TEMIN
minimum angle between the e- and -z axis (egamma conf.
void initExtraInfo()
Initializes the extra info.
double m_FRAPHI
fraction of time phi_ks is generated with peak(hard rad corr)
double m_PEGMIN
minimum phi sep of e-gamma (egamma config with hard rad corr)
void applySettings()
Apply the settings to the internal Fortran generator.
static const double MeV
[megaelectronvolt]
static const double GeV
Standard of [energy, momentum, mass].
GraphParticle & addParticle()
Add new particle to the graph.
Abstract base class for different kinds of events.