Belle II Software  release-06-00-14
TRGECLModule.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 #define TRGECL_SHORT_NAMES
10 
11 #include <framework/core/ModuleParamList.templateDetails.h>
12 #include <framework/core/ModuleParamList.h>
13 
14 #include "trg/ecl/TrgEclMaster.h"
15 //trg package headers
16 #include "trg/trg/Debug.h"
17 #include "trg/ecl/modules/trgecl/TRGECLModule.h"
18 #include "trg/ecl/dbobjects/TRGECLETMPara.h"
19 
20 #include <iostream>
21 
22 using namespace std;
23 
24 namespace Belle2 {
29  //
30  //
32  REG_MODULE(TRGECL);
33  //
34  //
35  //
36  string
37  TRGECLModule::version() const
38  {
39  return string("TRGECLModule 1.00");
40  }
41  //
42  //
43  //
44  TRGECLModule::TRGECLModule():
45  Module::Module(), _debugLevel(0), _Bhabha(0),
46  _Clustering(1), _ClusterLimit(6), _EventTiming(1),
47  _TimeWindow(250.0), _OverlapWindow(125.0), _NofTopTC(3),
48  _SelectEvent(1), _ConditionDB(0), _mumuThreshold(20),
49  _n300MeVCluster(1), _ECLBurstThreshold(200)
50  {
51 
52  string desc = "TRGECLModule(" + version() + ")";
53  setDescription(desc);
55 
56  addParam("DebugLevel",
58  "TRGECL debug level",
59  _debugLevel);
60  addParam("Bhabha",
61  _Bhabha,
62  "TRGECL Bhabha method 0 : Belle I, 1 :belle II(defult)",
63  _Bhabha);
64  addParam("Clustering",
66  "TRGECL Clustering method 0 : use only ICN, 1 : ICN + Energy(Defult)",
67  _Clustering);
68  addParam("ClusterLimit",
70  "The Limit number of cluster (Defult:6)",
72  addParam("EventTiming",
74  "TRGECL EventTiming method 0 : Belle I, 1 : Energetic TC, 2 : Energy Weighted timing (defult)",
75  _EventTiming);
76  addParam("NofTopTC",
77  _NofTopTC,
78  "TRGECL # of considered TC in energy weighted Timing method(Only work for EvenTiming Method 2)",
79  _NofTopTC);
80  addParam("TimeWindow",
82  "TRGECL Trigger decision Time Window",
83  _TimeWindow);
84  addParam("OverlapWindow",
86  "TRGECL Trigger decision Time Window",
88  addParam("EventSelect",
90  "TRGECL Select one trigger window for logic study",
91  _SelectEvent);
92  addParam("ConditionDB",
94  "Flag to use Condition Database(Defult 0)",
95  _ConditionDB);
96  addParam("3DBhabhaVetoInTrackThetaRegion",
97  m_3DBhabhaVetoInTrackThetaRegion,
98  "set 3DBhabhaVetoInTrackThetaRegion (low TCID and high TCID)",
99  m_3DBhabhaVetoInTrackThetaRegion);
100  addParam("EventTimingQualityThresholds",
101  m_EventTimingQualityThresholds,
102  "set EventTimingQualityThresholds (low energy(GeV) and high energy(GeV))",
103  m_EventTimingQualityThresholds);
104  addParam("3DBhabhaAddAngleCut",
105  m_3DBhabhaAddAngleCut,
106  "set Angle Cut of Bhbaha Additional veto for hie (dphi low and high, theta sum low and high(degree)",
107  m_3DBhabhaAddAngleCut);
108  addParam("Taub2bAngleCut",
110  "set Taub2bAngleCut(dphi low and high, theta sum low and high(degree)",
112  addParam("Taub2bEtotCut",
114  "set Taub2b total energy cut in TC ThetaID 1-17(GeV)",
116  addParam("Taub2bClusterECut1",
118  "set Taub2b 1 cluster energy Cut (GeV) for CL1 : ",
120  addParam("Taub2bClusterECut2",
121  m_taub2bClusterECut2,
122  "set Taub2b 1 cluster energy Cut (GeV) for CL2 : ",
123  m_taub2bClusterECut2);
124 
125  _2DBhabhaThresholdFWD.clear();
126  _2DBhabhaThresholdBWD.clear();
128  _3DBhabhaVetoThreshold.clear();
129  _3DBhabhaSelectionAngle.clear();
130  _3DBhabhaVetoAngle.clear();
131  _mumuAngle.clear();
132  m_3DBhabhaAddAngleCut.clear();
133  m_taub2bAngleCut.clear();
134 
135  _TotalEnergy.clear();
136  _LowMultiThreshold.clear();
137 
138  _TotalEnergy = {5, 10, 30}; // /100 MeV
139  _2DBhabhaThresholdFWD = {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 30, 35}; // /100 MeV
140  _2DBhabhaThresholdBWD = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30}; // /100 MeV
141  _3DBhabhaVetoThreshold = {30, 45}; // /100 MeV
142  _3DBhabhaSelectionThreshold = {20, 40}; // /100 MeV
143  _3DBhabhaVetoAngle = {160, 200, 165, 190}; // /100 MeV
144  _3DBhabhaSelectionAngle = {140, 220, 160, 200}; // /100 MeV
145  _mumuThreshold = 20; //100 MeV
146  _mumuAngle = {160, 200, 165, 190}; // degree
147  m_3DBhabhaAddAngleCut = {150, 210, 160, 200}; // degree
148  _LowMultiThreshold = {10, 20, 25, 30}; // degree
149  _n300MeVCluster = 1;
150  _ECLBurstThreshold = 20;
151  m_3DBhabhaVetoInTrackThetaRegion = {3, 15};
152  m_EventTimingQualityThresholds = {0.5, 10}; // GeV
153  m_taub2bAngleCut = {110, 250, 130, 230}; // degree
154  m_taub2bEtotCut = 7; // GeV
155  m_taub2bClusterECut1 = 1.9; // GeV
156  m_taub2bClusterECut2 = 999; // GeV
157 
158  if (TRGDebug::level()) {
159  std::cout << "TRGECLModule ... created" << std::endl;
160  }
161  }
162  //
163  //
164  //
166  {
167  if (TRGDebug::level()) {
168  std::cout << "TRGECLModule ... destructed " << std::endl;
169 
170  }
171  }
172  //
173  //
174  //
175  void
177  {
178 
180 
181  if (TRGDebug::level()) {
182  std::cout << "TRGECLModule::initialize ... options" << std::endl;
183  std::cout << TRGDebug::tab(4) << "debug level = " << TRGDebug::level()
184  << std::endl;
185  }
186  //
187  //
188  //
189  m_nRun = 0 ;
190  m_nEvent = 0 ;
191  m_hitNum = 0;
192  m_hitTCNum = 0;
193 
194  m_TRGECLHit.registerInDataStore();
195  m_TRGECLTrg.registerInDataStore();
196  m_TRGECLCluster.registerInDataStore();
197 
198  }
199  //
200  //
201  //
202  void
204  {
205  if (_ConditionDB == 1) {
206  for (const auto& para : m_ETMPara) {
207  _TotalEnergy = {(double)para.getELow(),
208  (double)para.getELow(),
209  (double)para.getELow()
210  };
211  for (int index = 0; index < 14; index ++) {
212  _2DBhabhaThresholdFWD.push_back((double)para.get2DBhabhaFWD(index));
213  _2DBhabhaThresholdBWD.push_back((double)para.get2DBhabhaBWD(index));
214  }
216  (double)para.get3DBhabhaVetoThreshold(0),
217  (double)para.get3DBhabhaVetoThreshold(1)
218  }; // /100 MeV
220  (double)para.get3DBhabhaSelectionThreshold(0),
221  (double)para.get3DBhabhaSelectionThreshold(1)
222  }; // /100 MeV
224  (double)para.get3DBhabhaVetoAngle(0),
225  (double)para.get3DBhabhaVetoAngle(1),
226  (double)para.get3DBhabhaVetoAngle(2),
227  (double)para.get3DBhabhaVetoAngle(3)
228  };
230  (double)para.get3DBhabhaSelectionAngle(0),
231  (double)para.get3DBhabhaSelectionAngle(1),
232  (double)para.get3DBhabhaSelectionAngle(2),
233  (double)para.get3DBhabhaSelectionAngle(3)
234  };
236  (double)(para.getmumuThreshold());
237  _mumuAngle = {
238  (double)para.getmumuAngle(0),
239  (double)para.getmumuAngle(1),
240  (double)para.getmumuAngle(2)
241  };
243  (double)para.getLowMultiThreshold(0),
244  (double)para.getLowMultiThreshold(1),
245  (double)para.getLowMultiThreshold(2),
246  (double)para.getLowMultiThreshold(3)
247  }; // /100 MeV
248  }
249  }
250 
251  B2INFO("[TRGECLModule] 3DBhabhaVetoInTrackThetaRegion (low : high) = ("
252  << m_3DBhabhaVetoInTrackThetaRegion[0] << " : "
253  << m_3DBhabhaVetoInTrackThetaRegion[1] << ")");
254 
255  B2INFO("[TRGECLModule] EventTimingQualityThresholds (low : high)= ("
256  << m_EventTimingQualityThresholds[0] << " : "
257  << m_EventTimingQualityThresholds[1] << ") (GeV)");
258 
259  B2INFO("[TRGECLModule] Taub2b 2 CL Angle cut in CM (degree) (dphi L, H, theta sum L, H ) = ("
260  << m_taub2bAngleCut[0] << ","
261  << m_taub2bAngleCut[1] << ","
262  << m_taub2bAngleCut[2] << ","
263  << m_taub2bAngleCut[3] << ")");
264  B2INFO("[TRGECLModule] Taub2b Total Energy Cut in lab. (GeV) = "
265  << m_taub2bEtotCut);
266  B2INFO("[TRGECLModule] Taub2b Cluster Energy Cut in lab. (GeV) : (E(CL1), E(CL2)) = ("
267  << m_taub2bClusterECut1 << ", "
268  << m_taub2bClusterECut2 << ")");
269  B2INFO("[TRGECLModule] Bhabha Add Angle cut in CM (degree) (dphi L, H, theta sum L, H ) = ("
270  << m_3DBhabhaAddAngleCut[0] << ","
271  << m_3DBhabhaAddAngleCut[1] << ","
272  << m_3DBhabhaAddAngleCut[2] << ","
273  << m_3DBhabhaAddAngleCut[3] << ")");
274 
275  if (TRGDebug::level()) {
276  std::cout << "TRGECLModule ... beginRun called " << std::endl;
277  }
278  // _ecl = TrgEcl::getTrgEcl();
279 
280  }
281  //
282  //
283  //
284  void
286  {
287 
288  if (TRGDebug::level()) {
289  std::cout << "TRGECLMoudle ... event called" << std::endl;
290  }
291  //
292  // simulation
293  //
294  TrgEclMaster* _ecl = new TrgEclMaster();
295 
296  _ecl->initialize(m_nEvent);
299  _ecl->setBhabhaMethod(_Bhabha);
301  _ecl->setTimeWindow(_TimeWindow);
303  _ecl->setNofTopTC(_NofTopTC);
310  _ecl->setmumuAngle(_mumuAngle);
311  _ecl->set3DBhabhaAddAngleCut(m_3DBhabhaAddAngleCut);
314  _ecl->setTaub2bClusterECut(m_taub2bClusterECut1, m_taub2bClusterECut2);
319  _ecl->set3DBhabhaVetoInTrackThetaRegion(m_3DBhabhaVetoInTrackThetaRegion);
320  _ecl->setEventTimingQualityThresholds(m_EventTimingQualityThresholds);
321 
322  if (_SelectEvent == 0) {
323  _ecl->simulate01(m_nEvent);
324  } else if (_SelectEvent == 1) {
325  _ecl->simulate02(m_nEvent);
326  }
327  // printf("TRGECLModule> eventId = %d \n", m_nEvent);
328  //
329  //
330  m_nEvent++;
331  //
332  //
333  //
334  delete _ecl;
335  }
336  //
337  //
338  //
339  void
341  {
342  if (TRGDebug::level()) {
343  std::cout << "TRGECLModule ... endRun called " << std::endl;
344  }
345  }
346  //
347  //
348  //
349  void
351  {
352  if (TRGDebug::level()) {
353  std::cout << "TRGECLModule ... terminate called " << std::endl;
354  }
355  }
356  //
357  //
358  //
360 } // 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
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ 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:80
int _Clustering
Clustering option.
Definition: TRGECLModule.h:97
double _ECLBurstThreshold
ECL Burst Bit Threshold.
Definition: TRGECLModule.h:133
double m_taub2bEtotCut
taub2b total energy (TC theta ID =1-17) (GeV)
Definition: TRGECLModule.h:146
int _ConditionDB
Flag to use Condition DB.
Definition: TRGECLModule.h:111
int _debugLevel
Debug level.
Definition: TRGECLModule.h:65
int _ClusterLimit
Cluster Limit.
Definition: TRGECLModule.h:99
std::vector< int > m_taub2bAngleCut
taub2b 2 cluster angle cut (degree)
Definition: TRGECLModule.h:144
DBArray< TRGECLETMPara > m_ETMPara
ETN Parameters.
Definition: TRGECLModule.h:159
double _mumuThreshold
mumu bit Energy Threshold
Definition: TRGECLModule.h:125
StoreArray< TRGECLTrg > m_TRGECLTrg
output for TRGECLTrg
Definition: TRGECLModule.h:155
int m_hitNum
The current number of created hits in an event.
Definition: TRGECLModule.h:83
int m_hitTCNum
TC Hit number.
Definition: TRGECLModule.h:85
int _n300MeVCluster
The number of Cluster exceeding 300 MeV.
Definition: TRGECLModule.h:131
int _SelectEvent
Event selection.
Definition: TRGECLModule.h:109
int m_nRun
Run number.
Definition: TRGECLModule.h:91
std::vector< double > _TotalEnergy
Total Energy Theshold (low, high, lum)
Definition: TRGECLModule.h:135
std::vector< double > _mumuAngle
mumu bit Angle
Definition: TRGECLModule.h:127
std::vector< double > _3DBhabhaVetoThreshold
3D Veto Bhabha Energy Threshold
Definition: TRGECLModule.h:119
double _TimeWindow
Trigger decision time window.
Definition: TRGECLModule.h:103
std::vector< double > _LowMultiThreshold
Low Multiplicity Threshold.
Definition: TRGECLModule.h:137
int m_nEvent
Event number.
Definition: TRGECLModule.h:93
int _EventTiming
Eventtiming option.
Definition: TRGECLModule.h:101
int _Bhabha
Bhabha option.
Definition: TRGECLModule.h:95
std::vector< double > _3DBhabhaSelectionAngle
3D Selection Bhabha Energy Angle
Definition: TRGECLModule.h:121
std::vector< double > _2DBhabhaThresholdBWD
2D Bhabha Energy Threshold
Definition: TRGECLModule.h:115
StoreArray< TRGECLCluster > m_TRGECLCluster
output for TRGECLCluster
Definition: TRGECLModule.h:157
std::vector< double > _3DBhabhaSelectionThreshold
3D Selection Bhabha Energy Threshold
Definition: TRGECLModule.h:117
StoreArray< TRGECLHit > m_TRGECLHit
The number of Cluster exceeding 300 MeV.
Definition: TRGECLModule.h:153
double m_taub2bClusterECut1
taub2b Cluster energy selection (GeV)
Definition: TRGECLModule.h:148
double _OverlapWindow
Trigger decision overlap window in oder to avoid boundary effect.
Definition: TRGECLModule.h:105
std::vector< double > _2DBhabhaThresholdFWD
2D Bhabha Energy Threshold
Definition: TRGECLModule.h:113
std::vector< double > _3DBhabhaVetoAngle
3D Veto Bhabha Energy Angle
Definition: TRGECLModule.h:123
void setLowMultiplicityThreshold(const std::vector< double > &iLowMultiThreshold)
set Low Multiplicity Threshold
Definition: TrgEclMaster.h:176
void setNofTopTC(int noftoptc)
set # of considered TC in energy weighted Timing method
Definition: TrgEclMaster.h:90
void setBhabhaMethod(int bhabha)
Set Bhabha.
Definition: TrgEclMaster.h:82
void setTaub2bAngleCut(const std::vector< int > &itaub2bAngleCut)
set tau b2b 2 cluster angle cut
Definition: TrgEclMaster.h:144
void set3DBhabhaAddAngleCut(const std::vector< double > &i3DBhabhaAddAngleCut)
set 3D Bhabha addtion Angle selection
Definition: TrgEclMaster.h:139
void simulate02(int)
simulates ECL trigger for Data Analysis
void setTimeWindow(int timewindow)
Set Trigger Decision window size.
Definition: TrgEclMaster.h:86
void initialize(int)
initialize
void setEventTimingMethod(int EventTiming)
Set Cluster.
Definition: TrgEclMaster.h:84
void setTaub2bEtotCut(double itaub2bEtotCut)
set tau b2b total energy cut
Definition: TrgEclMaster.h:149
void setClusterLimit(int limit)
Set the limit # of Cluster.
Definition: TrgEclMaster.h:80
void setClusterMethod(int cluster)
Get Event timing.
Definition: TrgEclMaster.h:78
void setTotalEnergyThreshold(const std::vector< double > &iTotalEnergy)
set Total Energy Theshold (low, high, lum)
Definition: TrgEclMaster.h:171
void setmumuThreshold(int mumuThreshold)
set mumu bit Threshold
Definition: TrgEclMaster.h:132
void set2DBhabhaThreshold(const std::vector< double > &i2DBhabhaThresholdFWD, const std::vector< double > &i2DBhabhaThresholdBWD)
set 2D Bhabha Energy Threshold
Definition: TrgEclMaster.h:104
void set3DBhabhaVetoAngle(const std::vector< double > &i3DBhabhaVetoAngle)
set 3D veto Bhabha Energy Angle
Definition: TrgEclMaster.h:127
void set3DBhabhaSelectionAngle(const std::vector< double > &i3DBhabhaSelectionAngle)
set 3D selection Bhabha Energy Angle
Definition: TrgEclMaster.h:122
void set3DBhabhaSelectionThreshold(const std::vector< double > &i3DBhabhaSelectionThreshold)
set 3D selection Bhabha Energy Threshold
Definition: TrgEclMaster.h:111
void setECLBurstThreshold(int ECLBurstThreshold)
set mumu bit Threshold
Definition: TrgEclMaster.h:166
void simulate01(int)
simulates ECL trigger for Global Cosmic data
void setOverlapWindow(int overlapwindow)
Set Trigger Decision overlap window size.
Definition: TrgEclMaster.h:88
void setn300MeVClusterThreshold(int n300MeVCluster)
set the number of cluster exceeding 300 MeV
Definition: TrgEclMaster.h:161
void set3DBhabhaVetoThreshold(const std::vector< double > &i3DBhabhaVetoThreshold)
set 3D veto Bhabha Energy Threshold
Definition: TrgEclMaster.h:116
void setmumuAngle(const std::vector< double > &imumuAngle)
set mumu bit Angle selection
Definition: TrgEclMaster.h:134
void setTaub2bClusterECut(double itaub2bClusterECut1, double itaub2bClusterECut2)
set tau b2b 1Cluster energy cut
Definition: TrgEclMaster.h:154
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 ~TRGECLModule()
Destructor
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.
Definition: TRGECLModule.cc:37
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.