Belle II Software  release-05-02-19
TRGECLModule.cc
1 //---------------------------------------------------------------
2 // $Id$
3 //---------------------------------------------------------------
4 // Filename : TRGECLModule.cc
5 // Section : TRG ECL
6 // Owner : InSu Lee / Yuuji Unno
7 // Email : islee@hep.hanyang.ac.kr / yunno@post.kek.jp
8 //---------------------------------------------------------------
9 // Description : A trigger module for TRG ECL
10 //---------------------------------------------------------------
11 // 1.00 : 2010/11/18 : First version
12 //---------------------------------------------------------------
13 
14 #define TRGECL_SHORT_NAMES
15 
16 #include <framework/core/ModuleParamList.templateDetails.h>
17 #include <framework/core/ModuleParamList.h>
18 
19 #include "trg/ecl/TrgEclMaster.h"
20 //trg package headers
21 #include "trg/trg/Debug.h"
22 #include "trg/ecl/modules/trgecl/TRGECLModule.h"
23 #include "trg/ecl/dbobjects/TRGECLETMPara.h"
24 
25 #include <iostream>
26 
27 using namespace std;
28 
29 namespace Belle2 {
34 //
35 //
37  REG_MODULE(TRGECL);
38 //
39 //
40 //
41  string
42  TRGECLModule::version() const
43  {
44  return string("TRGECLModule 1.00");
45  }
46 //
47 //
48 //
49  TRGECLModule::TRGECLModule(): Module::Module(), _debugLevel(0), _Bhabha(0), _Clustering(1), _ClusterLimit(6), _EventTiming(2),
50  _TimeWindow(250.0), _OverlapWindow(125.0), _NofTopTC(3), _SelectEvent(1), _ConditionDB(0), _mumuThreshold(20), _n300MeVCluster(1),
51  _ECLBurstThreshold(200)
52  {
53 
54  string desc = "TRGECLModule(" + version() + ")";
55  setDescription(desc);
57 
58  addParam("DebugLevel", _debugLevel, "TRGECL debug level", _debugLevel);
59  addParam("Bhabha", _Bhabha, "TRGECL Bhabha method 0 : Belle I, 1 :belle II(defult)", _Bhabha);
60  addParam("Clustering", _Clustering, "TRGECL Clustering method 0 : use only ICN, 1 : ICN + Energy(Defult)", _Clustering);
61  addParam("ClusterLimit", _ClusterLimit, "The Limit number of cluster (Defult:6)", _ClusterLimit);
62 
63  addParam("EventTiming", _EventTiming,
64  "TRGECL EventTiming method 0 : Belle I, 1 : Energetic TC, 2 : Energy Weighted timing (defult)", _EventTiming);
65  addParam("NofTopTC", _NofTopTC, "TRGECL # of considered TC in energy weighted Timing method(Only work for EvenTiming Method 2)",
66  _NofTopTC);
67 
68  addParam("TimeWindow", _TimeWindow, "TRGECL Trigger decision Time Window", _TimeWindow);
69  addParam("OverlapWindow", _OverlapWindow, "TRGECL Trigger decision Time Window", _OverlapWindow);
70  addParam("EventSelect", _SelectEvent, "TRGECL Select one trigger window for logic study", _SelectEvent);
71  addParam("ConditionDB", _ConditionDB, "Flag to use Condition Database(Defult 0)", _ConditionDB);
72 
73 
74  _2DBhabhaThresholdFWD.clear();
75  _2DBhabhaThresholdBWD.clear();
77  _3DBhabhaVetoThreshold.clear();
79  _3DBhabhaVetoAngle.clear();
80  _mumuAngle.clear();
81 
82  _TotalEnergy.clear();
83  _LowMultiThreshold.clear();
84 
85  _TotalEnergy = {5, 10, 30}; // /100 MeV
86  _2DBhabhaThresholdFWD = {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 30, 35}; // /100 MeV
87  _2DBhabhaThresholdBWD = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30}; // /100 MeV
88  _3DBhabhaVetoThreshold = {30, 45}; // /100 MeV
89  _3DBhabhaSelectionThreshold = {20, 40}; // /100 MeV
90  _3DBhabhaVetoAngle = {160, 200, 165, 190}; // /100 MeV
91  _3DBhabhaSelectionAngle = {140, 220, 160, 200}; // /100 MeV
92  _mumuThreshold = 20; //100 MeV
93  _mumuAngle = {160, 200, 165, 190}; // degree
94  _LowMultiThreshold = {10, 20, 25, 30}; // degree
95  _n300MeVCluster = 1;
96  _ECLBurstThreshold = 20;
97 
98 
99  if (TRGDebug::level()) {
100  std::cout << "TRGECLModule ... created" << std::endl;
101  }
102  }
103 //
104 //
105 //
107  {
108 
109  if (TRGDebug::level()) {
110  std::cout << "TRGECLModule ... destructed " << std::endl;
111 
112  }
113  }
114 //
115 //
116 //
117  void
119  {
120 
122 
123  if (TRGDebug::level()) {
124  std::cout << "TRGECLModule::initialize ... options" << std::endl;
125  std::cout << TRGDebug::tab(4) << "debug level = " << TRGDebug::level()
126  << std::endl;
127  }
128  //
129  //
130  //
131  m_nRun = 0 ;
132  m_nEvent = 0 ;
133  m_hitNum = 0;
134  m_hitTCNum = 0;
135 
136  m_TRGECLHit.registerInDataStore();
137  m_TRGECLTrg.registerInDataStore();
138  m_TRGECLCluster.registerInDataStore();
139 
140  }
141 //
142 //
143 //
144  void
146  {
147  if (_ConditionDB == 1) {
148  for (const auto& para : m_ETMPara) {
149  _TotalEnergy = {(double)para.getELow(), (double)para.getELow(), (double)para.getELow()};
150  for (int index = 0; index < 14; index ++) {
151  _2DBhabhaThresholdFWD.push_back((double)para.get2DBhabhaFWD(index));
152  _2DBhabhaThresholdBWD.push_back((double)para.get2DBhabhaBWD(index));
153  }
154  _3DBhabhaVetoThreshold = {(double)para.get3DBhabhaVetoThreshold(0), (double)para.get3DBhabhaVetoThreshold(1)}; // /100 MeV
155  _3DBhabhaSelectionThreshold = {(double)para.get3DBhabhaSelectionThreshold(0), (double)para.get3DBhabhaSelectionThreshold(1)}; // /100 MeV
156  _3DBhabhaVetoAngle = {(double)para.get3DBhabhaVetoAngle(0), (double)para.get3DBhabhaVetoAngle(1), (double)para.get3DBhabhaVetoAngle(2), (double)para.get3DBhabhaVetoAngle(3)}; // /100 MeV
157  _3DBhabhaSelectionAngle = {(double)para.get3DBhabhaSelectionAngle(0), (double)para.get3DBhabhaSelectionAngle(1), (double)para.get3DBhabhaSelectionAngle(2), (double)para.get3DBhabhaSelectionAngle(3)}; // /100 MeV
158 
159  _mumuThreshold = (double)(para.getmumuThreshold());
160  _mumuAngle = {(double)para.getmumuAngle(0), (double)para.getmumuAngle(1), (double)para.getmumuAngle(2)};
161  _LowMultiThreshold = {(double)para.getLowMultiThreshold(0) , (double)para.getLowMultiThreshold(1), (double)para.getLowMultiThreshold(2), (double)para.getLowMultiThreshold(3)}; // /100 MeV
162  }
163  }
164 
165  if (TRGDebug::level()) {
166  std::cout << "TRGECLModule ... beginRun called " << std::endl;
167  }
168  // _ecl = TrgEcl::getTrgEcl();
169 
170  }
171 //
172 //
173 //
174  void
176  {
177 
178  if (TRGDebug::level()) {
179  std::cout << "TRGECLMoudle ... event called" << std::endl;
180  }
181  //
182  // simulation
183  //
184  TrgEclMaster* _ecl = new TrgEclMaster();
185 
186  _ecl-> initialize(m_nEvent);
187  _ecl-> setClusterMethod(_Clustering);
188  _ecl-> setClusterLimit(_ClusterLimit);
189  _ecl-> setBhabhaMethod(_Bhabha);
190  _ecl-> setEventTimingMethod(_EventTiming);
191  _ecl -> setTimeWindow(_TimeWindow);
192  _ecl -> setOverlapWindow(_OverlapWindow);
193  _ecl -> setNofTopTC(_NofTopTC);
194  _ecl -> set2DBhabhaThreshold(_2DBhabhaThresholdFWD, _2DBhabhaThresholdBWD);
195  _ecl -> set3DBhabhaSelectionThreshold(_3DBhabhaSelectionThreshold);
196  _ecl -> set3DBhabhaVetoThreshold(_3DBhabhaVetoThreshold);
197  _ecl -> set3DBhabhaSelectionAngle(_3DBhabhaSelectionAngle);
198  _ecl -> set3DBhabhaVetoAngle(_3DBhabhaVetoAngle);
199  _ecl -> setmumuThreshold(_mumuThreshold);
200  _ecl -> setmumuAngle(_mumuAngle);
201  _ecl -> setTotalEnergyThreshold(_TotalEnergy);
202  _ecl -> setLowMultiplicityThreshold(_LowMultiThreshold);
203  _ecl -> setn300MeVClusterThreshold(_n300MeVCluster);
204  _ecl -> setECLBurstThreshold(_ECLBurstThreshold);
205 
206 
207 
208  if (_SelectEvent == 0) {
209  _ecl->simulate01(m_nEvent);
210  } else if (_SelectEvent == 1) {
211  _ecl->simulate02(m_nEvent);
212  }
213  // printf("TRGECLModule> eventId = %d \n", m_nEvent);
214 
215  //
216 
217  //
218  //
219  m_nEvent++;
220  //
221  //
222  //
223 
224  delete _ecl;
225 
226  }
227 //
228 //
229 //
230  void
232  {
233  if (TRGDebug::level()) {
234  std::cout << "TRGECLModule ... endRun called " << std::endl;
235  }
236  }
237 //
238 //
239 //
240  void
242  {
243  if (TRGDebug::level()) {
244  std::cout << "TRGECLModule ... terminate called " << std::endl;
245  }
246  }
247 //
248 //
249 //
251 } // namespace Belle2
Belle2::TRGECLModule::_ClusterLimit
int _ClusterLimit
Cluster Limit.
Definition: TRGECLModule.h:105
Belle2::TRGECLModule::_Bhabha
int _Bhabha
Bhabha option.
Definition: TRGECLModule.h:101
Belle2::TRGECLModule::_3DBhabhaVetoThreshold
std::vector< double > _3DBhabhaVetoThreshold
3D Veto Bhabha Energy Threshold
Definition: TRGECLModule.h:125
Belle2::TRGECLModule::m_nRun
int m_nRun
Run number.
Definition: TRGECLModule.h:97
Belle2::TRGECLModule::_Clustering
int _Clustering
Clustering option.
Definition: TRGECLModule.h:103
Belle2::TrgEclMaster::simulate02
void simulate02(int)
simulates ECL trigger for Data Analysis
Definition: TrgEclMaster.cc:540
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::TRGECLModule::~TRGECLModule
virtual ~TRGECLModule()
Destructor
Definition: TRGECLModule.cc:106
Belle2::TrgEclMaster
ETM class.
Definition: TrgEclMaster.h:40
Belle2::TRGECLModule::_ConditionDB
int _ConditionDB
Flag to use Condition DB.
Definition: TRGECLModule.h:117
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module::c_ParallelProcessingCertified
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:82
Belle2::TRGECLModule::_SelectEvent
int _SelectEvent
Event selection.
Definition: TRGECLModule.h:115
Belle2::TRGECLModule::_3DBhabhaSelectionThreshold
std::vector< double > _3DBhabhaSelectionThreshold
3D Selection Bhabha Energy Threshold
Definition: TRGECLModule.h:123
Belle2::TRGECLModule::_n300MeVCluster
int _n300MeVCluster
The number of Cluster exceeding 300 MeV.
Definition: TRGECLModule.h:135
Belle2::TRGECLModule::_debugLevel
int _debugLevel
Debug level.
Definition: TRGECLModule.h:71
Belle2::TRGECLModule::_3DBhabhaSelectionAngle
std::vector< double > _3DBhabhaSelectionAngle
3D Selection Bhabha Energy Angle
Definition: TRGECLModule.h:127
Belle2::TRGECLModule::m_nEvent
int m_nEvent
Event number.
Definition: TRGECLModule.h:99
Belle2::TrgEclMaster::simulate01
void simulate01(int)
simulates ECL trigger for Global Cosmic data
Definition: TrgEclMaster.cc:190
Belle2::TRGECLModule::_NofTopTC
int _NofTopTC
Definition: TRGECLModule.h:113
Belle2::TRGECLModule::m_hitNum
int m_hitNum
The current number of created hits in an event.
Definition: TRGECLModule.h:89
Belle2::TRGECLModule::_3DBhabhaVetoAngle
std::vector< double > _3DBhabhaVetoAngle
3D Veto Bhabha Energy Angle
Definition: TRGECLModule.h:129
Belle2::TRGECLModule::version
std::string version(void) const
returns version of TRGECLModule.
Definition: TRGECLModule.cc:42
Belle2::TRGECLModule::m_TRGECLTrg
StoreArray< TRGECLTrg > m_TRGECLTrg
output for TRGECLTrg
Definition: TRGECLModule.h:146
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::Module::setPropertyFlags
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:210
Belle2::TRGECLModule::_LowMultiThreshold
std::vector< double > _LowMultiThreshold
Low Multiplicity Threshold.
Definition: TRGECLModule.h:141
Belle2::TRGECLModule::_ECLBurstThreshold
double _ECLBurstThreshold
ECL Burst Bit Threshold.
Definition: TRGECLModule.h:137
Belle2::TRGECLModule::m_TRGECLCluster
StoreArray< TRGECLCluster > m_TRGECLCluster
output for TRGECLCluster
Definition: TRGECLModule.h:148
Belle2::TRGECLModule::initialize
virtual void initialize() override
Initilizes TRGECLModule.
Definition: TRGECLModule.cc:118
Belle2::TRGECLModule::_mumuThreshold
double _mumuThreshold
mumu bit Energy Threshold
Definition: TRGECLModule.h:131
Belle2::TRGECLModule::terminate
virtual void terminate() override
Called when processing ended.
Definition: TRGECLModule.cc:241
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TRGECLModule::_OverlapWindow
double _OverlapWindow
Trigger decision overlap window in oder to avoid boundary effect.
Definition: TRGECLModule.h:111
Belle2::TRGECLModule::m_hitTCNum
int m_hitTCNum
TC Hit number.
Definition: TRGECLModule.h:91
Belle2::TRGECLModule::_2DBhabhaThresholdBWD
std::vector< double > _2DBhabhaThresholdBWD
2D Bhabha Energy Threshold
Definition: TRGECLModule.h:121
Belle2::TRGECLModule::endRun
virtual void endRun() override
Called when run ended.
Definition: TRGECLModule.cc:231
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::TRGECLModule::_TimeWindow
double _TimeWindow
Trigger decision time window.
Definition: TRGECLModule.h:109
Belle2::TRGECLModule::_2DBhabhaThresholdFWD
std::vector< double > _2DBhabhaThresholdFWD
2D Bhabha Energy Threshold
Definition: TRGECLModule.h:119
Belle2::TRGDebug::tab
static std::string tab(void)
returns tab spaces.
Definition: Debug.cc:52
Belle2::TRGECLModule::m_ETMPara
DBArray< TRGECLETMPara > m_ETMPara
ETN Parameters.
Definition: TRGECLModule.h:150
Belle2::TRGECLModule::m_TRGECLHit
StoreArray< TRGECLHit > m_TRGECLHit
output for TRGECLHit
Definition: TRGECLModule.h:144
Belle2::TRGECLModule::beginRun
virtual void beginRun() override
Called when new run started.
Definition: TRGECLModule.cc:145
Belle2::TRGECLModule::_EventTiming
int _EventTiming
Eventtiming option.
Definition: TRGECLModule.h:107
Belle2::TRGECLModule::event
virtual void event() override
Called event by event.
Definition: TRGECLModule.cc:175
Belle2::TRGECLModule::_mumuAngle
std::vector< double > _mumuAngle
mumu bit Angle
Definition: TRGECLModule.h:133
Belle2::TRGECLModule::_TotalEnergy
std::vector< double > _TotalEnergy
Total Energy Theshold (low, high, lum)
Definition: TRGECLModule.h:139