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