Belle II Software  release-08-01-10
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 
17 using namespace std;
18 using namespace Belle2;
19 
20 //-----------------------------------------------------------------
21 // Register the Module
22 //-----------------------------------------------------------------
23 REG_MODULE(EvReduction)
24 
25 //-----------------------------------------------------------------
26 // Implementation
27 //-----------------------------------------------------------------
28 
30 {
31  //Set module properties
32  setDescription("Encode DataStore into RingBuffer");
33  setPropertyFlags(c_Input);
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 
45 EvReductionModule::~EvReductionModule()
46 {
47 }
48 
49 void EvReductionModule::initialize()
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 
73 void EvReductionModule::beginRun()
74 {
75  B2INFO("beginRun called.");
76 }
77 
78 
79 void EvReductionModule::event()
80 {
81 
82  // Skip first event since it is read in initialize();
83  StoreArray<RawDataBlock> dblk_ary;
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;
93  StoreArray<RawCOPPER> cpr_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 
112 void EvReductionModule::endRun()
113 {
114  //fill Run data
115 
116  B2INFO("EvReduction: endRun done.");
117 }
118 
119 
120 void EvReductionModule::terminate()
121 {
122  B2INFO("EvReduction: terminate called");
123 }
124 
A class definition of an input module for Sequential ROOT I/O.
Definition: EvReduction.h:46
Base class for Modules.
Definition: Module.h:72
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
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
@ c_Input
Input Process.
Abstract base class for different kinds of events.