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;
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;
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;
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;
186 calculationResult[
"Prefilter_InjectionStrip"] = 0;
187 calculationResult[
"Prefilter_CDCECLthreshold"] = 0;
197 }
catch (
const std::exception&) {
203 }
catch (
const std::exception&) {
209 }
catch (
const std::exception&) {
215 }
catch (
const std::exception&) {
221 }
catch (
const std::exception&) {
224 calculationResult[
"bha3d"] = bha3d;
225 calculationResult[
"bhapur"] = bhapurPsnm;
226 calculationResult[
"bhapur_lml1"] = lml1 and bhapurFtdl;
227 calculationResult[
"l1_bit_f"] = l1_bit_f;
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;
239 calculationResult[
"l1_trg_NN_info"] = 0;
240 if (
m_bitsNN.isValid() and
m_bitsNN.getEntries() > 0) {calculationResult[
"l1_trg_NN_info"] = 1;}
242 calculationResult[
"true"] = 1;
243 calculationResult[
"false"] = 0;
248 const ROOT::Math::XYZVector clustervertex = cUtil.
GetIPPosition();
250 ROOT::Math::PxPyPzEVector p4ofCOM;
251 p4ofCOM.SetPxPyPzE(0, 0, 0, boostrotate.
getCMSEnergy());
254 std::map<short, std::optional<MaximumPtTrack>> maximumPtTracks = {
259 std::map<short, std::optional<MaximumPtTrack>> maximumPtTracksWithoutZCut = {
264 std::map<short, std::optional<MaximumPtTrack>> maximumPCmsTracksC = {
272 if (not trackFitResult) {
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();
288 double clusterELab = 0.;
289 for (
auto& cluster : track.getRelationsTo<
ECLCluster>()) {
294 const double clusterECMS = clusterELab * pCMS / pLab;
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;
309 const auto& currentMaximumC = maximumPCmsTracksC.at(charge);
310 if (not currentMaximumC or pCMS > currentMaximumC->pCMS) {
313 newMaximum.
track = &track;
314 newMaximum.
pCMS = pCMS;
315 newMaximum.
pLab = pLab;
316 newMaximum.
p4CMS = momentumCMS;
317 newMaximum.
p4Lab = momentumLab;
320 maximumPCmsTracksC[charge] = newMaximum;
332 calculationResult[
"nTrkTight"] += 1;
338 const auto& currentMaximum = maximumPtTracksWithoutZCut.at(charge);
339 if (not currentMaximum or pT > currentMaximum->pT) {
342 newMaximum.
track = &track;
343 newMaximum.
pCMS = pCMS;
344 newMaximum.
pLab = pLab;
345 newMaximum.
p4CMS = momentumCMS;
346 newMaximum.
p4Lab = momentumLab;
349 maximumPtTracksWithoutZCut[charge] = newMaximum;
356 calculationResult[
"nTrkLoose"] += 1;
357 calculationResult[
"netChargeLoose"] += charge;
359 if (std::isnan(calculationResult[
"maximumPCMS"]) or pCMS > calculationResult[
"maximumPCMS"]) {
360 calculationResult[
"maximumPCMS"] = pCMS;
363 if (std::isnan(calculationResult[
"maximumPLab"]) or pLab > calculationResult[
"maximumPLab"]) {
364 calculationResult[
"maximumPLab"] = pLab;
369 const auto& currentMaximumLoose = maximumPtTracks.at(charge);
370 if (not currentMaximumLoose or pTLoose > currentMaximumLoose->pT) {
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;
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;
403 for (
short charge : { -1, 1}) {
404 auto& maximumPcmsTrackC = maximumPCmsTracksC.at(charge);
405 if (not maximumPcmsTrackC) {
411 calculationResult[
"pCmsNegC"] = maximumPcmsTrackC->pCMS;
412 calculationResult[
"clusterENegC"] = maximumPcmsTrackC->clusterEnergySumLab;
414 calculationResult[
"pCmsPosC"] = maximumPcmsTrackC->pCMS;
415 calculationResult[
"clusterEPosC"] = maximumPcmsTrackC->clusterEnergySumLab;
420 if (maximumPCmsTracksC.at(-1) and maximumPCmsTracksC.at(1)) {
424 calculationResult[
"dPhiCmsC"] = std::abs(ROOT::Math::VectorUtil::DeltaPhi(negativeTrack.
p4CMS,
425 positiveTrack.
p4CMS)) * TMath::RadToDeg();
431 std::vector<SelectedECLCluster> selectedClusters;
434 const double time = cluster.getTime();
436 std::abs(time) > 200 or
441 const double dt99 = cluster.getDeltaTime99();
448 selectedCluster.
cluster = &cluster;
452 selectedCluster.
isTrack = cluster.isTrack();
454 selectedClusters.push_back(selectedCluster);
457 calculationResult[
"nElow"] += 1;
460 calculationResult[
"nEmedium"] += 1;
463 calculationResult[
"nEhigh"] += 1;
467 calculationResult[
"nVetoClust"] += 1;
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;
479 calculationResult[
"chrgClust2GeV"] += 1;
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;}
490 const bool notInHighBackgroundEndcapRegion = 18.5 < thetaLab and thetaLab < 139.3;
492 calculationResult[
"nE180Lab"] += 1;
496 calculationResult[
"nE300Lab"] += 1;
500 calculationResult[
"nE500Lab"] += 1;
503 if (selectedCluster.
energyCMS >
m_Ehigh and notInHighBackgroundEndcapRegion) {
504 calculationResult[
"nE2000CMS"] += 1;
509 calculationResult[
"nE250Lab"] += 1;
512 calculationResult[
"nE4000CMS"] += 1;
517 calculationResult[
"nEsingleClust"] += 1;
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);
523 if (photon and barrelRegion) {
524 calculationResult[
"nEsinglePhotonBarrel"] += 1;
527 if (photon and extendedBarrelRegion) {
528 calculationResult[
"nEsinglePhotonExtendedBarrel"] += 1;
531 if (electron and barrelRegion) {
532 calculationResult[
"nEsingleElectronBarrel"] += 1;
535 if (electron and extendedBarrelRegion) {
536 calculationResult[
"nEsingleElectronExtendedBarrel"] += 1;
539 if (photon and endcapRegion) {
540 calculationResult[
"nEsinglePhotonEndcap"] += 1;
545 const bool reducedBarrelRegion = thetaLab > 44 and thetaLab < 98;
547 if (photon and reducedBarrelRegion) {
548 calculationResult[
"nReducedEsinglePhotonReducedBarrel"] += 1;
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;
558 if (not selectedCluster.
isTrack and barrelRegion) {
559 calculationResult[
"n2GeVNeutBarrel"] += 1;
561 if (not selectedCluster.
isTrack and endcapRegion) {
562 calculationResult[
"n2GeVNeutEndcap"] += 1;
564 if (selectedCluster.
isTrack and not lowAngleRegion) {
565 calculationResult[
"n2GeVChrg"] += 1;
567 if (lowAngleRegion) {
568 calculationResult[
"nEhighLowAng"] += 1;
570 if (photon and barrelRegion) {
571 calculationResult[
"n2GeVPhotonBarrel"] += 1;
573 if (photon and endcapRegion) {
574 calculationResult[
"n2GeVPhotonEndcap"] += 1;
580 std::sort(selectedClusters.begin(), selectedClusters.end(), [](
const auto & lhs,
const auto & rhs) {
581 return lhs.energyCMS > rhs.energyCMS;
585 for (
short charge : { -1, 1}) {
586 auto& maximumPtTrack = maximumPtTracks.at(charge);
587 if (not maximumPtTrack) {
592 if (maximumPtTrack->clusterEnergySumCMS > 4.5) {
593 calculationResult[
"ee1leg"] = 1;
597 if (maximumPtTrack->pCMS > 3 and maximumPtTrack->clusterEnergySumLab > 0. and maximumPtTrack->clusterEnergySumLab < 1.) {
598 calculationResult[
"singleMuon"] = 1;
603 if (maximumPtTracks.at(-1) and maximumPtTracks.at(1)) {
607 double dphi = std::abs(negativeTrack.
p4CMS.Phi() - positiveTrack.
p4CMS.Phi()) * TMath::RadToDeg();
614 const double negativeP = negativeTrack.
pCMS;
617 const double positiveP = positiveTrack.
pCMS;
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;
629 if (back2back and ((negativeClusterSum > 4.5 and positiveP > 3) or (positiveClusterSum > 4.5 and negativeP > 3))) {
630 calculationResult[
"ee1leg1trk"] = 1;
635 if ((negativeClusterSum > 4.5 and positiveClusterSum > 0.8 * positiveP) or
636 (positiveClusterSum > 4.5 and negativeClusterSum > 0.8 * negativeP)) {
637 calculationResult[
"ee1leg1e"] = 1;
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();
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;
654 if (calculationResult[
"maximumPCMS"] < 2 and dphi > 160 and (pmissTheta < 25. or pmissTheta > 155.)) {
655 calculationResult[
"eexxSelect"] = 1;
657 calculationResult[
"eeee"] = 1;
659 calculationResult[
"eemm"] = 1;
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;
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;
675 if (calculationResult[
"nTrkLooseB"] == 2 and calculationResult[
"nTrkTightB"] >= 1) {
676 calculationResult[
"radBhabhaB"] = 1;
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;
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;}
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;}
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;
708 if (selectedClusters.size() >= 2) {
712 double dphi = std::abs(firstCluster.
p4CMS.Phi() - secondCluster.
p4CMS.Phi()) * TMath::RadToDeg();
716 double thetaSum = (firstCluster.
p4CMS.Theta() + secondCluster.
p4CMS.Theta()) * TMath::RadToDeg();
717 double dthetaSum = std::abs(thetaSum - 180);
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;}
730 const double firstEnergy = firstCluster.
p4CMS.E();
731 const double secondEnergy = secondCluster.
p4CMS.E();
733 const bool highEnergetic = firstEnergy > 3 and secondEnergy > 3 and (firstEnergy > 4.5 or secondEnergy > 4.5);
735 if (dphi > 160 and dphi < 178 and dthetaSum < 15 and highEnergetic) {
736 calculationResult[
"ee2clst"] = 1;
739 if (dphi > 178 and dthetaSum < 15 and highEnergetic) {
740 calculationResult[
"gg2clst"] = 1;
743 if ((calculationResult[
"ee2clst"] == 1 or calculationResult[
"gg2clst"] == 1) and
744 calculationResult[
"ee1leg"] == 1) {
745 calculationResult[
"ee1leg1clst"] = 1;
748 const double Elab0 = firstCluster.
p4Lab.E();
749 const double Elab1 = secondCluster.
p4Lab.E();
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();
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;
766 if (dphiCutExtraLoose and oneIsNeutral and oneIsBarrel) {
767 calculationResult[
"ggBarrelVL"] = 1;
769 if (oneClustersAbove4 and dphiCutLoose and oneIsNeutral and oneIsBarrel) {
770 calculationResult[
"ggBarrelLoose"] = 1;
772 if (oneClustersAbove4 and dphiCutTight and bothAreNeutral and oneIsBarrel) {
773 calculationResult[
"ggBarrelTight"] = 1;
775 if (dphiCutExtraLoose and oneIsNeutral and not oneIsBarrel) {
776 calculationResult[
"ggEndcapVL"] = 1;
778 if (oneClustersAbove4 and dphiCutLoose and oneIsNeutral and not oneIsBarrel) {
779 calculationResult[
"ggEndcapLoose"] = 1;
781 if (oneClustersAbove4 and dphiCutTight and bothAreNeutral and not oneIsBarrel) {
782 calculationResult[
"ggEndcapTight"] = 1;
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;
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;
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;}
810 double thetaFlatten = 0;
813 for (
short charge : { -1, 1}) {
814 const auto& maximumPtTrack = maximumPtTracks.at(charge);
815 if (not maximumPtTrack) {
819 if (maximumPtTrack->clusterEnergySumCMS > 1.5) {
821 double tempFlatten = 0.;
823 double tempInvMass = (maximumPtTrack->p4Lab + cluster.p4Lab).M();
824 if (tempInvMass > invMass) {
825 invMass = tempInvMass;
827 tempFlatten = cluster.p4Lab.Theta() * TMath::RadToDeg();
832 tempFlatten = maximumPtTrack->p4Lab.Theta() * TMath::RadToDeg();
834 if (invMass > 5.29) {
835 calculationResult[
"selectee1leg1clst"] = 1;
836 thetaFlatten = tempFlatten;
842 if (maximumPtTracks.at(-1) and maximumPtTracks.at(1)) {
845 const double invMass = (negativeTrack.
p4Lab + positiveTrack.
p4Lab).M();
847 calculationResult[
"selectee1leg1trk"] = 1;
850 thetaFlatten = negativeTrack.
p4Lab.Theta() * TMath::RadToDeg();
855 if ((invMass > 9.) and (missNegClust or missPosClust)) {
856 calculationResult[
"eeOneClust"] = 1;
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;
872 if (calculationResult[
"nTrkLoose"] == 1 and calculationResult[
"maximumPCMS"] > 0.8 and selectedClusters.size() >= 2) {
874 decltype(selectedClusters) selectedSingleTagClusters(selectedClusters.size());
875 auto lastItem = std::copy_if(selectedClusters.begin(), selectedClusters.end(), selectedSingleTagClusters.begin(),
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;
883 selectedSingleTagClusters.resize(std::distance(selectedSingleTagClusters.begin(), lastItem));
885 if (selectedSingleTagClusters.size() >= 2) {
887 const auto& track = maximumPtTracks.at(-1) ? *maximumPtTracks.at(-1) : *maximumPtTracks.at(1);
889 const auto& firstCluster = selectedSingleTagClusters[0];
890 const auto& secondCluster = selectedSingleTagClusters[1];
892 const ROOT::Math::PxPyPzEVector trackP4CMS = track.p4CMS;
893 const ROOT::Math::PxPyPzEVector pi0P4CMS = firstCluster.p4CMS + secondCluster.p4CMS;
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.;
899 double dphiCMS = std::abs(trackP4CMS.Phi() - pi0P4CMS.Phi()) * TMath::RadToDeg();
901 dphiCMS = 360 - dphiCMS;
903 const bool passdPhi = dphiCMS > 160.;
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;
914 if (calculationResult[
"nTrkLooseB"] == 1 and calculationResult[
"maximumPCMSB"] > 0.8 and selectedClusters.size() >= 2) {
916 decltype(selectedClusters) selectedSingleTagClusters(selectedClusters.size());
917 auto lastItem = std::copy_if(selectedClusters.begin(), selectedClusters.end(), selectedSingleTagClusters.begin(),
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;
925 selectedSingleTagClusters.resize(std::distance(selectedSingleTagClusters.begin(), lastItem));
927 if (selectedSingleTagClusters.size() >= 2) {
929 const auto& track = maximumPtTracks.at(-1) ? *maximumPtTracks.at(-1) : *maximumPtTracks.at(1);
931 const auto& firstCluster = selectedSingleTagClusters[0];
932 const auto& secondCluster = selectedSingleTagClusters[1];
934 const ROOT::Math::PxPyPzEVector trackP4CMS = track.p4CMS;
935 const ROOT::Math::PxPyPzEVector pi0P4CMS = firstCluster.p4CMS + secondCluster.p4CMS;
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.;
941 double dphiCMS = std::abs(trackP4CMS.Phi() - pi0P4CMS.Phi()) * TMath::RadToDeg();
943 dphiCMS = 360 - dphiCMS;
945 const bool passdPhi = dphiCMS > 160.;
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;
958 const auto negTrack = maximumPtTracksWithoutZCut.at(-1);
959 const auto posTrack = maximumPtTracksWithoutZCut.at(1);
961 if (negTrack and posTrack) {
963 const double maxNegpT = negTrack->pT;
964 const double maxPospT = posTrack->pT;
965 const double maxClusterENeg = negTrack->clusterEnergySumLab;
966 const double maxClusterEPos = posTrack->clusterEnergySumLab;
968 const ROOT::Math::PxPyPzEVector& momentumLabNeg(negTrack->p4Lab);
969 const ROOT::Math::PxPyPzEVector& momentumLabPos(posTrack->p4Lab);
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();
981 double dphiLab = std::abs(momentumLabNeg.Phi() - momentumLabPos.Phi()) * TMath::RadToDeg();
983 dphiLab = 360 - dphiLab;
986 const double thetaSumLab = (momentumLabNeg.Theta() + momentumLabPos.Theta()) * TMath::RadToDeg();
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;
999 if (maximumPtTracksWithoutZCut.at(-1) and maximumPtTracksWithoutZCut.at(1)) {
1002 const auto nTrack = maximumPtTracksWithoutZCut.at(-1)->track;
1005 const auto pTrack = maximumPtTracksWithoutZCut.at(1)->track;
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();
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;
1033 const double backToBackTolerance = 10.;
1034 const bool backToBackLab = std::abs(thetaSumLab - 180.) < backToBackTolerance and std::abs(dPhiLab - 180.) < backToBackTolerance;
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;}
1056 B2FATAL(
"HLTprefilter parameters are not available.");
1077 if (
m_l1Trigger->testInput(
"passive_veto") == 1 &&
m_l1Trigger->testInput(
"cdcecl_veto") == 0) index = 1;
1078 }
catch (
const std::exception&) {
1085 calculationResult[
"Prefilter_InjectionStrip"] = 1;
1089 calculationResult[
"Prefilter_CDCECLthreshold"] = 1;