Belle II Software  release-06-02-00
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  addParam("Taub2b2AngleCut",
126  m_taub2b2AngleCut,
127  "set Taub2b2AngleCut(dphi low and high, theta sum low and high(degree))",
128  m_taub2b2AngleCut);
129  addParam("Taub2b2EtotCut",
130  m_taub2b2EtotCut,
131  "set Taub2b2 total energy cut in TC ThetaID 1-17(GeV)",
132  m_taub2b2EtotCut);
133  addParam("Taub2b2CLEEndcapCut",
134  m_taub2b2CLEEndcapCut,
135  "set Taub2b2 energy Cut (GeV) for cluseter in endcap (GeV) : ",
136  m_taub2b2CLEEndcapCut);
137  addParam("Taub2b2CLECut",
138  m_taub2b2CLECut,
139  "set Taub2b2 cluster energy Cut (GeV) : ",
140  m_taub2b2CLECut);
141 
142  _2DBhabhaThresholdFWD.clear();
143  _2DBhabhaThresholdBWD.clear();
145  _3DBhabhaVetoThreshold.clear();
146  _3DBhabhaSelectionAngle.clear();
147  _3DBhabhaVetoAngle.clear();
148  _mumuAngle.clear();
149  m_3DBhabhaAddAngleCut.clear();
150  m_taub2bAngleCut.clear();
151  m_taub2b2AngleCut.clear();
152 
153  _TotalEnergy.clear();
154  _LowMultiThreshold.clear();
155 
156  _TotalEnergy = {5, 10, 30}; // /100 MeV
157  _2DBhabhaThresholdFWD = {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 30, 35}; // /100 MeV
158  _2DBhabhaThresholdBWD = {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30}; // /100 MeV
159  _3DBhabhaVetoThreshold = {30, 45}; // /100 MeV
160  _3DBhabhaSelectionThreshold = {20, 40}; // /100 MeV
161  _3DBhabhaVetoAngle = {160, 200, 165, 190}; // /100 MeV
162  _3DBhabhaSelectionAngle = {140, 220, 160, 200}; // /100 MeV
163  _mumuThreshold = 20; //100 MeV
164  _mumuAngle = {160, 200, 165, 190}; // degree
165  m_3DBhabhaAddAngleCut = {150, 210, 160, 200}; // degree
166  _LowMultiThreshold = {10, 20, 25, 30}; // degree
167  _n300MeVCluster = 1;
168  _ECLBurstThreshold = 20;
169  m_3DBhabhaVetoInTrackThetaRegion = {3, 15};
170  m_EventTimingQualityThresholds = {0.5, 10}; // GeV
171  // taub2b
172  m_taub2bAngleCut = {110, 250, 130, 230}; // degree
173  m_taub2bEtotCut = 7; // GeV
174  m_taub2bClusterECut1 = 1.9; // GeV
175  m_taub2bClusterECut2 = 999; // GeV
176  // taub2b2
177  m_taub2b2AngleCut = {120, 240, 140, 220}; // degree
178  m_taub2b2EtotCut = 7.0; // GeV
179  m_taub2b2CLEEndcapCut = 3.0; // GeV
180  m_taub2b2CLECut = 0.162; // GeV
181 
182  if (TRGDebug::level()) {
183  std::cout << "TRGECLModule ... created" << std::endl;
184  }
185  }
186  //
187  //
188  //
190  {
191  if (TRGDebug::level()) {
192  std::cout << "TRGECLModule ... destructed " << std::endl;
193 
194  }
195  }
196  //
197  //
198  //
199  void
201  {
202 
204 
205  if (TRGDebug::level()) {
206  std::cout << "TRGECLModule::initialize ... options" << std::endl;
207  std::cout << TRGDebug::tab(4) << "debug level = " << TRGDebug::level()
208  << std::endl;
209  }
210  //
211  //
212  //
213  m_nRun = 0 ;
214  m_nEvent = 0 ;
215  m_hitNum = 0;
216  m_hitTCNum = 0;
217 
218  m_TRGECLHit.registerInDataStore();
219  m_TRGECLTrg.registerInDataStore();
220  m_TRGECLCluster.registerInDataStore();
221 
222  }
223  //
224  //
225  //
226  void
228  {
229  if (_ConditionDB == 1) {
230  for (const auto& para : m_ETMPara) {
231  _TotalEnergy = {(double)para.getELow(),
232  (double)para.getELow(),
233  (double)para.getELow()
234  };
235  for (int index = 0; index < 14; index ++) {
236  _2DBhabhaThresholdFWD.push_back((double)para.get2DBhabhaFWD(index));
237  _2DBhabhaThresholdBWD.push_back((double)para.get2DBhabhaBWD(index));
238  }
240  (double)para.get3DBhabhaVetoThreshold(0),
241  (double)para.get3DBhabhaVetoThreshold(1)
242  }; // /100 MeV
244  (double)para.get3DBhabhaSelectionThreshold(0),
245  (double)para.get3DBhabhaSelectionThreshold(1)
246  }; // /100 MeV
248  (double)para.get3DBhabhaVetoAngle(0),
249  (double)para.get3DBhabhaVetoAngle(1),
250  (double)para.get3DBhabhaVetoAngle(2),
251  (double)para.get3DBhabhaVetoAngle(3)
252  };
254  (double)para.get3DBhabhaSelectionAngle(0),
255  (double)para.get3DBhabhaSelectionAngle(1),
256  (double)para.get3DBhabhaSelectionAngle(2),
257  (double)para.get3DBhabhaSelectionAngle(3)
258  };
260  (double)(para.getmumuThreshold());
261  _mumuAngle = {
262  (double)para.getmumuAngle(0),
263  (double)para.getmumuAngle(1),
264  (double)para.getmumuAngle(2)
265  };
267  (double)para.getLowMultiThreshold(0),
268  (double)para.getLowMultiThreshold(1),
269  (double)para.getLowMultiThreshold(2),
270  (double)para.getLowMultiThreshold(3)
271  }; // /100 MeV
272  }
273  }
274 
275  B2INFO("[TRGECLModule] 3DBhabhaVetoInTrackThetaRegion (low : high) = ("
276  << m_3DBhabhaVetoInTrackThetaRegion[0] << " : "
277  << m_3DBhabhaVetoInTrackThetaRegion[1] << ")");
278 
279  B2INFO("[TRGECLModule] EventTimingQualityThresholds (low : high)= ("
280  << m_EventTimingQualityThresholds[0] << " : "
281  << m_EventTimingQualityThresholds[1] << ") (GeV)");
282 
283  B2INFO("[TRGECLModule] Taub2b two CL Angle cut in CM (degree) (dphi L, H, theta sum L, H ) = ("
284  << m_taub2bAngleCut[0] << ","
285  << m_taub2bAngleCut[1] << ","
286  << m_taub2bAngleCut[2] << ","
287  << m_taub2bAngleCut[3] << ")");
288  B2INFO("[TRGECLModule] Taub2b Total Energy Cut in lab. (GeV) = "
289  << m_taub2bEtotCut);
290  B2INFO("[TRGECLModule] Taub2b Cluster Energy Cut in lab. (GeV) : (E(CL1), E(CL2)) = ("
291  << m_taub2bClusterECut1 << ", "
292  << m_taub2bClusterECut2 << ")");
293  B2INFO("[TRGECLModule] Bhabha Add Angle cut in CM (degree) (dphi L, H, theta sum L, H) = ("
294  << m_3DBhabhaAddAngleCut[0] << ","
295  << m_3DBhabhaAddAngleCut[1] << ","
296  << m_3DBhabhaAddAngleCut[2] << ","
297  << m_3DBhabhaAddAngleCut[3] << ")");
298 
299  B2INFO("[TRGECLModule] Taub2b2 two CL Angle cut in CM (degree) (dphi L, H, theta sum L, H) = ("
300  << m_taub2b2AngleCut[0] << ","
301  << m_taub2b2AngleCut[1] << ","
302  << m_taub2b2AngleCut[2] << ","
303  << m_taub2b2AngleCut[3] << ")");
304  B2INFO("[TRGECLModule] Taub2b2 Total Energy Cut in lab. (GeV) = "
305  << m_taub2b2EtotCut);
306  B2INFO("[TRGECLModule] Taub2b2 Energy Cut in lab. for cluster in endcap (GeV) = "
307  << m_taub2b2CLEEndcapCut);
308  B2INFO("[TRGECLModule] Taub2b2 Cluster energy cut in lab. (GeV) = "
309  << m_taub2b2CLECut);
310 
311  if (TRGDebug::level()) {
312  std::cout << "TRGECLModule ... beginRun called " << std::endl;
313  }
314  // _ecl = TrgEcl::getTrgEcl();
315 
316  }
317  //
318  //
319  //
320  void
322  {
323 
324  if (TRGDebug::level()) {
325  std::cout << "TRGECLMoudle ... event called" << std::endl;
326  }
327  //
328  // simulation
329  //
330  TrgEclMaster* _ecl = new TrgEclMaster();
331 
332  _ecl->initialize(m_nEvent);
335  _ecl->setBhabhaMethod(_Bhabha);
337  _ecl->setTimeWindow(_TimeWindow);
339  _ecl->setNofTopTC(_NofTopTC);
346  _ecl->setmumuAngle(_mumuAngle);
347  _ecl->set3DBhabhaAddAngleCut(m_3DBhabhaAddAngleCut);
351  m_taub2bClusterECut2);
352  _ecl->setTaub2b2Cut(m_taub2b2AngleCut,
353  m_taub2b2EtotCut,
354  m_taub2b2CLEEndcapCut,
355  m_taub2b2CLECut);
360  _ecl->set3DBhabhaVetoInTrackThetaRegion(m_3DBhabhaVetoInTrackThetaRegion);
361  _ecl->setEventTimingQualityThresholds(m_EventTimingQualityThresholds);
362 
363  if (_SelectEvent == 0) {
364  _ecl->simulate01(m_nEvent);
365  } else if (_SelectEvent == 1) {
366  _ecl->simulate02(m_nEvent);
367  }
368  // printf("TRGECLModule> eventId = %d \n", m_nEvent);
369  //
370  //
371  m_nEvent++;
372  //
373  //
374  //
375  delete _ecl;
376  }
377  //
378  //
379  //
380  void
382  {
383  if (TRGDebug::level()) {
384  std::cout << "TRGECLModule ... endRun called " << std::endl;
385  }
386  }
387  //
388  //
389  //
390  void
392  {
393  if (TRGDebug::level()) {
394  std::cout << "TRGECLModule ... terminate called " << std::endl;
395  }
396  }
397  //
398  //
399  //
401 } // 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:167
double _mumuThreshold
mumu bit Energy Threshold
Definition: TRGECLModule.h:125
StoreArray< TRGECLTrg > m_TRGECLTrg
output for TRGECLTrg
Definition: TRGECLModule.h:163
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:165
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:161
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:188
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:145
void set3DBhabhaAddAngleCut(const std::vector< double > &i3DBhabhaAddAngleCut)
set 3D Bhabha addtion Angle selection
Definition: TrgEclMaster.h:140
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:150
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:183
void setmumuThreshold(int mumuThreshold)
set mumu bit Threshold
Definition: TrgEclMaster.h:133
void set2DBhabhaThreshold(const std::vector< double > &i2DBhabhaThresholdFWD, const std::vector< double > &i2DBhabhaThresholdBWD)
set 2D Bhabha Energy Threshold
Definition: TrgEclMaster.h:105
void set3DBhabhaVetoAngle(const std::vector< double > &i3DBhabhaVetoAngle)
set 3D veto Bhabha Energy Angle
Definition: TrgEclMaster.h:128
void set3DBhabhaSelectionAngle(const std::vector< double > &i3DBhabhaSelectionAngle)
set 3D selection Bhabha Energy Angle
Definition: TrgEclMaster.h:123
void set3DBhabhaSelectionThreshold(const std::vector< double > &i3DBhabhaSelectionThreshold)
set 3D selection Bhabha Energy Threshold
Definition: TrgEclMaster.h:112
void setECLBurstThreshold(int ECLBurstThreshold)
set mumu bit Threshold
Definition: TrgEclMaster.h:178
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:173
void set3DBhabhaVetoThreshold(const std::vector< double > &i3DBhabhaVetoThreshold)
set 3D veto Bhabha Energy Threshold
Definition: TrgEclMaster.h:117
void setmumuAngle(const std::vector< double > &imumuAngle)
set mumu bit Angle selection
Definition: TrgEclMaster.h:135
void setTaub2bClusterECut(double itaub2bClusterECut1, double itaub2bClusterECut2)
set tau b2b 1Cluster energy cut
Definition: TrgEclMaster.h:155
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.