Belle II Software  release-05-02-19
TRGGRLModule.cc
1 //-----------------------------------------------------------------------------
2 // $Id$
3 //-----------------------------------------------------------------------------
4 // Filename : TRGGRLModule.cc
5 // Section : TRG GRL
6 // Owner : Yoshihito Iwasaki
7 // Email : yoshihito.iwasaki@kek.jp
8 //-----------------------------------------------------------------------------
9 // Description : A trigger module for GRL
10 //-----------------------------------------------------------------------------
11 // 0.00 : 2013/12/13 : First version
12 //-----------------------------------------------------------------------------
13 
14 #define TRGGRL_SHORT_NAMES
15 
16 #include <iostream>
17 
18 #include "trg/grl/modules/trggrl/TRGGRLModule.h"
19 #include <framework/logging/Logger.h>
20 
21 using namespace std;
22 
23 namespace Belle2 {
30  REG_MODULE(TRGGRL);
31 
32  TRGGRL*
33  TRGGRLModule::_grl = 0;
34 
35  string
36  TRGGRLModule::version() const
37  {
38  return string("TRGGRLModule 0.00");
39  }
40 
41  TRGGRLModule::TRGGRLModule()
42  : Module::Module(),
43  _debugLevel(0),
44  _configFilename("TRGGDLConfig.dat"),
45  _simulationMode(2),
46  _fastSimulationMode(0),
47  _firmwareSimulationMode(0)
48  {
49 
50  string desc = "TRGGRLModule(" + version() + ")";
51  setDescription(desc);
53 
54  addParam("DebugLevel", _debugLevel, "TRGGRL debug level", _debugLevel);
55  addParam("ConfigFile",
57  "The filename of CDC trigger config file",
59  addParam("SimulationMode",
61  "TRGGRL simulation switch",
63  addParam("FastSimulationMode",
65  "TRGGRL fast simulation mode",
67  addParam("FirmwareSimulationMode",
69  "TRGGRL firmware simulation mode",
71  }
72 
74  {
75 
76  if (_grl)
77  TRGGRL::getTRGGRL("good-bye");
78 
79  }
80 
81  void
83  {
84 
85 // TRGDebug::level(_debugLevel);
86 
87  B2DEBUG(100, "TRGGRLModule::initialize ... options");
88  }
89 
90  void
92  {
93 
94  //...GDL config. name...
95  string cfn = _configFilename;
96 
97  //...GRL...
98  if (_grl == 0) {
99  _grl = TRGGRL::getTRGGRL(cfn,
103  } else if (cfn != _grl->configFile()) {
104  _grl = TRGGRL::getTRGGRL(cfn,
108  }
109 
110  B2DEBUG(300, "TRGGDLModule ... beginRun called configFile = " << cfn);
111 
112  }
113 
114  void
116  {
117 
118  //...GRL simulation...
119  _grl->update(true);
120  _grl->simulate();
121 
122  }
123 
124  void
126  {
127  B2DEBUG(300, "TRGGRLModule ... endRun called ");
128  }
129 
130 
131  void
133  {
134  _grl->terminate();
135  B2DEBUG(200, "TRGGRLModule ... terminate called ");
136  }
137 
139 } // namespace Belle2
Belle2::TRGGRL::configFile
std::string configFile(void) const
returns configuration file name.
Definition: TRGGRL.h:232
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module::c_ParallelProcessingCertified
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:82
Belle2::TRGGRL::simulate
void simulate(void)
fast trigger simulation.
Definition: TRGGRL.cc:169
Belle2::TRGGRLModule::_fastSimulationMode
int _fastSimulationMode
Switch for the fast simulation.
Definition: TRGGRLModule.h:79
Belle2::TRGGRLModule::_simulationMode
int _simulationMode
Mode for TRGGRL simulation.
Definition: TRGGRLModule.h:75
Belle2::TRGGRLModule::version
std::string version(void) const
returns version of TRGGRLModule.
Definition: TRGGRLModule.cc:36
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::Module::setPropertyFlags
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:210
Belle2::TRGGRL::update
void update(bool mcAnalysis=true)
updates TRGGRL information.
Definition: TRGGRL.cc:150
Belle2::TRGGRL::getTRGGRL
static TRGGRL * getTRGGRL(void)
returns TRGGRL object.
Definition: TRGGRL.cc:80
Belle2::TRGGRLModule::initialize
virtual void initialize() override
Initilizes TRGGRLModule.
Definition: TRGGRLModule.cc:82
Belle2::TRGGRLModule::_debugLevel
int _debugLevel
Debug level.
Definition: TRGGRLModule.h:68
Belle2::TRGGRLModule::~TRGGRLModule
virtual ~TRGGRLModule()
Destructor.
Definition: TRGGRLModule.cc:73
Belle2::TRGGRLModule::terminate
virtual void terminate() override
Called when processing ended.
Definition: TRGGRLModule.cc:132
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGGRLModule::endRun
virtual void endRun() override
Called when run ended.
Definition: TRGGRLModule.cc:125
Belle2::Module::addParam
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:562
Belle2::TRGGRLModule::_firmwareSimulationMode
int _firmwareSimulationMode
Switch for the firmware simulation. 0:do nothing, 1:do everything.
Definition: TRGGRLModule.h:82
Belle2::TRGGRL::terminate
void terminate(void)
terminates when run is finished
Definition: TRGGRL.cc:127
Belle2::TRGGRLModule::beginRun
virtual void beginRun() override
Called when new run started.
Definition: TRGGRLModule.cc:91
Belle2::TRGGRLModule::_configFilename
std::string _configFilename
Config. file name.
Definition: TRGGRLModule.h:71
Belle2::TRGGRLModule::_grl
static TRGGRL * _grl
A pointer to a TRGGRL;.
Definition: TRGGRLModule.h:87
Belle2::TRGGRLModule::event
virtual void event() override
Called event by event.
Definition: TRGGRLModule.cc:115