Belle II Software  release-08-01-10
MonitorData.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 #include <daq/dqm/modules/MonitorData.h>
9 
10 #include <framework/datastore/StoreArray.h>
11 #include <rawdata/dataobjects/RawCOPPER.h>
12 
13 using namespace std;
14 using namespace Belle2;
15 
16 
17 //#define DEBUG
18 
19 //-----------------------------------------------------------------
20 // Register the Module
21 //-----------------------------------------------------------------
22 REG_MODULE(MonitorData)
23 
24 //-----------------------------------------------------------------
25 // Implementation
26 //-----------------------------------------------------------------
27 
29 {
30  //Set module properties
31 
32  setDescription("Monitor Raw Data");
33  setPropertyFlags(c_ParallelProcessingCertified);
34  m_nevt = -1;
35 
36 }
37 
38 
39 
40 MonitorDataModule::~MonitorDataModule()
41 {
42 }
43 
44 void MonitorDataModule::defineHisto()
45 {
46  h_ncpr = new TH1F("NumCOPPER", "Number of COPPERs", 10, 0.0, 10.0);
47  h_nevt = new TH1F("Nevent COPPER", "Number of Events", 10, 0.0, 10.0);
48  h_size = new TH1F("Data Size COPPER", "Data Size", 100, 0.0, 2000.0);
49  h_size2d = new TH2F("Data Size vs. Cpr", "Data Size vs. Copper", 100, 0.0, 2000.0, 5, 0.0, 5.0);
50 }
51 
52 
53 void MonitorDataModule::initialize()
54 {
55  REG_HISTOGRAM
56 }
57 
58 
59 void MonitorDataModule::beginRun()
60 {
61  B2INFO("beginRun called.");
62 }
63 
64 
65 
66 
67 void MonitorDataModule::endRun()
68 {
69  //fill Run data
70 
71  B2INFO("endRun done.");
72 }
73 
74 
75 void MonitorDataModule::terminate()
76 {
77  B2INFO("terminate called");
78 }
79 
80 
81 
82 //
83 // User defined functions
84 //
85 
86 
87 void MonitorDataModule::event()
88 {
89  h_nevt->Fill((float)m_nevt);
90  StoreArray<RawCOPPER> rawcprarray;
91 
92  int ncpr = rawcprarray.getEntries();
93  h_ncpr->Fill((float)ncpr);
94 
95  for (int j = 0; j < ncpr; j++) {
96  for (int i = 0; i < rawcprarray[ j ]->GetNumEntries(); i++) {
97 
98  //int* buf;
99  //buf = rawcprarray[ j ]->GetBuffer(i);
100 
101  int size_byte = rawcprarray[ j ]->GetBlockNwords(i) * sizeof(int);
102  h_size->Fill((float)size_byte);
103  h_size2d->Fill((float)size_byte, (float)j);
104 
105 
106 // printf("=== event====\n exp %d run %d eve %d copperNode %d type %d size %d byte\n",
107 // rawcprarray[ j ]->GetExpNo( i ),
108 // rawcprarray[ j ]->GetRunNo( i ),
109 // rawcprarray[ j ]->GetEveNo( i ),
110 // rawcprarray[ j ]->GetSubsysId( i ),
111 // rawcprarray[ j ]->GetDataType( i ),
112 // size_byte);
113 
114 
115  //int* finesse_buf_1st = rawcprarray[ j ]->Get1stFINESSEBuffer(i);
116  //int* finesse_buf_2nd = rawcprarray[ j ]->Get2ndFINESSEBuffer(i);
117  //int* finesse_buf_3rd = rawcprarray[ j ]->Get3rdFINESSEBuffer(i);
118  //int* finesse_buf_4th = rawcprarray[ j ]->Get4thFINESSEBuffer(i);
119  // printf("FEEbuf %p %p %p %p\n", fee_buf_1st, fee_buf_2nd, fee_buf_3rd, fee_buf_4th);
120  }
121  }
122  m_nevt++;
123 
124 }
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
A class definition of an input module for Sequential ROOT I/O.
Definition: MonitorData.h:24
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
#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.