@@ -3592,6 +3592,7 @@ struct AnalysisDileptonTrack {
35923592 Configurable<float > fConfigMCGenDileptonLegEtaAbs {" cfgMCGenDileptonLegEtaAbs" , 0 .9f , " eta abs range for the dilepton leg" };
35933593 Configurable<float > fConfigMCGenHadronEtaAbs {" cfgMCGenHadronEtaAbs" , 0 .9f , " eta abs range for the hadron" };
35943594 Configurable<bool > fConfigUseMCRapcut {" cfgUseMCRapcut" , false , " Use Rap cut for dileptons used in the triplet vertexing(reconstructed)" };
3595+ Configurable<bool > fConfigUseCorrectlyAssociatedMC {" cfgUseCorrectlyAssociatedMC" , true , " Use only correctly associated track to construct triplet" };
35953596 Configurable<int > fConfigMixingDepth {" cfgMixingDepth" , 5 , " Event mixing pool depth" };
35963597
35973598 int fCurrentRun ; // needed to detect if the run changed and trigger update of calibrations etc.
@@ -3982,6 +3983,9 @@ struct AnalysisDileptonTrack {
39823983
39833984 uint32_t mcDecision = static_cast <uint32_t >(0 );
39843985 size_t isig = 0 ;
3986+ bool isCorrectAssoc_lepton1 = false ;
3987+ bool isCorrectAssoc_lepton2 = false ;
3988+ bool isCorrectAssoc_assoc = false ;
39853989
39863990 for (auto dilepton : dileptons) {
39873991 // get full track info of tracks based on the index
@@ -4001,6 +4005,12 @@ struct AnalysisDileptonTrack {
40014005 if (fConfigUseMCRapcut && abs (rap) > fConfigDileptonRapCutAbs )
40024006 continue ;
40034007
4008+ // Correct association
4009+ if (fConfigUseCorrectlyAssociatedMC ) {
4010+ isCorrectAssoc_lepton1 = (lepton1MC.reducedMCevent () == event.reducedMCevent ());
4011+ isCorrectAssoc_lepton2 = (lepton2MC.reducedMCevent () == event.reducedMCevent ());
4012+ }
4013+
40044014 VarManager::FillTrack<fgDileptonFillMap>(dilepton, fValuesDilepton );
40054015
40064016 // fill selected dilepton histograms for each specified selection
@@ -4051,11 +4061,22 @@ struct AnalysisDileptonTrack {
40514061 if (track.globalIndex () == dilepton.index0Id () || track.globalIndex () == dilepton.index1Id ()) {
40524062 continue ;
40534063 }
4064+
4065+ auto trackMC = track.reducedMCTrack ();
4066+ if (fConfigUseCorrectlyAssociatedMC ) { // check if correctly associated
4067+ isCorrectAssoc_assoc = (trackMC.reducedMCevent () == event.reducedMCevent ());
4068+ }
4069+ bool isCorrect_triplet = isCorrectAssoc_lepton1 && isCorrectAssoc_lepton2 && isCorrectAssoc_assoc;
4070+ if (fConfigUseCorrectlyAssociatedMC ) {
4071+ if (!isCorrect_triplet) {
4072+ continue ;
4073+ }
4074+ }
4075+
40544076 // compute needed quantities
40554077 VarManager::FillDileptonHadron (dilepton, track, fValuesHadron );
40564078 VarManager::FillDileptonTrackVertexing<TCandidateType, TEventFillMap, TTrackFillMap>(event, lepton1, lepton2, track, fValuesHadron );
40574079
4058- auto trackMC = track.reducedMCTrack ();
40594080 mcDecision = 0 ;
40604081 isig = 0 ;
40614082 for (auto sig = fRecMCSignals .begin (); sig != fRecMCSignals .end (); sig++, isig++) {
0 commit comments