Actually write out the variables into the map.
< number of clusters with Elab > m_EminLab outside of high background endcap region
< number of clusters with Elab > m_EminLab4Cluster outside of high background endcap region
< number of clusters with Elab > m_EminLab3Cluster outside of high background endcap region
< number of clusters with Ecms > m_Ehigh outside of high background endcap region
87{
88 calculationResult["nTrkLoose"] = 0;
89 calculationResult["nTrkTight"] = 0;
90 calculationResult["ee2leg"] = 0;
91 calculationResult["nEmedium"] = 0;
92 calculationResult["nElow"] = 0;
93 calculationResult["nEhigh"] = 0;
94 calculationResult["nE180Lab"] = 0;
95 calculationResult["nE300Lab"] = 0;
96 calculationResult["nE500Lab"] = 0;
97 calculationResult["nE2000CMS"] = 0;
98 calculationResult["nE4000CMS"] = 0;
99 calculationResult["nE250Lab"] = 0;
100 calculationResult["nMaxEPhotonAcc"] = 0;
101 calculationResult["dphiCmsClust"] = NAN;
102
103 calculationResult["netChargeLoose"] = 0;
104 calculationResult["maximumPCMS"] = NAN;
105 calculationResult["maximumPLab"] = NAN;
106 calculationResult["eexx"] = 0;
107 calculationResult["ee1leg1trk"] = 0;
108 calculationResult["nEhighLowAng"] = 0;
109 calculationResult["nEsingleClust"] = 0;
110 calculationResult["nEsinglePhotonBarrel"] = 0;
111 calculationResult["nEsinglePhotonExtendedBarrel"] = 0;
112 calculationResult["nEsinglePhotonEndcap"] = 0;
113 calculationResult["nEsingleElectronBarrel"] = 0;
114 calculationResult["nEsingleElectronExtendedBarrel"] = 0;
115 calculationResult["nReducedEsinglePhotonReducedBarrel"] = 0;
116 calculationResult["nVetoClust"] = 0;
117 calculationResult["chrgClust2GeV"] = 0;
118 calculationResult["neutClust045GeVAcc"] = 0;
119 calculationResult["neutClust045GeVBarrel"] = 0;
120 calculationResult["singleTagLowMass"] = 0;
121 calculationResult["singleTagHighMass"] = 0;
122 calculationResult["n2GeVNeutBarrel"] = 0;
123 calculationResult["n2GeVNeutEndcap"] = 0;
124 calculationResult["n2GeVChrg"] = 0;
125 calculationResult["n2GeVPhotonBarrel"] = 0;
126 calculationResult["n2GeVPhotonEndcap"] = 0;
127 calculationResult["ee1leg"] = 0;
128 calculationResult["ee1leg1clst"] = 0;
129 calculationResult["ee1leg1e"] = 0;
130 calculationResult["ee2clst"] = 0;
131 calculationResult["gg2clst"] = 0;
132 calculationResult["eeee"] = 0;
133 calculationResult["eemm"] = 0;
134 calculationResult["eexxSelect"] = 0;
135 calculationResult["radBhabha"] = 0;
136 calculationResult["eeBrem"] = 0;
137 calculationResult["isrRadBhabha"] = 0;
138 calculationResult["muonPairECL"] = 0;
139 calculationResult["ggHighPt"] = 0;
140 calculationResult["selectee1leg1trk"] = 0;
141 calculationResult["selectee1leg1clst"] = 0;
142 calculationResult["selectee"] = 0;
143 calculationResult["ggBarrelVL"] = 0;
144 calculationResult["ggBarrelLoose"] = 0;
145 calculationResult["ggBarrelTight"] = 0;
146 calculationResult["ggEndcapVL"] = 0;
147 calculationResult["ggEndcapLoose"] = 0;
148 calculationResult["ggEndcapTight"] = 0;
149 calculationResult["muonPairV"] = 0;
150 calculationResult["selectmumu"] = 0;
151 calculationResult["singleMuon"] = 0;
152 calculationResult["cosmic"] = 0;
153 calculationResult["displacedVertex"] = 0;
154 calculationResult["eeFlat0"] = 0;
155 calculationResult["eeFlat1"] = 0;
156 calculationResult["eeFlat2"] = 0;
157 calculationResult["eeFlat3"] = 0;
158 calculationResult["eeFlat4"] = 0;
159 calculationResult["eeFlat5"] = 0;
160 calculationResult["eeFlat6"] = 0;
161 calculationResult["eeFlat7"] = 0;
162 calculationResult["eeFlat8"] = 0;
163 calculationResult["eeOneClust"] = 0;
164
165
166 calculationResult["nTrkLooseB"] = 0;
167 calculationResult["nTrkTightB"] = 0;
168 calculationResult["maximumPCMSB"] = NAN;
169 calculationResult["netChargeLooseB"] = 0;
170 calculationResult["muonPairVB"] = 0;
171 calculationResult["eeBremB"] = 0;
172 calculationResult["singleTagLowMassB"] = 0;
173 calculationResult["singleTagHighMassB"] = 0;
174 calculationResult["radBhabhaB"] = 0;
175
176
177 calculationResult["nTrackC"] = 0;
178 calculationResult["maximumPCMSC"] = NAN;
179 calculationResult["pCmsNegC"] = NAN;
180 calculationResult["clusterENegC"] = NAN;
181 calculationResult["pCmsPosC"] = NAN;
182 calculationResult["clusterEPosC"] = NAN;
183 calculationResult["dPhiCmsC"] = NAN;
184
185
186 calculationResult["Prefilter_InjectionStrip"] = 0;
187 calculationResult["Prefilter_CDCECLthreshold"] = 0;
188
189
194 bool bha3d;
195 try {
197 } catch (const std::exception&) {
198 bha3d = false;
199 }
200 bool bhapurPsnm;
201 try {
203 } catch (const std::exception&) {
204 bhapurPsnm = false;
205 }
206 bool bhapurFtdl;
207 try {
209 } catch (const std::exception&) {
210 bhapurFtdl = false;
211 }
212 bool lml1;
213 try {
215 } catch (const std::exception&) {
216 lml1 = false;
217 }
218 bool l1_bit_f;
219 try {
221 } catch (const std::exception&) {
222 l1_bit_f = false;
223 }
224 calculationResult["bha3d"] = bha3d;
225 calculationResult["bhapur"] = bhapurPsnm;
226 calculationResult["bhapur_lml1"] = lml1 and bhapurFtdl;
227 calculationResult["l1_bit_f"] = l1_bit_f;
228 } else {
229 calculationResult["l1_trigger_random"] = 1;
230 calculationResult["l1_trigger_delayed_bhabha"] = 0;
231 calculationResult["l1_trigger_poisson"] = 0;
232 calculationResult["bha3d"] = 0;
233 calculationResult["bhapur"] = 0;
234 calculationResult["bhapur_lml1"] = 0;
235 calculationResult["l1_bit_f"] = 0;
236 }
237
238
239 calculationResult["l1_trg_NN_info"] = 0;
240 if (
m_bitsNN.isValid() and
m_bitsNN.getEntries() > 0) {calculationResult[
"l1_trg_NN_info"] = 1;}
241
242 calculationResult["true"] = 1;
243 calculationResult["false"] = 0;
244
245
246
247 ClusterUtils cUtil;
248 const ROOT::Math::XYZVector clustervertex = cUtil.
GetIPPosition();
249 PCmsLabTransform boostrotate;
250 ROOT::Math::PxPyPzEVector p4ofCOM;
251 p4ofCOM.SetPxPyPzE(0, 0, 0, boostrotate.
getCMSEnergy());
252
253
254 std::map<short, std::optional<MaximumPtTrack>> maximumPtTracks = {
255 { -1, {}}, {1, {}}
256 };
257
258
259 std::map<short, std::optional<MaximumPtTrack>> maximumPtTracksWithoutZCut = {
260 { -1, {}}, {1, {}}
261 };
262
263
264 std::map<short, std::optional<MaximumPtTrack>> maximumPCmsTracksC = {
265 { -1, {}}, {1, {}}
266 };
267
268
269
270 for (
const Track& track :
m_tracks) {
271 const TrackFitResult* trackFitResult = track.getTrackFitResultWithClosestMass(
Const::pion);
272 if (not trackFitResult) {
273
274 continue;
275 }
276
277
278 const short charge = trackFitResult->getChargeSign();
279 if (charge == 0) {continue;}
280 const double z0 = trackFitResult->getZ0();
281 const ROOT::Math::PxPyPzEVector& momentumLab = trackFitResult->get4Momentum();
282 const ROOT::Math::PxPyPzEVector momentumCMS = boostrotate.
rotateLabToCms() * momentumLab;
283 const double pCMS = momentumCMS.P();
284 const double pLab = momentumLab.P();
285 const double trackTime = track.getTrackTime();
286 const double pT = trackFitResult->getTransverseMomentum();
287 const int nCDCHits = (int)(0.5 + trackFitResult->getHitPatternCDC().getNHits());
288 double clusterELab = 0.;
289 for (auto& cluster : track.getRelationsTo<ECLCluster>()) {
292 }
293 }
294 const double clusterECMS = clusterELab * pCMS / pLab;
295
296
297
298
299 bool goodTrackCTime = true;
300 if (std::abs(trackTime) > 15.) {goodTrackCTime = false;}
301 if (std::abs(z0) < 1. and goodTrackCTime and pCMS > 0.2) {
302 calculationResult["nTrackC"] += 1;
303 if (std::isnan(calculationResult["maximumPCMSC"]) or pCMS > calculationResult["maximumPCMSC"]) {
304 calculationResult["maximumPCMSC"] = pCMS;
305 }
306 }
307
308
309 const auto& currentMaximumC = maximumPCmsTracksC.at(charge);
310 if (not currentMaximumC or pCMS > currentMaximumC->pCMS) {
311 MaximumPtTrack newMaximum;
313 newMaximum.
track = &track;
314 newMaximum.
pCMS = pCMS;
315 newMaximum.
pLab = pLab;
316 newMaximum.
p4CMS = momentumCMS;
317 newMaximum.
p4Lab = momentumLab;
320 maximumPCmsTracksC[charge] = newMaximum;
321 }
322
323
324
325
326 if (nCDCHits == 0) {
327 continue;
328 }
329
330
332 calculationResult["nTrkTight"] += 1;
333 }
334
335
336
337
338 const auto& currentMaximum = maximumPtTracksWithoutZCut.at(charge);
339 if (not currentMaximum or pT > currentMaximum->pT) {
340 MaximumPtTrack newMaximum;
342 newMaximum.
track = &track;
343 newMaximum.
pCMS = pCMS;
344 newMaximum.
pLab = pLab;
345 newMaximum.
p4CMS = momentumCMS;
346 newMaximum.
p4Lab = momentumLab;
349 maximumPtTracksWithoutZCut[charge] = newMaximum;
350 }
351
352
353
354
356 calculationResult["nTrkLoose"] += 1;
357 calculationResult["netChargeLoose"] += charge;
358
359 if (std::isnan(calculationResult["maximumPCMS"]) or pCMS > calculationResult["maximumPCMS"]) {
360 calculationResult["maximumPCMS"] = pCMS;
361 }
362
363 if (std::isnan(calculationResult["maximumPLab"]) or pLab > calculationResult["maximumPLab"]) {
364 calculationResult["maximumPLab"] = pLab;
365 }
366
367
368 const double pTLoose = trackFitResult->getTransverseMomentum();
369 const auto& currentMaximumLoose = maximumPtTracks.at(charge);
370 if (not currentMaximumLoose or pTLoose > currentMaximumLoose->pT) {
371 MaximumPtTrack newMaximum;
372 newMaximum.
pT = pTLoose;
373 newMaximum.
track = &track;
374 newMaximum.
pCMS = pCMS;
375 newMaximum.
pLab = momentumLab.P();
376 newMaximum.
p4CMS = momentumCMS;
377 newMaximum.
p4Lab = momentumLab;
380 maximumPtTracks[charge] = newMaximum;
381 }
382 }
383
384
385
386 if (nCDCHits >= 5) {
387 if (std::abs(z0) < 1.) {calculationResult["nTrkTightB"] += 1;}
388 if (std::abs(z0) < 5.) {
389 calculationResult["nTrkLooseB"] += 1;
390 calculationResult["netChargeLooseB"] += charge;
391 if (std::isnan(calculationResult["maximumPCMSB"]) or pCMS > calculationResult["maximumPCMSB"]) {
392 calculationResult["maximumPCMSB"] = pCMS;
393
394 }
395 }
396 }
397
398 }
399
400
401
402
403 for (short charge : { -1, 1}) {
404 auto& maximumPcmsTrackC = maximumPCmsTracksC.at(charge);
405 if (not maximumPcmsTrackC) {
406 continue;
407 }
408
409
410 if (charge == -1) {
411 calculationResult["pCmsNegC"] = maximumPcmsTrackC->pCMS;
412 calculationResult["clusterENegC"] = maximumPcmsTrackC->clusterEnergySumLab;
413 } else {
414 calculationResult["pCmsPosC"] = maximumPcmsTrackC->pCMS;
415 calculationResult["clusterEPosC"] = maximumPcmsTrackC->clusterEnergySumLab;
416 }
417 }
418
419
420 if (maximumPCmsTracksC.at(-1) and maximumPCmsTracksC.at(1)) {
421 const MaximumPtTrack& negativeTrack = *maximumPCmsTracksC.at(-1);
422 const MaximumPtTrack& positiveTrack = *maximumPCmsTracksC.at(1);
423
424 calculationResult[
"dPhiCmsC"] = std::abs(ROOT::Math::VectorUtil::DeltaPhi(negativeTrack.
p4CMS,
425 positiveTrack.
p4CMS)) * TMath::RadToDeg();
426 }
427
428
429
430
431 std::vector<SelectedECLCluster> selectedClusters;
433
434 const double time = cluster.getTime();
436 std::abs(time) > 200 or
438 continue;
439 }
440
441 const double dt99 = cluster.getDeltaTime99();
442
443
444 SelectedECLCluster selectedCluster;
448 selectedCluster.
cluster = &cluster;
452 selectedCluster.
isTrack = cluster.isTrack();
453
454 selectedClusters.push_back(selectedCluster);
455
457 calculationResult["nElow"] += 1;
458 }
460 calculationResult["nEmedium"] += 1;
461 }
463 calculationResult["nEhigh"] += 1;
464 }
465
467 calculationResult["nVetoClust"] += 1;
468 }
469
470
471
472 const double thetaLab = selectedCluster.
p4Lab.Theta() * TMath::RadToDeg();
473 const double zmva = cluster.getZernikeMVA();
474 const bool photon = zmva > 0.5 and not selectedCluster.
isTrack;
475 const bool electron = zmva > 0.5 and selectedCluster.
isTrack;
476
477
479 calculationResult["chrgClust2GeV"] += 1;
480 }
482 const bool isInAcceptance = 17. < thetaLab and thetaLab < 150.;
483 if (isInAcceptance) {calculationResult["neutClust045GeVAcc"] += 1;}
484 const bool isInBarrel = 30. < thetaLab and thetaLab < 130.;
485 if (isInBarrel) {calculationResult["neutClust045GeVBarrel"] += 1;}
486 }
487
488
489
490 const bool notInHighBackgroundEndcapRegion = 18.5 < thetaLab and thetaLab < 139.3;
492 calculationResult["nE180Lab"] += 1;
493 }
494
496 calculationResult["nE300Lab"] += 1;
497 }
498
500 calculationResult["nE500Lab"] += 1;
501 }
502
503 if (selectedCluster.
energyCMS >
m_Ehigh and notInHighBackgroundEndcapRegion) {
504 calculationResult["nE2000CMS"] += 1;
505 }
506
507
509 calculationResult["nE250Lab"] += 1;
510 }
512 calculationResult["nE4000CMS"] += 1;
513 }
514
515
517 calculationResult["nEsingleClust"] += 1;
518
519 const bool barrelRegion = thetaLab > 45 and thetaLab < 115;
520 const bool extendedBarrelRegion = thetaLab > 30 and thetaLab < 130;
521 const bool endcapRegion = (thetaLab > 22 and thetaLab < 45) or (thetaLab > 115 and thetaLab < 145);
522
523 if (photon and barrelRegion) {
524 calculationResult["nEsinglePhotonBarrel"] += 1;
525 }
526
527 if (photon and extendedBarrelRegion) {
528 calculationResult["nEsinglePhotonExtendedBarrel"] += 1;
529 }
530
531 if (electron and barrelRegion) {
532 calculationResult["nEsingleElectronBarrel"] += 1;
533 }
534
535 if (electron and extendedBarrelRegion) {
536 calculationResult["nEsingleElectronExtendedBarrel"] += 1;
537 }
538
539 if (photon and endcapRegion) {
540 calculationResult["nEsinglePhotonEndcap"] += 1;
541 }
542 }
543
545 const bool reducedBarrelRegion = thetaLab > 44 and thetaLab < 98;
546
547 if (photon and reducedBarrelRegion) {
548 calculationResult["nReducedEsinglePhotonReducedBarrel"] += 1;
549 }
550 }
551
553
554 const bool barrelRegion = thetaLab > 32 and thetaLab < 130;
555 const bool endcapRegion = (thetaLab > 22 and thetaLab < 32) or (thetaLab > 130 and thetaLab < 145);
556 const bool lowAngleRegion = thetaLab < 22 or thetaLab > 145;
557
558 if (not selectedCluster.
isTrack and barrelRegion) {
559 calculationResult["n2GeVNeutBarrel"] += 1;
560 }
561 if (not selectedCluster.
isTrack and endcapRegion) {
562 calculationResult["n2GeVNeutEndcap"] += 1;
563 }
564 if (selectedCluster.
isTrack and not lowAngleRegion) {
565 calculationResult["n2GeVChrg"] += 1;
566 }
567 if (lowAngleRegion) {
568 calculationResult["nEhighLowAng"] += 1;
569 }
570 if (photon and barrelRegion) {
571 calculationResult["n2GeVPhotonBarrel"] += 1;
572 }
573 if (photon and endcapRegion) {
574 calculationResult["n2GeVPhotonEndcap"] += 1;
575 }
576 }
577 }
578
579
580 std::sort(selectedClusters.begin(), selectedClusters.end(), [](const auto & lhs, const auto & rhs) {
581 return lhs.energyCMS > rhs.energyCMS;
582 });
583
584
585 for (short charge : { -1, 1}) {
586 auto& maximumPtTrack = maximumPtTracks.at(charge);
587 if (not maximumPtTrack) {
588 continue;
589 }
590
591
592 if (maximumPtTrack->clusterEnergySumCMS > 4.5) {
593 calculationResult["ee1leg"] = 1;
594 }
595
596
597 if (maximumPtTrack->pCMS > 3 and maximumPtTrack->clusterEnergySumLab > 0. and maximumPtTrack->clusterEnergySumLab < 1.) {
598 calculationResult["singleMuon"] = 1;
599 }
600 }
601
602
603 if (maximumPtTracks.at(-1) and maximumPtTracks.at(1)) {
604 const MaximumPtTrack& negativeTrack = *maximumPtTracks.at(-1);
605 const MaximumPtTrack& positiveTrack = *maximumPtTracks.at(1);
606
607 double dphi = std::abs(negativeTrack.
p4CMS.Phi() - positiveTrack.
p4CMS.Phi()) * TMath::RadToDeg();
608 if (dphi > 180) {
609 dphi = 360 - dphi;
610 }
611
614 const double negativeP = negativeTrack.
pCMS;
617 const double positiveP = positiveTrack.
pCMS;
618
619
620 const double thetaSum = (negativeTrack.
p4CMS.Theta() + positiveTrack.
p4CMS.Theta()) * TMath::RadToDeg();
621 const double dthetaSum = std::abs(thetaSum - 180);
622 const auto back2back = dphi > 175 and dthetaSum < 15;
623 if (back2back and negativeClusterSum > 3 and positiveClusterSum > 3 and
624 (negativeClusterSum > 4.5 or positiveClusterSum > 4.5)) {
625 calculationResult["ee2leg"] = 1;
626 }
627
628
629 if (back2back and ((negativeClusterSum > 4.5 and positiveP > 3) or (positiveClusterSum > 4.5 and negativeP > 3))) {
630 calculationResult["ee1leg1trk"] = 1;
631 }
632
633
634
635 if ((negativeClusterSum > 4.5 and positiveClusterSum > 0.8 * positiveP) or
636 (positiveClusterSum > 4.5 and negativeClusterSum > 0.8 * negativeP)) {
637 calculationResult["ee1leg1e"] = 1;
638 }
639
640
641 const ROOT::Math::PxPyPzEVector p4Miss = p4ofCOM - negativeTrack.
p4CMS - positiveTrack.
p4CMS;
642 const double pmissTheta = p4Miss.Theta() * TMath::RadToDeg();
643 const double pmissp = p4Miss.P();
644 const double relMissAngle0 = ROOT::Math::VectorUtil::Angle(negativeTrack.
p4CMS, p4Miss) * TMath::RadToDeg();
645 const double relMissAngle1 = ROOT::Math::VectorUtil::Angle(positiveTrack.
p4CMS, p4Miss) * TMath::RadToDeg();
646
647 const bool electronEP = positiveClusterSum > 0.8 * positiveP or negativeClusterSum > 0.8 * negativeP;
648 const bool notMuonPair = negativeClusterSumLab > 1 or positiveClusterSumLab > 1;
649 const double highp = std::max(negativeP, positiveP);
650 const double lowp = std::min(negativeP, positiveP);
651 const bool lowEdep = negativeClusterSumLab < 0.5 and positiveClusterSumLab < 0.5;
652
653
654 if (calculationResult["maximumPCMS"] < 2 and dphi > 160 and (pmissTheta < 25. or pmissTheta > 155.)) {
655 calculationResult["eexxSelect"] = 1;
656 if (electronEP) {
657 calculationResult["eeee"] = 1;
658 } else {
659 calculationResult["eemm"] = 1;
660 }
661 }
662
663
664 if ((pmissTheta < 20. or pmissTheta > 160.) and
665 ((calculationResult["maximumPCMS"] < 1.2 and dphi > 150.) or
666 (calculationResult["maximumPCMS"] < 2. and 175. < dphi))) {
667 calculationResult["eexx"] = 1;
668 }
669
670
671 if (negativeP > 1. and pmissTheta > 10. and pmissTheta < 170. and positiveP > 1. and dphi < 170. and pmissp > 1. and electronEP) {
672 if (calculationResult["nTrkLoose"] == 2 and calculationResult["nTrkTight"] >= 1) {
673 calculationResult["radBhabha"] = 1;
674 }
675 if (calculationResult["nTrkLooseB"] == 2 and calculationResult["nTrkTightB"] >= 1) {
676 calculationResult["radBhabhaB"] = 1;
677 }
678 }
679
680
681 if (negativeP > 2. and positiveP > 2. and 2 == calculationResult["nTrkLoose"] and
682 calculationResult["nTrkTight"] >= 1 and dphi > 175. and
683 (pmissTheta < 5. or pmissTheta > 175.) and electronEP) {
684 calculationResult["isrRadBhabha"] = 1;
685 }
686
687
688 if (highp > 4.5 and notMuonPair and pmissp > 1. and (relMissAngle0 < 5. or relMissAngle1 < 5.)) {
689 if (calculationResult["nTrkLoose"] == 2) { calculationResult["eeBrem"] = 1;}
690 if (calculationResult["nTrkLooseB"] >= 1) { calculationResult["eeBremB"] = 1;}
691 }
692
693
694 if (highp > 4.5 and lowEdep and thetaSum > 175. and thetaSum < 185. and dphi > 175.) {
695 if (calculationResult["nTrkLoose"] == 2) {calculationResult["muonPairV"] = 1;}
696 if (calculationResult["nTrkLooseB"] == 2) {calculationResult["muonPairVB"] = 1;}
697 }
698
699
700 if (highp > 3. and lowp > 2.5 and dphi > 165. and
701 ((negativeClusterSumLab > 0. and negativeClusterSumLab < 1.) or
702 (positiveClusterSumLab > 0. and positiveClusterSumLab < 1.))) {
703 calculationResult["selectmumu"] = 1;
704 }
705 }
706
707
708 if (selectedClusters.size() >= 2) {
709 const SelectedECLCluster& firstCluster = selectedClusters[0];
710 const SelectedECLCluster& secondCluster = selectedClusters[1];
711
712 double dphi = std::abs(firstCluster.
p4CMS.Phi() - secondCluster.
p4CMS.Phi()) * TMath::RadToDeg();
713 if (dphi > 180) {
714 dphi = 360 - dphi;
715 }
716 double thetaSum = (firstCluster.
p4CMS.Theta() + secondCluster.
p4CMS.Theta()) * TMath::RadToDeg();
717 double dthetaSum = std::abs(thetaSum - 180);
718
719
720 calculationResult["dphiCmsClust"] = dphi;
721 for (int ic = 0; ic < 2; ic++) {
722 const double thetaLab = selectedClusters[ic].p4Lab.Theta() * TMath::RadToDeg();
723 const bool isInAcceptance = 17. < thetaLab and thetaLab < 150.;
724 const ECLCluster* cluster = selectedClusters[ic].cluster;
725 const double zmva = cluster->getZernikeMVA();
726 const bool photon = zmva > 0.5 and not selectedClusters[ic].isTrack;
727 if (isInAcceptance and photon) {calculationResult["nMaxEPhotonAcc"] += 1;}
728 }
729
730 const double firstEnergy = firstCluster.
p4CMS.E();
731 const double secondEnergy = secondCluster.
p4CMS.E();
732
733 const bool highEnergetic = firstEnergy > 3 and secondEnergy > 3 and (firstEnergy > 4.5 or secondEnergy > 4.5);
734
735 if (dphi > 160 and dphi < 178 and dthetaSum < 15 and highEnergetic) {
736 calculationResult["ee2clst"] = 1;
737 }
738
739 if (dphi > 178 and dthetaSum < 15 and highEnergetic) {
740 calculationResult["gg2clst"] = 1;
741 }
742
743 if ((calculationResult["ee2clst"] == 1 or calculationResult["gg2clst"] == 1) and
744 calculationResult["ee1leg"] == 1) {
745 calculationResult["ee1leg1clst"] = 1;
746 }
747
748 const double Elab0 = firstCluster.
p4Lab.E();
749 const double Elab1 = secondCluster.
p4Lab.E();
750
751
752 if (firstEnergy > 2 and secondEnergy > 2) {
753 const double thetaLab0 = firstCluster.
p4Lab.Theta() * TMath::RadToDeg();
754 const double thetaLab1 = secondCluster.
p4Lab.Theta() * TMath::RadToDeg();
755
756 const bool barrel0 = 32. < thetaLab0 and thetaLab0 < 130.;
757 const bool barrel1 = 32. < thetaLab1 and thetaLab1 < 130.;
758 const bool oneClustersAbove4 = firstEnergy > 4 or secondEnergy > 4;
759 const bool oneIsNeutral = not firstCluster.
isTrack or not secondCluster.
isTrack;
760 const bool bothAreNeutral = not firstCluster.
isTrack and not secondCluster.
isTrack;
761 const bool oneIsBarrel = barrel0 or barrel1;
762 const bool dphiCutExtraLoose = dphi > 175;
763 const bool dphiCutLoose = dphi > 177;
764 const bool dphiCutTight = dphi > 177.5;
765
766 if (dphiCutExtraLoose and oneIsNeutral and oneIsBarrel) {
767 calculationResult["ggBarrelVL"] = 1;
768 }
769 if (oneClustersAbove4 and dphiCutLoose and oneIsNeutral and oneIsBarrel) {
770 calculationResult["ggBarrelLoose"] = 1;
771 }
772 if (oneClustersAbove4 and dphiCutTight and bothAreNeutral and oneIsBarrel) {
773 calculationResult["ggBarrelTight"] = 1;
774 }
775 if (dphiCutExtraLoose and oneIsNeutral and not oneIsBarrel) {
776 calculationResult["ggEndcapVL"] = 1;
777 }
778 if (oneClustersAbove4 and dphiCutLoose and oneIsNeutral and not oneIsBarrel) {
779 calculationResult["ggEndcapLoose"] = 1;
780 }
781 if (oneClustersAbove4 and dphiCutTight and bothAreNeutral and not oneIsBarrel) {
782 calculationResult["ggEndcapTight"] = 1;
783 }
784 }
785
786 const double minEnergy = std::min(Elab0, Elab1);
787 const double maxEnergy = std::max(Elab0, Elab1);
788 if (dphi > 155 and thetaSum > 165 and thetaSum < 195 and minEnergy > 0.15 and minEnergy < 0.5 and
789 maxEnergy > 0.15 and maxEnergy < 0.5) {
790 calculationResult["muonPairECL"] = 1;
791 }
792
793
794 const double thetaLab0 = firstCluster.
p4Lab.Theta() * TMath::RadToDeg();
795 const double thetaLab1 = secondCluster.
p4Lab.Theta() * TMath::RadToDeg();
796 const bool inHieRegion0 = thetaLab0 > 26. and thetaLab0 < 130.;
797 const bool inHieRegion1 = thetaLab1 > 26. and thetaLab1 < 130.;
798 const bool firstIsNeutral = not firstCluster.
isTrack;
799 const bool secondIsNeutral = not secondCluster.
isTrack;
800
801 if (secondEnergy > 0.3 and inHieRegion0 and inHieRegion1 and firstIsNeutral and secondIsNeutral) {
802 const ROOT::Math::PxPyPzEVector ggP4CMS = firstCluster.
p4CMS + secondCluster.
p4CMS;
803 if (ggP4CMS.pt() > 1.) {calculationResult["ggHighPt"] = 1;}
804 }
805
806 }
807
808
809
810 double thetaFlatten = 0;
811
812
813 for (short charge : { -1, 1}) {
814 const auto& maximumPtTrack = maximumPtTracks.at(charge);
815 if (not maximumPtTrack) {
816 continue;
817 }
818
819 if (maximumPtTrack->clusterEnergySumCMS > 1.5) {
820 double invMass = 0.;
821 double tempFlatten = 0.;
822 for (const SelectedECLCluster& cluster : selectedClusters) {
823 double tempInvMass = (maximumPtTrack->p4Lab + cluster.p4Lab).M();
824 if (tempInvMass > invMass) {
825 invMass = tempInvMass;
826 if (charge == 1) {
827 tempFlatten = cluster.p4Lab.Theta() * TMath::RadToDeg();
828 }
829 }
830 }
831 if (charge == -1) {
832 tempFlatten = maximumPtTrack->p4Lab.Theta() * TMath::RadToDeg();
833 }
834 if (invMass > 5.29) {
835 calculationResult["selectee1leg1clst"] = 1;
836 thetaFlatten = tempFlatten;
837 }
838 }
839 }
840
841
842 if (maximumPtTracks.at(-1) and maximumPtTracks.at(1)) {
843 const MaximumPtTrack& negativeTrack = *maximumPtTracks.at(-1);
844 const MaximumPtTrack& positiveTrack = *maximumPtTracks.at(1);
845 const double invMass = (negativeTrack.
p4Lab + positiveTrack.
p4Lab).M();
847 calculationResult["selectee1leg1trk"] = 1;
848 }
849
850 thetaFlatten = negativeTrack.
p4Lab.Theta() * TMath::RadToDeg();
851
852
855 if ((invMass > 9.) and (missNegClust or missPosClust)) {
856 calculationResult["eeOneClust"] = 1;
857 }
858 }
859
860 if (calculationResult["selectee1leg1trk"] == 1 or calculationResult["selectee1leg1clst"] == 1) {
861 for (int iflat = 0; iflat < 9; iflat++) {
862 const std::string& eeFlatName = "eeFlat" + std::to_string(iflat);
863 calculationResult[eeFlatName] =
864 thetaFlatten >= flatBoundaries[iflat] and thetaFlatten < flatBoundaries[iflat + 1];
865 if (calculationResult[eeFlatName]) {
866 calculationResult["selectee"] = 1;
867 }
868 }
869 }
870
871
872 if (calculationResult["nTrkLoose"] == 1 and calculationResult["maximumPCMS"] > 0.8 and selectedClusters.size() >= 2) {
873
874 decltype(selectedClusters) selectedSingleTagClusters(selectedClusters.size());
875 auto lastItem = std::copy_if(selectedClusters.begin(), selectedClusters.end(), selectedSingleTagClusters.begin(),
876 [](auto & cluster) {
877 const bool isNeutralCluster = not cluster.isTrack;
878 const bool hasEnoughEnergy = cluster.energyLab > 0.1;
879 const double clusterThetaLab = cluster.p4Lab.Theta() * TMath::RadToDeg();
880 const bool isInAcceptance = 17 < clusterThetaLab and clusterThetaLab < 150.;
881 return isNeutralCluster and hasEnoughEnergy and isInAcceptance;
882 });
883 selectedSingleTagClusters.resize(std::distance(selectedSingleTagClusters.begin(), lastItem));
884
885 if (selectedSingleTagClusters.size() >= 2) {
886
887 const auto& track = maximumPtTracks.at(-1) ? *maximumPtTracks.at(-1) : *maximumPtTracks.at(1);
888
889 const auto& firstCluster = selectedSingleTagClusters[0];
890 const auto& secondCluster = selectedSingleTagClusters[1];
891
892 const ROOT::Math::PxPyPzEVector trackP4CMS = track.p4CMS;
893 const ROOT::Math::PxPyPzEVector pi0P4CMS = firstCluster.
p4CMS + secondCluster.
p4CMS;
894
895 const bool passPi0ECMS = pi0P4CMS.E() > 1. and pi0P4CMS.E() < 0.525 * p4ofCOM.M();
896 const double thetaSumCMS = (pi0P4CMS.Theta() + trackP4CMS.Theta()) * TMath::RadToDeg();
897 const bool passThetaSum = thetaSumCMS < 170. or thetaSumCMS > 190.;
898
899 double dphiCMS = std::abs(trackP4CMS.Phi() - pi0P4CMS.Phi()) * TMath::RadToDeg();
900 if (dphiCMS > 180) {
901 dphiCMS = 360 - dphiCMS;
902 }
903 const bool passdPhi = dphiCMS > 160.;
904
905 if (passPi0ECMS and passThetaSum and passdPhi and pi0P4CMS.M() < 0.7) {
906 calculationResult["singleTagLowMass"] = 1;
907 } else if (passPi0ECMS and passThetaSum and passdPhi and pi0P4CMS.M() > 0.7) {
908 calculationResult["singleTagHighMass"] = 1;
909 }
910 }
911 }
912
913
914 if (calculationResult["nTrkLooseB"] == 1 and calculationResult["maximumPCMSB"] > 0.8 and selectedClusters.size() >= 2) {
915
916 decltype(selectedClusters) selectedSingleTagClusters(selectedClusters.size());
917 auto lastItem = std::copy_if(selectedClusters.begin(), selectedClusters.end(), selectedSingleTagClusters.begin(),
918 [](auto & cluster) {
919 const bool isNeutralCluster = not cluster.isTrack;
920 const bool hasEnoughEnergy = cluster.energyLab > 0.1;
921 const double clusterThetaLab = cluster.p4Lab.Theta() * TMath::RadToDeg();
922 const bool isInAcceptance = 17 < clusterThetaLab and clusterThetaLab < 150.;
923 return isNeutralCluster and hasEnoughEnergy and isInAcceptance;
924 });
925 selectedSingleTagClusters.resize(std::distance(selectedSingleTagClusters.begin(), lastItem));
926
927 if (selectedSingleTagClusters.size() >= 2) {
928
929 const auto& track = maximumPtTracks.at(-1) ? *maximumPtTracks.at(-1) : *maximumPtTracks.at(1);
930
931 const auto& firstCluster = selectedSingleTagClusters[0];
932 const auto& secondCluster = selectedSingleTagClusters[1];
933
934 const ROOT::Math::PxPyPzEVector trackP4CMS = track.p4CMS;
935 const ROOT::Math::PxPyPzEVector pi0P4CMS = firstCluster.
p4CMS + secondCluster.
p4CMS;
936
937 const bool passPi0ECMS = pi0P4CMS.E() > 1. and pi0P4CMS.E() < 0.525 * p4ofCOM.M();
938 const double thetaSumCMS = (pi0P4CMS.Theta() + trackP4CMS.Theta()) * TMath::RadToDeg();
939 const bool passThetaSum = thetaSumCMS < 170. or thetaSumCMS > 190.;
940
941 double dphiCMS = std::abs(trackP4CMS.Phi() - pi0P4CMS.Phi()) * TMath::RadToDeg();
942 if (dphiCMS > 180) {
943 dphiCMS = 360 - dphiCMS;
944 }
945 const bool passdPhi = dphiCMS > 160.;
946
947 if (passPi0ECMS and passThetaSum and passdPhi and pi0P4CMS.M() < 0.7) {
948 calculationResult["singleTagLowMassB"] = 1;
949 } else if (passPi0ECMS and passThetaSum and passdPhi and pi0P4CMS.M() > 0.7) {
950 calculationResult["singleTagHighMassB"] = 1;
951 }
952 }
953 }
954
955
957
958 const auto negTrack = maximumPtTracksWithoutZCut.at(-1);
959 const auto posTrack = maximumPtTracksWithoutZCut.at(1);
960
961 if (negTrack and posTrack) {
962
963 const double maxNegpT = negTrack->pT;
964 const double maxPospT = posTrack->pT;
965 const double maxClusterENeg = negTrack->clusterEnergySumLab;
966 const double maxClusterEPos = posTrack->clusterEnergySumLab;
967
968 const ROOT::Math::PxPyPzEVector& momentumLabNeg(negTrack->p4Lab);
969 const ROOT::Math::PxPyPzEVector& momentumLabPos(posTrack->p4Lab);
970
971 const double& z0Neg = negTrack->track->getTrackFitResultWithClosestMass(
Const::pion)->getZ0();
972 const double& d0Neg = negTrack->track->getTrackFitResultWithClosestMass(
Const::pion)->getD0();
973 const double& z0Pos = posTrack->track->getTrackFitResultWithClosestMass(
Const::pion)->getZ0();
974 const double& d0Pos = posTrack->track->getTrackFitResultWithClosestMass(
Const::pion)->getD0();
975
976
981 double dphiLab = std::abs(momentumLabNeg.Phi() - momentumLabPos.Phi()) * TMath::RadToDeg();
982 if (dphiLab > 180) {
983 dphiLab = 360 - dphiLab;
984 }
985
986 const double thetaSumLab = (momentumLabNeg.Theta() + momentumLabPos.Theta()) * TMath::RadToDeg();
987
988 constexpr double phiBackToBackTolerance = 2.;
989 constexpr double thetaBackToBackTolerance = 2.;
990 if ((180 - dphiLab) < phiBackToBackTolerance and std::abs(180 - thetaSumLab) < thetaBackToBackTolerance) {
991 calculationResult["cosmic"] = 1;
992 }
993 }
994 }
995 }
996
997
998
999 if (maximumPtTracksWithoutZCut.at(-1) and maximumPtTracksWithoutZCut.at(1)) {
1000
1001
1002 const auto nTrack = maximumPtTracksWithoutZCut.at(-1)->track;
1003 Particle* nParticle =
new Particle(nTrack,
Const::pion);
1004
1005 const auto pTrack = maximumPtTracksWithoutZCut.at(1)->track;
1006 Particle* pParticle =
new Particle(pTrack,
Const::pion);
1007
1008
1009 Belle2::analysis::VertexFitKFit* vertexFit = new Belle2::analysis::VertexFitKFit();
1013
1014
1015 const double chisq = vertexFit->
getCHIsq();
1016 const int ndf = vertexFit->
getNDF();
1017 const double vertexProb = TMath::Prob(chisq, ndf);
1018 const auto vertexLocation = vertexFit->
getVertex();
1019 const double vertexXY = vertexLocation.perp();
1020 const double vertexTheta = vertexLocation.theta() * TMath::RadToDeg();
1021
1022
1023
1024
1025
1026 const ROOT::Math::PxPyPzEVector& momentumLabNeg(maximumPtTracksWithoutZCut.at(-1)->p4Lab);
1027 const ROOT::Math::PxPyPzEVector& momentumLabPos(maximumPtTracksWithoutZCut.at(1)->p4Lab);
1028 const double thetaSumLab = (momentumLabNeg.Theta() + momentumLabPos.Theta()) * TMath::RadToDeg();
1029 double dPhiLab = std::abs(momentumLabNeg.Phi() - momentumLabPos.Phi()) * TMath::RadToDeg();
1030 if (dPhiLab > 180) {
1031 dPhiLab = 360 - dPhiLab;
1032 }
1033 const double backToBackTolerance = 10.;
1034 const bool backToBackLab = std::abs(thetaSumLab - 180.) < backToBackTolerance and std::abs(dPhiLab - 180.) < backToBackTolerance;
1035
1036
1037 const double minProbChiVertex = 0.005;
1038 const double minXYVertex = 3.;
1039 const double maxXYVertex = 60.;
1040 const double minThetaVertex = 30.;
1041 const double maxThetaVertex = 120.;
1042 if (vertexProb > minProbChiVertex and vertexXY > minXYVertex and vertexXY < maxXYVertex and vertexTheta > minThetaVertex
1043 and vertexTheta < maxThetaVertex
1044 and not backToBackLab) {calculationResult["displacedVertex"] = 1;}
1045
1046
1047 delete nParticle;
1048 delete pParticle;
1049 delete vertexFit;
1050
1051 }
1052
1053
1054
1056 B2FATAL("HLTprefilter parameters are not available.");
1057
1058
1068
1069
1073
1074
1075 int index = 0;
1076 try {
1077 if (
m_l1Trigger->testInput(
"passive_veto") == 1 &&
m_l1Trigger->testInput(
"cdcecl_veto") == 0) index = 1;
1078 } catch (const std::exception&) {
1079 }
1080
1081
1082 if (index == 1) {
1083
1085 calculationResult["Prefilter_InjectionStrip"] = 1;
1086 }
1087
1089 calculationResult["Prefilter_CDCECLthreshold"] = 1;
1090 }
1091 }
1092
1093
1094}
const ROOT::Math::PxPyPzEVector Get4MomentumFromCluster(const ECLCluster *cluster, ECLCluster::EHypothesisBit hypo)
Returns four momentum vector.
const ROOT::Math::XYZVector GetIPPosition()
Returns default IP position from beam parameters.
static const ChargedStable pion
charged pion particle
@ c_nPhotons
CR is split into n photons (N1)
double m_EminLab
which lab energy defines nE180Lab
double m_reducedEsinglePhoton
which CMS energy defines nReducedEsingle clusters
StoreObjPtr< TRGSummary > m_l1Trigger
Store Object with the trigger result.
double m_E0min
which CMS energy defines nEmedium
double m_goodMagneticRegionZ0
maximum z0 for well understood magnetic field (cm)
double m_cosmicMinPt
which LAB pt defines a cosmic
double m_EsinglePhoton
which CMS energy defines nEsingleClust
double m_E2min
which CMS energy defines nElow
double m_tightTrkZ0
which Z0 defines a tight track
StoreArray< Track > m_tracks
Store Array of the tracks to be used.
double m_EminLab3Cluster
which lab energy defines nE500Lab
double m_Ehigh
which CMS energy defines nEhigh
DBObjPtr< HLTPrefilterParameters > m_hltPrefilterParameters
Objects relevant to HLTPrefilter monitoring HLTprefilterParameters Database OjbPtr.
StoreArray< ECLCluster > m_eclClusters
Store Array of the ecl clusters to be used.
double m_EminLab4Cluster
which lab energy defines nE300Lab
HLTPrefilter::TimingCutState m_timingPrefilter
Helper instance for timing based prefilter.
double m_cosmicMaxClusterEnergy
which LAB cluster energy vetoes a cosmic candidate
HLTPrefilter::CDCECLCutState m_cdceclPrefilter
Helper instance for CDC-ECL occupancy based prefilter.
double m_goodMagneticRegionD0
minimum d0 for well understood magnetic field, if z0 is large (cm)
double m_looseTrkZ0
which Z0 defines a loose track
@ TTYP_DPHY
delayed physics events for background
@ TTYP_POIS
poisson random trigger
@ TTYP_RAND
random trigger events
virtual int getNDF(void) const
Get an NDF of the fit.
enum KFitError::ECode addParticle(const Particle *particle)
Add a particle to the fitter.
double getCHIsq(void) const override
Get a chi-square of the fit.
enum KFitError::ECode doFit(void)
Perform a vertex-constraint fit.
const HepPoint3D getVertex(const int flag=KFitConst::kAfterFit) const
Get a vertex position.
double pLab
the momentum magnitude in lab system
double pT
the pT of the track
ROOT::Math::PxPyPzEVector p4CMS
the 4 momentum in CMS system
double clusterEnergySumLab
the sum of related cluster energies in lab system
ROOT::Math::PxPyPzEVector p4Lab
the 4 momentum in lab system
double clusterEnergySumCMS
the sum of related cluster energies in CMS system
double pCMS
the momentum magnitude in CMS system
const Track * track
the track
double energyLab
the energy in Lab system
double clusterTime
the time of the cluster
ROOT::Math::PxPyPzEVector p4CMS
the 4 momentum in CMS system
ROOT::Math::PxPyPzEVector p4Lab
the 4 momentum in lab system
const ECLCluster * cluster
The ECL cluster.
bool isTrack
is this ECL cluster likely from a track (or a photon) = is it charged?
double energyCMS
the energy in CMS system