Belle II Software development
TrgEclMaster.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//---------------------------------------------------------------
10// Description : A class to represent TRG ECL
11//---------------------------------------------------------------------------------
12//
13// ECL trigger bit
14// ---------------------------------------------------------------------------------
15// Variable(in Tsim) | N(bit) | Address | Parameter
16// -------------------------------------- ------------------------------------------
17// | 1 | 0 | TRG(Hit or not)
18// | 7 | 7 downto 1 | Timing (LSB = 1 ns )
19// m_Triggerbit[0] | 7 | 14 downto 8 | Revoclk from FAM (LSB = 125 ns)
20// (upto 12th | 3 | 17 downto 15 | ECL-TRG Timing Source
21// bhabha bit) | 1 | 18 | Physics TRG
22// (32bit) | 1 | 19 | Belle type Bhabha
23// ------------------| 14 | 33 downto 20 | Bhabha Type
24// | 13 | 46 downto 34 | Total Energy
25// | 1 | 47 | E low (Etot >0.5 GeV)
26// | 1 | 48 | E High (Etot > 1.0 GeV)
27// m_Triggerbit[1] | 1 | 49 | E lom (Etot > 3.0 GeV)
28// | 7 | 56 dwonto 50 | ICN
29// | 3 | 59 downto 57 | BG veto
30// | 1 | 60 | Cluster Overflow
31// | 1 | 61 | 3D Bhabha Trigger for Veto
32// | 1 | 62 | (lml0) N Cluster >= 3, at least one Cluster >300 MeV (LAB), not 3D ECL Bhabha
33// _________________ | 1 | 63 | (lml1) one Cluster >= 2GeV(CM) with Theta Id = 4~14
34// | 1 | 64 | (lml2) one Cluster >= 2GeV(CM) with Theta Id = 2,3,15 or 16 and not a 3D ECL Bhabha
35// | 1 | 65 | (lml3) one Cluster >= 2GeV(CM) with Theta Id = 2, 3, 15 or 16 and not a 3D ECL Bhabha
36// | 1 | 66 | (lml4) one Cluster >= 2GeV(CM) with Theta Id = 1 or 17 and not a 3D ECL Bhabha
37// | 1 | 67 | (lml5) one Cluster >= 2GeV(CM) with Theta Id = 1 or 17 and a 3D ECL Bhabha
38// m_Triggerbit[2] | 1 | 68 | (lml6) exactly one Cluster >= 1GeV(CM) and one Cluster > 300 MeV (LAB ), in Theta Id 4~15(Barrel)
39// | 1 | 69 | (lml7) exactly one Cluster >= 1GeV(CM) and one Cluster > 300 MeV (LAB), in Theta Id 2, 3 or 16
40// | 1 | 70 | (lml8) 170 < delta phi(CM) < 190 degree, both Clusters > 250 MeV (LAB), and no 2GeV (CM) Cluster
41// | 1 | 71 | (lml9) 170 < delta phi(CM) < 190 degree, one Cluster < 250 MeV (LAB), the other Cluster > 250 MeV(LAB), and no 2GeV (CM) Cluster
42// | 1 | 72 | (lml10) 160 < delta phi(CM) < 200 degree, 160 < Sum Theta (CM)< 200 degree, no 2 GeV(CM) cluster
43// | 1 | 73 | (lml11) No 2GeV(CM) CL in an event
44// | 1 | 74 | 3D Bhabha Trigger for selection
45// | 1 | 75 | mumu bit
46// | 1 | 76 | Bhabha prescale bit
47// | 1 | 77 | E_tot > 20 GeV
48// | 1 | 78 | (lml12) N Cluster >= 3, at least one Cluster >500 MeV (LAB) with Theta Id 2~16, not 3D ECL Bhabha
49// | 1 | 79 | (lml13) Only one Cluster >500 MeV (CM) with Theta Id 6~11 and no other CL >= 300 MeV(LAB) anywhere
50// | 1 | 83 downto 80 | clock counter(set to be "0000" in tsim)
51// | 1 | 85 downto 84 | event timing quality flag
52// | 1 | 86 | 3D Bhabha Veto Intrk
53// | 1 | 88 downto 87 | 3D Bhabha selection theta flag
54// | 1 | 89 | [ecltaub2b] for 1x1 tau process : (110<delta phi(CM)<250, 130<Thata Sum(CM)<230, Etot1to17(Lab)<7GeV, E(1CL)(Lab)<1.9GeV)
55// | 1 | 90 | [hie1] hie && 1CL veto(not (N(CL)=1 && CL in FW)) && 2CL veto-1(not (N(CL)=2 && 160 < dphi < 200 && 150 < sum theta < 250))
56// | 1 | 91 | [hie2] hie && 1CL veto(not (N(CL)=1 && CL in FW)) && 2CL veto-2(not (N(CL)=2 && 160 < dphi < 200 || 150 < sum theta < 250))
57// | 1 | 92 | [hie3] hie && 1CL veto(not (N(CL)=1 && CL in FW)) && 2CL veto-3(not (N(CL)=2 && CL_lowe in FW or BW)
58// | 1 | 93 | [ecltaub2b v2] for 1x1 tau process : (120<delta phi(CM)<240, 140<Thata Sum(CM)<220, Etot1to17(Lab)<7GeV, N(CL) in endcap with E(CL)(3GeV) , E(CL)>0.165 for N(CL)==2, 1CL E(CL)>0.14 and 2CL E(CL)>0.165 for N(CL)==3, 2CL E(CL)>0.14 and 2CL E(CL)>0.165 for N(CL)==4, 1CL E(CL)>0.12 and 2CL E(CL)>0.14 and 2CL E(CL)>0.165 for N(CL)>4
59// | 1 | 94 | [ecltaub2b v3] for 1x1 tau process : (120<delta phi(CM)<240, 140<Thata Sum(CM)<220, Etot1to17(Lab)<7GeV, E(CL)>0.140 in lab for one of 2CL in b2b CLs, CL ThetaID= 2-16 for b2b CLs, CL(E)>0.12GeV in lab for all CLs, CL(E)<4.5GeV in lab for all CLs)
60// | 1 | 95 | [hie4] hie && 1CL veto(not (N(CL)=1 && CL in FW)) && 2CL veto-4(not (N(CL)=2 && CL_lowe in FW or BW) && E(CL_lowe)>0.5GeV)
61// ---------------------------------------------------------------------------------
62
63#define TRG_SHORT_NAMES
64#define TRGECL_SHORT_NAMES
65
66#include "framework/datastore/StoreArray.h"
67#include "trg/ecl/TrgEclMaster.h"
68#include "trg/ecl/TrgEclCluster.h"
69
70#include "trg/ecl/dataobjects/TRGECLTrg.h"
71#include "trg/ecl/dataobjects/TRGECLHit.h"
72#include "trg/ecl/dataobjects/TRGECLCluster.h"
73//
74#include <math.h>
75#include <TRandom3.h>
76//
77//
78using namespace std;
79using namespace Belle2;
80//
81//
82//
84 m_TimeWindow(250.0), m_OverlapWindow(0.0), m_Clustering(1), m_Bhabha(0),
85 m_EventTiming(1), m_NofTopTC(3), m_ClusterLimit(6), m_Triggerbit{0, 0, 0, 0},
86 m_Lowmultibit(0), m_PrescaleFactor(0), m_PrescaleCounter(0), m_mumuThreshold(20),
87 m_taub2bEtotCut(7.0),
88 m_taub2bClusterECut1(1.9),
89 m_taub2bClusterECut2(999),
90 m_taub2b2EtotCut(7.0),
91 m_taub2b2CLEEndcapCut(3.0),
92 m_taub2b2CLECut(0.162),
93 m_taub2b3EtotCut(7.0),
94 m_taub2b3CLEb2bCut(0.14),
95 m_taub2b3CLELowCut(0.12),
96 m_taub2b3CLEHighCut(4.5),
97 m_n300MeVCluster(1),
98 m_ECLBurstThreshold(200)
99{
100
105 m_obj_map = new TrgEclMapping();
107}
108//
109//
110//
112{
113 delete m_obj_cluster;
114 delete m_obj_beambkg;
115 delete m_obj_bhabha;
116 delete m_obj_timing;
117 delete m_obj_map;
118 delete m_obj_database;
119}
120//
121//
122//
123std::string
125{
126 return "TrgEclMaster";
127}
128//
129//
130//
131std::string
133{
134 return std::string("TrgEclMaster 2.1");
135}
136//
137//
138//
139void
141{
142 m_TCEnergy.clear();
143 m_TCTiming.clear();
144 m_TCBeamBkgTag.clear();
145 m_HitTCId.clear();
146 m_TCHitEnergy.clear();
147 m_TCHitTiming.clear();
148 m_TCHitBeamBkgTag.clear();
149
150 m_TCEnergy.resize(576);
151 m_TCTiming.resize(576);
152 m_TCBeamBkgTag.resize(576);
153
154 m_TotalEnergy = {5, 10, 30}; // /100 MeV
156 {40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 30, 35}; // /100 MeV
158 {25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 30}; // /100 MeV
159 m_3DBhabhaVetoThreshold = {30, 45}; // /100 MeV
160 m_3DBhabhaSelectionThreshold = {20, 40}; // /100 MeV
161 m_3DBhabhaVetoAngle = {160, 200, 165, 190}; // /100 MeV
162 m_3DBhabhaSelectionAngle = {140, 220, 160, 200}; // /100 MeV
163 m_mumuAngle = {160, 200, 165, 190}; // degree
164 m_3DBhabhaAddAngleCut = {150, 210, 160, 200}; // degree
165 m_LowMultiThreshold = {10, 20, 25, 30}; // degree
166
168 m_EventTimingQualityThresholds = {5, 6}; // GeV
169 m_ECLBurstThreshold = 200; // 10 ADC
170
171 // taub2b cut
172 m_taub2bAngleCut = {110, 250, 130, 230}; // degree
173 m_taub2bEtotCut = 7.0; // GeV
174 m_taub2bClusterECut1 = 1.9; // GeV
175 m_taub2bClusterECut2 = 999; // GeV
176
177 // taub2b2 cut
178 m_taub2b2AngleCut = {120, 240, 140, 220}; // degree
179 m_taub2b2EtotCut = 7.0; // GeV
180 m_taub2b2CLEEndcapCut = 3.0; // GeV
181 m_taub2b2CLECut = 0.162; // GeV
182
183 //taub2b3 cut
184 m_taub2b3AngleCut = {120, 240, 140, 220}; // degree
185 m_taub2b3EtotCut = 7.0; // GeV
186 m_taub2b3CLEb2bCut = 0.14; // GeV
187 m_taub2b3CLELowCut = 0.12; // GeV
188 m_taub2b3CLEHighCut = 4.5; // GeV
189
190}
191//========================================================
192//
193//========================================================
194void
195TrgEclMaster::simulate01(int m_nEvent) // Firmware simulator(time window 250 ns )
196{
197 // TrgEclFAM* obj_trgeclfam = new TrgEclFAM();
198 // obj_trgeclfam->setup(m_nEvent, 1);
199 // setPRS(obj_trgeclfam);
200 //
201 //----------
202 // TC Etot
203 //----------
204 //
205 // Energy sum of forward and barrel except for extreme forward
206 // so Etot is sum of "phi ring ID" = 1-14
207 // Etot threshold are
208 // 1.0 GeV for Etot01
209 // 0.5 GeV for Etot02nt
210 // 3.0 GeV for Etot03
211 //
212 // Read FAM Output
213 m_TCTiming.clear();
214 m_TCEnergy.clear();
215 m_TCBeamBkgTag.clear();
216 m_TCEnergy.resize(576);
217 m_TCTiming.resize(576);
218 m_TCBeamBkgTag.resize(576);
219
220 StoreArray<TRGECLHit> trgeclHitArray;
221 for (int ii = 0; ii < trgeclHitArray.getEntries(); ii++) {
222
223 TRGECLHit* aTRGECLHit = trgeclHitArray[ii];
224 int iTCID = (aTRGECLHit->getTCId() - 1);
225 double HitTiming = aTRGECLHit->getTimeAve();
226 double HitEnergy = aTRGECLHit->getEnergyDep();
227 double HitBeamBkg = aTRGECLHit->getBeamBkgTag();
228
229 m_TCTiming[iTCID].push_back(HitTiming);
230 m_TCEnergy[iTCID].push_back(HitEnergy);
231 m_TCBeamBkgTag[iTCID].push_back(HitBeamBkg);
232 }
233 //
234 //
235 int nBin = 8000 / (m_TimeWindow / 2) ; //8000/125
236 /* cppcheck-suppress variableScope */
237 double WindowStart;
238 /* cppcheck-suppress variableScope */
239 double WindowEnd;
240 double fluctuation = ((gRandom->Uniform(-1, 0))) * 125;
241 /* cppcheck-suppress variableScope */
242 double check_window_start;
243 /* cppcheck-suppress variableScope */
244 double check_window_end;
245
246 for (int iBin = 0 ; iBin < nBin; iBin ++) {
247
248 check_window_start = iBin * (m_TimeWindow / 3) + fluctuation - 4000;
249 WindowStart = check_window_start;
250 check_window_end = check_window_start + m_TimeWindow / 3;
251 WindowEnd = WindowStart + m_TimeWindow;
252 m_HitTCId.clear();
253 m_TCHitTiming.clear();
254 m_TCHitEnergy.clear();
255 m_TCHitBeamBkgTag.clear();
256
257 // prepare TC Hit in time window --
258 for (int iTCId = 0; iTCId < 576; iTCId++) {
259 const int hitsize = m_TCTiming[iTCId].size();
260 for (int ihit = 0; ihit < hitsize; ihit++) {
261 if (m_TCTiming[iTCId][ihit] > check_window_start &&
262 m_TCTiming[iTCId][ihit] < check_window_end) {
263 m_HitTCId.push_back(iTCId + 1);
264
265 }
266 }
267 }
268 if (m_HitTCId.size() == 0) {continue;}
269 else {
270 m_HitTCId.clear();
271 for (int iTCId = 0; iTCId < 576; iTCId++) {
272 const int hitsize = m_TCTiming[iTCId].size();
273 for (int ihit = 0; ihit < hitsize; ihit++) {
274 if (m_TCTiming[iTCId][ihit] > WindowStart &&
275 m_TCTiming[iTCId][ihit] < WindowEnd) {
276 m_HitTCId.push_back(iTCId + 1);
277 m_TCHitTiming.push_back(m_TCTiming[iTCId][ihit]);
278 m_TCHitEnergy.push_back(m_TCEnergy[iTCId][ihit]);
279 }
280 }
281 }
282 iBin = iBin + 2;
283 }
284 int noftchit = m_HitTCId.size();
285 if (noftchit == 0) {continue;}
286
287 double eventtiming = 0;
288 // Get EventTiming
291 // m_obj_timing->setEventTimingQualityThresholds(m_EventTimingQualityThresholds);
292
294 int timingsource = m_obj_timing->GetTimingSource();
295 int EventTimingQualityFlag = m_obj_timing->getEventTimingQualityFlag();
296 //--------------------------------------------------
297 // Ring sum and Total Energy Sum
298 //-------------------------------------------------
299 std::vector<std::vector<double>> thetaringsum;
300 std::vector<double> phiringsum;
301
302 thetaringsum.clear();
303 phiringsum.clear();
304 thetaringsum.resize(3, std::vector<double>(36, 0));
305 phiringsum.resize(17, 0);
306 setRS(m_HitTCId, m_TCHitEnergy, phiringsum, thetaringsum);
307
308 double E_phys = 0;
309 double E_total = 0;
310 int E_burst = 0;
311 for (int iii = 0; iii <= 16; iii++) {
312 if (iii > 0 && iii < 15) {E_phys += phiringsum[iii];}
313 E_total += phiringsum[iii];
314 }
315 if (E_total == 0) {continue;}
316 int ELow = 0, EHigh = 0, ELum = 0;
317
318 if (E_total > m_ECLBurstThreshold / 10) {
319 E_burst = 0x01;
320 }
321 if (E_phys > m_TotalEnergy[0] / 10) { // GeV
322 ELow = 0x01;
323 }
324 if (E_phys > m_TotalEnergy[1] / 10) { // GeV
325 EHigh = 0x01;
326 }
327 if (E_phys > m_TotalEnergy[2] / 10) { // GeV
328 ELum = 0x01;
329 }
330 //--------------
331 // Clustering
332 //--------------
333 //
334 // TrgEclCluster m_obj_cluster;
337 m_obj_cluster->setEventId(m_nEvent);
339 m_obj_cluster->setICN(m_HitTCId); // Belle Cluster Counting
340
341 int icn = m_obj_cluster->getICNFwBr();
342 int icnfwd = m_obj_cluster->getICNSub(0);
343 int icnbr = m_obj_cluster->getICNSub(1);
344 int icnbwd = m_obj_cluster->getICNSub(2);
345 //--------------
346 // Low Multiplicity bit
347 //--------------
348 std::vector<double> ClusterTiming;
349 std::vector<double> ClusterEnergy;
350 std::vector<int> MaxTCId;
351 ClusterTiming.clear();
352 ClusterEnergy.clear();
353 MaxTCId.clear();
354 StoreArray<TRGECLCluster> trgeclClusterArray;
355 for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
356 TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
357 int maxTCId = aTRGECLCluster->getMaxTCId();
358 double clusterenergy = aTRGECLCluster->getEnergyDep();
359 double clustertiming = aTRGECLCluster->getTimeAve();
360 ClusterTiming.push_back(clustertiming);
361 ClusterEnergy.push_back(clusterenergy);
362 MaxTCId.push_back(maxTCId);
363 }
364 // const int ncluster = ClusterEnergy.size();
365
366 makeLowMultiTriggerBit(MaxTCId, ClusterEnergy);
367 //--------------
368 // Bhabha veto
369 //--------------
386 // for taub2b3
392
393 std::vector<double> vct_bhabha;
394 vct_bhabha.clear();
395 int bhabha2D = 0 ;
396 int bhabha3D_veto = 0 ;
397 int bhabha3D_sel = 0;
398 int mumu = 0;
399 int bhabha3DVetoInTrackFlag = 0;
400 int bhabha3DSelectionThetaFlag = 0;
401 int taub2bFlag = 0;
402 int taub2b2Flag = 0;
403 int taub2b3Flag = 0;
404
405 bool b_2Dbhabha = m_obj_bhabha->GetBhabha00(phiringsum);
406 vct_bhabha = m_obj_bhabha->GetBhabhaComb();
407 if (b_2Dbhabha && (icn < 4)) {bhabha2D = 1;}
408 bool b_3Dbhabha = m_obj_bhabha->GetBhabha01();
409 if (b_3Dbhabha) {bhabha3D_veto = 1;}
410 bool b_3Dbhabha_sel = m_obj_bhabha->GetBhabha02();
411 if (b_3Dbhabha_sel) {bhabha3D_sel = 1;}
412 bool b_mumu = m_obj_bhabha->Getmumu();
413 if (b_mumu) {mumu = 1;}
414 bhabha3DVetoInTrackFlag = m_obj_bhabha->get3DBhabhaVetoInTrackFlag();
415 bhabha3DSelectionThetaFlag = m_obj_bhabha->get3DBhabhaSelectionThetaFlag();
416 taub2bFlag = (m_obj_bhabha->GetTaub2b(E_total)) ? 1 : 0;
417 taub2b2Flag = (m_obj_bhabha->GetTaub2b2(E_total)) ? 1 : 0;
418 taub2b3Flag = (m_obj_bhabha->GetTaub2b3(E_total)) ? 1 : 0;
419
420 //------------------------
421 // Beam Background veto (Old cosmic veto)
422 //------------------------
423 int beambkgtag = 0;
424 beambkgtag = m_obj_beambkg->GetBeamBkg(thetaringsum);
425
426 int bhabhaprescale = 0;
428 bhabhaprescale = 1;
430 } else if (m_PrescaleFactor > m_PrescaleCounter) {
432 }
433 //-------------
434 // Make ECL Trigger Bit
435 //-------------
436 int hit = 1; // hit or not
437 int Timing = (int)(eventtiming + 0.5);
438 int RevoFAM = 0;
439 int TimingSource = m_obj_timing->GetTimingSource(); // FWD(0), Barrel(0), Backward(0);
440 int etot = (int)(E_phys * 1000 + 0.5); // total Energy in theta ID [2~15]
441 int physics = 0;
442 if ((etot > 1000 || icn > 3) && !(bhabha2D == 1)) {physics = 1;}
443 std::vector<int> bhabhabit;
444 bhabhabit.clear();
445 int bhabhabitsize = vct_bhabha.size();
446 for (int ibhabha = 0; ibhabha < bhabhabitsize; ibhabha++) {
447 bhabhabit.push_back((int)vct_bhabha[ibhabha]);
448 }
449 int ClusterOverflow = m_obj_cluster->getNofExceedCluster();
450 int flagoverflow = 0;
451 if (ClusterOverflow > 0) {
452 flagoverflow = 1;
453 }
454
455 makeTriggerBit(hit, Timing, 0, timingsource, E_phys,
456 bhabha2D, physics, bhabhabit, icn, beambkgtag,
457 flagoverflow, bhabha3D_veto, m_Lowmultibit,
458 bhabha3D_sel, mumu, bhabhaprescale, E_burst,
459 EventTimingQualityFlag,
460 bhabha3DVetoInTrackFlag,
461 bhabha3DSelectionThetaFlag,
462 taub2bFlag, 0, taub2b2Flag, taub2b3Flag);
463
464 int m_hitEneNum = 0;
465 StoreArray<TRGECLTrg> trgEcltrgArray;
466 trgEcltrgArray.appendNew();
467 m_hitEneNum = trgEcltrgArray.getEntries() - 1;
468 //-------------
469 // Store
470 //-------------
471 trgEcltrgArray[m_hitEneNum]->setEventId(m_nEvent);
472 trgEcltrgArray[m_hitEneNum]->setPRS01(phiringsum[0]);
473 trgEcltrgArray[m_hitEneNum]->setPRS02(phiringsum[1]);
474 trgEcltrgArray[m_hitEneNum]->setPRS03(phiringsum[2]);
475 trgEcltrgArray[m_hitEneNum]->setPRS04(phiringsum[3]);
476 trgEcltrgArray[m_hitEneNum]->setPRS05(phiringsum[4]);
477 trgEcltrgArray[m_hitEneNum]->setPRS06(phiringsum[5]);
478 trgEcltrgArray[m_hitEneNum]->setPRS07(phiringsum[6]);
479 trgEcltrgArray[m_hitEneNum]->setPRS08(phiringsum[7]);
480 trgEcltrgArray[m_hitEneNum]->setPRS09(phiringsum[8]);
481 trgEcltrgArray[m_hitEneNum]->setPRS10(phiringsum[9]);
482 trgEcltrgArray[m_hitEneNum]->setPRS11(phiringsum[10]);
483 trgEcltrgArray[m_hitEneNum]->setPRS12(phiringsum[11]);
484 trgEcltrgArray[m_hitEneNum]->setPRS13(phiringsum[12]);
485 trgEcltrgArray[m_hitEneNum]->setPRS14(phiringsum[13]);
486 trgEcltrgArray[m_hitEneNum]->setPRS15(phiringsum[14]);
487 trgEcltrgArray[m_hitEneNum]->setPRS16(phiringsum[15]);
488 trgEcltrgArray[m_hitEneNum]->setPRS17(phiringsum[16]);
489 //
490 trgEcltrgArray[m_hitEneNum]->setEtot(E_phys);
491 trgEcltrgArray[m_hitEneNum]->setNofTCHit(noftchit);
492 //
493 trgEcltrgArray[m_hitEneNum]->setBhabha01(vct_bhabha[0]);
494 trgEcltrgArray[m_hitEneNum]->setBhabha02(vct_bhabha[1]);
495 trgEcltrgArray[m_hitEneNum]->setBhabha03(vct_bhabha[2]);
496 trgEcltrgArray[m_hitEneNum]->setBhabha04(vct_bhabha[3]);
497 trgEcltrgArray[m_hitEneNum]->setBhabha05(vct_bhabha[4]);
498 trgEcltrgArray[m_hitEneNum]->setBhabha06(vct_bhabha[5]);
499 trgEcltrgArray[m_hitEneNum]->setBhabha07(vct_bhabha[6]);
500 trgEcltrgArray[m_hitEneNum]->setBhabha08(vct_bhabha[7]);
501 trgEcltrgArray[m_hitEneNum]->setBhabha09(vct_bhabha[8]);
502 trgEcltrgArray[m_hitEneNum]->setBhabha10(vct_bhabha[9]);
503 trgEcltrgArray[m_hitEneNum]->setBhabha11(vct_bhabha[10]);
504 trgEcltrgArray[m_hitEneNum]->setBhabha12(vct_bhabha[11]);
505 trgEcltrgArray[m_hitEneNum]->setBhabha13(vct_bhabha[12]);
506 trgEcltrgArray[m_hitEneNum]->setBhabha14(vct_bhabha[13]);
507 trgEcltrgArray[m_hitEneNum]->setBhabha15(vct_bhabha[14]);
508 trgEcltrgArray[m_hitEneNum]->setBhabha16(vct_bhabha[15]);
509 trgEcltrgArray[m_hitEneNum]->setBhabha17(vct_bhabha[16]);
510 trgEcltrgArray[m_hitEneNum]->setBhabha18(vct_bhabha[17]);
511 //
512 trgEcltrgArray[m_hitEneNum]->setICN(icn);
513 trgEcltrgArray[m_hitEneNum]->setICNFw(icnfwd);
514 trgEcltrgArray[m_hitEneNum]->setICNBr(icnbr);
515 trgEcltrgArray[m_hitEneNum]->setICNBw(icnbwd);
516 //
517 trgEcltrgArray[m_hitEneNum]->setECLtoGDL(m_Triggerbit[0], 0);
518 trgEcltrgArray[m_hitEneNum]->setECLtoGDL(m_Triggerbit[1], 1);
519 trgEcltrgArray[m_hitEneNum]->setECLtoGDL(m_Triggerbit[2], 2);
520 trgEcltrgArray[m_hitEneNum]->setECLtoGDL(m_Triggerbit[3], 3);
521
522 trgEcltrgArray[m_hitEneNum]->setBhabhaVeto(bhabha2D);
523 trgEcltrgArray[m_hitEneNum]->setBeamBkgVeto(beambkgtag);
524 trgEcltrgArray[m_hitEneNum]->setEventTiming(eventtiming);
525
526 trgEcltrgArray[m_hitEneNum]->setHit(hit);
527 trgEcltrgArray[m_hitEneNum]->setRevoclk(RevoFAM);
528 trgEcltrgArray[m_hitEneNum]->setTimingSource(TimingSource);
529 trgEcltrgArray[m_hitEneNum]->setPhysics(physics) ;
530 trgEcltrgArray[m_hitEneNum]->set2DBhabha(bhabha2D);
531 trgEcltrgArray[m_hitEneNum]->set3DBhabha(bhabha3D_veto);
532 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSel(bhabha3D_sel);
533 trgEcltrgArray[m_hitEneNum]->setmumuBit(mumu);
534 trgEcltrgArray[m_hitEneNum]->setBhabhaPrescaleBit(bhabhaprescale);
535
536 trgEcltrgArray[m_hitEneNum]->setELow(ELow) ;
537 trgEcltrgArray[m_hitEneNum]->setEHihg(EHigh);
538 trgEcltrgArray[m_hitEneNum]->setELum(ELum) ;
539 trgEcltrgArray[m_hitEneNum]->setClusterOverflow(ClusterOverflow) ;
540 trgEcltrgArray[m_hitEneNum]->setLowMultiBit(m_Lowmultibit);
541 }
542
543 return;
544}
545//========================================================
546//
547//========================================================
548void
549TrgEclMaster::simulate02(int m_nEvent) // select one window for analyze trigger logic
550{
551
552 // TrgEclFAM* obj_trgeclfam = new TrgEclFAM();
553 // obj_trgeclfam->setup(m_nEvent, 1);
554 // setPRS(obj_trgeclfam);
555 //
556 //----------
557 // TC Etot
558 //----------
559 //
560 // Energy sum of forward and barrel except for extreme forward
561 // so Etot is sum of "phi ring ID" = 1-14
562 // Etot threshold are
563 // 1.0 GeV for Etot01
564 // 0.5 GeV for Etot02nt
565 // 3.0 GeV for Etot03
566 //
567 // Read FAM Output
568 m_TCTiming.clear();
569 m_TCEnergy.clear();
570 m_TCBeamBkgTag.clear();
571 m_TCEnergy.resize(576);
572 m_TCTiming.resize(576);
573 m_TCBeamBkgTag.resize(576);
574
575 StoreArray<TRGECLHit> trgeclHitArray;
576 for (int ii = 0; ii < trgeclHitArray.getEntries(); ii++) {
577
578 TRGECLHit* aTRGECLHit = trgeclHitArray[ii];
579 int iTCID = (aTRGECLHit->getTCId() - 1);
580 double HitTiming = aTRGECLHit->getTimeAve();
581 double HitEnergy = aTRGECLHit->getEnergyDep();
582 double HitBeamBkg = aTRGECLHit->getBeamBkgTag();
583
584 m_TCTiming[iTCID].push_back(HitTiming);
585 m_TCEnergy[iTCID].push_back(HitEnergy);
586 m_TCBeamBkgTag[iTCID].push_back(HitBeamBkg);
587 }
588 //
589 //
590 int nBin = 2 * 8000 / m_TimeWindow ;
591 double WindowStart = 0;
592 double WindowEnd = 0;
593 double fluctuation = ((gRandom->Uniform(-1, 0))) * 125;
594
595 int startBin = nBin / 2 - 1; //start previous bin near 0s
596
597 int endBin = nBin / 2 + 1; //start next bin near 0s
598
599 if (m_EventTiming == 0) {
600 m_TimeWindow = 500;
601 m_OverlapWindow = 0;
602 }
603
604 double maxE = 0;
605 int max_bin = 0;
606
607 for (int iBin = startBin ; iBin <= endBin; iBin ++) {
608 WindowStart = iBin * (m_TimeWindow - m_OverlapWindow) + fluctuation - 4000;
609
610 if (iBin == 0) {WindowStart = - 4000 + fluctuation;}
611 WindowEnd = WindowStart + m_TimeWindow;
612
613 double totalE = 0;
614 // prepare TC Hit in time window --
615 for (int iTCId = 0; iTCId < 576; iTCId++) {
616 const int hitsize = m_TCTiming[iTCId].size();
617 for (int ihit = 0; ihit < hitsize; ihit++) {
618 if (m_TCTiming[iTCId][ihit] > WindowStart &&
619 m_TCTiming[iTCId][ihit] < WindowEnd) {
620 totalE += m_TCEnergy[iTCId][ihit] ;
621 }
622 }
623 }
624 if (totalE == 0) {continue;}
625 if (maxE < totalE) { //select the bin having the highest total energy
626 maxE = totalE;
627 max_bin = iBin;
628 }
629 }
630
631 WindowStart = max_bin * (m_TimeWindow - m_OverlapWindow) + fluctuation - 4000;
632 if (max_bin == 0) {WindowStart = - 4000 + fluctuation;}
633 WindowEnd = WindowStart + m_TimeWindow;
634
635 m_HitTCId.clear();
636 m_TCHitTiming.clear();
637 m_TCHitEnergy.clear();
638 m_TCHitBeamBkgTag.clear();
639
640 // prepare TC Hit in time window --
641 for (int iTCId = 0; iTCId < 576; iTCId++) {
642 const int hitsize = m_TCTiming[iTCId].size();
643 for (int ihit = 0; ihit < hitsize; ihit++) {
644 if (m_TCTiming[iTCId][ihit] > WindowStart &&
645 m_TCTiming[iTCId][ihit] < WindowEnd) {
646 m_HitTCId.push_back(iTCId + 1);
647 m_TCHitTiming.push_back(m_TCTiming[iTCId][ihit]);
648 m_TCHitEnergy.push_back(m_TCEnergy[iTCId][ihit]);
649 m_TCHitBeamBkgTag.push_back(m_TCBeamBkgTag[iTCId][ihit]);
650 }
651 }
652 }
653
654 int noftchit = m_HitTCId.size();
655 if (noftchit == 0) { return;}
656
657 double eventtiming = 0;
658 // Get EventTiming
661 m_obj_timing->setEventTimingQualityThresholds(m_EventTimingQualityThresholds);
662
664 int timingsource = m_obj_timing->GetTimingSource();
665
666 int EventTimingQualityFlag = m_obj_timing->getEventTimingQualityFlag();
667 //--------------------------------------------------
668 // Ring sum and Total Energy Sum
669 //-------------------------------------------------
670 std::vector<std::vector<double>> thetaringsum;
671 std::vector<double> phiringsum;
672
673 thetaringsum.clear();
674 phiringsum.clear();
675 thetaringsum.resize(3, std::vector<double>(36, 0));
676 phiringsum.resize(17, 0);
677 setRS(m_HitTCId, m_TCHitEnergy, phiringsum, thetaringsum);
678
679 //double E_br; //variable not used
680 //double E_fwd; //variable not used
681 //double E_bwd; //variable not used
682 double E_phys = 0;
683 double E_total = 0;
684 int E_burst = 0;
685
686 for (int iii = 0; iii <= 16; iii++) {
687 if (iii > 0 && iii < 15) {E_phys += phiringsum[iii];}
688 //if (iii < 3) {E_fwd += phiringsum[iii];} //TODO variable not used, should be?
689 //if (iii > 2 && iii < 15) {E_br += phiringsum[iii];} //TODO not used, should be?
690 //if (iii > 14) {E_bwd += phiringsum[iii];} //TODO not used, should be?
691 E_total += phiringsum[iii];
692 }
693
694 if (E_total == 0) {return;}
695 int ELow = 0, EHigh = 0, ELum = 0;
696 if (E_total > m_ECLBurstThreshold) {
697 E_burst = 0x01;
698 }
699
700 if (E_phys > m_TotalEnergy[0] / 10) { // GeV
701 ELow = 0x01;
702 }
703 if (E_phys > m_TotalEnergy[1] / 10) { // GeV
704 EHigh = 0x01;
705 }
706 if (E_phys > m_TotalEnergy[2] / 10) { // GeV
707 ELum = 0x01;
708 }
709 //--------------
710 // Clustering
711 //--------------
712 //
713 // TrgEclCluster m_obj_cluster;
716 m_obj_cluster->setEventId(m_nEvent);
718 m_obj_cluster->setICN(m_HitTCId); // Belle Cluster Counting
719
720 int icn = m_obj_cluster->getICNFwBr();
721 int icnfwd = m_obj_cluster->getICNSub(0);
722 int icnbr = m_obj_cluster->getICNSub(1);
723 int icnbwd = m_obj_cluster->getICNSub(2);
724
725 int NofCluster1to17 = m_obj_cluster->getNofCluster();
726 //--------------
727 // Low Multiplicity bit
728 //--------------
729 std::vector<double> ClusterTiming;
730 std::vector<double> ClusterEnergy;
731 std::vector<int> MaxTCId;
732 std::vector<int> MaxThetaId;
733 ClusterTiming.clear();
734 ClusterEnergy.clear();
735 MaxTCId.clear();
736 MaxThetaId.clear();
737 StoreArray<TRGECLCluster> trgeclClusterArray;
738 for (int ii = 0; ii < trgeclClusterArray.getEntries(); ii++) {
739 TRGECLCluster* aTRGECLCluster = trgeclClusterArray[ii];
740 int maxTCId = aTRGECLCluster->getMaxTCId();
741 int maxThetaId = aTRGECLCluster->getMaxThetaId();
742 double clusterenergy = aTRGECLCluster->getEnergyDep();
743 double clustertiming = aTRGECLCluster->getTimeAve();
744 ClusterTiming.push_back(clustertiming);
745 ClusterEnergy.push_back(clusterenergy);
746 MaxTCId.push_back(maxTCId);
747 MaxThetaId.push_back(maxThetaId);
748 }
749 // int NofCluster = m_obj_cluster->getNofCluster();
750 makeLowMultiTriggerBit(MaxTCId, ClusterEnergy);
751 //--------------
752 // Bhabha veto (and mumu and tau b2b trigger)
753 //--------------
772 //
778
779
780 std::vector<double> vct_bhabha;
781 vct_bhabha.clear();
782 int bhabha2D = 0 ;
783 int bhabha3D_veto = 0 ;
784 int bhabha3D_sel = 0;
785 int mumu = 0;
786 int bhabha3DVetoInTrackFlag = -1;
787 int bhabha3DSelectionThetaFlag = -1;
788 int taub2bFlag = 0;
789 int taub2b2Flag = 0;
790 int taub2b3Flag = 0;
791
792 bool b_2Dbhabha = m_obj_bhabha->GetBhabha00(phiringsum);
793 vct_bhabha = m_obj_bhabha->GetBhabhaComb();
794 if (b_2Dbhabha && (icn < 4)) {bhabha2D = 1;}
795 bool b_3Dbhabha = m_obj_bhabha->GetBhabha01();
796 if (b_3Dbhabha) {bhabha3D_veto = 1;}
797 bool b_3Dbhabha_sel = m_obj_bhabha->GetBhabha02();
798 if (b_3Dbhabha_sel) {bhabha3D_sel = 1;}
799 bool b_mumu = m_obj_bhabha->Getmumu();
800 if (b_mumu) {mumu = 1;}
801 int bhabhaprescale = 0;
803 bhabhaprescale = 1;
805 } else if (m_PrescaleFactor > m_PrescaleCounter) {
807 }
808 bhabha3DVetoInTrackFlag = m_obj_bhabha->get3DBhabhaVetoInTrackFlag();
809 bhabha3DSelectionThetaFlag = m_obj_bhabha->get3DBhabhaSelectionThetaFlag();
810 taub2bFlag = (m_obj_bhabha->GetTaub2b(E_total)) ? 1 : 0;
811 taub2b2Flag = (m_obj_bhabha->GetTaub2b2(E_total)) ? 1 : 0;
812 taub2b3Flag = (m_obj_bhabha->GetTaub2b3(E_total)) ? 1 : 0;
813
814 //------------------------
815 // additional Bhabha veto
816 //------------------------
817 int bhabha_addition = m_obj_bhabha->GetBhabhaAddition();
818 //------------------------
819 // hie with additional Bhabha veto
820 //------------------------
821 int beambkgtag = 0;
822 beambkgtag = m_obj_beambkg->GetBeamBkg(thetaringsum);
823
824 int bit_hie_bhav = 0;
825 if (E_phys > 1.0) {
826 bit_hie_bhav |= (~bhabha_addition & 0x01) & (~bhabha_addition >> 4 & 0x01); // hie4
827 bit_hie_bhav <<= 1;
828 bit_hie_bhav |= (~bhabha_addition & 0x01) & (~bhabha_addition >> 3 & 0x01); // hie3
829 bit_hie_bhav <<= 1;
830 bit_hie_bhav |= (~bhabha_addition & 0x01) & (~bhabha_addition >> 2 & 0x01); // hie2
831 bit_hie_bhav <<= 1;
832 bit_hie_bhav |= (~bhabha_addition & 0x01) & (~bhabha_addition >> 1 & 0x01); // hie1
833 }
834 //-------------
835 // Make ECL Trigger Bit
836 //-------------
837 int hit = 1; // hit or not
838 int Timing = (int)(eventtiming + 0.5);
839 int RevoFAM = 0;
840 int TimingSource = m_obj_timing->GetTimingSource(); // FWD(0), Barrel(0), Backward(0);
841 int etot = (int)(E_phys * 1000 + 0.5); // total Energy in theta ID [2~15]
842
843 //int bhabha2D = BtoBTag ;
844 int physics = 0;
845 if ((etot > 1000 || icn > 3) && !(bhabha2D == 1)) {physics = 1;}
846 std::vector<int> bhabhabit;
847 bhabhabit.clear();
848 int bhabhabitsize = vct_bhabha.size();
849 for (int ibhabha = 0; ibhabha < bhabhabitsize; ibhabha++) {
850 bhabhabit.push_back((int)vct_bhabha[ibhabha]);
851 }
852 int ClusterOverflow = m_obj_cluster->getNofExceedCluster();
853 int flagoverflow = 0;
854 if (ClusterOverflow > 0) {
855 flagoverflow = 1;
856 }
857
858 makeTriggerBit(hit, Timing, 0, timingsource, E_phys, bhabha2D,
859 physics, bhabhabit, icn, beambkgtag, flagoverflow,
860 bhabha3D_veto, m_Lowmultibit, bhabha3D_sel, mumu,
861 bhabhaprescale, E_burst,
862 EventTimingQualityFlag,
863 bhabha3DVetoInTrackFlag,
864 bhabha3DSelectionThetaFlag,
865 taub2bFlag,
866 bit_hie_bhav,
867 taub2b2Flag,
868 taub2b3Flag);
869
870 //----------------------------------------------------
871 // ECL trigger
872 //----------------------------------------------------
873 // Integer GDL "Output word to GDL:"
874 // "bit0-2 = Etot1,2,3"
875 // "bit3 = Bhabha,"
876 // "bit4 = prescaled Bhabha,"
877 // "bit5-8 = ICN(3bits)+FORWARD(1bit) OR ICN(3+1 carry),"
878 // "bit9 = cosmic,"
879 // "bit10 = neutral timing trigger"
880 //
881 //------------------------------
882 // 2 10 16
883 //------------------------------
884 // 1 0000000000001 1 1 Etot1
885 // 2 0000000000010 2 2 Etot2
886 // 3 0000000000100 4 4 Etot3
887 // 4 0000000001000 8 8 Bhabha
888 // 5 0000000010000 16 10 preBhabha
889 // 6 0000000100000 32 20 ICN
890 // 7 0000001000000 64 40 ICN
891 // 8 0000010000000 128 80 ICN
892 // 9 0000100000000 256 100 ForwardICN
893 // 10 0001000000000 512 200 BeamBkgVeto
894 // 11 0010000000000 1024 400 Timing
895 //------------------------------
896 // int bitEtot1 = 0x0001;
897 // int bitEtot2 = 0x0002;
898 // int bitEtot3 = 0x0004;
899 // int bitBhabha = 0x0008;
900 // int bitPreBhabha = 0x0010;
901 // int bitForwardICN = 0x0100;
902 // int bitBeamBkgVeto = 0x0200;
903 // int bitTiming = 0x0400;
904
905 // bool boolEtot[3] = {false};
906 // if (E_phys > 1.0) boolEtot[1] = true;
907 // bool boolBhabha = (boolBtoBTag && icn > 4);
908 // bool boolPreBhabha = false;
909 // bool boolForwardICN = icnfwd;
910 // bool boolBeamBkgVeto = boolBeamBkgTag;
911 // int bit = 0;
912 // //
913 // // bit 5-7
914 // bit = (icn >= 7) ? 0x0007 : icn;
915 // bit <<= 5;
916 // // bit 0
917 // bit |= boolEtot[0] ? bitEtot1 : 0;
918 // // bit 1
919 // bit |= boolEtot[1] ? bitEtot2 : 0;
920 // // bit 2
921 // bit |= boolEtot[2] ? bitEtot3 : 0;
922 // // bit 3
923 // bit |= boolBhabha ? bitBhabha : 0;
924 // // bit 4
925 // bit |= boolPreBhabha ? bitPreBhabha : 0;
926 // // bit 8
927 // bit |= boolForwardICN ? bitForwardICN : 0;
928 // // bit 9
929 // bit |= boolBeamBkgVeto ? bitBeamBkgVeto : 0;
930 // // bit 10
931 // bit |= bitTiming;
932 //
933 // printf("bit = %i \n", bit);
934 //----------------------
935 // if (0){ // check bit by "binary" output
936 // int xxx = bit;
937 // int yyy = 0;
938 // int iii = 0;
939 // int ans = 0;
940 // while (xxx > 0) {
941 // yyy = xxx % 2;
942 // ans = ans + yyy * pow(10,iii);
943 // xxx = xxx / 2;
944 // iii = iii++;
945 // }
946 // printf("xxx = %i \n", ans);
947 // }
948
949
950 int m_hitEneNum = 0;
951 StoreArray<TRGECLTrg> trgEcltrgArray;
952 trgEcltrgArray.appendNew();
953 m_hitEneNum = trgEcltrgArray.getEntries() - 1;
954 //----------------------------------------------------
955 // Store
956 //----------------------------------------------------
957 trgEcltrgArray[m_hitEneNum]->setEventId(m_nEvent);
958 trgEcltrgArray[m_hitEneNum]->setPRS01(phiringsum[0]);
959 trgEcltrgArray[m_hitEneNum]->setPRS02(phiringsum[1]);
960 trgEcltrgArray[m_hitEneNum]->setPRS03(phiringsum[2]);
961 trgEcltrgArray[m_hitEneNum]->setPRS04(phiringsum[3]);
962 trgEcltrgArray[m_hitEneNum]->setPRS05(phiringsum[4]);
963 trgEcltrgArray[m_hitEneNum]->setPRS06(phiringsum[5]);
964 trgEcltrgArray[m_hitEneNum]->setPRS07(phiringsum[6]);
965 trgEcltrgArray[m_hitEneNum]->setPRS08(phiringsum[7]);
966 trgEcltrgArray[m_hitEneNum]->setPRS09(phiringsum[8]);
967 trgEcltrgArray[m_hitEneNum]->setPRS10(phiringsum[9]);
968 trgEcltrgArray[m_hitEneNum]->setPRS11(phiringsum[10]);
969 trgEcltrgArray[m_hitEneNum]->setPRS12(phiringsum[11]);
970 trgEcltrgArray[m_hitEneNum]->setPRS13(phiringsum[12]);
971 trgEcltrgArray[m_hitEneNum]->setPRS14(phiringsum[13]);
972 trgEcltrgArray[m_hitEneNum]->setPRS15(phiringsum[14]);
973 trgEcltrgArray[m_hitEneNum]->setPRS16(phiringsum[15]);
974 trgEcltrgArray[m_hitEneNum]->setPRS17(phiringsum[16]);
975 //
976 trgEcltrgArray[m_hitEneNum]->setEtot(E_phys);
977 trgEcltrgArray[m_hitEneNum]->setNofTCHit(noftchit);
978 //
979 trgEcltrgArray[m_hitEneNum]->setBhabha01(vct_bhabha[0]);
980 trgEcltrgArray[m_hitEneNum]->setBhabha02(vct_bhabha[1]);
981 trgEcltrgArray[m_hitEneNum]->setBhabha03(vct_bhabha[2]);
982 trgEcltrgArray[m_hitEneNum]->setBhabha04(vct_bhabha[3]);
983 trgEcltrgArray[m_hitEneNum]->setBhabha05(vct_bhabha[4]);
984 trgEcltrgArray[m_hitEneNum]->setBhabha06(vct_bhabha[5]);
985 trgEcltrgArray[m_hitEneNum]->setBhabha07(vct_bhabha[6]);
986 trgEcltrgArray[m_hitEneNum]->setBhabha08(vct_bhabha[7]);
987 trgEcltrgArray[m_hitEneNum]->setBhabha09(vct_bhabha[8]);
988 trgEcltrgArray[m_hitEneNum]->setBhabha10(vct_bhabha[9]);
989 trgEcltrgArray[m_hitEneNum]->setBhabha11(vct_bhabha[10]);
990 trgEcltrgArray[m_hitEneNum]->setBhabha12(vct_bhabha[11]);
991 trgEcltrgArray[m_hitEneNum]->setBhabha13(vct_bhabha[12]);
992 trgEcltrgArray[m_hitEneNum]->setBhabha14(vct_bhabha[13]);
993 trgEcltrgArray[m_hitEneNum]->setBhabha15(vct_bhabha[14]);
994 trgEcltrgArray[m_hitEneNum]->setBhabha16(vct_bhabha[15]);
995 trgEcltrgArray[m_hitEneNum]->setBhabha17(vct_bhabha[16]);
996 trgEcltrgArray[m_hitEneNum]->setBhabha18(vct_bhabha[17]);
997 //
998 trgEcltrgArray[m_hitEneNum]->setICN(icn);
999 trgEcltrgArray[m_hitEneNum]->setICNFw(icnfwd);
1000 trgEcltrgArray[m_hitEneNum]->setICNBr(icnbr);
1001 trgEcltrgArray[m_hitEneNum]->setICNBw(icnbwd);
1002 //
1003 trgEcltrgArray[m_hitEneNum]->setECLtoGDL(m_Triggerbit[0], 0);
1004 trgEcltrgArray[m_hitEneNum]->setECLtoGDL(m_Triggerbit[1], 1);
1005 trgEcltrgArray[m_hitEneNum]->setECLtoGDL(m_Triggerbit[2], 2);
1006 trgEcltrgArray[m_hitEneNum]->setECLtoGDL(m_Triggerbit[3], 3);
1007
1008 trgEcltrgArray[m_hitEneNum]->setBhabhaVeto(bhabha2D);
1009 trgEcltrgArray[m_hitEneNum]->setBeamBkgVeto(beambkgtag);
1010 trgEcltrgArray[m_hitEneNum]->setEventTiming(eventtiming);
1011
1012 trgEcltrgArray[m_hitEneNum]->setHit(hit);
1013 trgEcltrgArray[m_hitEneNum]->setRevoclk(RevoFAM);
1014 trgEcltrgArray[m_hitEneNum]->setTimingSource(TimingSource);
1015 trgEcltrgArray[m_hitEneNum]->setPhysics(physics) ;
1016 trgEcltrgArray[m_hitEneNum]->set2DBhabha(bhabha2D);
1017 trgEcltrgArray[m_hitEneNum]->set3DBhabha(bhabha3D_veto);
1018 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSel(bhabha3D_sel);
1019 trgEcltrgArray[m_hitEneNum]->setmumuBit(mumu);
1020 trgEcltrgArray[m_hitEneNum]->setBhabhaPrescaleBit(bhabhaprescale);
1021
1022 trgEcltrgArray[m_hitEneNum]->setELow(ELow) ;
1023 trgEcltrgArray[m_hitEneNum]->setEHihg(EHigh);
1024 trgEcltrgArray[m_hitEneNum]->setELum(ELum) ;
1025 trgEcltrgArray[m_hitEneNum]->setClusterOverflow(ClusterOverflow) ;
1026 trgEcltrgArray[m_hitEneNum]->setLowMultiBit(m_Lowmultibit);
1027
1028 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoInTrackFlag(m_obj_bhabha->get3DBhabhaVetoInTrackFlag());
1029 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoClusterTCId(m_obj_bhabha->get3DBhabhaVetoClusterTCId(0), 0);
1030 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoClusterTCId(m_obj_bhabha->get3DBhabhaVetoClusterTCId(1), 1);
1031 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoClusterEnergy(m_obj_bhabha->get3DBhabhaVetoClusterEnergy(0), 0);
1032 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoClusterEnergy(m_obj_bhabha->get3DBhabhaVetoClusterEnergy(1), 1);
1033 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoClusterTiming(m_obj_bhabha->get3DBhabhaVetoClusterTiming(0), 0);
1034 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoClusterTiming(m_obj_bhabha->get3DBhabhaVetoClusterTiming(1), 1);
1035 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoClusterThetaId(m_obj_bhabha->get3DBhabhaVetoClusterThetaId(0), 0);
1036 trgEcltrgArray[m_hitEneNum]->set3DBhabhaVetoClusterThetaId(m_obj_bhabha->get3DBhabhaVetoClusterThetaId(1), 1);
1037
1038 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionThetaFlag(m_obj_bhabha->get3DBhabhaSelectionThetaFlag());
1039 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionClusterTCId(m_obj_bhabha->get3DBhabhaSelectionClusterTCId(0), 0);
1040 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionClusterTCId(m_obj_bhabha->get3DBhabhaSelectionClusterTCId(1), 1);
1041 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionClusterEnergy(m_obj_bhabha->get3DBhabhaSelectionClusterEnergy(0), 0);
1042 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionClusterEnergy(m_obj_bhabha->get3DBhabhaSelectionClusterEnergy(1), 1);
1043 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionClusterTiming(m_obj_bhabha->get3DBhabhaSelectionClusterTiming(0), 0);
1044 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionClusterTiming(m_obj_bhabha->get3DBhabhaSelectionClusterTiming(1), 1);
1045 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionClusterThetaId(m_obj_bhabha->get3DBhabhaSelectionClusterThetaId(0), 0);
1046 trgEcltrgArray[m_hitEneNum]->set3DBhabhaSelectionClusterThetaId(m_obj_bhabha->get3DBhabhaSelectionClusterThetaId(1), 1);
1047
1048 trgEcltrgArray[m_hitEneNum]->setEventTimingQualityFlag(m_obj_timing->getEventTimingQualityFlag());
1049 trgEcltrgArray[m_hitEneNum]->setEventTimingTCId(m_obj_timing->getEventTimingTCId());
1050 trgEcltrgArray[m_hitEneNum]->setEventTimingTCThetaId(m_obj_timing->getEventTimingTCThetaId());
1051 trgEcltrgArray[m_hitEneNum]->setEventTimingTCEnergy(m_obj_timing->getEventTimingTCEnergy());
1052
1053 trgEcltrgArray[m_hitEneNum]->setEtot1to17(E_total);
1054 trgEcltrgArray[m_hitEneNum]->setTaub2bFlag(taub2bFlag);
1055 trgEcltrgArray[m_hitEneNum]->setTaub2bAngleFlag(m_obj_bhabha->getTaub2bAngleFlag());
1056 trgEcltrgArray[m_hitEneNum]->setTaub2bEtotFlag(m_obj_bhabha->getTaub2bEtotFlag());
1057 trgEcltrgArray[m_hitEneNum]->setTaub2bClusterEFlag(m_obj_bhabha->getTaub2bClusterEFlag());
1058
1059 trgEcltrgArray[m_hitEneNum]->setNofCluster1to17(NofCluster1to17);
1060
1061 trgEcltrgArray[m_hitEneNum]->setDataClockWindowStartTime(WindowStart);
1062
1063 return;
1064}
1065//========================================================
1066//
1067//========================================================
1068void
1069TrgEclMaster::setRS(std::vector<int> TCId,
1070 std::vector<double> TCHit,
1071 std::vector<double>& phiringsum,
1072 std::vector<std::vector<double>>& thetaringsum)
1073{
1074 //
1075 //
1076 // TC Phi & Theta ring sum
1077 //
1078 //----------------------------------------
1079 // FW BR BW total
1080 //----------------------------------------
1081 //TC phi ring 3 12 2 17
1082 //ID 1-3 4-15 16-17
1083 //TC Theta ring 32 36 32
1084 //ID 1-32 1-36 1-32
1085
1086 //----------------------------------------
1087 //
1088 thetaringsum.resize(3, std::vector<double>(36, 0.));
1089 phiringsum.resize(17);
1090 const int size_hit = TCHit.size();
1091 for (int iHit = 0; iHit < size_hit; iHit++) {
1092 int iTCId = TCId[iHit] - 1;
1093 if (TCHit[iHit] > 0) {
1094 int iTCThetaId = m_obj_map->getTCThetaIdFromTCId(iTCId + 1) - 1 ;
1095 int iTCPhiId = m_obj_map->getTCPhiIdFromTCId(iTCId + 1) - 1 ;
1096 phiringsum[iTCThetaId] += TCHit[iHit];
1097 if (iTCThetaId < 3) {
1098 //fwd
1099 if (iTCThetaId != 0) {
1100 thetaringsum[0][iTCPhiId] += TCHit[iHit];
1101 }
1102 } else if (iTCThetaId < 15) {
1103 //barrel
1104 thetaringsum[1][iTCPhiId] += TCHit[iHit];
1105 } else {
1106 //bwd
1107 thetaringsum[2][iTCPhiId] += TCHit[iHit];
1108 }
1109
1110 }
1111
1112 }
1113
1114}
1115//========================================================
1116//
1117//========================================================
1118void
1119TrgEclMaster::makeTriggerBit(int hit, int Timing, int RevoFAM, int TimingSource,
1120 double etot, int bhabha2D, int physics,
1121 std::vector<int> bhabhatype, int ICN, int BGVeto,
1122 int ClusterOverflow, int bhabha3D, int lowmultibit,
1123 int bhabha3D_sel, int mumubit, int prescale, int burst,
1124 int EventTimingQualityFlag, int bhabha3DVetoInTrackFlag,
1125 int bhabha3DSelectionThetaFlag,
1126 int taub2bFlag,
1127 int bit_hie_bhav,
1128 int taub2b2Flag,
1129 int taub2b3Flag)
1130{
1131
1132 m_Triggerbit[0] = 0;
1133 m_Triggerbit[1] = 0;
1134 m_Triggerbit[2] = 0;
1135 m_Triggerbit[3] = 0;
1136
1137 // int physics = 0;
1138 int elow = 0;
1139 int ehigh = 0;
1140 int elum = 0;
1141 int bhabhaveto = 0;
1142 int Bhabhatype = bhabha2D;
1143
1144 if (etot > 0.5) {
1145 elow = 0x01;
1146 }
1147 if (etot > 1.0) {
1148 ehigh = 0x01;
1149 }
1150 if (etot > 3.0) {
1151 elum = 0x01;
1152 }
1153
1154 if (bhabhatype.size() > 14) {
1155 for (int ibhabha = 0; ibhabha < 13; ibhabha++) {
1156 int type = 0x00;
1157 if (bhabhatype[ibhabha] == 1) {type = 0x01;}
1158
1159 Bhabhatype |= type;
1160 Bhabhatype <<= 1;
1161
1162 }
1163 }
1164
1165 int bit_hit = hit & 0x01;
1166 int bit_Timing = (Timing & 0x7F) ;
1167 int bit_RevoFAM = (RevoFAM & 0x7F) ;
1168 int bit_TimingSource = (TimingSource & 0x07) ;
1169 int bit_physics = (physics & 0x01) ;
1170 int bit_2Dbhabha = (bhabhaveto & 0x01) ;
1171 int bit_bhabhatype = (Bhabhatype & 0x3FFF);
1172 int bit_etot = (((int)etot) & 0x1FFF) ;
1173 int bit_elow = (elow & 0x01);
1174 int bit_ehigh = (ehigh & 0x01) ;
1175 int bit_elum = (elum & 0x01) ;
1176 int bit_ICN = (ICN & 0x7F) ;
1177 int bit_BGVeto = (BGVeto & 0x07) ;
1178 int bit_ClusterOverflow = (ClusterOverflow & 0x01);
1179 int bit_3Dbhabha = (bhabha3D & 0x01);
1180
1181 int bit_lowmulti1 = lowmultibit & 0x0FFF;
1182 int bit_lowmulti2 = (lowmultibit >>= 12) & 0x3;
1183 int bit_3DBhabha_sel = bhabha3D_sel & 0x01;
1184 int bit_mumu = mumubit & 0x01;
1185 int bit_prescale = prescale & 0x01;
1186 int bit_burst = burst & 0x01;
1187 int bit_clkcc = 0; // 4 bits for revo counter (set to be 0 in tsim)
1188 int bit_eventtimingqualityflag = EventTimingQualityFlag & 0x03;
1189 int bit_bhabha3dvetointrackflag = 0;
1190 if (bhabha3D == 1) {
1191 bit_bhabha3dvetointrackflag = bhabha3DVetoInTrackFlag & 0x01;
1192 }
1193 int bit_bhabha3dselectionthetaflag = 0;
1194 if (bhabha3D_sel == 1) {
1195 bit_bhabha3dselectionthetaflag = bhabha3DSelectionThetaFlag & 0x03;
1196 }
1197 int bit_taub2bflag = taub2bFlag & 0x01;
1198 int bit_taub2b2flag = taub2b2Flag & 0x01;
1199 int bit_taub2b3flag = taub2b3Flag & 0x01;
1200
1201 int bit_hie_bhav_hie123 = bit_hie_bhav & 0x7; // for hie1, hie2, hie3
1202 int bit_hie_bhav_hie4 = (bit_hie_bhav >> 3) & 0x1; // for hie4
1203
1204 m_Triggerbit[2] |= bit_hie_bhav_hie4;
1205 m_Triggerbit[2] <<= 1;
1206 m_Triggerbit[2] |= bit_taub2b3flag;
1207 m_Triggerbit[2] <<= 1;
1208 m_Triggerbit[2] |= bit_taub2b2flag;
1209 m_Triggerbit[2] <<= 3;
1210 m_Triggerbit[2] |= bit_hie_bhav_hie123;
1211 m_Triggerbit[2] <<= 1;
1212 m_Triggerbit[2] |= bit_taub2bflag;
1213 m_Triggerbit[2] <<= 2;
1214 m_Triggerbit[2] |= bit_bhabha3dselectionthetaflag;
1215 m_Triggerbit[2] <<= 1;
1216 m_Triggerbit[2] |= bit_bhabha3dvetointrackflag;
1217 m_Triggerbit[2] <<= 2;
1218 m_Triggerbit[2] |= bit_eventtimingqualityflag;
1219 m_Triggerbit[2] <<= 4;
1220 m_Triggerbit[2] |= bit_clkcc;
1221 m_Triggerbit[2] <<= 2;
1222 m_Triggerbit[2] |= bit_lowmulti2;
1223 m_Triggerbit[2] <<= 1;
1224 m_Triggerbit[2] |= bit_burst;
1225 m_Triggerbit[2] <<= 1;
1226 m_Triggerbit[2] |= bit_prescale;
1227 m_Triggerbit[2] <<= 1;
1228 m_Triggerbit[2] |= bit_mumu;
1229 m_Triggerbit[2] <<= 1;
1230 m_Triggerbit[2] |= bit_3DBhabha_sel;
1231 m_Triggerbit[2] <<= 10;
1232 m_Triggerbit[2] |= ((bit_lowmulti1) >> 2) & 0x3FF;
1233
1234 m_Triggerbit[1] |= (bit_lowmulti1 & 0x03);
1235 m_Triggerbit[1] <<= 1;
1236 m_Triggerbit[1] |= bit_3Dbhabha;
1237 m_Triggerbit[1] <<= 1;
1238 m_Triggerbit[1] |= bit_ClusterOverflow;
1239 m_Triggerbit[1] <<= 3;
1240 m_Triggerbit[1] |= bit_BGVeto;
1241 m_Triggerbit[1] <<= 7;
1242 m_Triggerbit[1] |= bit_ICN;
1243 m_Triggerbit[1] <<= 1;
1244 m_Triggerbit[1] |= bit_elum;
1245 m_Triggerbit[1] <<= 1;
1246 m_Triggerbit[1] |= bit_ehigh;
1247 m_Triggerbit[1] <<= 1;
1248 m_Triggerbit[1] |= bit_elow;
1249 m_Triggerbit[1] <<= 13;
1250 m_Triggerbit[1] |= bit_etot;
1251 m_Triggerbit[1] <<= 2;
1252 m_Triggerbit[1] |= ((bit_bhabhatype >> 12) & 0x03);
1253
1254 m_Triggerbit[0] |= (bit_bhabhatype & 0x0FFF);
1255 m_Triggerbit[0] <<= 1;
1256 m_Triggerbit[0] |= bit_2Dbhabha;
1257 m_Triggerbit[0] <<= 1;
1258 m_Triggerbit[0] |= bit_physics;
1259 m_Triggerbit[0] <<= 3;
1260 m_Triggerbit[0] |= bit_TimingSource;
1261 m_Triggerbit[0] <<= 7;
1262 m_Triggerbit[0] |= bit_RevoFAM;
1263 m_Triggerbit[0] <<= 7;
1264 m_Triggerbit[0] |= bit_Timing;
1265 m_Triggerbit[0] <<= 1;
1266 m_Triggerbit[0] |= bit_hit;
1267
1268 // int tmp = (m_Triggerbit[2] >> 24) & 0x03;
1269 // printf("%5i %5i %i\n", bit_bhabha3dselectionthetaflag, tmp, m_Triggerbit[2]);
1270}
1271//
1272//
1273//
1274void
1275TrgEclMaster::makeLowMultiTriggerBit(std::vector<int> CenterTCId,
1276 std::vector<double> clusterenergy)
1277{
1278
1279 //---------------------------------------------------------------------------------
1280 // ECL trigger
1281 //---------------------------------------------------------------------------------
1282 //Variable(in Tsim) | N(bit) | Address | Parameter
1283 //-------------------------------------- ------------------------------------------
1284 // | 1 | 62 | N Cluster >= 3, at least one Cluster >300 MeV (LAB), not 3D ECL Bhabha
1285 // | 1 | 63 | one Cluster >= 2GeV(CM) with Theta Id = 4~14
1286 // m_Lowmultibit | 1 | 64 | one Cluster >= 2GeV(CM) with Theta Id = 2,3,15 or 16 and not a 3D ECL Bhabha
1287 // | 1 | 65 | one Cluster >= 2GeV(CM) with Theta Id = 2, 3, 15 or 16 and not a 3D ECL Bhabha
1288 // | 1 | 66 | one Cluster >= 2GeV(CM) with Theta Id = 1 or 17 and not a 3D ECL Bhabha
1289 // | 1 | 67 | one Cluster >= 2GeV(CM) with Theta Id = 1 or 17 and a 3D ECL Bhabha
1290 // | 1 | 68 | exactly one Cluster >= 1GeV(CM) and one Cluster > 300 MeV (LAB ), in Theta Id 4~15(Barrel)
1291 // | 1 | 69 | exactly one Cluster >= 1GeV(CM) and one Cluster > 300 MeV (LAB), in Theta Id 2, 3 or 16
1292 // | 1 | 70 | 170 < delta phi(CM) < 190 degree, both Clusters > 250 MeV (LAB), and no 2GeV (CM) Cluster
1293 // | 1 | 71 | 170 < delta phi(CM) < 190 degree, one Cluster < 250 MeV (LAB), the other Cluster > 250 MeV(LAB), and no 2GeV (CM) Cluster
1294 // | 1 | 72 | 160 < delta phi(CM) < 200 degree, 160 < Sum Theta (CM)< 200 degree, no 2 GeV(CM) cluster
1295 // | 1 | 73 | No 2GeV (CM) Cluster
1296 //---------------------------------------------------------------------------------
1297 m_Lowmultibit = 0;
1298 int _nClust = CenterTCId.size();
1299 int _n300MeV = 0;
1300 int _n2GeV = 0;
1301 int _n2GeV414 = 0;
1302 int _n2GeV231516 = 0;
1303 int _n2GeV117 = 0;
1304 int _n1GeV415 = 0;
1305 int _n1GeV2316 = 0;
1306 int _nClust216 = 0;
1307 int _n500MeV216 = 0;
1308 int _n500MeV611 = 0;
1309 for (int ic = 0; ic < _nClust; ic++) {
1310 if (clusterenergy[ic] > 0.3) {_n300MeV++;}
1311 int thetaid = m_obj_map->getTCThetaIdFromTCId(CenterTCId[ic]);
1312 int lut = m_obj_database->Get3DBhabhaLUT(CenterTCId[ic]);
1313 int thresh = 15 & lut;
1314 if (thetaid >= 2 && thetaid <= 16) {_nClust216++;}
1315 if (thetaid >= 6 && thetaid <= 11) {
1316 if (clusterenergy[ic] * 100 > 5 * thresh) {
1317 _n500MeV611++;
1318 }
1319 }
1320
1321 if (clusterenergy[ic] > 0.5 && thetaid >= 2 && thetaid <= 16) {_n500MeV216++;}
1322 if (clusterenergy[ic] * 100 > (thresh * m_LowMultiThreshold[1])) { //200 <MeV
1323 _n2GeV++;
1324 if (thetaid >= 4 && thetaid <= 14) {_n2GeV414++;}
1325 if (thetaid == 2 || thetaid == 3 || thetaid == 15 || thetaid == 16) {_n2GeV231516++;}
1326 if (thetaid == 1 || thetaid == 17) {_n2GeV117++;}
1327 }
1328 if (clusterenergy[ic] * 100 > thresh * m_LowMultiThreshold[0]) { // 100 MeV
1329 if (thetaid >= 4 && thetaid <= 15) {_n1GeV415++;}
1330 if (thetaid == 2 || thetaid == 3 || thetaid == 16) {_n1GeV2316++;}
1331 }
1332 }
1333 //---------------------------------------------------------------------
1334 //..Trigger objects using back-to-back ECL clusters, plus Bhabha vetoes
1335 // nPhiPairHigh nPhiPairLow n3DPair nECLBhabha nTrkBhabha
1336
1337 int _nPhiPairHigh = 0;
1338 int _nPhiPairLow = 0;
1339 int _n3DPair = 0;
1340 int _nECLBhabha = 0;
1341 for (int i0 = 0; i0 < _nClust - 1; i0++) {
1342 for (int i1 = i0 + 1; i1 < _nClust; i1++) {
1343 int lut1 = m_obj_database->Get3DBhabhaLUT(CenterTCId[i0]);
1344 int lut2 = m_obj_database->Get3DBhabhaLUT(CenterTCId[i1]);
1345
1346 int energy1 = 15 & lut1;
1347 int energy2 = 15 & lut2;
1348 lut1 >>= 4;
1349 lut2 >>= 4;
1350 int phi1 = 511 & lut1;
1351 int phi2 = 511 & lut2;
1352 lut1 >>= 9;
1353 lut2 >>= 9;
1354 int theta1 = lut1;
1355 int theta2 = lut2;
1356
1357 //..back to back in phi
1358 int dphi = abs(phi1 - phi2);
1359 if (dphi > 180) {dphi = 360 - dphi;}
1360 int thetaSum = theta1 + theta2;
1361
1362 // cout << dphi << " " << thetaSum << endl;
1363 // cout << clusterenergy[i0] << " " << clusterenergy[i1] << endl;
1364 // if (dphi > 180.) {dphi = 360 - dphi;}
1365 if (dphi > 170. && clusterenergy[i0] > m_LowMultiThreshold[2] / 100
1366 && clusterenergy[i1] > m_LowMultiThreshold[2] / 100) {_nPhiPairHigh++;}
1367 if (dphi > 170. &&
1368 ((clusterenergy[i0] < m_LowMultiThreshold[2] / 100 &&
1369 clusterenergy[i1] > m_LowMultiThreshold[2] / 100) ||
1370 (clusterenergy[i0] > m_LowMultiThreshold[2] / 100 &&
1371 clusterenergy[i1] < m_LowMultiThreshold[2] / 100))) {_nPhiPairLow++;}
1372 //..3D
1373 if (dphi > 160. && thetaSum > 160. && thetaSum < 200) {_n3DPair++;}
1374 //..ecl Bhabha
1375 if (dphi > 160 &&
1376 thetaSum > 165 &&
1377 thetaSum < 190 &&
1378 clusterenergy[i0] * 100 > m_3DBhabhaVetoThreshold[0] * energy1 &&
1379 clusterenergy[i1] * 100 > m_3DBhabhaVetoThreshold[0] * energy2 &&
1380 (clusterenergy[i0] * 100 > m_3DBhabhaVetoThreshold[1] * energy1 ||
1381 clusterenergy[i1] * 100 > m_3DBhabhaVetoThreshold[1] * energy2)) {
1382 _nECLBhabha++;
1383
1384 }
1385 }
1386 }
1387 int bit1 = 0;
1388 int bit2 = 0;
1389 int bit3 = 0;
1390 int bit4 = 0;
1391 int bit5 = 0;
1392 int bit6 = 0;
1393 int bit7 = 0;
1394 int bit8 = 0;
1395 int bit9 = 0;
1396 int bit10 = 0;
1397 int bit11 = 0;
1398 int bit12 = 0;
1399 int bit13 = 0;
1400 int bit14 = 0;
1401
1402
1403 if (_nClust >= 3 && _n300MeV >= m_n300MeVCluster && _nECLBhabha == 0) {
1404 bit1 = 0x01; //6
1405 }
1406 if (_n2GeV414 > 0) {
1407 bit2 = 0x01; //7
1408 }
1409 if (_n2GeV231516 && _nECLBhabha == 0) {
1410 bit3 = 0x01; //9
1411 }
1412 if (_n2GeV231516 && _nECLBhabha != 0) {
1413 bit4 = 0x01; //10
1414 }
1415 if (_n2GeV117 && _nECLBhabha == 0) {
1416 bit5 = 0x01; //11
1417 }
1418 if (_n2GeV117 && _nECLBhabha != 0) {
1419 bit6 = 0x01; //12
1420 }
1421 if (_n1GeV415 == 1 && _n300MeV == 1) {
1422 bit7 = 0x01; //13
1423 }
1424 if (_n1GeV2316 == 1 && _n300MeV == 1) {
1425 bit8 = 0x01; //14
1426 }
1427 if (_nPhiPairHigh > 0 && _n2GeV == 0) {
1428 bit9 = 0x01; //15
1429 }
1430 if (_nPhiPairLow > 0 && _n2GeV == 0) {
1431 bit10 = 0x01; //16
1432 }
1433 if (_n3DPair > 0 && _n2GeV == 0) {
1434 bit11 = 0x01; //17;
1435 }
1436 if (_n2GeV == 0) {
1437 bit12 = 0x01; //4
1438 }
1439 if (_nClust216 >= 3 && _n500MeV216 > 0 && _nECLBhabha == 0) {
1440 bit13 = 0x01; //6
1441 }
1442 if (_n500MeV611 == 1 && _n300MeV == 1) {
1443 bit14 = 0x01; //6
1444 }
1445
1446 int total_bit = 0;
1447 total_bit |= bit14;
1448 total_bit <<= 1;
1449 total_bit |= bit13;
1450 total_bit <<= 1;
1451 total_bit |= bit12;
1452 total_bit <<= 1;
1453 total_bit |= bit11;
1454 total_bit <<= 1;
1455 total_bit |= bit10;
1456 total_bit <<= 1;
1457 total_bit |= bit9;
1458 total_bit <<= 1;
1459 total_bit |= bit8;
1460 total_bit <<= 1;
1461 total_bit |= bit7;
1462 total_bit <<= 1;
1463 total_bit |= bit6;
1464 total_bit <<= 1;
1465 total_bit |= bit5;
1466 total_bit <<= 1;
1467 total_bit |= bit4;
1468 total_bit <<= 1;
1469 total_bit |= bit3;
1470 total_bit <<= 1;
1471 total_bit |= bit2;
1472 total_bit <<= 1;
1473 total_bit |= bit1;
1474
1475 m_Lowmultibit = total_bit ;
1476}
1477//
1478//
1479//
1480double TrgEclMaster::setTotalEnergy(std::vector<double> phisum)
1481{
1482
1483 double E_phys = 0;
1484 for (int iii = 0; iii <= 16; iii++) {
1485 if (iii > 0 && iii < 15) {E_phys += phisum[iii];}
1486 }
1487 return E_phys;
1488}
1489//
1490//
1491//
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
T * appendNew()
Construct a new T object at the end of the array.
Definition: StoreArray.h:246
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
Example Detector.
Definition: TRGECLCluster.h:24
double getTimeAve() const
The method to get hit average time.
int getMaxThetaId()
The method to set Theta Id of maximum TC in Cluster.
double getEnergyDep() const
The method to get deposited energy.
int getMaxTCId() const
The method to get the Maximum(center) TC id.
Example Detector.
Definition: TRGECLHit.h:22
double getTimeAve() const
The method to get hit average time.
Definition: TRGECLHit.h:64
double getEnergyDep() const
The method to get deposited energy.
Definition: TRGECLHit.h:61
int getBeamBkgTag() const
The method to get Beam Background tag.
Definition: TRGECLHit.h:66
int getTCId() const
The method to get TC id.
Definition: TRGECLHit.h:58
A Class of ECL Trigger clustering
Definition: TrgEclBeamBKG.h:29
A Class of ECL Trigger clustering
Definition: TrgEclBhabha.h:32
int getTaub2bAngleFlag(void)
get taub2b 2 cluster angle cut flag
Definition: TrgEclBhabha.h:236
bool GetBhabha00(std::vector< double >)
Belle 2D Bhabha veto method.
bool Getmumu()
MuMu selection for calibration.
int getTaub2bEtotFlag(void)
get total energy(TC theta id=1-17) flag for taub2b
Definition: TrgEclBhabha.h:238
double get3DBhabhaVetoClusterTiming(int cl_idx)
get each cluster timing of two clusters of 3D Bhabha veto (ns)
Definition: TrgEclBhabha.h:183
int GetBhabhaAddition(void)
Additional Bhabha veto.
std::vector< double > GetBhabhaComb()
Output 2D Bhabha combination.
Definition: TrgEclBhabha.h:65
void set3DBhabhaAddAngleCut(const std::vector< double > &i3DBhabhaAddAngleCut)
set 3D Bhabha addtion Angle selection
Definition: TrgEclBhabha.h:100
double get3DBhabhaSelectionClusterEnergy(int cl_idx)
get each cluster energy of two clusters of 3D Bhabha selection (GeV)
Definition: TrgEclBhabha.h:220
int get3DBhabhaSelectionThetaFlag(void)
get trigger bit(2bits) of flag which shows theta position of clusters of 3DBhabha Selection.
Definition: TrgEclBhabha.h:198
void setTaub2bAngleCut(const std::vector< int > &iTaub2bAngleCut)
set 2 Cluster angle selection for tau 1x1 decay [0], [1] for low and high of dphi,...
Definition: TrgEclBhabha.h:111
double get3DBhabhaSelectionClusterTiming(int cl_idx)
get each cluster timing of two clusters of 3D Bhabha selection (ns)
Definition: TrgEclBhabha.h:228
void setTaub2bClusterECut(const double iTaub2bClusterECut1, const double iTaub2bClusterECut2)
set cluster energy cut for taub2b
Definition: TrgEclBhabha.h:121
int get3DBhabhaSelectionClusterThetaId(int cl_idx)
get each TC theta ID(most energetic TC in a cluster) of two clusters of 3D Bhabha selection
Definition: TrgEclBhabha.h:212
void setmumuThreshold(int mumuThreshold)
set mumu bit Threshold
Definition: TrgEclBhabha.h:96
void set2DBhabhaThreshold(const std::vector< double > &i2DBhabhaThresholdFWD, const std::vector< double > &i2DBhabhaThresholdBWD)
set 2D Bhabha Energy Threshold
Definition: TrgEclBhabha.h:69
int get3DBhabhaVetoClusterThetaId(int cl_idx)
get each TC theta ID(most energetic TC in a cluster) of two clusters of 3D Bhabha veto
Definition: TrgEclBhabha.h:167
int getTaub2bClusterEFlag(void)
taub2b Cluster energy flag
Definition: TrgEclBhabha.h:240
void set3DBhabhaVetoAngle(const std::vector< double > &i3DBhabhaVetoAngle)
set 3D veto Bhabha Energy Angle
Definition: TrgEclBhabha.h:91
void setTaub2b2Cut(const std::vector< int > &iTaub2b2AngleCut, const double iTaub2b2EtotCut, const double iTaub2b2CLEEndcapCut, const double iTaub2b2CLECut)
set taub2b2 cut
Definition: TrgEclBhabha.h:128
bool GetBhabha02()
Belle II 3D Bhabha method for selection.
void set3DBhabhaSelectionAngle(const std::vector< double > &i3DBhabhaSelectionAngle)
set 3D selection Bhabha Energy Angle
Definition: TrgEclBhabha.h:86
void set3DBhabhaSelectionThreshold(const std::vector< double > &i3DBhabhaSelectionThreshold)
set 3D selection Bhabha Energy Threshold
Definition: TrgEclBhabha.h:76
double get3DBhabhaVetoClusterEnergy(int cl_idx)
get each cluster energy of two clusters of 3D Bhabha veto (GeV)
Definition: TrgEclBhabha.h:175
void setTaub2bEtotCut(const double iTaub2bEtotCut)
set total energy cut for taub2b
Definition: TrgEclBhabha.h:116
int get3DBhabhaVetoInTrackFlag(void)
get trigger bit of flag(1bit) whether two clusters statisfy 3D Bhabha veto are in CDCTRG region in th...
Definition: TrgEclBhabha.h:153
bool GetTaub2b3(double)
Taub2b3.
bool GetTaub2b(double)
Taub2b selection.
bool GetBhabha01()
Belle II 3D Bhabha method for veto.
int get3DBhabhaVetoClusterTCId(int cl_idx)
get each TCID(most energetic TC in a cluster) of two clusters of 3D Bhabha veto
Definition: TrgEclBhabha.h:158
void set3DBhabhaVetoInTrackThetaRegion(const std::vector< int > &i3DBhabhaVetoInTrackThetaRegion)
set ThetaID (low and high) for 3DBhabhaVetoInTrack
Definition: TrgEclBhabha.h:105
void set3DBhabhaVetoThreshold(const std::vector< double > &i3DBhabhaVetoThreshold)
set 3D veto Bhabha Energy Threshold
Definition: TrgEclBhabha.h:81
void setmumuAngle(const std::vector< double > &imumuAngle)
set mumu bit Angle selection
Definition: TrgEclBhabha.h:98
void setTaub2b3Cut(const std::vector< int > &iTaub2b3AngleCut, const double iTaub2b3EtotCut, const double iTaub2b3CLEb2bCut, const double iTaub2b3CLELowCut, const double iTaub2b3CLEHighCut)
set taub2b3 cut
Definition: TrgEclBhabha.h:139
int get3DBhabhaSelectionClusterTCId(int cl_idx)
get each TCID(most energetic TC in a cluster) of two clusters of 3D Bhabha selection
Definition: TrgEclBhabha.h:203
bool GetTaub2b2(double)
Taub2b selection (tighter selection than Taub2b)
A Class of ECL Trigger clustering
Definition: TrgEclCluster.h:30
void setICN(const std::vector< int > &)
set ICN for each part(Fw,Br,Bw)
int getICNSub(int)
get ICN in each region(Fw(0), Br(1), Bw(2))
int getICNFwBr(void)
get ICN in Barrel and Forward
int getNofExceedCluster()
get # Cluster in case of exceeding limit
void setClusterLimit(int limit)
Set Limit of Cluster.
Definition: TrgEclCluster.h:73
int getNofCluster()
0 : center , 1; upper , 2: right , 3: lower , 4: lower right
Definition: TrgEclCluster.h:95
void setClusteringMethod(int method)
Set.
Definition: TrgEclCluster.h:71
void setEventId(int eventId)
Set EventId.
Definition: TrgEclCluster.h:69
class TrgEclDataBase;
int Get3DBhabhaLUT(int)
TC CM Phi
A class of TC Mapping.
Definition: TrgEclMapping.h:26
int getTCThetaIdFromTCId(int)
get [TC Theta ID] from [TC ID]
int getTCPhiIdFromTCId(int)
get [TC Phi ID] from [TC ID]
double m_taub2b3CLELowCut
taub2b3 cluster energy low cut in lab for all clusters (GeV)
Definition: TrgEclMaster.h:320
double m_taub2bEtotCut
tau b2b total energy (TC theta ID =1-17) (GeV)
Definition: TrgEclMaster.h:298
double m_taub2b3CLEHighCut
taub2b3 cluster energy high cut in lab for all clusters (GeV)
Definition: TrgEclMaster.h:322
TrgEclDataBase * m_obj_database
Beam Backgroud veto object.
Definition: TrgEclMaster.h:347
std::vector< double > m_LowMultiThreshold
Low Multiplicity Threshold.
Definition: TrgEclMaster.h:330
std::vector< double > m_2DBhabhaThresholdBWD
2D Bhabha Energy Threshold
Definition: TrgEclMaster.h:279
double m_ECLBurstThreshold
ECL Burst Bit Threshold.
Definition: TrgEclMaster.h:326
std::vector< double > m_mumuAngle
mumu bit Angle
Definition: TrgEclMaster.h:291
int m_Clustering
clutering option
Definition: TrgEclMaster.h:258
std::vector< int > m_HitTCId
Hit TC Energy in time window.
Definition: TrgEclMaster.h:234
std::vector< double > m_EventTimingQualityThresholds
energy threshold(low, high) for quality flag (GeV)
Definition: TrgEclMaster.h:334
std::vector< double > m_TotalEnergy
Total Energy Theshold (low, high, lum)
Definition: TrgEclMaster.h:328
std::vector< int > m_taub2bAngleCut
tau b2b 2 cluster angle cut (degree) (dphi low, dphi high, theta_sum low, theta_sum high)
Definition: TrgEclMaster.h:296
int m_ClusterLimit
The limit number of Cluster.
Definition: TrgEclMaster.h:266
std::vector< double > m_TCHitTiming
Hit TC Timing in time window.
Definition: TrgEclMaster.h:238
void simulate02(int)
simulates ECL trigger for Data Analysis
std::vector< std::vector< double > > m_TCTiming
Hit TC Timing.
Definition: TrgEclMaster.h:229
std::vector< int > m_3DBhabhaVetoInTrackThetaRegion
Theta region (low, high) of 3D Bhabha Veto InTrack.
Definition: TrgEclMaster.h:332
int m_PrescaleCounter
Bhabha Prescale Countor.
Definition: TrgEclMaster.h:274
std::string version(void) const
returns version.
TrgEclMaster(void)
TrgEclMaster Constructor.
Definition: TrgEclMaster.cc:83
int m_EventTiming
EventTiming option.
Definition: TrgEclMaster.h:262
void initialize(int)
initialize
double setTotalEnergy(std::vector< double >)
Set Total Energy.
void makeLowMultiTriggerBit(std::vector< int >, std::vector< double >)
make LowMultiTriggerBit
double m_OverlapWindow
TRG Decision overlap window.
Definition: TrgEclMaster.h:255
std::vector< std::vector< int > > m_TCBeamBkgTag
Hit TC Beam Background tag.
Definition: TrgEclMaster.h:231
int m_n300MeVCluster
The number of Cluster exceeding 300 MeV.
Definition: TrgEclMaster.h:324
int m_Triggerbit[4]
ECL Trigger bit.
Definition: TrgEclMaster.h:268
std::vector< double > m_3DBhabhaSelectionAngle
3D Selection Bhabha Energy Angle
Definition: TrgEclMaster.h:285
std::vector< double > m_3DBhabhaVetoThreshold
3D Veto Bhabha Energy Threshold
Definition: TrgEclMaster.h:283
std::vector< double > m_3DBhabhaAddAngleCut
Angle selection of additional Bhabha addition in CM frame.
Definition: TrgEclMaster.h:293
double m_taub2b2EtotCut
taub2b2 total energy (TC theta ID =1-17) (GeV)
Definition: TrgEclMaster.h:307
void setRS(std::vector< int >, std::vector< double >, std::vector< double > &, std::vector< std::vector< double > > &)
ECL bit information for GDL.
TrgEclMapping * m_obj_map
Mapping object.
Definition: TrgEclMaster.h:337
std::vector< double > m_TCHitEnergy
Hit TC Energy in time window.
Definition: TrgEclMaster.h:236
int m_Lowmultibit
Low Multiplicity bit.
Definition: TrgEclMaster.h:270
std::vector< double > m_3DBhabhaVetoAngle
3D Veto Bhabha Energy Angle
Definition: TrgEclMaster.h:287
std::vector< double > m_3DBhabhaSelectionThreshold
3D Selection Bhabha Energy Threshold
Definition: TrgEclMaster.h:281
TrgEclBhabha * m_obj_bhabha
Bhabha object.
Definition: TrgEclMaster.h:343
double m_mumuThreshold
mumu bit Energy Threshold
Definition: TrgEclMaster.h:289
int m_PrescaleFactor
Bhabha Prescale Factor.
Definition: TrgEclMaster.h:272
double m_taub2bClusterECut2
taub2b one Cluster energy selection (GeV)
Definition: TrgEclMaster.h:302
std::string name(void) const
returns name.
std::vector< int > m_taub2b2AngleCut
taub2b2 angle selection(degree) (3,2,1,0) = (dphi low, dphi high, theta_sum low, theta_sum high)
Definition: TrgEclMaster.h:305
double m_taub2b3EtotCut
taub2b3 total energy (TC theta ID =1-17) (GeV)
Definition: TrgEclMaster.h:316
std::vector< int > m_TCHitBeamBkgTag
Hit TC Beam Background tag in time window.
Definition: TrgEclMaster.h:240
double m_taub2b3CLEb2bCut
taub2b3 cluster energy cut in lab for one of b2b clusters (GeV)
Definition: TrgEclMaster.h:318
void simulate01(int)
simulates ECL trigger for Global Cosmic data
TrgEclBeamBKG * m_obj_beambkg
Beam Backgroud veto object.
Definition: TrgEclMaster.h:345
double m_taub2bClusterECut1
taub2b one Cluster energy selection (GeV)
Definition: TrgEclMaster.h:300
void makeTriggerBit(int, int, int, int, double, int, int, std::vector< int >, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int)
make Trigger bit except for Low Multiplicity related bit
TrgEclCluster * m_obj_cluster
Cluster object.
Definition: TrgEclMaster.h:339
virtual ~TrgEclMaster()
TrgEclMaster Destructor.
std::vector< double > m_2DBhabhaThresholdFWD
2D Bhabha Energy Threshold
Definition: TrgEclMaster.h:277
std::vector< std::vector< double > > m_TCEnergy
Hit TC Energy.
Definition: TrgEclMaster.h:227
TrgEclTiming * m_obj_timing
EventTiming object.
Definition: TrgEclMaster.h:341
double m_taub2b2CLECut
taub2b2 cluseter energy cut (GeV)
Definition: TrgEclMaster.h:311
double m_taub2b2CLEEndcapCut
taub2b2 cluster energy cut for endcap cluster (GeV)
Definition: TrgEclMaster.h:309
std::vector< int > m_taub2b3AngleCut
taub2b3 selection cuts (3,2,1,0) = (dphi low, dphi high, theta_sum low, theta_sum high)
Definition: TrgEclMaster.h:314
double m_TimeWindow
Hit TC Energy in time window.
Definition: TrgEclMaster.h:253
A Class of ECL Trigger clustering
Definition: TrgEclTiming.h:29
void Setup(const std::vector< int > &, const std::vector< double > &, const std::vector< double > &)
SetUp.
Definition: TrgEclTiming.cc:43
void SetNofTopTC(int NtopTC)
Set # of considered TC in Energy weighted timing method.
Definition: TrgEclTiming.h:56
double GetEventTiming(int)
Get Evnet-timing.
Definition: TrgEclTiming.cc:55
int GetTimingSource()
Get Timing Source.
Definition: TrgEclTiming.h:58
Abstract base class for different kinds of events.
STL namespace.