Belle II Software  release-05-02-19
TeeggInputModule.cc
1 /************************************************************************
2 * BASF2 (Belle Analysis Framework 2) *
3 * Copyright(C) 2015 Belle II Collaboration *
4 * *
5 * Author: The Belle II Collaboration *
6 * Contributors: Torben Ferber *
7 * *
8 * This software is provided "as is" without any warranty. *
9 **************************************************************************/
10 
11 #include <generators/modules/teegginput/TeeggInputModule.h>
12 
13 #include <framework/datastore/StoreArray.h>
14 
15 using namespace std;
16 using namespace Belle2;
17 
18 //-----------------------------------------------------------------
19 // Register the Module
20 //-----------------------------------------------------------------
21 REG_MODULE(TeeggInput)
22 
23 //-----------------------------------------------------------------
24 // Implementation
25 //-----------------------------------------------------------------
26 
27 TeeggInputModule::TeeggInputModule() : Module(), m_initial(BeamParameters::c_smearVertex)
28 {
29  //Set module properties
30  setDescription("Generates events with TEEGG.");
31 
32  //Parameter definition
33  addParam("VACPOL", m_sVACPOL, "Vacuum polarization: off, nsk (Novosibirsk) or hlmnt (Teubner et al., default)",
34  std::string("hlmnt"));
35  addParam("CMSEnergy", m_cmsEnergy, "CMS energy [GeV] (default: take from xml)", 0.0);
36  addParam("TEVETO", m_TEVETO, "Maximum theta of e+ in final state (in deg)", 0.1);
37  addParam("TEMIN", m_TEMIN, "Minimum angle between the e- and -z axis (EGAMMA conf. only) (in deg)", 20.0);
38  addParam("TGMIN", m_TGMIN, "Minimum angle between the gamma and -z axis (in deg)", 20.0);
39  addParam("TGVETO", m_TGVETO, "Maximum angle between the gamma and -z axis(ETRON conf. only) (in deg)", 0.05);
40  addParam("EEMIN", m_EEMIN, "Minimum energy of the e- (EGAMMA and ETRON conf.) (in GeV)", 2.0);
41  addParam("EGMIN", m_EGMIN, "Minimum energy of the gamma (EGAMMA and GAMMA conf.) (in GeV)", 2.0);
42  addParam("PEGMIN", m_PEGMIN, "Minimum phi sep of e-gamma (EGAMMA config with hard rad. corr.) (in deg)", 0.0);
43  addParam("EEVETO", m_EEVETO, "Minimum energy to veto (GAMMA config with hard rad. corr.) (in GeV)", 0.0);
44  addParam("EGVETO", m_EGVETO, "Minimum energy to veto (ETRON/GAMMA config with hard rad. corr.) (in GeV)", 0.0);
45  addParam("PHVETO", m_PHVETO, "Minimum phi sep to veto (ETRON/GAMMA config with hard rad. corr. (in deg)", 0.0);
46  addParam("CUTOFF", m_CUTOFF, "Cutoff energy for radiative corrections (in CM frame) (in GeV)", 0.250);
47  addParam("EPS", m_EPS, "Param. epsilon_s (smaller val. increases sampling of k_s^pbc)", 0.01);
48  addParam("FRAPHI", m_FRAPHI, "Fraction of time phi_ks is generated with peak(hard rad corr)", 0.0);
49  addParam("EPSPHI", m_EPSPHI, "Param. epsilon_phi ('cutoff' of the phi_ks peak)", 1.0e-4);
50  addParam("WGHT1M", m_WGHT1M, "Maximum weight for generation of QP0, cos(theta QP)", 1.001);
51  addParam("WGHTMX", m_WGHTMX, "Maximum weight for the trial events", 1.000);
52  addParam("RADCOR", m_sRADCOR, "Specifies radiative correction (NONE, SOFT or HARD)", std::string("NONE"));
53  addParam("CONFIG", m_sCONFIG, "Specifies the event configuration (EGAMMA, GAMMA, GAMMAE or ETRON)", std::string("EGAMMA"));
54  addParam("MATRIX", m_sMATRIX, "Specifies which eeg matrix element (BK, BKM2, TCHAN or EPA)", std::string("BKM2"));
55  addParam("MTRXGG", m_sMTRXGG, "Specifies which eegg matrix element (EPADC, BEEGG or MEEGG)", std::string("EPADC"));
56  addParam("UNWEIGHTED", m_UNWGHT, "If true then generate unweighted events", 1);
57 }
58 
59 TeeggInputModule::~TeeggInputModule()
60 {
61 
62 }
63 
64 
65 void TeeggInputModule::initialize()
66 {
67  //Initialize MCParticle collection.
68  StoreArray<MCParticle> mcparticle;
69  mcparticle.registerInDataStore();
70 
71  //Initialize initial particle for beam parameters.
72  m_initial.initialize();
73 
74  // Initialize ExtraInfo (holds vaccum polarization corrections)
75  m_generator.initExtraInfo();
76 
77 }
78 
79 
80 void TeeggInputModule::event()
81 {
82 
83  // Check if the BeamParameters have changed (if they do, abort the job! otherwise cross section calculation will be a nightmare.)
84  if (m_beamParams.hasChanged()) {
85  if (!m_initialized) {
86  initializeGenerator();
87  } else {
88  B2FATAL("TeeggInputModule::event(): BeamParameters have changed within a job, this is not supported for TEEGG!");
89  }
90  }
91 
92  m_mcGraph.clear();
93 
94  // initial particle from beam parameters
95  const MCInitialParticles& initial = m_initial.generate();
96 
97  // true boost
98  TLorentzRotation boost = initial.getCMSToLab();
99 
100  // vertex
101  TVector3 vertex = initial.getVertex();
102 
103  m_generator.generateEvent(m_mcGraph, vertex, boost);
104  m_mcGraph.generateList("", MCParticleGraph::c_setDecayInfo | MCParticleGraph::c_checkCyclic);
105 }
106 
107 
108 void TeeggInputModule::terminate()
109 {
110  m_generator.term();
111 }
112 
113 void TeeggInputModule::initializeGenerator()
114 {
115  const BeamParameters& nominal = m_initial.getBeamParameters();
116  m_cmsEnergy = nominal.getMass();
117 
118  m_generator.setCMSEnergy(m_cmsEnergy);
119  m_generator.setVACPOL(m_sVACPOL);
120  m_generator.setTEVETO(m_TEVETO);
121  m_generator.setTEMIN(m_TEMIN);
122  m_generator.setTGMIN(m_TGMIN);
123  m_generator.setTGVETO(m_TGVETO);
124  m_generator.setEEMIN(m_EEMIN);
125  m_generator.setEGMIN(m_EGMIN);
126  m_generator.setPEGMIN(m_PEGMIN);
127  m_generator.setEEVETO(m_EEVETO);
128  m_generator.setEGVETO(m_EGVETO);
129  m_generator.setPHVETO(m_PHVETO);
130  m_generator.setCUTOFF(m_CUTOFF);
131  m_generator.setEPS(m_EPS);
132  m_generator.setFRAPHI(m_FRAPHI);
133  m_generator.setEPSPHI(m_EPSPHI);
134  m_generator.setWGHT1M(m_WGHT1M);
135  m_generator.setWGHTMX(m_WGHTMX);
136  m_generator.setRADCOR(m_sRADCOR);
137  m_generator.setCONFIG(m_sCONFIG);
138  m_generator.setMATRIX(m_sMATRIX);
139  m_generator.setMTRXGG(m_sMTRXGG);
140  m_generator.setUNWGHT(m_UNWGHT);
141 
142  m_generator.init();
143 
144  m_initialized = true;
145 
146 }
147 
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::MCInitialParticles
This class contains the initial state for the given event.
Definition: MCInitialParticles.h:35
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::MCInitialParticles::getVertex
const TVector3 & getVertex() const
Get the position of the collision.
Definition: MCInitialParticles.h:143
Belle2::TeeggInputModule
The TEEGG Generator module.
Definition: TeeggInputModule.h:45
Belle2::MCInitialParticles::getCMSToLab
const TLorentzRotation & getCMSToLab() const
Return the LorentzRotation to convert from CMS to lab frame.
Definition: MCInitialParticles.h:161
Belle2::StoreArray< MCParticle >
Belle2::BeamParameters
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
Definition: BeamParameters.h:33