Created
July 30, 2018 19:41
-
-
Save mattleblanc/469e93a7cc3ab9299c4b410cd6775620 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| ''' | |
| Romain Madar's significance formula | |
| see s7 here for more details: | |
| https://indico.cern.ch/event/696609/contributions/2943410/attachments/1625903/2589232/Btagging.pdf | |
| ''' | |
| import math | |
| from optparse import OptionParser | |
| parser = OptionParser() | |
| parser.add_option("--s", help="How many signal events?", type=float, default=1) | |
| parser.add_option("--b", help="How many background events?", type=float, default=10) | |
| parser.add_option("--db", help="Percent uncertainty on background?", type=float, default=0.3) | |
| parser.add_option("--verbose", action='store_true', help="Verbose output? Default is False", default=False) | |
| (options, args) = parser.parse_args() | |
| s=options.s | |
| b=options.b | |
| db=options.db | |
| t1 = (s+b)*math.log((s+b)*(b+db*db)/(b*b+(s+b)*db*db)) | |
| t2 = b*b/(db*db)*math.log(1.+s*db*db/(b*(b+db*db))) | |
| Sum = math.sqrt(2.*(t1-t2)); | |
| if( Sum != Sum or math.isinf(Sum)): Sum = 0; | |
| print Sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment