susy2015 / SusyAnaTools

1 stars 18 forks source link

Differences in Selection #407

Closed caleb-james-smith closed 4 years ago

caleb-james-smith commented 5 years ago

There are differences in the baseline selections of NanoSUSY-tools and SusyAnaTools. So far, we found that Pass_EventFilter does not match. The reason for this difference is not resolved. For now we will only use Pass_EventFilter as stored in the ntuples (from NanoSUSY-tools).

In addition, there are 5 events from the 2016 MET dataset that have disagreement in baseline selection. I will post the difference below.

Here is the current StopCfg release that I am using: https://github.com/susy2015/StopCfg/releases/tag/PostProcessed_StopNtuple_v4.1.0

2016 MET Events with differences:

logs/4145364_32_makePlots_Data_MET_2016_PeriodD_14.stdout:firstSpec: _jetpt30; CMS event: 1185166870 ntuple event: 1019568
logs/4145364_39_makePlots_Data_MET_2016_PeriodE_8.stdout:firstSpec: _jetpt30; CMS event: 196937071 ntuple event: 404718
logs/4145364_58_makePlots_Data_MET_2016_PeriodG_10.stdout:firstSpec: _jetpt30; CMS event: 31829586 ntuple event: 178125
logs/4145364_76_makePlots_Data_MET_2016_PeriodH_20.stdout:firstSpec: _jetpt30; CMS event: 519215141 ntuple event: 554604
logs/4145364_79_makePlots_Data_MET_2016_PeriodH_26.stdout:firstSpec: _jetpt30; CMS event: 200262979 ntuple event: 580285

values from these events which are not equal:

logs/4145364_32_makePlots_Data_MET_2016_PeriodD_14.stdout:hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 0  --- NOT_EQUAL --- 
logs/4145364_32_makePlots_Data_MET_2016_PeriodD_14.stdout:    hui_Stop0l_ISRJetPt    = 250.750000 and caleb_ISRJetPt                  = 0.000000  --- NOT_EQUAL --- 
logs/4145364_32_makePlots_Data_MET_2016_PeriodD_14.stdout:    hui_Stop0l_nResolved   = 0 and caleb_nResolvedTops             = 1  --- NOT_EQUAL --- 
logs/4145364_39_makePlots_Data_MET_2016_PeriodE_8.stdout:hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 0  --- NOT_EQUAL --- 
logs/4145364_39_makePlots_Data_MET_2016_PeriodE_8.stdout:    hui_Stop0l_ISRJetPt    = 200.000000 and caleb_ISRJetPt                  = 0.000000  --- NOT_EQUAL --- 
logs/4145364_58_makePlots_Data_MET_2016_PeriodG_10.stdout:hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 0  --- NOT_EQUAL --- 
logs/4145364_58_makePlots_Data_MET_2016_PeriodG_10.stdout:    hui_Stop0l_ISRJetPt    = 200.000000 and caleb_ISRJetPt                  = 0.000000  --- NOT_EQUAL --- 
logs/4145364_76_makePlots_Data_MET_2016_PeriodH_20.stdout:hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 0  --- NOT_EQUAL --- 
logs/4145364_76_makePlots_Data_MET_2016_PeriodH_20.stdout:    hui_Pass_dPhiMETLowDM  = 1 and caleb_SAT_Pass_dPhiMETLowDM     = 0  --- NOT_EQUAL --- 
logs/4145364_76_makePlots_Data_MET_2016_PeriodH_20.stdout:    hui_Stop0l_Mtb         = 28.413425 and caleb_mtb                       = 28.413378  --- NOT_EQUAL --- 
logs/4145364_79_makePlots_Data_MET_2016_PeriodH_26.stdout:hui_Pass_lowDM_withCaloMETRatio  = 0 and caleb_SAT_Pass_lowDM  = 1  --- NOT_EQUAL --- 
logs/4145364_79_makePlots_Data_MET_2016_PeriodH_26.stdout:    hui_Stop0l_Mtb         = 188.473145 and caleb_mtb                       = 0.000000  --- NOT_EQUAL --- 
logs/4145364_79_makePlots_Data_MET_2016_PeriodH_26.stdout:    hui_Stop0l_Ptb         = 20.000000 and caleb_ptb                       = 0.000000  --- NOT_EQUAL --- 
logs/4145364_79_makePlots_Data_MET_2016_PeriodH_26.stdout:    hui_Stop0l_nbtags      = 1 and caleb_nBottoms                  = 0  --- NOT_EQUAL --- 
caleb-james-smith commented 5 years ago

Here are the root files for these 5 events in order:

root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodD/Data_MET_2016_PeriodD_5.root
root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodE/Data_MET_2016_PeriodE_16.root
root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodG/Data_MET_2016_PeriodG_19.root
root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodH/Data_MET_2016_PeriodH_27.root
root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodH/Data_MET_2016_PeriodH_32.root
caleb-james-smith commented 5 years ago

Here is the new top tagger config to fix the 2016 DeepCSV working point.

https://github.com/susy2015/TopTaggerCfg/releases/tag/DeepResolved_DeepCSV_GR_fromStop0lPostProc_2016_v1.0.2

caleb-james-smith commented 5 years ago

Now baseline selections match for the event 1185166870 due to using this new top tagger config.

-----------------------------------------------------------------------------------------
firstSpec: _jetpt30; CMS event: 1185166870 ntuple event: 1019568
hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 1 
hui_Pass_highDM_withCaloMETRatio = 0 and caleb_SAT_Pass_highDM = 0 
    hui_Pass_LeptonVeto    = 1 and caleb_SAT_Pass_LeptonVeto       = 1 
    hui_Pass_JetID         = 1 and caleb_SAT_Pass_JetID            = 1 
    hui_Pass_EventFilter   = 1 and caleb_Pass_EventFilter          = 1 
    hui_Pass_CaloMETRatio  = 1 and caleb_Pass_CaloMETRatio         = 1 
    hui_Pass_MET           = 1 and caleb_SAT_Pass_MET              = 1 
    hui_Pass_HT            = 1 and caleb_SAT_Pass_HT               = 1 
    hui_Pass_NJets         = 1 and caleb_SAT_Pass_NJets            = 1 
    hui_Pass_dPhiMETLowDM  = 1 and caleb_SAT_Pass_dPhiMETLowDM     = 1 
    hui_Pass_dPhiMETMedDM  = 0 and caleb_SAT_Pass_mid_dPhiMETLowDM = 0 
    hui_Pass_dPhiMETHighDM = 0 and caleb_SAT_Pass_dPhiMETHighDM    = 0 
    hui_MET_pt             = 300.600067 and caleb_met                       = 300.600067 
    hui_Stop0l_HT          = 551.031250 and caleb_HT                        = 551.031250 
    hui_Stop0l_ISRJetPt    = 250.750000 and caleb_ISRJetPt                  = 250.750000 
    hui_Stop0l_METSig      = 12.805631 and caleb_S_met                     = 12.805631 
    hui_Stop0l_Mtb         = 118.273758 and caleb_mtb                       = 118.273750 
    hui_Stop0l_Ptb         = 95.890625 and caleb_ptb                       = 95.890625 
    hui_Stop0l_nJets       = 7 and caleb_nJets                     = 7 
    hui_Stop0l_nbtags      = 2 and caleb_nBottoms                  = 2 
    hui_Stop0l_nTop        = 0 and caleb_nMergedTops               = 0 
    hui_Stop0l_nW          = 0 and caleb_nWs                       = 0 
    hui_Stop0l_nResolved   = 0 and caleb_nResolvedTops             = 0 
    caleb_MergedTopTotalSF    = 1.000000
    caleb_WTotalSF            = 1.000000
    caleb_ResolvedTopTotalSF  = 1.000000
------------- hui tops -------------
    resolved top 0: pt=236.500000, eta=-0.072525, phi=2.456055, mass=153.687500, disc=0.912720, type=3
    resolved top 1: pt=136.000000, eta=0.658813, phi=1.974121, mass=194.062500, disc=0.937744, type=3
    resolved top 2: pt=95.203125, eta=-1.672363, phi=-0.456482, mass=130.031250, disc=0.804688, type=3
    resolved top 3: pt=160.718750, eta=0.998047, phi=1.928955, mass=156.843750, disc=0.855957, type=3
------------- caleb tops -------------
caleb-james-smith commented 5 years ago

Now the baseline selections match for event 200262979 after fixing the operators for jet selection for b quark variables (ptb, mtb, nBottoms).

See commit here: https://github.com/susy2015/SusyAnaTools/commit/fc8062c07b5588c7ab090bf343eaaba6c97d1d98

-----------------------------------------------------------------------------------------
firstSpec: _jetpt30; CMS event: 200262979 ntuple event: 580285
hui_Pass_lowDM_withCaloMETRatio  = 0 and caleb_SAT_Pass_lowDM  = 0 
hui_Pass_highDM_withCaloMETRatio = 0 and caleb_SAT_Pass_highDM = 0 
    hui_Pass_LeptonVeto    = 1 and caleb_SAT_Pass_LeptonVeto       = 1 
    hui_Pass_JetID         = 1 and caleb_SAT_Pass_JetID            = 1 
    hui_Pass_EventFilter   = 1 and caleb_Pass_EventFilter          = 1 
    hui_Pass_CaloMETRatio  = 1 and caleb_Pass_CaloMETRatio         = 1 
    hui_Pass_MET           = 1 and caleb_SAT_Pass_MET              = 1 
    hui_Pass_HT            = 1 and caleb_SAT_Pass_HT               = 1 
    hui_Pass_NJets         = 1 and caleb_SAT_Pass_NJets            = 1 
    hui_Pass_dPhiMETLowDM  = 1 and caleb_SAT_Pass_dPhiMETLowDM     = 1 
    hui_Pass_dPhiMETMedDM  = 0 and caleb_SAT_Pass_mid_dPhiMETLowDM = 0 
    hui_Pass_dPhiMETHighDM = 1 and caleb_SAT_Pass_dPhiMETHighDM    = 1 
    hui_MET_pt             = 453.790009 and caleb_met                       = 453.790009 
    hui_Stop0l_HT          = 441.218750 and caleb_HT                        = 441.218750 
    hui_Stop0l_ISRJetPt    = 414.500000 and caleb_ISRJetPt                  = 414.500000 
    hui_Stop0l_METSig      = 21.603691 and caleb_S_met                     = 21.603691 
    hui_Stop0l_Mtb         = 188.473145 and caleb_mtb                       = 188.473145 
    hui_Stop0l_Ptb         = 20.000000 and caleb_ptb                       = 20.000000 
    hui_Stop0l_nJets       = 2 and caleb_nJets                     = 2 
    hui_Stop0l_nbtags      = 1 and caleb_nBottoms                  = 1 
    hui_Stop0l_nTop        = 0 and caleb_nMergedTops               = 0 
    hui_Stop0l_nW          = 0 and caleb_nWs                       = 0 
    hui_Stop0l_nResolved   = 0 and caleb_nResolvedTops             = 0 
    caleb_MergedTopTotalSF    = 1.000000
    caleb_WTotalSF            = 1.000000
    caleb_ResolvedTopTotalSF  = 1.000000
------------- hui tops -------------
------------- caleb tops -------------
caleb-james-smith commented 5 years ago

See https://github.com/susy2015/NanoSUSY-tools/issues/78 for discussion of fixing the jet pt and eta sorting for the dphi cut which resolves the difference for CMS event 519215141.

caleb-james-smith commented 5 years ago

Event 31829586 was resolved by using this fat jet pt cut. double fat_jet_pt_cut = 199.999;

caleb-james-smith commented 5 years ago

Summary of issues in order.

  1. correct 2016 DeepCSV working point in top tagger config
  2. ISR jet pt
  3. ISR jet pt
  4. dphi MET and jets
  5. operators (<, > vs. <=, >=) for b jets
    root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodD/Data_MET_2016_PeriodD_5.root
    root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodE/Data_MET_2016_PeriodE_16.root
    root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodG/Data_MET_2016_PeriodG_19.root
    root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodH/Data_MET_2016_PeriodH_27.root
    root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodH/Data_MET_2016_PeriodH_32.root
caleb-james-smith commented 5 years ago

CMS event 196937071 is also resolved by this ISR jet pt cut

double fat_jet_pt_cut = 199.999;
zhenbinwu commented 5 years ago

I am glad you are solving the puzzles. But I am trying to understand the 199.999 and the values difference on other thread. Is it a reading issue from the ntuple with NtupleReader?

caleb-james-smith commented 5 years ago

See PR for implementation: https://github.com/susy2015/SusyAnaTools/pull/408

caleb-james-smith commented 5 years ago

Using 199.999 is a strange solution, but it fixes the problem we had where a jet with pt 200.0 was passing the cut pt < 200.0. This jet was tagged as an ISR jet in post-processing, but it was not being tagged as an ISR jet in SusyAnaTools due to a problem with double comparison.

zhenbinwu commented 5 years ago

So if you print out the pt value on https://github.com/susy2015/SusyAnaTools/blob/master/Tools/baselineDef.cc#L2104, you got a 200GeV jet, but the code still pass the pt < 200.0 cut?

What is " a problem with double comparison." ?

I think we want to be careful here. As this is only 2016 comparison right? We still have 2017/2018. What if a jet with really pt of 199.99, will this introduce another differences between your code and NanoSUSY?

caleb-james-smith commented 5 years ago

Oh, I am using the ROOT TLorentzVector function Pt() on the FatJet TLV stored in our ntuple to get the pt value. This function returns a double.

caleb-james-smith commented 5 years ago

Here is where I printed if jets were passing the pt cuts:

https://github.com/susy2015/SusyAnaTools/blob/development/Tools/baselineDef.cc#L2232-L2245

caleb-james-smith commented 5 years ago

Here is what I got after the fix:

-----------------------------------------------------------------------------------------
firstSpec=_jetpt30; run=277420; luminosityBlock=177; CMS_event=196937071; ntuple_event=404718
hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 1 
hui_Pass_highDM_withCaloMETRatio = 0 and caleb_SAT_Pass_highDM = 0 
    hui_Pass_LeptonVeto    = 1 and caleb_SAT_Pass_LeptonVeto       = 1 
    hui_Pass_JetID         = 1 and caleb_SAT_Pass_JetID            = 1 
    hui_Pass_EventFilter   = 1 and caleb_Pass_EventFilter          = 1 
    hui_Pass_CaloMETRatio  = 1 and caleb_Pass_CaloMETRatio         = 1 
    hui_Pass_MET           = 1 and caleb_SAT_Pass_MET              = 1 
    hui_Pass_HT            = 1 and caleb_SAT_Pass_HT               = 1 
    hui_Pass_NJets         = 1 and caleb_SAT_Pass_NJets            = 1 
    hui_Pass_dPhiMETLowDM  = 1 and caleb_SAT_Pass_dPhiMETLowDM     = 1 
    hui_Pass_dPhiMETMedDM  = 0 and caleb_SAT_Pass_mid_dPhiMETLowDM = 0 
    hui_Pass_dPhiMETHighDM = 1 and caleb_SAT_Pass_dPhiMETHighDM    = 1 
    hui_MET_pt             = 255.846130 and caleb_met                       = 255.846130 
    hui_Stop0l_HT          = 338.250000 and caleb_HT                        = 338.250000 
    hui_Stop0l_ISRJetPt    = 200.000000 and caleb_ISRJetPt                  = 200.000000 
    hui_Stop0l_METSig      = 13.911051 and caleb_S_met                     = 13.911051 
    hui_Stop0l_Mtb         = 0.000000 and caleb_mtb                       = 0.000000 
    hui_Stop0l_Ptb         = 0.000000 and caleb_ptb                       = 0.000000 
    hui_Stop0l_nJets       = 2 and caleb_nJets                     = 2 
    hui_Stop0l_nbtags      = 0 and caleb_nBottoms                  = 0 
    hui_Stop0l_nTop        = 0 and caleb_nMergedTops               = 0 
    hui_Stop0l_nW          = 0 and caleb_nWs                       = 0 
    hui_Stop0l_nResolved   = 0 and caleb_nResolvedTops             = 0 
    caleb_MergedTopTotalSF    = 1.000000
    caleb_WTotalSF            = 1.000000
    caleb_ResolvedTopTotalSF  = 1.000000
------------- hui tops -------------
------------- caleb tops -------------
------------- caleb met, jets, dphi -------------
met = 255.846130
metphi = 0.414673
jet index=0, sorted_index=0
jet index=1, sorted_index=1
Jet_0: pt=178.125000, eta=-0.581177, phi=2.611816, mass=15.320312
Jet_1: pt=160.125000, eta=1.369385, phi=-1.966553, mass=17.312500
Jet_2: pt=24.906250, eta=-2.677246, phi=-2.488770, mass=6.093750
dPhi_0 = 2.197144
dPhi_1 = 2.381226
dPhi_2 = 999.000000
dPhi_3 = 999.000000
dPhi_4 = 999.000000
------------- caleb fat jets -------------
FatJet_0: pt=200.000000, eta=-0.575928, phi=2.616211, mass=26.328125
FatJet_1: pt=194.250000, eta=1.347168, phi=-1.965332, mass=43.937500
FatJet 0: p_t = 200.000000, eta = -0.575928, phi = 2.616211, mass = 26.328125, btag_disc = 0.014038
ISR jet pt 200.000000 is greater than 199.999000.
myISRJetIndex = 0
caleb-james-smith commented 5 years ago

Here is what we had for CMS event 31829586 before the pt cut fix (note this is a different event).

-----------------------------------------------------------------------------------------
firstSpec=_jetpt30; run=280015; luminosityBlock=19; CMS_event=31829586; ntuple_event=178125
hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 0  --- NOT_EQUAL --- 
hui_Pass_highDM_withCaloMETRatio = 0 and caleb_SAT_Pass_highDM = 0 
    hui_Pass_LeptonVeto    = 1 and caleb_SAT_Pass_LeptonVeto       = 1 
    hui_Pass_JetID         = 1 and caleb_SAT_Pass_JetID            = 1 
    hui_Pass_EventFilter   = 1 and caleb_Pass_EventFilter          = 1 
    hui_Pass_CaloMETRatio  = 1 and caleb_Pass_CaloMETRatio         = 1 
    hui_Pass_MET           = 1 and caleb_SAT_Pass_MET              = 1 
    hui_Pass_HT            = 1 and caleb_SAT_Pass_HT               = 1 
    hui_Pass_NJets         = 1 and caleb_SAT_Pass_NJets            = 1 
    hui_Pass_dPhiMETLowDM  = 1 and caleb_SAT_Pass_dPhiMETLowDM     = 1 
    hui_Pass_dPhiMETMedDM  = 0 and caleb_SAT_Pass_mid_dPhiMETLowDM = 0 
    hui_Pass_dPhiMETHighDM = 1 and caleb_SAT_Pass_dPhiMETHighDM    = 1 
    hui_MET_pt             = 267.568878 and caleb_met                       = 267.568878 
    hui_Stop0l_HT          = 310.468750 and caleb_HT                        = 310.468750 
    hui_Stop0l_ISRJetPt    = 200.000000 and caleb_ISRJetPt                  = 0.000000  --- NOT_EQUAL --- 
    hui_Stop0l_METSig      = 15.185414 and caleb_S_met                     = 15.185415 
    hui_Stop0l_Mtb         = 0.000000 and caleb_mtb                       = 0.000000 
    hui_Stop0l_Ptb         = 0.000000 and caleb_ptb                       = 0.000000 
    hui_Stop0l_nJets       = 3 and caleb_nJets                     = 3 
    hui_Stop0l_nbtags      = 0 and caleb_nBottoms                  = 0 
    hui_Stop0l_nTop        = 0 and caleb_nMergedTops               = 0 
    hui_Stop0l_nW          = 0 and caleb_nWs                       = 0 
    hui_Stop0l_nResolved   = 0 and caleb_nResolvedTops             = 0 
    caleb_MergedTopTotalSF    = 1.000000
    caleb_WTotalSF            = 1.000000
    caleb_ResolvedTopTotalSF  = 1.000000
------------- hui tops -------------
------------- caleb tops -------------
------------- caleb met, jets, dphi -------------
met = 267.568878
metphi = 0.879395
jet index=0, sorted_index=0
jet index=1, sorted_index=1
jet index=2, sorted_index=2
Jet_0: pt=176.125000, eta=-2.233398, phi=-2.016113, mass=17.875000
Jet_1: pt=90.812500, eta=2.171387, phi=-2.268555, mass=10.789062
Jet_2: pt=43.531250, eta=-1.509766, phi=2.484863, mass=10.281250
Jet_3: pt=26.046875, eta=4.025391, phi=2.093750, mass=5.250000
Jet_4: pt=16.531250, eta=3.312988, phi=-1.238281, mass=3.412109
dPhi_0 = 2.895508
dPhi_1 = 3.135236
dPhi_2 = 1.605469
dPhi_3 = 999.000000
dPhi_4 = 999.000000
------------- caleb fat jets -------------
FatJet_0: pt=200.000000, eta=-2.233887, phi=-1.992676, mass=25.593750
FatJet 0: p_t = 200.000000, eta = -2.233887, phi = -1.992676, mass = 25.593750, btag_disc = 0.070557
FAIL fat jet pt requirement
myISRJetIndex = -1
hatakeyamak commented 5 years ago

isClose one and 199.999 are a bit scary, and I don't want to just leave them as happy solutions.

But, we have to find a way to move on too. We have overwhelming tons of analysis work to work on in coming days.

Among Caleb, Joe, I, we just talked about:

suggest: caleb runs entire 2016 MET or full run2 MET to make sure now he doesn’t see any mismatches (or not introducing new mismatches in what he is check). Then, move on to validation bin predictions, search bin validation, systematics, dR cut (photon, quark), documentation etc. This is imminent, and should try to do all this for rest of this weekend and by end of next week.

But, maybe in the meantime @Joe can help nail down this puzzle. [he is traveling tomorrow from CERN to US, so probably he can do only starting from Monday].

Of course, any help to resolve this puzzle would be much appreciated.

Does this make sense? @zhenbinwu If you have some suggestions on this, it will be much appreciated.

caleb-james-smith commented 5 years ago

Ok, I ran over 2016 MET data again. The are no differences in low/high dm baselines now.

zhenbinwu commented 5 years ago

From the print out above, it is confusing for me as well.

To perform a check, I would suggest Caleb print out the fatjet_pt - 200 value. Make a comparison of that diff with std::numeric_limits::epsilon() to check whether we really hitting the "machine epsilon". If that is the case, well, we are just too (un)lucky.

If not, we can check whether there is overloaded > sign somewhere.

caleb-james-smith commented 5 years ago

Ok, we have a new fix now, which is to round the TLorentzVector Pt() to a float to match the post-processing values.

2231   // WARNING: must cast to fat jet pt to float (round) to match post-processing selection
2232   float fat_jet_pt_cut = 200.0;
2233   float fat_jet_pt     = fat_jets[i].Pt();
caleb-james-smith commented 5 years ago

Here is CMS event 196937071 which matches using float pt.

cmslpc26.fnal.gov Tools # (fixPhoton) time ./makePlots -st -D Data_MET_2016_fixSelection -Y 2016 -E 10000 -R Data_MET_2016 -N 1 -M 1 | grep -v LHAPDF 
Using luminosity 35815.2
Processing file(s): /uscms/home/caleb/nobackup/SusyAnalysis/CMSSW_9_4_4/src/ZInvisible/Tools/condor/DataMC_2016_submission_2019-11-14_12-33-03
Warning in <TClass::Init>: no dictionary for class ROOT::TIOFeatures is available
    root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodE/Data_MET_2016_PeriodE_16.root
Before go to event 400000
After go to event 400000
Event #: 401000
Event #: 402000
Event #: 403000
Event #: 404000
-----------------------------------------------------------------------------------------
firstSpec=_jetpt30; run=277420; luminosityBlock=177; CMS_event=196937071; ntuple_event=404718
hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 1 
hui_Pass_highDM_withCaloMETRatio = 0 and caleb_SAT_Pass_highDM = 0 
    hui_Pass_LeptonVeto    = 1 and caleb_SAT_Pass_LeptonVeto       = 1 
    hui_Pass_JetID         = 1 and caleb_SAT_Pass_JetID            = 1 
    hui_Pass_EventFilter   = 1 and caleb_Pass_EventFilter          = 1 
    hui_Pass_CaloMETRatio  = 1 and caleb_Pass_CaloMETRatio         = 1 
    hui_Pass_MET           = 1 and caleb_SAT_Pass_MET              = 1 
    hui_Pass_HT            = 1 and caleb_SAT_Pass_HT               = 1 
    hui_Pass_NJets         = 1 and caleb_SAT_Pass_NJets            = 1 
    hui_Pass_dPhiMETLowDM  = 1 and caleb_SAT_Pass_dPhiMETLowDM     = 1 
    hui_Pass_dPhiMETMedDM  = 0 and caleb_SAT_Pass_mid_dPhiMETLowDM = 0 
    hui_Pass_dPhiMETHighDM = 1 and caleb_SAT_Pass_dPhiMETHighDM    = 1 
    hui_MET_pt             = 255.846130371093750000000000000000 and caleb_met                   = 255.846130371093750000000000000000 
    hui_Stop0l_HT          = 338.250000000000000000000000000000 and caleb_HT                    = 338.250000000000000000000000000000 
    hui_Stop0l_ISRJetPt    = 200.000000000000000000000000000000 and caleb_ISRJetPt              = 200.000000000000000000000000000000 
    hui_Stop0l_METSig      = 13.911050796508789062500000000000 and caleb_S_met                 = 13.911050796508789062500000000000 
    hui_Stop0l_Mtb         = 0.000000000000000000000000000000 and caleb_mtb                   = 0.000000000000000000000000000000 
    hui_Stop0l_Ptb         = 0.000000000000000000000000000000 and caleb_ptb                   = 0.000000000000000000000000000000 
    hui_Stop0l_nJets       = 2 and caleb_nJets                     = 2 
    hui_Stop0l_nbtags      = 0 and caleb_nBottoms                  = 0 
    hui_Stop0l_nTop        = 0 and caleb_nMergedTops               = 0 
    hui_Stop0l_nW          = 0 and caleb_nWs                       = 0 
    hui_Stop0l_nResolved   = 0 and caleb_nResolvedTops             = 0 
    caleb_MergedTopTotalSF    = 1.000000000000000000000000000000
    caleb_WTotalSF            = 1.000000000000000000000000000000
    caleb_ResolvedTopTotalSF  = 1.000000000000000000000000000000
------------- hui tops -------------
------------- caleb tops -------------
------------- caleb met, jets, dphi -------------
met = 255.846130371093750000000000000000
metphi = 0.414672851562500000000000000000
jet index=0, sorted_index=0
jet index=1, sorted_index=1
Jet_0: pt=178.125000000000000000000000000000, eta=-0.581176757812500000000000000000, phi=2.611816406250000000000000000000, mass=15.320312500000000000000000000000
Jet_1: pt=160.125000000000000000000000000000, eta=1.369384765625000222044604925031, phi=-1.966552734375000000000000000000, mass=17.312499999999580779785901540890
Jet_2: pt=24.906249999999996447286321199499, eta=-2.677246093750007549516567451064, phi=-2.488769531250000000000000000000, mass=6.093750000000000000000000000000
dPhi_0 = 2.197143554687500000000000000000
dPhi_1 = 2.381225585937500000000000000000
dPhi_2 = 999.000000000000000000000000000000
dPhi_3 = 999.000000000000000000000000000000
dPhi_4 = 999.000000000000000000000000000000
------------- caleb fat jets -------------
FatJet_0: pt=199.999999999999971578290569595993, eta=-0.575927734375000000000000000000, phi=2.616210937500000000000000000000, mass=26.328125000000138555833473219536
FatJet_1: pt=194.250000000000000000000000000000, eta=1.347167968749999777955395074969, phi=-1.965332031250000000000000000000, mass=43.937500000000000000000000000000
FatJet 0: p_t = 199.999999999999971578290569595993, eta = -0.575927734375000000000000000000, phi = 2.616210937500000000000000000000, mass = 26.328125000000138555833473219536, btag_disc = 0.014038085937500000000000000000
ISR jet pt 200.000000000000000000000000000000 is close to 200.000000000000000000000000000000.
ISR jet pt 200.000000000000000000000000000000 is equal to 200.000000000000000000000000000000.
myISRJetIndex = 0
Event #: 405000
Event #: 406000
Event #: 407000
Event #: 408000
Event #: 409000
Event #: 410000
  Eur.Phys.J. C75 (2015) 3, 132  (http://arxiv.org/abs/1412.7420)

real    0m26.270s
user    0m20.845s
sys 0m1.321s
caleb-james-smith commented 5 years ago

Here is CMS event 31829586 which matches using float pt.

cmslpc26.fnal.gov Tools # (fixPhoton) time ./makePlots -st -D Data_MET_2016_fixSelection -Y 2016 -E 10000 -R Data_MET_2016 -N 1 -M 2 | grep -v LHAPDF 
Using luminosity 35815.2
Processing file(s): /uscms/home/caleb/nobackup/SusyAnalysis/CMSSW_9_4_4/src/ZInvisible/Tools/condor/DataMC_2016_submission_2019-11-14_12-33-03
Warning in <TClass::Init>: no dictionary for class ROOT::TIOFeatures is available
    root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodG/Data_MET_2016_PeriodG_19.root
Before go to event 170000
After go to event 170000
Event #: 171000
Event #: 172000
Event #: 173000
Event #: 174000
Event #: 175000
Event #: 176000
Event #: 177000
Event #: 178000
-----------------------------------------------------------------------------------------
firstSpec=_jetpt30; run=280015; luminosityBlock=19; CMS_event=31829586; ntuple_event=178125
hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 1 
hui_Pass_highDM_withCaloMETRatio = 0 and caleb_SAT_Pass_highDM = 0 
    hui_Pass_LeptonVeto    = 1 and caleb_SAT_Pass_LeptonVeto       = 1 
    hui_Pass_JetID         = 1 and caleb_SAT_Pass_JetID            = 1 
    hui_Pass_EventFilter   = 1 and caleb_Pass_EventFilter          = 1 
    hui_Pass_CaloMETRatio  = 1 and caleb_Pass_CaloMETRatio         = 1 
    hui_Pass_MET           = 1 and caleb_SAT_Pass_MET              = 1 
    hui_Pass_HT            = 1 and caleb_SAT_Pass_HT               = 1 
    hui_Pass_NJets         = 1 and caleb_SAT_Pass_NJets            = 1 
    hui_Pass_dPhiMETLowDM  = 1 and caleb_SAT_Pass_dPhiMETLowDM     = 1 
    hui_Pass_dPhiMETMedDM  = 0 and caleb_SAT_Pass_mid_dPhiMETLowDM = 0 
    hui_Pass_dPhiMETHighDM = 1 and caleb_SAT_Pass_dPhiMETHighDM    = 1 
    hui_MET_pt             = 267.568878173828125000000000000000 and caleb_met                   = 267.568878173828125000000000000000 
    hui_Stop0l_HT          = 310.468750000000000000000000000000 and caleb_HT                    = 310.468750000000000000000000000000 
    hui_Stop0l_ISRJetPt    = 200.000000000000000000000000000000 and caleb_ISRJetPt              = 200.000000000000000000000000000000 
    hui_Stop0l_METSig      = 15.185414314270019531250000000000 and caleb_S_met                 = 15.185415267944335937500000000000 
    hui_Stop0l_Mtb         = 0.000000000000000000000000000000 and caleb_mtb                   = 0.000000000000000000000000000000 
    hui_Stop0l_Ptb         = 0.000000000000000000000000000000 and caleb_ptb                   = 0.000000000000000000000000000000 
    hui_Stop0l_nJets       = 3 and caleb_nJets                     = 3 
    hui_Stop0l_nbtags      = 0 and caleb_nBottoms                  = 0 
    hui_Stop0l_nTop        = 0 and caleb_nMergedTops               = 0 
    hui_Stop0l_nW          = 0 and caleb_nWs                       = 0 
    hui_Stop0l_nResolved   = 0 and caleb_nResolvedTops             = 0 
    caleb_MergedTopTotalSF    = 1.000000000000000000000000000000
    caleb_WTotalSF            = 1.000000000000000000000000000000
    caleb_ResolvedTopTotalSF  = 1.000000000000000000000000000000
------------- hui tops -------------
------------- caleb tops -------------
------------- caleb met, jets, dphi -------------
met = 267.568878173828125000000000000000
metphi = 0.879394531250000000000000000000
jet index=0, sorted_index=0
jet index=1, sorted_index=1
jet index=2, sorted_index=2
Jet_0: pt=176.125000000000000000000000000000, eta=-2.233398437500000888178419700125, phi=-2.016113281250000000000000000000, mass=17.875000000000000000000000000000
Jet_1: pt=90.812500000000000000000000000000, eta=2.171386718750000000000000000000, phi=-2.268554687500000000000000000000, mass=10.789062500000000000000000000000
Jet_2: pt=43.531250000000000000000000000000, eta=-1.509765625000000444089209850063, phi=2.484863281250000000000000000000, mass=10.281250000000088817841970012523
Jet_3: pt=26.046875000000000000000000000000, eta=4.025390624999952038365336193237, phi=2.093750000000000000000000000000, mass=5.249999999988912868786883336725
Jet_4: pt=16.531250000000000000000000000000, eta=3.312988281250008881784197001252, phi=-1.238281250000000000000000000000, mass=3.412109374998933741807149999659
dPhi_0 = 2.895507812500000000000000000000
dPhi_1 = 3.135236024856567382812500000000
dPhi_2 = 1.605468750000000000000000000000
dPhi_3 = 999.000000000000000000000000000000
dPhi_4 = 999.000000000000000000000000000000
------------- caleb fat jets -------------
FatJet_0: pt=199.999999999999971578290569595993, eta=-2.233886718750000444089209850063, phi=-1.992675781250000000000000000000, mass=25.593750000002273736754432320595
FatJet 0: p_t = 199.999999999999971578290569595993, eta = -2.233886718750000444089209850063, phi = -1.992675781250000000000000000000, mass = 25.593750000002273736754432320595, btag_disc = 0.070556640625000000000000000000
ISR jet pt 200.000000000000000000000000000000 is close to 200.000000000000000000000000000000.
ISR jet pt 200.000000000000000000000000000000 is equal to 200.000000000000000000000000000000.
myISRJetIndex = 0
Event #: 179000
Event #: 180000
  Eur.Phys.J. C75 (2015) 3, 132  (http://arxiv.org/abs/1412.7420)

real    0m24.478s
user    0m20.445s
sys 0m0.947s
zhenbinwu commented 5 years ago

I am confused by your print out.

FatJet 0: p_t = 199.999999999999971578290569595993, but later on it becomes 200.00000.

But I am glad cast to float type could fix this.

caleb-james-smith commented 5 years ago

That is the rounding in action.

caleb-james-smith commented 5 years ago

Sorry, it is a little confusing. the values here are from the TLorentzVector before rounding to floats:

FatJet_0: pt=199.999999999999971578290569595993, eta=-2.233886718750000444089209850063, phi=-1.992675781250000000000000000000, mass=25.593750000002273736754432320595
caleb-james-smith commented 5 years ago

In addition, we now cast pts to floats for jet sorting.

 32     template<>
 33     bool greaterThan(const std::pair<TLorentzVector,unsigned int>& p1, const std::pair<TLorentzVector,unsigned int>& p2)
 34     {
 35         // WARNING: round pt to float to match post-processing sorting
 36         float p1_pt = p1.first.Pt();
 37         float p2_pt = p2.first.Pt();
 38         //if (isClose(p1.first.Pt(), p2.first.Pt()))
 39         if (p1_pt == p2_pt)
 40         {   
 41             //printf("INFO: pt are equal; sorting by abs(eta). pt_1 = %f, pt_2 = %f, eta_1 = %f, eta_2 = %f\n", p1.first.Pt(), p2.first.Pt(), p1.first.Eta(), p2.first.Eta());
 42             return abs(p1.first.Eta()) < abs(p2.first.Eta());
 43         }
 44         else
 45         {   
 46             //printf("pt_1 = %f, pt_2 = %f, pt_1 - pt_2 = %f, diff_equal_zero = %d\n", p1.first.Pt(), p2.first.Pt(), p1.first.Pt() - p2.first.Pt(), p1.first.Pt() - p2.first.Pt() == 0.0);
 47             return p1_pt > p2_pt;
 48         }
 49     }
caleb-james-smith commented 5 years ago

Now CMS event 519215141 agrees using float jet pts for sorting.

cmslpc26.fnal.gov Tools # (fixPhoton) time ./makePlots -st -D Data_MET_2016_fixSelection -Y 2016 -E 10000 -R Data_MET_2016 -N 1 -M 3 | grep -v LHAPDF 
Using luminosity 35815.2
Processing file(s): /uscms/home/caleb/nobackup/SusyAnalysis/CMSSW_9_4_4/src/ZInvisible/Tools/condor/DataMC_2016_submission_2019-11-14_12-33-03
Warning in <TClass::Init>: no dictionary for class ROOT::TIOFeatures is available
    root://cmseos.fnal.gov//store/user/lpcsusyhad/Stop_production/Summer16_94X_v3/PostProcessed_25Apr2019_v4p1//Data_MET_2016_PeriodH/Data_MET_2016_PeriodH_27.root
Before go to event 550000
After go to event 550000
Event #: 551000
Event #: 552000
Event #: 553000
Event #: 554000
-----------------------------------------------------------------------------------------
firstSpec=_jetpt30; run=283283; luminosityBlock=250; CMS_event=519215141; ntuple_event=554604
hui_Pass_lowDM_withCaloMETRatio  = 1 and caleb_SAT_Pass_lowDM  = 1 
hui_Pass_highDM_withCaloMETRatio = 0 and caleb_SAT_Pass_highDM = 0 
    hui_Pass_LeptonVeto    = 1 and caleb_SAT_Pass_LeptonVeto       = 1 
    hui_Pass_JetID         = 1 and caleb_SAT_Pass_JetID            = 1 
    hui_Pass_EventFilter   = 1 and caleb_Pass_EventFilter          = 1 
    hui_Pass_CaloMETRatio  = 1 and caleb_Pass_CaloMETRatio         = 1 
    hui_Pass_MET           = 1 and caleb_SAT_Pass_MET              = 1 
    hui_Pass_HT            = 1 and caleb_SAT_Pass_HT               = 1 
    hui_Pass_NJets         = 1 and caleb_SAT_Pass_NJets            = 1 
    hui_Pass_dPhiMETLowDM  = 1 and caleb_SAT_Pass_dPhiMETLowDM     = 1 
    hui_Pass_dPhiMETMedDM  = 0 and caleb_SAT_Pass_mid_dPhiMETLowDM = 0 
    hui_Pass_dPhiMETHighDM = 0 and caleb_SAT_Pass_dPhiMETHighDM    = 0 
    hui_MET_pt             = 497.632263183593750000000000000000 and caleb_met                   = 497.632263183593750000000000000000 
    hui_Stop0l_HT          = 2433.312500000000000000000000000000 and caleb_HT                    = 2433.312500000000000000000000000000 
    hui_Stop0l_ISRJetPt    = 1085.000000000000000000000000000000 and caleb_ISRJetPt              = 1085.000000000000000000000000000000 
    hui_Stop0l_METSig      = 10.088105201721191406250000000000 and caleb_S_met                 = 10.088105201721191406250000000000 
    hui_Stop0l_Mtb         = 28.413425445556640625000000000000 and caleb_mtb                   = 28.413377761840820312500000000000  --- NOT_EQUAL --- 
    hui_Stop0l_Ptb         = 344.875000000000000000000000000000 and caleb_ptb                   = 344.875000000000000000000000000000 
    hui_Stop0l_nJets       = 7 and caleb_nJets                     = 7 
    hui_Stop0l_nbtags      = 2 and caleb_nBottoms                  = 2 
    hui_Stop0l_nTop        = 0 and caleb_nMergedTops               = 0 
    hui_Stop0l_nW          = 0 and caleb_nWs                       = 0 
    hui_Stop0l_nResolved   = 0 and caleb_nResolvedTops             = 0 
    caleb_MergedTopTotalSF    = 1.000000000000000000000000000000
    caleb_WTotalSF            = 1.000000000000000000000000000000
    caleb_ResolvedTopTotalSF  = 1.000000000000000000000000000000
------------- hui tops -------------
------------- caleb tops -------------
------------- caleb met, jets, dphi -------------
met = 497.632263183593750000000000000000
metphi = 0.447387695312500000000000000000
jet index=0, sorted_index=0
jet index=1, sorted_index=1
jet index=2, sorted_index=2
jet index=3, sorted_index=3
jet index=4, sorted_index=4
jet index=5, sorted_index=5
jet index=6, sorted_index=6
Jet_0: pt=1075.000000000000000000000000000000, eta=1.201171875000000222044604925031, phi=-2.917968750000000000000000000000, mass=81.625000000000000000000000000000
Jet_1: pt=548.500000000000000000000000000000, eta=0.113952636718749944488848768742, phi=-0.103775024414062500000000000000, mass=64.562499999999545252649113535881
Jet_2: pt=221.375000000000000000000000000000, eta=0.012928009033203185715321659188, phi=2.608886718750000000000000000000, mass=40.531249999999907629444351186976
Jet_3: pt=221.375000000000028421709430404007, eta=0.133605957031250000000000000000, phi=0.361755371093750000000000000000, mass=16.499999999999779731751914368942
Jet_4: pt=198.999999999999971578290569595993, eta=0.565917968750000000000000000000, phi=-1.702148437500000000000000000000, mass=20.203124999999818811602381174453
Jet_5: pt=123.500000000000000000000000000000, eta=-0.011024475097656156324932297252, phi=1.081298828125000000000000000000, mass=14.039062500000000000000000000000
Jet_6: pt=44.562500000000000000000000000000, eta=-0.398620605468750000000000000000, phi=0.928344726562500000000000000000, mass=3.250000000000000000000000000000
Jet_7: pt=18.125000000000000000000000000000, eta=-0.342224121093750055511151231258, phi=-0.902465820312500000000000000000, mass=3.603515625000000000000000000000
Jet_8: pt=15.117187499999998223643160599750, eta=-3.537109375000001332267629550188, phi=2.602539062500000000000000000000, mass=3.703125000000000000000000000000
dPhi_0 = 2.917828798294067382812500000000
dPhi_1 = 0.551162719726562500000000000000
dPhi_2 = 2.161499023437500000000000000000
dPhi_3 = 0.085632324218750000000000000000
dPhi_4 = 2.149536132812500000000000000000
------------- caleb fat jets -------------
FatJet_0: pt=1085.000000000000000000000000000000, eta=1.200683593750000000000000000000, phi=-2.918945312500000000000000000000, mass=80.812500000000000000000000000000
FatJet_1: pt=737.000000000000000000000000000000, eta=0.122695922851562527755575615629, phi=0.040092468261718743061106096093, mass=179.375000000000000000000000000000
FatJet_2: pt=243.125000000000000000000000000000, eta=0.026596069335937513877787807814, phi=2.620117187500000000000000000000, mass=53.343750000000000000000000000000
FatJet_3: pt=209.000000000000000000000000000000, eta=0.560791015625000000000000000000, phi=-1.698974609375000000000000000000, mass=21.218750000000000000000000000000
FatJet_4: pt=179.875000000000028421709430404007, eta=-0.114288330078124972244424384371, phi=1.043212890625000000000000000000, mass=39.593750000000000000000000000000
FatJet 0: p_t = 1085.000000000000000000000000000000, eta = 1.200683593750000000000000000000, phi = -2.918945312500000000000000000000, mass = 80.812500000000000000000000000000, btag_disc = 0.177368164062500000000000000000
ISR jet pt 1085.000000000000000000000000000000 is greater than 200.000000000000000000000000000000.
myISRJetIndex = 0
Event #: 555000
Event #: 556000
Event #: 557000
Event #: 558000
Event #: 559000
Event #: 560000
  Eur.Phys.J. C75 (2015) 3, 132  (http://arxiv.org/abs/1412.7420)

real    0m23.869s
user    0m20.519s
sys 0m0.892s
caleb-james-smith commented 4 years ago

Here is the PR with the fix: https://github.com/susy2015/SusyAnaTools/pull/408

The PR is not merged yet. I will leave this issue open until the PR is merged.