Belle II Software  release-05-02-19
TRGECLRawdataAnalysisModule.cc
1 //---------------------------------------------------------------
2 // $Id$
3 //---------------------------------------------------------------
4 // Filename : TRGECLRawdataAnalysisModule.cc
5 // Section : TRG ECL
6 // Owner : InSoo Lee / Yuuji Unno / SungHyun Kim
7 // Email : islee@hep.hanyang.ac.kr / yunno@post.kek.jp / sunghun.kim@belle2.org
8 //---------------------------------------------------------------
9 // Description : A trigger module for TRG ECL
10 //---------------------------------------------------------------
11 // 1.00 : 2017/08/01 : ECL Trigger Raw data analyzer.
12 // Save Cluster information
13 // using Unpacker version 1.1
14 //---------------------------------------------------------------
15 
16 //trg package headers
17 #include "trg/trg/Debug.h"
18 #include "trg/ecl/modules/trgeclRawdataAnalysis/TRGECLRawdataAnalysisModule.h"
19 
20 #include <iostream>
21 
22 using namespace std;
23 
24 namespace Belle2 {
29 //
30 //
32  REG_MODULE(TRGECLRawdataAnalysis);
33 //
34 //
35 //
36  string
37  TRGECLRawdataAnalysisModule::version() const
38  {
39  return string("TRGECLAnalysisModule 1.00");
40  }
41 //
42 //
43 //
44  TRGECLRawdataAnalysisModule::TRGECLRawdataAnalysisModule()
45  : Module::Module(),
46  _debugLevel(0), _Clustering(1)
47  {
48 
49  string desc = "TRGECLRawdataAnalysisModule(" + version() + ")";
50  setDescription(desc);
51  // setPropertyFlags(c_ParallelProcessingCertified | c_InitializeInProcess);
52 
53  addParam("DebugLevel", _debugLevel, "TRGECL debug level", _debugLevel);
54  addParam("Clustering", _Clustering, "TRGECL Clustering method 0 : use only ICN, 1 : ICN + Energy(Defult)", _Clustering);
55 
56 
57 
58  if (TRGDebug::level()) {
59  std::cout << "TRGECLRawdataAnalysisModule ... created" << std::endl;
60  }
61  }
62 //
63 //
64 //
66  {
67 
68  if (TRGDebug::level()) {
69  std::cout << "TRGECLRawdataAnalysisModule ... destructed " << std::endl;
70 
71  }
72  }
73 //
74 //
75 //
76  void
78  {
79 
81 
82  if (TRGDebug::level()) {
83  std::cout << "TRGECLRawdataAnalysisModule::initialize ... options" << std::endl;
84  std::cout << TRGDebug::tab(4) << "debug level = " << TRGDebug::level()
85  << std::endl;
86  }
87  //
88  //
89  //
90  m_nRun = 0 ;
91  m_nEvent = 0 ;
92  m_hitNum = 0;
93  m_hitTCNum = 0;
94 
95  m_TRGECLUnpackerStore.registerInDataStore();
96  m_TRGECLCluster.registerInDataStore();
97  m_TRGECLTiming.registerInDataStore();
98 
99  }
100 //
101 //
102 //
103  void
105  {
106 
107  if (TRGDebug::level()) {
108  std::cout << "TRGECLRawdataAnalysisModule ... beginRun called " << std::endl;
109  }
110  // _ecl = TrgEcl::getTrgEcl();
111 
112  }
113 //
114 //
115 //
116  void
118  {
119 
120  if (TRGDebug::level()) {
121  std::cout << "TRGECLMoudle ... event called" << std::endl;
122  }
123 
124  std::vector<int> TCId;
125  std::vector<double> TCTiming;
126  std::vector<double> TCEnergy;
127 
128  TCId.clear();
129  TCTiming.clear();
130  TCEnergy.clear();
131 
132  int HitRevoFAM = 0;
133  int HitFineTime = 0;
134 
135 
136  //
137  StoreArray<TRGECLUnpackerStore> trgeclUnpackerStoreArray;
138  for (int ii = 0; ii < trgeclUnpackerStoreArray.getEntries(); ii++) {
139 
140  TRGECLUnpackerStore* TCHit = trgeclUnpackerStoreArray[ii];
141  int iTCID = (TCHit->getTCId() - 1);
142  int HitTiming = TCHit ->getTCTime();
143  int HitEnergy = TCHit -> getTCEnergy();
144  HitRevoFAM = TCHit -> getRevoFAM();
145  HitFineTime = TCHit -> getTCTime();
146 
147  if (iTCID == -1) {continue;}
148 
149  TCId.push_back(iTCID + 1);
150  TCTiming.push_back(HitTiming);
151  TCEnergy.push_back(HitEnergy);
152 
153 
154 
155  }
156  TrgEclCluster obj_cluster;
157  if (TCId.size() > 0) {
158 
159  obj_cluster.setClusteringMethod(_Clustering);
160  obj_cluster.setEventId(m_nEvent);
161  obj_cluster.setICN(TCId, TCEnergy, TCTiming); // Make Cluster
162  obj_cluster.save(m_nEvent); // Save Clusters to TRGECLCluster
163 
164  }
165 
166  int Timing = ((HitFineTime >> 3) & 0xF) + ((HitRevoFAM & 0x7F) << 4);
167 
168  m_hitNum = 0;
169  StoreArray<TRGECLTiming> TimingArray;
170  TimingArray.appendNew();
171  m_hitNum = TimingArray.getEntries() - 1;
172  TimingArray[m_hitNum]->setEventId(m_nEvent);
173  TimingArray[m_hitNum]->setTiming(Timing);
174 
175 
176  //
177 
178  //
179  //
180  m_nEvent++;
181  //
182  //
183  //
184 
185 
186  }
187 //
188 //
189 //
190  void
192  {
193  if (TRGDebug::level()) {
194  std::cout << "TRGECLRawdataAnalysisModule ... endRun called " << std::endl;
195  }
196  }
197 //
198 //
199 //
200  void
202  {
203  if (TRGDebug::level()) {
204  std::cout << "TRGECLRawdataAnalysisModule ... terminate called " << std::endl;
205  }
206  }
207 //
208 //
209 //
211 } // namespace Belle2
Belle2::StoreArray::appendNew
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:256
Belle2::TRGECLRawdataAnalysisModule::m_TRGECLTiming
StoreArray< TRGECLTiming > m_TRGECLTiming
output for TRGECLTiming
Definition: TRGECLRawdataAnalysisModule.h:77
Belle2::TRGECLUnpackerStore
Example Detector.
Definition: TRGECLUnpackerStore.h:25
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
Belle2::TRGDebug::level
static int level(void)
returns the debug level.
Definition: Debug.cc:72
Belle2::TRGECLRawdataAnalysisModule::m_nEvent
int m_nEvent
Event number.
Definition: TRGECLRawdataAnalysisModule.h:108
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::TRGECLUnpackerStore::getTCId
int getTCId() const
The method to get cell id.
Definition: TRGECLUnpackerStore.h:80
Belle2::TRGECLRawdataAnalysisModule::m_hitTCNum
int m_hitTCNum
TC Hit number.
Definition: TRGECLRawdataAnalysisModule.h:100
Belle2::TRGECLRawdataAnalysisModule::m_TRGECLCluster
StoreArray< TRGECLCluster > m_TRGECLCluster
output for TRGECLCluster
Definition: TRGECLRawdataAnalysisModule.h:76
Belle2::TRGECLRawdataAnalysisModule::_Clustering
int _Clustering
Clustering option.
Definition: TRGECLRawdataAnalysisModule.h:110
Belle2::TRGECLRawdataAnalysisModule::version
std::string version(void) const
returns version of TRGECLModule.
Definition: TRGECLRawdataAnalysisModule.cc:37
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::TRGECLRawdataAnalysisModule::initialize
virtual void initialize() override
Initilizes TRGECLModule.
Definition: TRGECLRawdataAnalysisModule.cc:77
Belle2::TRGECLRawdataAnalysisModule::terminate
virtual void terminate() override
Called when processing ended.
Definition: TRGECLRawdataAnalysisModule.cc:201
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrgEclCluster::setClusteringMethod
void setClusteringMethod(int method)
Set.
Definition: TrgEclCluster.h:67
Belle2::TrgEclCluster::setEventId
void setEventId(int eventId)
Set EventId.
Definition: TrgEclCluster.h:65
Belle2::TRGECLUnpackerStore::getTCTime
int getTCTime() const
The method to get hit average time.
Definition: TRGECLUnpackerStore.h:83
Belle2::TRGECLRawdataAnalysisModule::m_TRGECLUnpackerStore
StoreArray< TRGECLUnpackerStore > m_TRGECLUnpackerStore
output for TRGECLUnpackerStore
Definition: TRGECLRawdataAnalysisModule.h:75
Belle2::TRGECLRawdataAnalysisModule::_debugLevel
int _debugLevel
Debug level.
Definition: TRGECLRawdataAnalysisModule.h:80
Belle2::TRGECLRawdataAnalysisModule::endRun
virtual void endRun() override
Called when run ended.
Definition: TRGECLRawdataAnalysisModule.cc:191
Belle2::TrgEclCluster::save
void save(int)
Save Cluster information in TRGECLCluster Table.
Definition: TrgEclCluster.cc:190
Belle2::Module::addParam
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:562
Belle2::TRGECLRawdataAnalysisModule::~TRGECLRawdataAnalysisModule
virtual ~TRGECLRawdataAnalysisModule()
Destructor
Definition: TRGECLRawdataAnalysisModule.cc:65
Belle2::TRGECLRawdataAnalysisModule::m_hitNum
int m_hitNum
The current number of created hits in an event.
Definition: TRGECLRawdataAnalysisModule.h:98
Belle2::TrgEclCluster::setICN
void setICN(std::vector< int >)
Destructor.
Definition: TrgEclCluster.cc:156
Belle2::TRGDebug::tab
static std::string tab(void)
returns tab spaces.
Definition: Debug.cc:52
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::TRGECLRawdataAnalysisModule::beginRun
virtual void beginRun() override
Called when new run started.
Definition: TRGECLRawdataAnalysisModule.cc:104
Belle2::TrgEclCluster
A Class of ECL Trigger clustering
Definition: TrgEclCluster.h:35
Belle2::TRGECLRawdataAnalysisModule::m_nRun
int m_nRun
Run number.
Definition: TRGECLRawdataAnalysisModule.h:106
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226
Belle2::TRGECLRawdataAnalysisModule::event
virtual void event() override
Called event by event.
Definition: TRGECLRawdataAnalysisModule.cc:117