@@ -3794,7 +3794,10 @@ struct AnalysisDileptonTrack {
37943794 DefineHistograms (fHistMan , Form (" MCTruthGen_%s" , sig->GetName ()), " " );
37953795 DefineHistograms (fHistMan , Form (" MCTruthGenSel_%s" , sig->GetName ()), " " );
37963796 }
3797- DefineHistograms (fHistMan , " MCTruthGenAccepted" , " " );
3797+ for (auto & sig: fRecMCSignals ) {
3798+ DefineHistograms (fHistMan , Form (" MCTruthGenSelBR_%s" , sig->GetName ()), " " );
3799+ DefineHistograms (fHistMan , Form (" MCTruthGenSelBRAccepted_%s" , sig->GetName ()), " " );
3800+ }
37983801 }
37993802
38003803 TString addHistsStr = fConfigAddJSONHistograms .value ;
@@ -4199,40 +4202,42 @@ struct AnalysisDileptonTrack {
41994202 }
42004203 }
42014204
4202- /* for (auto& [t1, t2, t3] : combinations(groupedMCTracks, groupedMCTracks, groupedMCTracks)) {
4205+ // make a list of all MC tracks in the MC collision corresponding to the current reconstructed event
4206+ std::vector<size_t > mcTrackIndices;
4207+ for (auto & t : groupedMCTracks) {
4208+ mcTrackIndices.push_back (t.globalIndex ());
4209+ }
42034210
4204- if (! (t1.mcReducedFlags() & (uint16_t(1) << fConfigMCGenSignalDileptonLegPos.value))) {
4205- continue;
4206- }
4207- if (t1.pt() < fConfigMCGenDileptonLegPtMin.value ) {
4208- continue;
4209- }
4210- if (std::abs(t1.eta()) > fConfigMCGenDileptonLegEtaAbs.value ) {
4211- continue;
4212- }
4211+ // make a three nested for loop over all MC tracks in the vector
4212+ for ( auto t1 : mcTrackIndices) {
4213+ auto track1 = mcTracks. rawIteratorAt (*(&t1));
4214+ for ( auto t2 : mcTrackIndices ) {
4215+ if (t1 == t2 || t2 < t1) continue ;
4216+ auto track2 = mcTracks. rawIteratorAt (*(&t2));
4217+ for ( auto t3 : mcTrackIndices ) {
4218+ if (t3 == t1 || t3 == t2) continue ;
4219+ auto track3 = mcTracks. rawIteratorAt (*(&t3));
42134220
4214- if (! (t2.mcReducedFlags() & (uint16_t(1) << fConfigMCGenSignalDileptonLegNeg.value))) {
4215- continue;
4216- }
4217- if (t2.pt() < fConfigMCGenDileptonLegPtMin.value) {
4218- continue;
4219- }
4220- if (std::abs(t2.eta()) > fConfigMCGenDileptonLegEtaAbs.value) {
4221- continue;
4222- }
4221+ for (auto & sig : fRecMCSignals ) {
4222+ if (sig->CheckSignal (true , track1, track2, track3)) {
4223+ fHistMan ->FillHistClass (Form (" MCTruthGenSelBR_%s" , sig->GetName ()), VarManager::fgValues);
42234224
4224- if (! (t3.mcReducedFlags() & (uint16_t(1) << fConfigMCGenSignalHadron.value))) {
4225- continue;
4226- }
4227- if (t3.pt() < fConfigMCGenHadronPtMin.value) {
4228- continue;
4229- }
4230- if (std::abs(t3.eta()) > fConfigMCGenHadronEtaAbs.value) {
4231- continue;
4225+ // apply kinematic cuts
4226+ if (track1.pt () < fConfigMCGenDileptonLegPtMin .value || std::abs (track1.eta ()) > fConfigMCGenDileptonLegEtaAbs .value ) {
4227+ continue ;
4228+ }
4229+ if (track2.pt () < fConfigMCGenDileptonLegPtMin .value || std::abs (track2.eta ()) > fConfigMCGenDileptonLegEtaAbs .value ) {
4230+ continue ;
4231+ }
4232+ if (track3.pt () < fConfigMCGenHadronPtMin .value || std::abs (track3.eta ()) > fConfigMCGenHadronEtaAbs .value ) {
4233+ continue ;
4234+ }
4235+ fHistMan ->FillHistClass (Form (" MCTruthGenSelBRAccepted_%s" , sig->GetName ()), VarManager::fgValues);
4236+ }
4237+ }
4238+ }
42324239 }
4233-
4234- fHistMan->FillHistClass("MCTruthGenSelAccepted", VarManager::fgValues);
4235- }*/
4240+ }
42364241 } // end loop over reconstructed events
42374242 }
42384243
0 commit comments