Belle II Software development
TRGECLRawdataAnalysisModule.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//trg package headers
10#include "trg/trg/Debug.h"
11#include "trg/ecl/modules/trgeclRawdataAnalysis/TRGECLRawdataAnalysisModule.h"
12
13#include <iostream>
14
15using namespace std;
16
17namespace Belle2 {
22//
23//
25 REG_MODULE(TRGECLRawdataAnalysis);
26//
27//
28//
29 string
31 {
32 return string("TRGECLAnalysisModule 1.00");
33 }
34//
35//
36//
38 : Module::Module(),
39 _debugLevel(0), _Clustering(1)
40 {
41
42 string desc = "TRGECLRawdataAnalysisModule(" + version() + ")";
43 setDescription(desc);
44 // setPropertyFlags(c_ParallelProcessingCertified | c_InitializeInProcess);
45
46 addParam("DebugLevel", _debugLevel, "TRGECL debug level", _debugLevel);
47 addParam("Clustering", _Clustering, "TRGECL Clustering method 0 : use only ICN, 1 : ICN + Energy(Defult)", _Clustering);
48
49
50
51 if (TRGDebug::level()) {
52 std::cout << "TRGECLRawdataAnalysisModule ... created" << std::endl;
53 }
54 }
55//
56//
57//
59 {
60
61 if (TRGDebug::level()) {
62 std::cout << "TRGECLRawdataAnalysisModule ... destructed " << std::endl;
63
64 }
65 }
66//
67//
68//
69 void
71 {
72
74
75 if (TRGDebug::level()) {
76 std::cout << "TRGECLRawdataAnalysisModule::initialize ... options" << std::endl;
77 std::cout << TRGDebug::tab(4) << "debug level = " << TRGDebug::level()
78 << std::endl;
79 }
80 //
81 //
82 //
83 m_nRun = 0 ;
84 m_nEvent = 0 ;
85 m_hitNum = 0;
86 m_hitTCNum = 0;
87
88 m_TRGECLUnpackerStore.registerInDataStore();
89 m_TRGECLCluster.registerInDataStore();
90 m_TRGECLTiming.registerInDataStore();
91
92 }
93//
94//
95//
96 void
98 {
99
100 if (TRGDebug::level()) {
101 std::cout << "TRGECLRawdataAnalysisModule ... beginRun called " << std::endl;
102 }
103 // _ecl = TrgEcl::getTrgEcl();
104
105 }
106//
107//
108//
109 void
111 {
112
113 if (TRGDebug::level()) {
114 std::cout << "TRGECLMoudle ... event called" << std::endl;
115 }
116
117 std::vector<int> TCId;
118 std::vector<double> TCTiming;
119 std::vector<double> TCEnergy;
120
121 TCId.clear();
122 TCTiming.clear();
123 TCEnergy.clear();
124
125 int HitRevoFAM = 0;
126 int HitFineTime = 0;
127
128
129 //
130 StoreArray<TRGECLUnpackerStore> trgeclUnpackerStoreArray;
131 for (int ii = 0; ii < trgeclUnpackerStoreArray.getEntries(); ii++) {
132
133 TRGECLUnpackerStore* TCHit = trgeclUnpackerStoreArray[ii];
134 int iTCID = (TCHit->getTCId() - 1);
135 int HitTiming = TCHit ->getTCTime();
136 int HitEnergy = TCHit -> getTCEnergy();
137 HitRevoFAM = TCHit -> getRevoFAM();
138 HitFineTime = TCHit -> getTCTime();
139
140 if (iTCID == -1) {continue;}
141
142 TCId.push_back(iTCID + 1);
143 TCTiming.push_back(HitTiming);
144 TCEnergy.push_back(HitEnergy);
145
146
147
148 }
149 TrgEclCluster obj_cluster;
150 if (TCId.size() > 0) {
151
152 obj_cluster.setClusteringMethod(_Clustering);
153 obj_cluster.setEventId(m_nEvent);
154 obj_cluster.setICN(TCId, TCEnergy, TCTiming); // Make Cluster
155 obj_cluster.save(m_nEvent); // Save Clusters to TRGECLCluster
156
157 }
158
159 int Timing = ((HitFineTime >> 3) & 0xF) + ((HitRevoFAM & 0x7F) << 4);
160
161 m_hitNum = 0;
162 StoreArray<TRGECLTiming> TimingArray;
163 TimingArray.appendNew();
164 m_hitNum = TimingArray.getEntries() - 1;
165 TimingArray[m_hitNum]->setEventId(m_nEvent);
166 TimingArray[m_hitNum]->setTiming(Timing);
167
168
169 //
170
171 //
172 //
173 m_nEvent++;
174 //
175 //
176 //
177
178
179 }
180//
181//
182//
183 void
185 {
186 if (TRGDebug::level()) {
187 std::cout << "TRGECLRawdataAnalysisModule ... endRun called " << std::endl;
188 }
189 }
190//
191//
192//
193 void
195 {
196 if (TRGDebug::level()) {
197 std::cout << "TRGECLRawdataAnalysisModule ... terminate called " << std::endl;
198 }
199 }
200//
201//
202//
204} // namespace Belle2
Base class for Modules.
Definition: Module.h:72
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
int m_hitNum
The current number of created hits in an event.
StoreArray< TRGECLCluster > m_TRGECLCluster
output for TRGECLCluster
StoreArray< TRGECLUnpackerStore > m_TRGECLUnpackerStore
output for TRGECLUnpackerStore
StoreArray< TRGECLTiming > m_TRGECLTiming
output for TRGECLTiming
int getTCId() const
The method to get cell id.
int getTCTime() const
The method to get hit average time.
A Class of ECL Trigger clustering
Definition: TrgEclCluster.h:30
void save(int)
Save Cluster information in TRGECLCluster Table.
void setICN(const std::vector< int > &)
set ICN for each part(Fw,Br,Bw)
void setClusteringMethod(int method)
Set.
Definition: TrgEclCluster.h:71
void setEventId(int eventId)
Set EventId.
Definition: TrgEclCluster.h:69
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
virtual void initialize() override
Initilizes TRGECLModule.
virtual void event() override
Called event by event.
virtual void endRun() override
Called when run ended.
virtual void terminate() override
Called when processing ended.
virtual void beginRun() override
Called when new run started.
std::string version(void) const
returns version of TRGECLModule.
static std::string tab(void)
returns tab spaces.
Definition: Debug.cc:47
static int level(void)
returns the debug level.
Definition: Debug.cc:67
Abstract base class for different kinds of events.
STL namespace.