Belle II Software development
OverrideGenerationFlagsModule.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <generators/modules/OverrideGenerationFlagsModule.h>
10#include <framework/database/Database.h>
11
12using namespace Belle2;
13
14//-----------------------------------------------------------------
15// Register the Module
16//-----------------------------------------------------------------
17REG_MODULE(OverrideGenerationFlags);
18
19//-----------------------------------------------------------------
20// Implementation
21//-----------------------------------------------------------------
22
24{
25 setDescription("Ovverride generation flags for BeamParameters "
26 "from database.");
27 addParam("smearEnergy", m_SmearEnergy,
28 "Smear energy when generating initial events.", true);
29 addParam("smearDirection", m_SmearDirection,
30 "Smear beam direction when generating initial events.", true);
31 addParam("smearVertex", m_SmearVertex,
32 "Smear vertex position when generating initial events.", true);
33 addParam("generateCMS", m_GenerateCMS,
34 "Generate events in CMS, not lab system.", false);
35}
36
38{
39}
40
42{
43}
44
46{
47}
48
50{
51 BeamParameters* beamParameters = new BeamParameters(*m_BeamParameters);
52 int flags = 0;
53 if (m_GenerateCMS)
55 if (m_SmearEnergy)
59 if (m_SmearVertex)
61 beamParameters->setGenerationFlags(flags);
62 /* Override for one run. */
63 DBStore::Instance().addConstantOverride("BeamParameters", beamParameters,
64 true);
65}
66
68{
69}
70
72{
73}
This class contains the nominal beam parameters and the parameters used for smearing of the primary v...
void setGenerationFlags(int flags) override
Set the generation flags to be used for event generation (ORed combination of EGenerationFlags).
@ c_generateCMS
generate initial event in CMS instead of lab
@ c_smearBeamEnergy
smear energy of HER and LER (but not direction)
@ c_smearBeamDirection
smear direction of HER and LER (but not energy)
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
bool m_SmearDirection
Smear beam direction when generating initial events.
virtual void initialize() override
Initializer.
virtual void event() override
This method is called for each event.
virtual void endRun() override
This method is called if the current run ends.
virtual void terminate() override
This method is called at the end of the event processing.
bool m_SmearVertex
Smear vertex position when generating initial events.
virtual void beginRun() override
Called when entering a new run.
DBObjPtr< BeamParameters > m_BeamParameters
Beam parameters.
bool m_GenerateCMS
Generate events in CMS, not lab system.
bool m_SmearEnergy
Smear energy when generating initial events.
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
static DBStore & Instance()
Instance of a singleton DBStore.
Definition: DBStore.cc:28
void addConstantOverride(const std::string &name, TObject *obj, bool oneRun=false)
Add constant override payload.
Definition: DBStore.cc:204
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.