Belle II Software  release-08-01-10
DQMHistAnalysisEpicsEnable.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 // Own header.
10 #include <dqm/analysis/modules/DQMHistAnalysisEpicsEnable.h>
11 
12 #include <TH1F.h>
13 
14 using namespace std;
15 using namespace Belle2;
16 
17 //-----------------------------------------------------------------
18 // Register module
19 //-----------------------------------------------------------------
20 
21 REG_MODULE(DQMHistAnalysisEpicsEnable);
22 
23 DQMHistAnalysisEpicsEnableModule::DQMHistAnalysisEpicsEnableModule()
25 {
26  // set module description (e.g. insert text)
27  setDescription("EPICS output enabler module");
29 
30  addParam("useEpicsReadOnly", m_useEpicsRO, "use Epics Read Only", false);
31  addParam("PVPrefix", m_locPVPrefix, "Set EPICS PV prefix", std::string("TEST:"));
32 
33 #ifdef _BELLE2_EPICS
34  if (!ca_current_context()) SEVCHK(ca_context_create(ca_disable_preemptive_callback), "ca_context_create");
35 #endif
36 }
37 
39 {
40 #ifdef _BELLE2_EPICS
41  if (ca_current_context()) ca_context_destroy();
42 #endif
43 }
44 
46 {
47 #ifdef _BELLE2_EPICS
48  setUseEpics(true); // set always true
51 #endif
52 }
53 
55 {
56  // -> now trigger flush to network
57  // it wont harm to do this more often than needed.
58  updateEpicsPVs(5.0); // 5 seconds timeout
59 }
void initialize() override final
Initialize the Module.
std::string m_locPVPrefix
local PVPrefix for setting as global
bool m_useEpicsRO
Read Only local flag for EPICS.
The base class for the histogram analysis module.
void setPVPrefix(std::string &prefix)
set global Prefix for EPICS PVs
void setUseEpics(bool flag)
Setter for EPICS usage.
void setUseEpicsReadOnly(bool flag)
Setter EPICS flag in read only mode.
int updateEpicsPVs(float timeout)
Update all EPICS PV (flush to network)
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ 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:80
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
#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.