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) {
103 void Teegg::setDefaultSettings()
105 m_cmsEnergy = 5.28695 * 2.0 * Unit::GeV;
107 m_pi = 3.1415926535897932384626433832795029;
108 m_conversionFactor = 0.389379660e6;
109 m_alphaQED0 = 1.0 / 137.0359895;
110 m_massElectron = 0.51099906 * Unit::MeV;
114 m_sCONFIG =
"EGAMMA";
124 m_PEGMIN = m_pi / 4.00;
127 m_PHVETO = m_pi / 4.00;
147 void Teegg::initExtraInfo()
159 void Teegg::generateEvent(
MCParticleGraph& mcGraph, ROOT::Math::XYZVector vertex, ROOT::Math::LorentzRotation boost)
163 teeggm_(&mode, m_xpar, m_npar);
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;
178 m_weight = teeggextra_.tweight;
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);
200 teeggm_(&mode, m_xpar, m_npar);
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);
214 void Teegg::applySettings()
219 m_npar[0] = m_UNWGHT;
221 if (m_sRADCOR ==
"NONE") m_RADCOR = 3;
222 else if (m_sRADCOR ==
"SOFT") m_RADCOR = 2;
223 else if (m_sRADCOR ==
"HARD") m_RADCOR = 1;
225 m_npar[1] = m_RADCOR;
227 if (m_sCONFIG ==
"EGAMMA") m_CONFIG = 11;
228 else if (m_sCONFIG ==
"ETRON") m_CONFIG = 12;
229 else if (m_sCONFIG ==
"GAMMA") m_CONFIG = 13;
230 else if (m_sCONFIG ==
"GAMMAE") m_CONFIG = 14;
232 m_npar[2] = m_CONFIG;
234 if (m_sMATRIX ==
"BK") m_MATRIX = 21;
235 else if (m_sMATRIX ==
"BKM2") m_MATRIX = 22;
236 else if (m_sMATRIX ==
"TCHAN") m_MATRIX = 23;
237 else if (m_sMATRIX ==
"EPA") m_MATRIX = 24;
239 m_npar[3] = m_MATRIX;
241 if (m_sMTRXGG ==
"EPADC") m_MTRXGG = 31;
242 else if (m_sMTRXGG ==
"BEEGG") m_MTRXGG = 32;
243 else if (m_sMTRXGG ==
"MEEGG") m_MTRXGG = 33;
244 else if (m_sMTRXGG ==
"HEEGG") m_MTRXGG = 34;
246 m_npar[4] = m_MTRXGG;
248 if (m_sVACPOL ==
"OFF") m_VACPOL = 41;
249 else if (m_sVACPOL ==
"HLMNT") m_VACPOL = 42;
250 else if (m_sVACPOL ==
"NSK") m_VACPOL = 43;
252 m_npar[5] = m_VACPOL;
257 double toRad = TMath::DegToRad();
258 m_xpar[0] = m_TEVETO * toRad;
259 m_xpar[1] = m_TEMIN * toRad;
260 m_xpar[2] = m_TGMIN * toRad;
261 m_xpar[3] = m_TGVETO * toRad;
264 m_xpar[6] = m_PEGMIN * toRad;
265 m_xpar[7] = m_EEVETO;
266 m_xpar[8] = m_EGVETO;
267 m_xpar[9] = m_PHVETO * toRad;
268 m_xpar[10] = m_CUTOFF;
270 m_xpar[12] = m_FRAPHI;
271 m_xpar[13] = m_EPSPHI;
272 m_xpar[14] = m_WGHT1M;
273 m_xpar[15] = m_WGHTMX;
274 m_xpar[30] = m_cmsEnergy;
277 teeggm_(&mode, m_xpar, m_npar);
281 void Teegg::storeParticle(
MCParticleGraph& mcGraph,
const double* mom,
int pdg, ROOT::Math::XYZVector vertex,
282 ROOT::Math::LorentzRotation boost,
283 bool isVirtual,
bool isInitial)
288 part.addStatus(MCParticle::c_IsVirtual);
289 }
else if (isInitial) {
290 part.addStatus(MCParticle::c_Initial);
294 part.addStatus(MCParticle::c_PrimaryParticle);
297 part.addStatus(MCParticle::c_StableInGenerator);
301 part.addStatus(MCParticleGraph::GraphParticle::c_IsISRPhoton);
302 part.addStatus(MCParticleGraph::GraphParticle::c_IsFSRPhoton);
306 part.setFirstDaughter(0);
307 part.setLastDaughter(0);
308 part.setMomentum(ROOT::Math::XYZVector(mom[0], mom[1], mom[2]));
309 part.setMass(TDatabasePDG::Instance()->GetParticle(pdg)->Mass());
310 part.setEnergy(mom[3]);
313 ROOT::Math::PxPyPzEVector p4 = part.get4Vector();
314 p4.SetPz(-1.0 * p4.Pz());
320 ROOT::Math::XYZVector v3 = part.getProductionVertex();
322 part.setProductionVertex(v3);
323 part.setValidVertex(
true);
Class to represent Particle data in graph.
Class to build, validate and sort a particle decay chain.
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.
GraphParticle & addParticle()
Add new particle to the graph.
Abstract base class for different kinds of events.