Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Background Measurement 2022 #43

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions BackgroundEstimation/python/FiducialMapCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ def CompareFiducialMap(self):
existingMapName += '2017_data.root'
elif '2018' in self.Numerator["sample"]:
existingMapName += '2017_data.root' # doesn't exist yet, compare to 2017
elif '2022' in self.Numerator['sample']:
existingMapName += '2017_data.root' #doesn't exist yet, compare to 2017
existingMapFile = TFile(existingMapName, 'read')
existingMapDenominator = existingMapFile.Get('beforeVeto')
existingMapNumerator = existingMapFile.Get('afterVeto')
Expand Down
10 changes: 5 additions & 5 deletions BackgroundEstimation/python/bkgdEstimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,11 +726,11 @@ def printNest (self):

nEst.isPositive ()

print("Types in alpha", type(scaleFactor), type(pPassVeto), type(pPassMetCut), type(pPassMetTriggers))
print("Debugging: \n\t pPassVeto {} \n\t passes {} \n\t scaleFactor {} \n\t total {} \n\t pPassMetCut {} \n\t pPassMetTriggers {}".format(str(pPassVeto), str(passes), str(scaleFactor), str(total), str(pPassMetCut), str(pPassMetTriggers)))
#print("Types in alpha", type(scaleFactor), type(pPassVeto), type(pPassMetCut), type(pPassMetTriggers))
#print("Debugging: \n\t pPassVeto {} \n\t passes {} \n\t scaleFactor {} \n\t total {} \n\t pPassMetCut {} \n\t pPassMetTriggers {}".format(str(pPassVeto), str(passes), str(scaleFactor), str(total), str(pPassMetCut), str(pPassMetTriggers)))

alpha = scaleFactor * pPassVeto * pPassMetCut * pPassMetTriggers
print("Debugging, alpha after construction {}".format(str(alpha)))
#print("Debugging, alpha after construction {}".format(str(alpha)))
if self._useExternalTriggerEfficiency and hasattr (self, 'externalTriggerEfficiency'):
alpha /= self.externalTriggerEfficiency
if (hasattr (self, "TagPt35MetTrigHEMveto") and hasattr (self, "TagPt35MetTrig")) or (hasattr (self, "TrigEffNumerHEMveto") and hasattr (self, "TrigEffNumer")):
Expand All @@ -749,7 +749,7 @@ def printNest (self):
alpha = (scaleFactor / total) * nCtrl * pPassMetCut * pPassMetTriggers
print("N: " + str (passes))

print("Alpha is of type", type(alpha))
#print("Alpha is of type", type(alpha))
print("alpha: " + str (alpha))
if alpha.centralValue () > 0:
if alpha.uncertaintyDown () == alpha.uncertaintyUp ():
Expand Down Expand Up @@ -977,7 +977,7 @@ def printPpassVetoTagProbe (self):
eff = scaledPasses / total

print("P (pass lepton veto) in tag-probe sample: " + str (eff))
print("Debugging P {}, Eff {}".format(str(p), str(eff)))
#print("Debugging P {}, Eff {}".format(str(p), str(eff)))
return (eff, p, sf, total)
else:
print("TagProbe and TagProbePass not both defined. Not printing lepton veto efficiency...")
Expand Down
6 changes: 3 additions & 3 deletions BackgroundEstimation/test/bkgdEstimate_2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
#fakeSidebands = [(x * 0.05, (x + 1) * 0.05) for x in range(1, 10)]
fakeSidebands = [(0.05, 0.50)]

applyHEMveto = True
applyHEMveto = False

stdout = sys.stdout
nullout = open("/dev/null", "w")
Expand Down Expand Up @@ -158,8 +158,8 @@
electronBkgdEstimate.addChannel("TagProbe", "ZtoEleProbeTrk" + nLayersWords[0], "EGamma_2022" + runPeriod, dirs['Mike'] + "EGamma_2022/EGamma_2022F_zToEE/")
electronBkgdEstimate.addChannel("TagProbePass", "ZtoEleProbeTrkWithFilter" + nLayersWords[0], "EGamma_2022" + runPeriod, dirs['Mike'] + "EGamma_2022/EGamma_2022F_zToEE/")
electronBkgdEstimate.addChannel("TagProbePassSS", "ZtoEleProbeTrkWithSSFilter" + nLayersWords[0], "EGamma_2022" + runPeriod, dirs['Mike'] + "EGamma_2022/EGamma_2022F_zToEE/")
#electronBkgdEstimate.addChannel("TagPt35", "ElectronTagPt55" + nLayersWords[0], "EGamma_2022" + runPeriod, dirs['Mike'] + "2022/fromLPC/electronControlRegionBinnedLayers")
#electronBkgdEstimate.addChannel("TagPt35MetTrig", "ElectronTagPt55MetTrig" + nLayersWords[0], "EGamma_2022" + runPeriod, dirs['Mike'] + "2022/fromLPC/electronControlRegionBinnedLayers")
electronBkgdEstimate.addChannel("TagPt35", "ElectronTagPt55" + nLayersWords[0], "EGamma_2022" + runPeriod, dirs['Mike'] + "EGamma_2022/EGamma_2022F_electronTagPT/")
electronBkgdEstimate.addChannel("TagPt35MetTrig", "ElectronTagPt55MetTrig" + nLayersWords[0], "EGamma_2022" + runPeriod, dirs['Mike'] + "EGamma_2022/EGamma_2022F_electronTagPT/")

'''if runPeriod in ['C', 'D', 'CD'] and applyHEMveto:
# HEM 15/16 issue; veto MET in phi range
Expand Down
31 changes: 20 additions & 11 deletions BackgroundEstimation/test/createFiducialMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@
if os.environ["CMSSW_VERSION"].startswith ("CMSSW_10_2_"):
runPeriods = ['2018A', '2018B', '2018C', '2018D', '2018']
selectionNames = ['FiducialCalcBeforeOldCuts', 'FiducialCalcAfterOldCuts']
if os.environ['CMSSW_VERSION'].startswith('CMSSW_12') or os.environ['CMSSW_VERSION'].startswith('CMSSW_13'):
runPeriods = ['2022F']
selectionNames = ['FiducialCalcBeforeOldCuts', 'FiducialCalcAfterOldCuts']

for runPeriod in runPeriods:

print "********************************************************************************"
print "Calculating electron fiducial map in search region", runPeriod
print "--------------------------------------------------------------------------------"
print("********************************************************************************")
print("Calculating electron fiducial map in search region", runPeriod)
print("--------------------------------------------------------------------------------")

condorDirectory = dirs['Brian'] + "2015/eleHotSpots"
datasetName = "SingleEle"
Expand All @@ -41,6 +44,9 @@
if '2018' in runPeriod:
condorDirectory = dirs['Brian'] + "2018/fromLPC/eleHotSpots"
datasetName = "EGamma"
if '2022' in runPeriod:
condorDirectory = dirs['Mike'] + 'EGamma_2022/EGamma_2022F_fiducialMap'
datasetName = 'EGamma'

fout = TFile.Open("newElectronFiducialMap_" + runPeriod + ".root", "recreate")

Expand All @@ -54,8 +60,8 @@
electronMap.CalculateFiducialMap()
electronMap.MakePlots()
electronMap.CompareFiducialMap()
print "********************************************************************************"
print "\n\n"
print("********************************************************************************")
print("\n\n")

fout.Close()

Expand All @@ -67,9 +73,9 @@
if '2018' in runPeriod:
condorDirectory = dirs['Brian'] + "2018/fromLPC/muonHotSpots"

print "********************************************************************************"
print "Calculating muon fiducial map in search region", runPeriod
print "--------------------------------------------------------------------------------"
'''print("********************************************************************************")
print("Calculating muon fiducial map in search region", runPeriod)
print("--------------------------------------------------------------------------------")

fout = TFile.Open("newMuonFiducialMap_" + runPeriod + ".root", "recreate")

Expand All @@ -83,10 +89,10 @@
muonMap.CalculateFiducialMap()
muonMap.MakePlots()
muonMap.CompareFiducialMap()
print "********************************************************************************"
print "\n\n"
print("********************************************************************************")
print("\n\n")

fout.Close()
fout.Close()'''

if os.environ["CMSSW_VERSION"].startswith ("CMSSW_7_6_"):
remakePayload('Electron', '2015')
Expand All @@ -100,3 +106,6 @@
if os.environ["CMSSW_VERSION"].startswith ("CMSSW_10_2_"):
remakePayload('Electron', '2018', ['A', 'B', 'C', 'D'])
remakePayload('Muon', '2018', ['A', 'B', 'C', 'D'])
#if os.environ['CMSSW_VERSION'].startswith('CMSSW_12') or os.environ['CMSSW_VERSION'].startswith('CMSSW_13'):
#remakePayload('Electron', '2022', ['F'])
#remakePayload('Muon', '2022', ['A', 'B', 'C', 'D'])
44 changes: 24 additions & 20 deletions StandardAnalysis/python/IntegratedLuminosity_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,34 +384,38 @@ def CreateCompositeLumis(allLumis, year, allPeriods):

# using HLT_PFMET105_IsoTrk50_*
"MET_2022A" : -1,
"MET_2022B" : 90.100668583,
"JetMET_2022C" : 5067.183864430,
"JetMET_2022D" : 3002.294492741,
"MET_2022E" : 5870.638540164,
"MET_2022F" : 18015.978262574,
"MET_2022G" : 3118.633730489,
"MET_2022B" : 89.078989610,
"JetMET_2022C" : 5010.409016184,
"JetMET_2022D" : 2970.045129108,
"MET_2022E" : 5806.955207286,
"MET_2022F" : 17781.598893382,
"MET_2022G" : 3082.753035617,

# using HLT_IsoMu24_v* with Golden json files
"Muon_2022A" : -1,
"Muon_2022B" : 77.329631,
"Muon_2022C" : 4476.362177,
"Muon_2022D" : 2747.864685,
"Muon_2022E" : 5878.354165,
"Muon_2022F" : 18006.977824,
"Muon_2022G" : 3121.865602,
"Muon_2022B" : 89.078989610,
"Muon_2022C" : 5010.409016184,
"Muon_2022D" : 2970.045129108,
"Muon_2022E" : 5806.955207286,
"Muon_2022F" : 17781.901464250,
"Muon_2022G" : 3082.753035617,

# using HLT_Ele32_WPTight_Gsf_v*
"EGamma_2022A:" : -1,
"EGamma_2022B" : 0077.329631,
"EGamma_2022C" : 4476.362177,
"EGamma_2022D" : 2747.864685,
#"EGamma_2022E" : 6.121188303, #fixme
"EGamma_2022E" : 5878.354165,
"EGamma_2022F" : -1, #fixme
"EGamma_2022G" : 3283.111599, #fixme
"EGamma_2022B" : 89.07898961,
"EGamma_2022C" : 5010.409016,
"EGamma_2022D" : 2970.045129,
"EGamma_2022E" : 5806.955207,
"EGamma_2022F" : 17781.59889, #fixme
"EGamma_2022G" : 3082.753036, #fixme

"Tau_2022B" : -1,

"Tau_2022B" : -1,
"Tau_2022B" : -1,
"Tau_2022B" : -1,
"Tau_2022B" : -1,
"Tau_2022B" : -1,
"Tau_2022B" : -1,
}

# now create a single lumi dict, starting with 2015
Expand Down