Belle II Software development
EvReduction.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 <daq/rfarm/event/modules/EvReduction.h>
10#include <TSystem.h>
11
12#include <rawdata/dataobjects/RawTLU.h>
13#include <rawdata/dataobjects/RawTRG.h>
14
15// #define DESY
16
17using namespace std;
18using namespace Belle2;
19
20//-----------------------------------------------------------------
21// Register the Module
22//-----------------------------------------------------------------
23REG_MODULE(EvReduction);
24
25//-----------------------------------------------------------------
26// Implementation
27//-----------------------------------------------------------------
28
30{
31 //Set module properties
32 setDescription("Encode DataStore into RingBuffer");
34
35 addParam("EventReductionFactor", m_red_factor, "Event reduction factor: ", 3);
36
37
38 m_nevt = -1;
39
40 //Parameter definition
41 B2INFO("Rx: Constructor done.");
42}
43
44
45EvReductionModule::~EvReductionModule()
46{
47}
48
50{
51 gSystem->Load("libdataobjects");
52
53 // Initialize EvtMetaData
54
55 // Initialize Array of RawCOPPER
56 m_rawDataBlock.registerInDataStore();
57 m_rawCOPPER.registerInDataStore();
58 m_rawSVD.registerInDataStore();
59 m_rawCDC.registerInDataStore();
60 m_rawTOP.registerInDataStore();
61 m_rawARICH.registerInDataStore();
62 m_rawECL.registerInDataStore();
63 m_rawKLM.registerInDataStore();
64 m_rawFTSW.registerInDataStore();
65
66#ifdef DESY
67 m_rawTLU.registerInDataStore();
68#endif
69 B2INFO("Rx initialized.");
70}
71
72
74{
75 B2INFO("beginRun called.");
76}
77
78
80{
81
82 // Skip first event since it is read in initialize();
84 StoreArray<RawFTSW> ftsw_ary;
85 StoreArray<RawTLU> tlu_ary;
86 StoreArray<RawCDC> cdc_ary;
87 StoreArray<RawSVD> svd_ary;
88 StoreArray<RawECL> ecl_ary;
89 StoreArray<RawTOP> top_ary;
90 StoreArray<RawARICH> arich_ary;
91 StoreArray<RawKLM> klm_ary;
92 StoreArray<RawTRG> trg_ary;
94
95 if ((m_nevt % m_red_factor) != 0) {
96 ftsw_ary.clear();
97 tlu_ary.clear();
98 cdc_ary.clear();
99 svd_ary.clear();
100 ecl_ary.clear();
101 top_ary.clear();
102 arich_ary.clear();
103 klm_ary.clear();
104 trg_ary.clear();
105 cpr_ary.clear();
106 }
107
108 m_nevt++;
109 return;
110}
111
113{
114 //fill Run data
115
116 B2INFO("EvReduction: endRun done.");
117}
118
119
121{
122 B2INFO("EvReduction: terminate called");
123}
124
int m_nevt
No. of sent events.
Definition EvReduction.h:69
EvReductionModule()
Constructor / Destructor.
StoreArray< RawSVD > m_rawSVD
RawSVD.
Definition EvReduction.h:76
void initialize() override
Module functions to be called from main process.
void event() override
This method is the core of the module.
void endRun() override
This method is called if the current run ends.
StoreArray< RawFTSW > m_rawFTSW
RawFTSW.
Definition EvReduction.h:81
void terminate() override
This method is called at the end of the event processing.
StoreArray< RawCOPPER > m_rawCOPPER
RawCOPPER.
Definition EvReduction.h:74
StoreArray< RawARICH > m_rawARICH
RawARICH.
Definition EvReduction.h:79
void beginRun() override
Module functions to be called from event process.
StoreArray< RawKLM > m_rawKLM
RawKLM.
Definition EvReduction.h:80
StoreArray< RawTOP > m_rawTOP
RawTOP.
Definition EvReduction.h:77
StoreArray< RawDataBlock > m_rawDataBlock
RawDataBlock.
Definition EvReduction.h:73
StoreArray< RawECL > m_rawECL
RawECL.
Definition EvReduction.h:78
StoreArray< RawCDC > m_rawCDC
RawCDC.
Definition EvReduction.h:75
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
Module()
Constructor.
Definition Module.cc:30
@ c_Input
This module is an input module (reads data).
Definition Module.h:78
Accessor to arrays stored in the data store.
Definition StoreArray.h:113
void clear() override
Delete all entries in this array.
Definition StoreArray.h:207
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:559
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.
STL namespace.