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 <analysis/dataobjects/EventExtraInfo.h>
15 #include <framework/datastore/StoreObjPtr.h>
17 #include <TDatabasePDG.h>
18 #include <TLorentzVector.h>
56 void teegg_rndmarr_(
double* drvec,
int* lengt)
58 for (
int i = 0; i < *lengt; ++i) {
59 double rr = gRandom->Rndm();
64 double teegg_rndm_(
int*)
66 double r = gRandom->Rndm();
71 void teeggm_(
int* mode,
double* xpar,
int* npar);
74 void teegg_warning_generic_(
double* weight,
double* max)
76 B2WARNING(
"TEEGG: Maximum weight " << *max <<
" to small, increase fmax to at least " << *weight);
80 void report_() { B2FATAL(
"Teegg: report_() is not implemented"); }
82 void golife_() { B2FATAL(
"Teegg: golife_() is not implemented"); }
84 void golint_() { B2FATAL(
"Teegg: golint_() is not implemented"); }
89 for (
int i = 0; i < 100; ++i) {
102 void Teegg::setDefaultSettings()
104 m_cmsEnergy = 5.28695 * 2.0 * Unit::GeV;
106 m_pi = 3.1415926535897932384626433832795029;
107 m_conversionFactor = 0.389379660e6;
108 m_alphaQED0 = 1.0 / 137.0359895;
109 m_massElectron = 0.51099906 * Unit::MeV;
113 m_sCONFIG =
"EGAMMA";
123 m_PEGMIN = m_pi / 4.00;
126 m_PHVETO = m_pi / 4.00;
146 void Teegg::initExtraInfo()
158 void Teegg::generateEvent(
MCParticleGraph& mcGraph, TVector3 vertex, TLorentzRotation boost)
162 teeggm_(&mode, m_xpar, m_npar);
165 storeParticle(mcGraph, momset_.tq2, 11, vertex, boost,
false,
false);
166 storeParticle(mcGraph, momset_.tp2, -11, vertex, boost,
false,
false);
169 for (
int iPhot = 0; iPhot < momset_.tnphot; ++iPhot) {
170 double photMom[4] = {momset_.tphot[0][iPhot], momset_.tphot[1][iPhot], momset_.tphot[2][iPhot], momset_.tphot[3][iPhot]};
171 storeParticle(mcGraph, photMom, 22, vertex, boost,
false,
false);
175 m_t = teeggextra_.tt;
176 m_w2 = teeggextra_.tw2;
177 m_weight = teeggextra_.tweight;
178 m_vp2 = teeggextra_.tvp2;
182 eventMetaDataPtr->setGeneratedWeight(m_weight);
186 if (not eventExtraInfo.isValid())
187 eventExtraInfo.create();
188 if (eventExtraInfo->hasExtraInfo(
"GeneratorVP2")) {
189 B2WARNING(
"EventExtraInfo with given name is already set! I won't set it again!");
191 eventExtraInfo->addExtraInfo(
"GeneratorVP2", m_vp2);
199 teeggm_(&mode, m_xpar, m_npar);
201 B2RESULT(
"Cross-section (nb) = " << teeggresults_.rescross / 1.e3 <<
" +/- " << teeggresults_.rescrosserr / 1.e3 <<
"");
202 B2RESULT(
"Events (unweighted) = " << teeggresults_.resngen);
203 B2RESULT(
"Trials = " << teeggresults_.resntrials);
204 B2RESULT(
"Efficiency = " << 100.*teeggresults_.reseff <<
" %");
205 B2RESULT(
"Average Q2 = " << teeggresults_.avgq2);
213 void Teegg::applySettings()
218 m_npar[0] = m_UNWGHT;
220 if (m_sRADCOR ==
"NONE") m_RADCOR = 3;
221 else if (m_sRADCOR ==
"SOFT") m_RADCOR = 2;
222 else if (m_sRADCOR ==
"HARD") m_RADCOR = 1;
224 m_npar[1] = m_RADCOR;
226 if (m_sCONFIG ==
"EGAMMA") m_CONFIG = 11;
227 else if (m_sCONFIG ==
"ETRON") m_CONFIG = 12;
228 else if (m_sCONFIG ==
"GAMMA") m_CONFIG = 13;
229 else if (m_sCONFIG ==
"GAMMAE") m_CONFIG = 14;
231 m_npar[2] = m_CONFIG;
233 if (m_sMATRIX ==
"BK") m_MATRIX = 21;
234 else if (m_sMATRIX ==
"BKM2") m_MATRIX = 22;
235 else if (m_sMATRIX ==
"TCHAN") m_MATRIX = 23;
236 else if (m_sMATRIX ==
"EPA") m_MATRIX = 24;
238 m_npar[3] = m_MATRIX;
240 if (m_sMTRXGG ==
"EPADC") m_MTRXGG = 31;
241 else if (m_sMTRXGG ==
"BEEGG") m_MTRXGG = 32;
242 else if (m_sMTRXGG ==
"MEEGG") m_MTRXGG = 33;
243 else if (m_sMTRXGG ==
"HEEGG") m_MTRXGG = 34;
245 m_npar[4] = m_MTRXGG;
247 if (m_sVACPOL ==
"OFF") m_VACPOL = 41;
248 else if (m_sVACPOL ==
"HLMNT") m_VACPOL = 42;
249 else if (m_sVACPOL ==
"NSK") m_VACPOL = 43;
251 m_npar[5] = m_VACPOL;
256 double toRad = TMath::DegToRad();
257 m_xpar[0] = m_TEVETO * toRad;
258 m_xpar[1] = m_TEMIN * toRad;
259 m_xpar[2] = m_TGMIN * toRad;
260 m_xpar[3] = m_TGVETO * toRad;
263 m_xpar[6] = m_PEGMIN * toRad;
264 m_xpar[7] = m_EEVETO;
265 m_xpar[8] = m_EGVETO;
266 m_xpar[9] = m_PHVETO * toRad;
267 m_xpar[10] = m_CUTOFF;
269 m_xpar[12] = m_FRAPHI;
270 m_xpar[13] = m_EPSPHI;
271 m_xpar[14] = m_WGHT1M;
272 m_xpar[15] = m_WGHTMX;
273 m_xpar[30] = m_cmsEnergy;
276 teeggm_(&mode, m_xpar, m_npar);
280 void Teegg::storeParticle(
MCParticleGraph& mcGraph,
const double* mom,
int pdg, TVector3 vertex, TLorentzRotation boost,
281 bool isVirtual,
bool isInitial)
286 part.addStatus(MCParticle::c_IsVirtual);
287 }
else if (isInitial) {
288 part.addStatus(MCParticle::c_Initial);
292 part.addStatus(MCParticle::c_PrimaryParticle);
295 part.addStatus(MCParticle::c_StableInGenerator);
299 part.addStatus(MCParticleGraph::GraphParticle::c_IsISRPhoton);
300 part.addStatus(MCParticleGraph::GraphParticle::c_IsFSRPhoton);
304 part.setFirstDaughter(0);
305 part.setLastDaughter(0);
306 part.setMomentum(TVector3(mom[0], mom[1], mom[2]));
307 part.setMass(TDatabasePDG::Instance()->GetParticle(pdg)->Mass());
308 part.setEnergy(mom[3]);
311 TLorentzVector p4 = part.get4Vector();
312 p4.SetPz(-1.0 * p4.Pz());
318 TVector3 v3 = part.getProductionVertex();
320 part.setProductionVertex(v3);
321 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.