Belle II Software development
TRGEfficiencyDQMModule.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// Own include
10#include <trg/gdl/modules/trggdlDQM/TRGEfficiencyDQMModule.h>
11
12// Belle II headers
13#include <mdst/dataobjects/HitPatternCDC.h>
14
15// ROOT headers
16#include <cmath>
17#include <Math/Vector3D.h>
18#include <TVector3.h>
19#include <TDirectory.h>
20
21// C++ headers
22#include <cmath>
23#include <vector>
24
25
26using namespace Belle2;
27
28
29REG_MODULE(TRGEfficiencyDQM);
30
32{
33 setDescription("DQM module to calculcate the L1 trigger efficiency.");
35}
36
40
42{
43 TDirectory* oldDir = gDirectory;
44 oldDir->mkdir("TRGEFF");
45 oldDir->cd("TRGEFF");
46
47 m_hPhi = new TH1F("hPhi", "", 36, -180.0, 180.0);
48 m_hPhi_psnecl = new TH1F("hPhi_psnecl", "", 36, -180.0, 180.0);
49 m_hPhi_psnecl_ftdf = new TH1F("hPhi_psnecl_ftdf", "", 36, -180.0, 180.0);
50
51 m_hPt = new TH1F("hPt", "", 50, 0, 5);
52 m_hPt_psnecl = new TH1F("hPt_psnecl", "", 50, 0, 5);
53 m_hPt_psnecl_ftdf = new TH1F("hPt_psnecl_ftdf", "", 50, 0, 5);
54
55 m_nobha_f_phi = new TH1F("nobha_f_phi", "", 36, -180., 180.);
56 m_nobha_f_phi_psnecl = new TH1F("nobha_f_phi_psnecl", "", 36, -180., 180.);
57 m_nobha_f_phi_psnecl_ftdf = new TH1F("nobha_f_phi_psnecl_ftdf", "", 36, -180., 180.);
58
59 m_nobha_hPt = new TH1F("nobha_hPt", "", 50, 0, 5);
60 m_nobha_hPt_psnecl = new TH1F("nobha_hPt_psnecl", "", 50, 0, 5);
61 m_nobha_hPt_psnecl_ftdf = new TH1F("nobha_hPt_psnecl_ftdf", "", 50, 0, 5);
62
63 m_hP3_y = new TH1F("hP3_y", "", 50, 0, 5);
64 m_hP3_y_psnecl = new TH1F("hP3_y_psnecl", "", 50, 0, 5);
65 m_hP3_y_psnecl_ftdf = new TH1F("hP3_y_psnecl_ftdf", "", 50, 0, 5);
66
67 m_hP3_z = new TH1F("hP3_z", "", 50, 0, 5);
68 m_hP3_z_psnecl = new TH1F("hP3_z_psnecl", "", 50, 0, 5);
69 m_hP3_z_psnecl_ftdf = new TH1F("hP3_z_psnecl_ftdf", "", 50, 0, 5);
70
71 m_nobha_hP3_y = new TH1F("nobha_hP3_y", "", 50, 0, 5);
72 m_nobha_hP3_y_psnecl = new TH1F("nobha_hP3_y_psnecl", "", 50, 0, 5);
73 m_nobha_hP3_y_psnecl_ftdf = new TH1F("nobha_hP3_y_psnecl_ftdf", "", 50, 0, 5);
74
75 m_nobha_hP3_z = new TH1F("nobha_hP3_z", "", 50, 0, 5);
76 m_nobha_hP3_z_psnecl = new TH1F("nobha_hP3_z_psnecl", "", 50, 0, 5);
77 m_nobha_hP3_z_psnecl_ftdf = new TH1F("nobha_hP3_z_psnecl_ftdf", "", 50, 0, 5);
78
79 m_nobha_phi_y = new TH1F("nobha_phi_y", "", 36, -180., 180.);
80 m_nobha_phi_y_psnecl = new TH1F("nobha_phi_y_psnecl", "", 36, -180., 180.);
81 m_nobha_phi_y_psnecl_ftdf = new TH1F("nobha_phi_y_psnecl_ftdf", "", 36, -180., 180.);
82
83 m_nobha_phi_z = new TH1F("nobha_phi_z", "", 36, -180., 180.);
84 m_nobha_phi_z_psnecl = new TH1F("nobha_phi_z_psnecl", "", 36, -180., 180.);
85 m_nobha_phi_z_psnecl_ftdf = new TH1F("nobha_phi_z_psnecl_ftdf", "", 36, -180., 180.);
86
87 m_fyo_dphi = new TH1F("fyo_dphi", "", 18, 0., 180.);
88 m_fyo_dphi_psnecl = new TH1F("fyo_dphi_psnecl", "", 18, 0., 180.);
89 m_fyo_dphi_psnecl_ftdf = new TH1F("fyo_dphi_psnecl_ftdf", "", 18, 0., 180.);
90
91 m_nobha_fyo_dphi = new TH1F("nobha_fyo_dphi", "", 18, 0., 180.);
92 m_nobha_fyo_dphi_psnecl = new TH1F("nobha_fyo_dphi_psnecl", "", 18, 0., 180.);
93 m_nobha_fyo_dphi_psnecl_ftdf = new TH1F("nobha_fyo_dphi_psnecl_ftdf", "", 18, 0., 180.);
94
95 m_stt_phi = new TH1F("stt_phi", "", 36, -180., 180.);
96 m_stt_phi_psnecl = new TH1F("stt_phi_psnecl", "", 36, -180., 180.);
97 m_stt_phi_psnecl_ftdf = new TH1F("stt_phi_psnecl_ftdf", "", 36, -180., 180.);
98
99 m_stt_P3 = new TH1F("stt_P3", "", 50, 0, 5);
100 m_stt_P3_psnecl = new TH1F("stt_P3_psnecl", "", 50, 0, 5);
101 m_stt_P3_psnecl_ftdf = new TH1F("stt_P3_psnecl_ftdf", "", 50, 0, 5);
102
103 m_stt_theta = new TH1F("stt_theta", "", 18, 0, 180);
104 m_stt_theta_psnecl = new TH1F("stt_theta_psnecl", "", 18, 0, 180);
105 m_stt_theta_psnecl_ftdf = new TH1F("stt_theta_psnecl_ftdf", "", 18, 0, 180);
106
107 m_nobha_stt_phi = new TH1F("nobha_stt_phi", "", 36, -180., 180.);
108 m_nobha_stt_phi_psnecl = new TH1F("nobha_stt_phi_psnecl", "", 36, -180., 180.);
109 m_nobha_stt_phi_psnecl_ftdf = new TH1F("nobha_stt_phi_psnecl_ftdf", "", 36, -180., 180.);
110
111 m_nobha_stt_P3 = new TH1F("nobha_stt_P3", "", 50, 0, 5);
112 m_nobha_stt_P3_psnecl = new TH1F("nobha_stt_P3_psnecl", "", 50, 0, 5);
113 m_nobha_stt_P3_psnecl_ftdf = new TH1F("nobha_stt_P3_psnecl_ftdf", "", 50, 0, 5);
114
115 m_nobha_stt_theta = new TH1F("nobha_stt_theta", "", 18, 0, 180);
116 m_nobha_stt_theta_psnecl = new TH1F("nobha_stt_theta_psnecl", "", 18, 0, 180);
117 m_nobha_stt_theta_psnecl_ftdf = new TH1F("nobha_stt_theta_psnecl_ftdf", "", 18, 0, 180);
118
119 m_hie_E = new TH1F("hie_E", "", 60, 0, 12);
120 m_hie_E_psnecl = new TH1F("hie_E_psnecl", "", 60, 0, 12);
121 m_hie_E_psnecl_ftdf = new TH1F("hie_E_psnecl_ftdf", "", 60, 0, 12);
122
123 m_nobha_hie_E = new TH1F("nobha_hie_E", "", 60, 0, 12);
124 m_nobha_hie_E_psnecl = new TH1F("nobha_hie_E_psnecl", "", 60, 0, 12);
125 m_nobha_hie_E_psnecl_ftdf = new TH1F("nobha_hie_E_psnecl_ftdf", "", 60, 0, 12);
126
127 m_ecltiming_E = new TH1F("ecltiming_E", "", 60, 0, 12);
128 m_ecltiming_E_psnecl = new TH1F("ecltiming_E_psnecl", "", 60, 0, 12);
129 m_ecltiming_E_psnecl_ftdf = new TH1F("ecltiming_E_psnecl_ftdf", "", 60, 0, 12);
130
131 m_ecltiming_theta = new TH1F("ecltiming_theta", "", 18, 0, 180);
132 m_ecltiming_theta_psnecl = new TH1F("ecltiming_theta_psnecl", "", 18, 0, 180);
133 m_ecltiming_theta_psnecl_ftdf = new TH1F("ecltiming_theta_psnecl_ftdf", "", 18, 0, 180);
134
135 m_ecltiming_phi = new TH1F("ecltiming_phi", "", 36, -180., 180.);
136 m_ecltiming_phi_psnecl = new TH1F("ecltiming_phi_psnecl", "", 36, -180., 180.);
137 m_ecltiming_phi_psnecl_ftdf = new TH1F("ecltiming_phi_psnecl_ftdf", "", 36, -180., 180.);
138
139 m_klmhit_phi = new TH1F("klmhit_phi", "", 18, -180., 180.);
140 m_klmhit_phi_psnecl = new TH1F("klmhit_phi_psnecl", "", 18, -180., 180.);
141 m_klmhit_phi_psnecl_ftdf = new TH1F("klmhit_phi_psnecl_ftdf", "", 18, -180., 180.);
142
143 m_klmhit_theta = new TH1F("klmhit_theta", "", 18, 0, 180);
144 m_klmhit_theta_psnecl = new TH1F("klmhit_theta_psnecl", "", 18, 0, 180);
145 m_klmhit_theta_psnecl_ftdf = new TH1F("klmhit_theta_psnecl_ftdf", "", 18, 0, 180);
146
147 m_eklmhit_phi = new TH1F("eklmhit_phi", "", 18, -180., 180.);
148 m_eklmhit_phi_psnecl = new TH1F("eklmhit_phi_psnecl", "", 18, -180., 180.);
149 m_eklmhit_phi_psnecl_ftdf = new TH1F("eklmhit_phi_psnecl_ftdf", "", 18, -180., 180.);
150
151 m_eklmhit_theta = new TH1F("eklmhit_theta", "", 18, 0, 180);
152 m_eklmhit_theta_psnecl = new TH1F("eklmhit_theta_psnecl", "", 18, 0, 180);
153 m_eklmhit_theta_psnecl_ftdf = new TH1F("eklmhit_theta_psnecl_ftdf", "", 18, 0, 180);
154
155 oldDir->cd();
156}
157
159{
160 REG_HISTOGRAM
161}
162
164{
165 if (!m_Tracks.isOptional()) {
166 B2WARNING("Tracks array not available, but required to estimate the trigger efficiency");
167 return;
168 }
169 if (!m_ECLClusters.isOptional()) {
170 B2WARNING("ECLClusters array not available, but required to estimate the trigger efficiency");
171 return;
172 }
173 if (!m_KLMClusters.isOptional()) {
174 B2WARNING("KLMClusters array not available, but required to estimate the trigger efficiency");
175 return;
176 }
177 if (!m_TrgSummary.isValid()) {
178 B2WARNING("TRGSummary object not available but required to estimate the trigger efficiency");
179 return;
180 }
181 if (!m_HltResult.isValid()) {
182 B2WARNING("SoftwareTriggerResult object not available but required to get the HLT result");
183 return;
184 }
185
186 bool hltAccepted = false;
187 if (m_HltResult) {
188 try {
189 hltAccepted = (m_HltResult->getResult("software_trigger_cut&filter&total_result") == SoftwareTriggerCutResult::c_accept)
190 ?
191 true : false;
192 } catch (const std::out_of_range&) {
193 hltAccepted = false;
194 }
195 }
196
197 if (not hltAccepted) {
198 B2WARNING("TRGEfficiencyDQMModule: Event rejected by the HLT filter, skipping the module");
199 return;
200 }
201
205
206 // calculate the total energy
207 double E_ecl_all = 0; // the ECL total energy
208 double E_ecl_hie = 0; // the ECL total energy in the hie "acceptance"
209
210 bool trg_hie_psncdc = 0; // for ECL energy trigger, for hie
211 bool trg_hie_Eecl = 0; // for ECL energy trigger, for hie
212 bool trg_ecltiming_psncdc = 0; // for ECL energy trigger, for ecltiming
213 bool trg_ecltiming_Eecl = 0; // for ECL energy trigger. for ecltiming
214 bool trg_nobha_hie_Eecl = 0;
215
216 for (const auto& b2eclcluster : m_ECLClusters) {
217
218 if (!(b2eclcluster.hasHypothesis(ECLCluster::EHypothesisBit::c_nPhotons))) continue;
219
220 const double phi = b2eclcluster.getPhi() / Unit::deg;
221 const double theta = b2eclcluster.getTheta() / Unit::deg;
222 const double energy = b2eclcluster.getEnergyRaw();
223
224 if (energy < 0.1) continue;
225
226 E_ecl_all += energy;
227 // the ECL total energy in the thetaID range 2<=ThetaID<=15 (corresponds to 22.49<=theta<=126.80) for ehigh bit
228 if (theta >= 22.49 && theta <= 126.8) {
229 E_ecl_hie += energy;
230 }
231
232 const bool trg_psncdc = m_TrgSummary->testPsnm("ffy") || m_TrgSummary->testPsnm("fyo") || m_TrgSummary->testPsnm("stt");
233 const bool trg_hie = m_TrgSummary->testFtdl("hie");
234 const bool trg_hie_nobha = m_TrgSummary->testInput("ehigh"); // remove the bha_veto for hie bit
235 const bool trg_ecltiming = m_TrgSummary->testFtdl("ecltiming");
236
237 m_ecltiming_theta->Fill(theta);
238 m_ecltiming_phi->Fill(phi);
239
240 if (trg_psncdc) {
241 trg_hie_psncdc = 1;
242 trg_ecltiming_psncdc = 1;
243
244 m_ecltiming_theta_psnecl->Fill(theta);
245 m_ecltiming_phi_psnecl->Fill(phi);
246 }
247
248 if (trg_psncdc && trg_hie) {
249 trg_hie_Eecl = 1;
250 }
251 if (trg_psncdc && trg_hie_nobha) {
252 trg_nobha_hie_Eecl = 1;
253 }
254 if (trg_psncdc && trg_ecltiming) {
255 trg_ecltiming_Eecl = 1;
256
257 m_ecltiming_theta_psnecl_ftdf->Fill(theta);
258 m_ecltiming_phi_psnecl_ftdf->Fill(phi);
259 }
260 }
261
262 // sum of the ECL total energy
263 m_hie_E->Fill(E_ecl_hie);
264 m_nobha_hie_E->Fill(E_ecl_hie);
265 if (trg_hie_psncdc) {
266 m_hie_E_psnecl->Fill(E_ecl_hie);
267 m_nobha_hie_E_psnecl->Fill(E_ecl_hie);
268 }
269 if (trg_hie_Eecl) {
270 m_hie_E_psnecl_ftdf->Fill(E_ecl_hie);
271 }
272 if (trg_nobha_hie_Eecl) {
273 m_nobha_hie_E_psnecl_ftdf->Fill(E_ecl_hie);
274 }
275
276 m_ecltiming_E->Fill(E_ecl_all);
277 if (trg_ecltiming_psncdc) {
278 m_ecltiming_E_psnecl->Fill(E_ecl_all);
279 }
280 if (trg_ecltiming_Eecl) {
281 m_ecltiming_E_psnecl_ftdf->Fill(E_ecl_all);
282 }
283
287 for (const auto& b2klmcluster : m_KLMClusters) {
288 const int nlayer = b2klmcluster.getLayers();
289
290 if (nlayer <= 6)
291 continue;
292
293 const double phi = b2klmcluster.getMomentum().Phi() / Unit::deg;
294 const double theta = b2klmcluster.getMomentum().Theta() / Unit::deg;
295
296 bool trg_KLMecl = m_TrgSummary->testPsnm("hie") || m_TrgSummary->testPsnm("c4") || m_TrgSummary->testPsnm("eclmumu") ||
297 m_TrgSummary->testPsnm("lml1") || m_TrgSummary->testPsnm("lml2") || m_TrgSummary->testPsnm("lml6") ||
298 m_TrgSummary->testPsnm("lml7") || m_TrgSummary->testPsnm("lml8") || m_TrgSummary->testPsnm("lml9") ||
299 m_TrgSummary->testPsnm("lml10");
300 // these trigger flags are not available in older data
301 try {
302 trg_KLMecl |= m_TrgSummary->testPsnm("ecltaub2b3") || m_TrgSummary->testPsnm("hie4");
303 } catch (const std::exception&) {
304 }
305
306 const bool trg_klmhit = m_TrgSummary->testFtdl("klmhit");
307 const bool trg_eklmhit = m_TrgSummary->testFtdl("eklmhit");
308
309 m_klmhit_phi->Fill(phi);
310 m_klmhit_theta->Fill(theta);
311 m_eklmhit_phi->Fill(phi);
312 m_eklmhit_theta->Fill(theta);
313
314 if (trg_KLMecl) {
315 m_klmhit_theta_psnecl->Fill(theta);
316 m_eklmhit_theta_psnecl->Fill(theta);
317 }
318 if (trg_KLMecl && trg_klmhit) {
319 m_klmhit_theta_psnecl_ftdf->Fill(theta);
320 }
321 if (trg_KLMecl && trg_eklmhit) {
322 m_eklmhit_theta_psnecl_ftdf->Fill(theta);
323 }
324
325 // add theta cut for phi distribution, since the efficiency at some theta range is very low.
326 if (trg_KLMecl && theta > 50 && theta < 120) {
327 m_klmhit_phi_psnecl->Fill(phi);
328 }
329 if (trg_KLMecl && ((theta > 20 && theta < 40) || (theta > 120 && theta < 160))) {
330 m_eklmhit_phi_psnecl->Fill(phi);
331 }
332 if (trg_KLMecl && trg_klmhit && theta > 50 && theta < 120) {
333 m_klmhit_phi_psnecl_ftdf->Fill(phi);
334 }
335 if (trg_KLMecl && trg_eklmhit && ((theta > 20 && theta < 40) || (theta > 120 && theta < 160))) {
336 m_eklmhit_phi_psnecl_ftdf->Fill(phi);
337 }
338 }
339
343
344 std::vector<double> p_stt_P3_psnecl_ftdf, p_stt_P3_psnecl, p_stt_P3, phi_fyo_dphi, phi_fyo_dphi_psnecl, phi_fyo_dphi_psnecl_ftdf ;
345
346 std::vector<double> p_nobha_stt_P3_psnecl_ftdf, p_nobha_stt_P3_psnecl, p_nobha_stt_P3, phi_nobha_fyo_dphi,
347 phi_nobha_fyo_dphi_psnecl,
348 phi_nobha_fyo_dphi_psnecl_ftdf ;
349
350 int nitrack = 0; // the i track of the m_Tracks
351 for (const auto& b2track : m_Tracks) {
352 const Belle2::TrackFitResult* fitresult = b2track.getTrackFitResultWithClosestMass(Const::pion);
353 if (!fitresult) {
354 B2WARNING("No track fit result found.");
355 nitrack++;
356 continue;
357 }
358
359 // require high NDF track
360 const int ndf = fitresult->getNDF();
361 if (ndf < 20) {
362 nitrack++;
363 continue;
364 }
365
366 // IP tracks at barrel
367 if (std::abs(fitresult->getD0()) < 1.0 && std::abs(fitresult->getZ0()) < 1.0 && fitresult->getHitPatternCDC().getLastLayer() > 50
368 && fitresult->getHitPatternCDC().getFirstLayer() < 5) {
369 const double phi = fitresult->getPhi() / Unit::deg;
370 const double pt = fitresult->getTransverseMomentum();
371 const double p3 = fitresult->getMomentum().R(); // 3-momentum
372 const double theta = fitresult->getMomentum().Theta() / Unit::deg;
373
374 bool trg_psnecl = m_TrgSummary->testPsnm("hie") || m_TrgSummary->testPsnm("c4") || m_TrgSummary->testPsnm("eclmumu") ||
375 m_TrgSummary->testPsnm("lml1") || m_TrgSummary->testPsnm("lml2") || m_TrgSummary->testPsnm("lml6") ||
376 m_TrgSummary->testPsnm("lml7") || m_TrgSummary->testPsnm("lml8") || m_TrgSummary->testPsnm("lml9") ||
377 m_TrgSummary->testPsnm("lml10");
378 // these trigger flags are not available in older data
379 try {
380 trg_psnecl |= m_TrgSummary->testPsnm("ecltaub2b3") || m_TrgSummary->testPsnm("hie4");
381 } catch (const std::exception&) {
382 }
383
384 const bool trg_ftdf = m_TrgSummary->testFtdl("f");
385
386 // for f bit, reomove the Bhabha_veto
387 const bool trg_itdt2 = (m_TrgSummary->testInput("t2_0") || m_TrgSummary->testInput("t2_1") || m_TrgSummary->testInput("t2_2")
388 || m_TrgSummary->testInput("t2_3"));
389
390 // for z, reomove the Bhabha_veto
391 const bool trg_itdt3 = (m_TrgSummary->testInput("t3_0") || m_TrgSummary->testInput("t3_1") || m_TrgSummary->testInput("t3_2")
392 || m_TrgSummary->testInput("t3_3"));
393
394 // for y, reomove the Bhabha_veto
395 const bool trg_itdt4 = (m_TrgSummary->testInput("ty_0") || m_TrgSummary->testInput("ty_1") || m_TrgSummary->testInput("ty_2")
396 || m_TrgSummary->testInput("ty_3"));
397
398 // (t3>0 and !bhaveto and !veto) for z
399 const bool trg_ftdz = m_TrgSummary->testFtdl("z");
400
401 // (ty>0 and !bhaveto and !veto) for y
402 const bool trg_ftdy = m_TrgSummary->testFtdl("y");
403
404 // typ and !bha veto and !veto
405 const bool trg_stt = m_TrgSummary->testFtdl("stt");
406
407 // remove bha_veto
408 const bool trg_stt_nobha = m_TrgSummary->testInput("typ") ;
409
410 // require pt > 0.3 GeV
411 if (pt > 0.3) {
412 m_hPhi->Fill(phi);
413 if (trg_psnecl) {
414 m_hPhi_psnecl->Fill(phi);
415 }
416 if (trg_psnecl && trg_ftdf) {
417 m_hPhi_psnecl_ftdf->Fill(phi);
418 }
419 }
420
421 m_hPt->Fill(pt);
422 m_nobha_hPt->Fill(pt);
423 m_nobha_f_phi->Fill(phi);
424
425 m_hP3_z->Fill(p3);
426 m_hP3_y->Fill(p3);
427
428 m_nobha_hP3_z->Fill(p3);
429 m_nobha_hP3_y->Fill(p3);
430
431 m_nobha_phi_z->Fill(phi);
432 m_nobha_phi_y->Fill(phi);
433
434 m_stt_theta->Fill(theta);
435 m_stt_phi->Fill(phi);
436 p_stt_P3.push_back(p3);
437
438 m_nobha_stt_theta->Fill(theta);
439 m_nobha_stt_phi->Fill(phi);
440 p_nobha_stt_P3.push_back(p3);
441
442
443 if (trg_psnecl) {
444 m_hPt_psnecl->Fill(pt);
445 m_nobha_hPt_psnecl->Fill(pt);
446 m_nobha_f_phi_psnecl->Fill(phi);
447
448 m_hP3_z_psnecl->Fill(p3); // for z bit
449 m_hP3_y_psnecl->Fill(p3); // for y bit
450
451 m_nobha_hP3_z_psnecl->Fill(p3); // remove bhabha veto for z bit
452 m_nobha_hP3_y_psnecl->Fill(p3); // remove bhabha veto for y bit
453
454 m_nobha_phi_z_psnecl->Fill(phi);
455 m_nobha_phi_y_psnecl->Fill(phi);
456
457 m_stt_phi_psnecl->Fill(phi);
458 p_stt_P3_psnecl.push_back(p3);
459 m_stt_theta_psnecl->Fill(theta);
460
461 m_nobha_stt_phi_psnecl->Fill(phi);
462 p_nobha_stt_P3_psnecl.push_back(p3);
463 m_nobha_stt_theta_psnecl->Fill(theta);
464 }
465
466 if (trg_psnecl && trg_ftdf) {
467 m_hPt_psnecl_ftdf->Fill(pt);
468 }
469 if (trg_psnecl && trg_itdt2) {
470 m_nobha_hPt_psnecl_ftdf->Fill(pt);
471 m_nobha_f_phi_psnecl_ftdf->Fill(phi);
472 }
473
474 if (trg_psnecl && trg_ftdz) {
475 m_hP3_z_psnecl_ftdf->Fill(p3);
476 }
477 if (trg_psnecl && trg_ftdy) {
478 m_hP3_y_psnecl_ftdf->Fill(p3);
479 }
480 if (trg_psnecl && trg_itdt3) {
481 m_nobha_hP3_z_psnecl_ftdf->Fill(p3);
482 m_nobha_phi_z_psnecl_ftdf->Fill(phi);
483 }
484 if (trg_psnecl && trg_itdt4) {
485 m_nobha_hP3_y_psnecl_ftdf->Fill(p3);
486 m_nobha_phi_y_psnecl_ftdf->Fill(phi);
487 }
488
489 if (trg_psnecl && trg_stt) {
490 m_stt_phi_psnecl_ftdf->Fill(phi);
491 p_stt_P3_psnecl_ftdf.push_back(p3);
492 m_stt_theta_psnecl_ftdf->Fill(theta);
493 }
494 if (trg_psnecl && trg_stt_nobha) {
495 m_nobha_stt_phi_psnecl_ftdf->Fill(phi);
496 p_nobha_stt_P3_psnecl_ftdf.push_back(p3);
497 m_nobha_stt_theta_psnecl_ftdf->Fill(theta);
498 }
499
500 // the following is for fyo \deleta_phi
501 int njtrack = 0; // the j track of the m_Tracks
502 for (const auto& j_b2track : m_Tracks) {
503 if (nitrack >= njtrack) {
504 njtrack++;
505 continue;
506 }
507
508 const Belle2::TrackFitResult* jfitresult = j_b2track.getTrackFitResultWithClosestMass(Const::pion);
509 if (!jfitresult) {
510 B2WARNING("No track fit result found.");
511 njtrack++;
512 continue;
513 }
514
515 // require high NDF track
516 int jndf = jfitresult->getNDF();
517 if (jndf < 20) {
518 njtrack++;
519 continue;
520 }
521
522 // IP tracks at barrel
523 if (std::abs(jfitresult->getD0()) < 1.0 && std::abs(jfitresult->getZ0()) < 1.0 && jfitresult->getHitPatternCDC().getLastLayer() > 50
524 && jfitresult->getHitPatternCDC().getFirstLayer() < 5) {
525 const double jrk_phi = jfitresult->getPhi() / Unit::deg;
526 const double delta_phi = std::abs(phi - jrk_phi);
527 const double dphi = (delta_phi > 180) ? 360 - delta_phi : delta_phi;
528
529 const bool trg_fyo = m_TrgSummary->testFtdl("fyo");
530 const bool trg_fyo_nobha = (m_TrgSummary->testInput("t2_1") || m_TrgSummary->testInput("t2_2")
531 || m_TrgSummary->testInput("t2_3"))
532 &&
533 (m_TrgSummary->testInput("ty_0") || m_TrgSummary->testInput("ty_1") || m_TrgSummary->testInput("ty_2")
534 || m_TrgSummary->testInput("ty_3"))
535 &&
536 m_TrgSummary->testInput("cdc_open90");
537
538 phi_fyo_dphi.push_back(dphi);
539 phi_nobha_fyo_dphi.push_back(dphi);
540
541 if (trg_psnecl) {
542 phi_fyo_dphi_psnecl.push_back(dphi);
543 phi_nobha_fyo_dphi_psnecl.push_back(dphi);
544 }
545 if (trg_psnecl && trg_fyo) {
546 phi_fyo_dphi_psnecl_ftdf.push_back(dphi);
547 }
548 if (trg_psnecl && trg_fyo_nobha) {
549 phi_nobha_fyo_dphi_psnecl_ftdf.push_back(dphi);
550 }
551 }
552 njtrack++;
553 }
554 }
555 nitrack++;
556 }
557
558 // the largest cdc_open angle in an event for fyo bit
559 if (phi_fyo_dphi_psnecl_ftdf.size() != 0) {
560 const auto max_it = std::max_element(phi_fyo_dphi_psnecl_ftdf.begin(), phi_fyo_dphi_psnecl_ftdf.end());
561 const double max_value = *max_it;
562 m_fyo_dphi_psnecl_ftdf->Fill(max_value);
563 }
564 if (phi_fyo_dphi_psnecl.size() != 0) {
565 const auto max_it = std::max_element(phi_fyo_dphi_psnecl.begin(), phi_fyo_dphi_psnecl.end());
566 const double max_value = *max_it;
567 m_fyo_dphi_psnecl->Fill(max_value);
568 }
569 if (phi_fyo_dphi.size() != 0) {
570 const auto max_it = std::max_element(phi_fyo_dphi.begin(), phi_fyo_dphi.end());
571 const double max_value = *max_it;
572 m_fyo_dphi->Fill(max_value);
573 }
574
575 //
576 if (phi_nobha_fyo_dphi_psnecl_ftdf.size() != 0) {
577 const auto max_it = std::max_element(phi_nobha_fyo_dphi_psnecl_ftdf.begin(), phi_nobha_fyo_dphi_psnecl_ftdf.end());
578 const double max_value = *max_it;
579 m_nobha_fyo_dphi_psnecl_ftdf->Fill(max_value);
580 }
581 if (phi_nobha_fyo_dphi_psnecl.size() != 0) {
582 const auto max_it = std::max_element(phi_nobha_fyo_dphi_psnecl.begin(), phi_nobha_fyo_dphi_psnecl.end());
583 const double max_value = *max_it;
584 m_nobha_fyo_dphi_psnecl->Fill(max_value);
585 }
586 if (phi_nobha_fyo_dphi.size() != 0) {
587 const auto max_it = std::max_element(phi_nobha_fyo_dphi.begin(), phi_nobha_fyo_dphi.end());
588 const double max_value = *max_it;
589 m_nobha_fyo_dphi->Fill(max_value);
590 }
591
592 // the largest momentum track p in an event for stt bit
593 if (p_stt_P3_psnecl_ftdf.size() != 0) {
594 const auto max_it = std::max_element(p_stt_P3_psnecl_ftdf.begin(), p_stt_P3_psnecl_ftdf.end());
595 const double max_value = *max_it;
596 m_stt_P3_psnecl_ftdf->Fill(max_value);
597 }
598 if (p_stt_P3_psnecl.size() != 0) {
599 const auto max_it = std::max_element(p_stt_P3_psnecl.begin(), p_stt_P3_psnecl.end());
600 const double max_value = *max_it;
601 m_stt_P3_psnecl->Fill(max_value);
602 }
603 if (p_stt_P3.size() != 0) {
604 const auto max_it = std::max_element(p_stt_P3.begin(), p_stt_P3.end());
605 const double max_value = *max_it;
606 m_stt_P3->Fill(max_value);
607 }
608
609 //
610 if (p_nobha_stt_P3_psnecl_ftdf.size() != 0) {
611 const auto max_it = std::max_element(p_nobha_stt_P3_psnecl_ftdf.begin(), p_nobha_stt_P3_psnecl_ftdf.end());
612 const double max_value = *max_it;
613 m_nobha_stt_P3_psnecl_ftdf->Fill(max_value);
614 }
615 if (p_nobha_stt_P3_psnecl.size() != 0) {
616 const auto max_it = std::max_element(p_nobha_stt_P3_psnecl.begin(), p_nobha_stt_P3_psnecl.end());
617 const double max_value = *max_it;
618 m_nobha_stt_P3_psnecl->Fill(max_value);
619 }
620 if (p_nobha_stt_P3.size() != 0) {
621 const auto max_it = std::max_element(p_nobha_stt_P3.begin(), p_nobha_stt_P3.end());
622 const double max_value = *max_it;
623 m_nobha_stt_P3->Fill(max_value);
624 }
625
626}
static const ChargedStable pion
charged pion particle
Definition Const.h:661
@ c_nPhotons
CR is split into n photons (N1)
Definition ECLCluster.h:41
HistoModule()
Constructor.
Definition HistoModule.h:32
short getLastLayer() const
Returns the index of the last layer with a hit.
short getFirstLayer() const
Returns the index of the first layer with a hit.
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
void initialize() override
Initialize the Module.
TH1F * m_hPhi_psnecl_ftdf
Histogram of cdc phi of IP tracks with ecl and f bit.
void event() override
Event processor.
StoreObjPtr< SoftwareTriggerResult > m_HltResult
HLT result.
TH1F * m_hPhi_psnecl
Histogram of cdc phi of IP tracks with ecl bit.
StoreArray< ECLCluster > m_ECLClusters
ECL Clusters.
TH1F * m_hPhi
Histogram of cdc phi of IP tracks.
StoreArray< KLMCluster > m_KLMClusters
KLM Clusters.
StoreObjPtr< TRGSummary > m_TrgSummary
Trigger summary.
StoreArray< Track > m_Tracks
Tracks.
void defineHisto() override
Histogram definitions.
Values of the result of a track fit with a given particle hypothesis.
float getNDF() const
Getter for number of degrees of freedom of the track fit.
double getPhi() const
Getter for phi0 with CDF naming convention.
double getD0() const
Getter for d0.
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
double getZ0() const
Getter for z0.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
HitPatternCDC getHitPatternCDC() const
Getter for the hit pattern in the CDC;.
static const double deg
degree to radians
Definition Unit.h:109
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition Module.h:649
Abstract base class for different kinds of events.