Skip to content
Snippets Groups Projects
Commit bd3c82d9 authored by jingjing's avatar jingjing
Browse files

Implement check on input hists of no entry or trivial value

parent b14ddfcd
No related branches found
No related tags found
No related merge requests found
......@@ -413,12 +413,18 @@ if __name__ == '__main__':
if args.makeTheoryShapeVariations and "PMG_" in path or "Nominal" in path:
pmgWeightDict = makeHistDict.fillHistDict(path, myTObject , args.mcCampaign, myDSIDHelper, channelMap = channelMapping , masterHistDict = pmgWeightDict, customMapping=myDSIDHelper.DSIDtoDSIDMapping)
if args.checkTrivialHists: # Check for any hists of zero integral and/or mean value in the input
bmin = myTObject.FindBin(xmin)
bmax = myTObject.FindBin(xmax)
histTitle = myTObject.GetName
if myTObject.Integral(bmin, bmax) == 0 or myTObject.GetMean(axis=1) == 0:
raise ValueError('Hist', histTitle, 'has no content!')
import pdb; pdb.set_trace()
bmin = myTObject.GetXaxis().FindBin(myTObject.GetMinimum())
bmax = myTObject.GetXaxis().FindBin(myTObject.GetMaximum())
#print(path, myTObject.Integral(bmin, bmax))
#import pdb; pdb.set_trace()
#if myTObject.Integral(bmin, bmax) == 0:
if myTObject.GetEntries() == 0:
raise ValueError('Hist', path, 'has no entry!')
if myTObject.GetMean() == 0:
raise ValueError('Hist', path, 'has zero mean value!')
#import pdb; pdb.set_trace()
nRelevantHistsProcessed += 1
......@@ -441,18 +447,18 @@ if __name__ == '__main__':
# import pdb; pdb.set_trace()
# print(masspointDictBeforeInterpolation)
if args.interpolateSamples: addInterpolatedSignalSamples(masterHistDict, channels = "ZXSR")
import pdb; pdb.set_trace()
#import pdb; pdb.set_trace()
##############################################################################
# add 'expectedData' hists, i.e. hist constructed from background samples
##############################################################################
addExpectedData(masterHistDict)
import pdb; pdb.set_trace()
#import pdb; pdb.set_trace()
###############################################################################################################
# sum up 4e + 2mu2e hists to 2l2e and 4mu + 2e2mu hists to 2l2mu hists, and include them in the masterHistDict
###############################################################################################################
makeHistDict.add2l2eAnd2l2muHists(masterHistDict)
import pdb; pdb.set_trace()
#import pdb; pdb.set_trace()
###############################################################################################################
......@@ -461,14 +467,14 @@ if __name__ == '__main__':
if args.rebin > 1:
for anyHist in loopOverRecursiveDict( masterHistDict ): anyHist.Rebin( args.rebin )
reportMemUsage.reportMemUsage(startTime = startTimeInterp)
import pdb; pdb.set_trace()
#import pdb; pdb.set_trace()
##############################################################################
# write the histograms in the masterHistDict to file for the limit setting
##############################################################################
rootDictAndTDirTools.writeDictTreeToRootFile( masterHistDict, targetFilename = args.outputTo )
reportMemUsage.reportMemUsage(startTime = startTime)
import pdb; pdb.set_trace()
#import pdb; pdb.set_trace()
##############################################################################
# create an overview of the signal samples (regular and interpolated)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment