ATLAS Offline Software
Classes | Functions | Variables
CheckAppliedSFs Namespace Reference

Classes

class  ReleaseComparer
 
class  SystematicComparer
 

Functions

def getArgParser ()
 
def getCalibReleasesAndWP (tree)
 
def getSystematics (tree, wp, calib_release)
 

Variables

dictionary KnownWPs
 
def Options = getArgParser().parse_args()
 
 infile = ROOT.TFile(Options.InputFile)
 
 tree = infile.Get("MuonEfficiencyTest")
 
 calibReleases
 
 WPs = userWPs
 
list userWPs = []
 
def bonusname = Options.bonusname
 
list Histos = []
 
def systematics = getSystematics(tree,wp, calibReleases[0])+[""]
 
string corrType = "Scale Factor"
 
 var_name
 
 axis_title
 
 bmin
 
 bin_width
 
 name_old_rel
 
 name_new_rel
 
 test_tree
 
 branch_old
 
 branch_new
 
 bins
 
 branch_sys_old
 
 branch_sys_new
 
 e3
 
 bmax
 
 weight_old
 
 weight_new
 
 dummy = ROOT.TCanvas("dummy", "dummy", 800, 600)
 
 histoCR1 = comp.get_old_histo().TH1()
 
 histoCR2 = comp.get_new_histo().TH1()
 
 pu = PlotUtils(status = Options.label)
 
 TopPad
 
string variationDrawn = "Nominal"
 
string type_drawn = "Scale factor"
 

Function Documentation

◆ getArgParser()

def CheckAppliedSFs.getArgParser ( )

Definition at line 159 of file CheckAppliedSFs.py.

159 def getArgParser():
160  parser = argparse.ArgumentParser(description='This script checks applied scale factors written to a file by MuonEfficiencyCorrections/MuonEfficiencyCorrectionsSFFilesTest. For more help type \"python CheckAppliedSFs.py -h\"', prog='CheckAppliedSFs', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
161  parser.add_argument('-i', '--InputFile', help='Specify an input root file', default="SFTest.root")
162  parser.add_argument('-o', '--outDir', help='Specify a destination directory', default="Plots")
163  parser.add_argument('-l', '--label', help='Specify the dataset you used with MuonEfficiencyCorrectionsSFFilesTest', default="Internal")
164  parser.add_argument('-w', '--WP', help='Specify a WP to plot', nargs='+', default=[])
165  parser.add_argument('-c', '--SFConstituent', help='Specify if you want to plot nominal value, sys or stat error', nargs='+', default=["SF","DataEff","MCEff"])
166  parser.add_argument('--bonusname', help='Specify a bonus name for the filename', default="")
167  parser.add_argument('--bonuslabel', help='Specify a bonus label printed in the histogram', default="")
168  parser.add_argument('--noComparison', help='do not plot comparison to old release', action='store_true', default=False)
169  parser.add_argument('-n', '--nBins', help='specify number of bins for histograms', type=int, default=50)
170  return parser
171 

◆ getCalibReleasesAndWP()

def CheckAppliedSFs.getCalibReleasesAndWP (   tree)

Definition at line 172 of file CheckAppliedSFs.py.

172 def getCalibReleasesAndWP(tree):
173  branchesInFile = [key.GetName() for key in tree.GetListOfBranches()]
174  calibReleases = []
175  allWPs = set([wp for wp in KnownWPs.iterkeys() ])
176  WPs = []
177  for i in branchesInFile:
178  print i
179  if not i.endswith("SF"): continue
180  if not i.startswith("c"): continue
181  calibCand = i[1:-3]
182 
183  wp_str = i[ : i.rfind("_")]
184  beststr = wp_str[wp_str.rfind("_")+1 : ]
185  if beststr in allWPs:
186  if not beststr in WPs: WPs.append(beststr)
187  if not calibCand[ : calibCand.find(beststr)-1] in calibReleases: calibReleases.append(calibCand[ : calibCand.find(beststr)-1])
188  print "INFO: Found the following working points: %s"%(", ".join(WPs))
189  return calibReleases, WPs
190 

◆ getSystematics()

def CheckAppliedSFs.getSystematics (   tree,
  wp,
  calib_release 
)

Definition at line 191 of file CheckAppliedSFs.py.

191 def getSystematics(tree, wp, calib_release):
192  search_str = "c%s_%s_SF"%(calib_release, wp)
193  syst_names = [key.GetName()[len(search_str) + 2:] for key in tree.GetListOfBranches() if key.GetName().startswith(search_str) and key.GetName() != search_str]
194  print syst_names
195  return syst_names
196 

Variable Documentation

◆ axis_title

CheckAppliedSFs.axis_title

Definition at line 241 of file CheckAppliedSFs.py.

◆ bin_width

CheckAppliedSFs.bin_width

Definition at line 242 of file CheckAppliedSFs.py.

◆ bins

CheckAppliedSFs.bins

Definition at line 252 of file CheckAppliedSFs.py.

◆ bmax

CheckAppliedSFs.bmax

Definition at line 264 of file CheckAppliedSFs.py.

◆ bmin

CheckAppliedSFs.bmin

Definition at line 242 of file CheckAppliedSFs.py.

◆ bonusname

def CheckAppliedSFs.bonusname = Options.bonusname

Definition at line 226 of file CheckAppliedSFs.py.

◆ branch_new

CheckAppliedSFs.branch_new

Definition at line 245 of file CheckAppliedSFs.py.

◆ branch_old

CheckAppliedSFs.branch_old

Definition at line 245 of file CheckAppliedSFs.py.

◆ branch_sys_new

CheckAppliedSFs.branch_sys_new

Definition at line 258 of file CheckAppliedSFs.py.

◆ branch_sys_old

CheckAppliedSFs.branch_sys_old

Definition at line 257 of file CheckAppliedSFs.py.

◆ calibReleases

CheckAppliedSFs.calibReleases

Definition at line 206 of file CheckAppliedSFs.py.

◆ corrType

CheckAppliedSFs.corrType = "Scale Factor"

Definition at line 233 of file CheckAppliedSFs.py.

◆ dummy

CheckAppliedSFs.dummy = ROOT.TCanvas("dummy", "dummy", 800, 600)

Definition at line 303 of file CheckAppliedSFs.py.

◆ e3

CheckAppliedSFs.e3

Definition at line 264 of file CheckAppliedSFs.py.

◆ histoCR1

CheckAppliedSFs.histoCR1 = comp.get_old_histo().TH1()

Definition at line 308 of file CheckAppliedSFs.py.

◆ histoCR2

CheckAppliedSFs.histoCR2 = comp.get_new_histo().TH1()

Definition at line 309 of file CheckAppliedSFs.py.

◆ Histos

list CheckAppliedSFs.Histos = []

Definition at line 228 of file CheckAppliedSFs.py.

◆ infile

CheckAppliedSFs.infile = ROOT.TFile(Options.InputFile)

Definition at line 203 of file CheckAppliedSFs.py.

◆ KnownWPs

dictionary CheckAppliedSFs.KnownWPs
Initial value:
1 = {
2  "Loose" : "RECO",
3  "Medium" : "RECO",
4  "Tight" : "RECO",
5  "HightPt3Layers":"RECO",
6  "HighPt" : "RECO",
7  "LowPt" : "RECO",
8  "LowPtMVA" : "RECO",
9 
10  "TTVA" : "TTVA",
11  "FCLooseIso": "ISO",
12  "FCTight_FixedRadIso": "ISO",
13  "FCLoose_FixedRadIso": "ISO",
14  "FixedCutHighPtTrackOnlyIso": "ISO",
15  "FCTightIso": "ISO",
16  "FixedCutPflowLooseIso": "ISO",
17  "FCTightTrackOnlyIso": "ISO",
18  "FixedCutPflowTightIso": "ISO",
19  "FCTightTrackOnly_FixedRadIso": "ISO",
20  "BadMuonVeto_HighPt" : "BADMUON",
21  }

Definition at line 137 of file CheckAppliedSFs.py.

◆ name_new_rel

CheckAppliedSFs.name_new_rel

Definition at line 243 of file CheckAppliedSFs.py.

◆ name_old_rel

CheckAppliedSFs.name_old_rel

Definition at line 243 of file CheckAppliedSFs.py.

◆ Options

def CheckAppliedSFs.Options = getArgParser().parse_args()

Definition at line 198 of file CheckAppliedSFs.py.

◆ pu

CheckAppliedSFs.pu = PlotUtils(status = Options.label)

Definition at line 311 of file CheckAppliedSFs.py.

◆ systematics

def CheckAppliedSFs.systematics = getSystematics(tree,wp, calibReleases[0])+[""]

Definition at line 231 of file CheckAppliedSFs.py.

◆ test_tree

CheckAppliedSFs.test_tree

Definition at line 244 of file CheckAppliedSFs.py.

◆ TopPad

CheckAppliedSFs.TopPad

Definition at line 318 of file CheckAppliedSFs.py.

◆ tree

CheckAppliedSFs.tree = infile.Get("MuonEfficiencyTest")

Definition at line 205 of file CheckAppliedSFs.py.

◆ type_drawn

CheckAppliedSFs.type_drawn = "Scale factor"

Definition at line 334 of file CheckAppliedSFs.py.

◆ userWPs

list CheckAppliedSFs.userWPs = []

Definition at line 211 of file CheckAppliedSFs.py.

◆ var_name

CheckAppliedSFs.var_name

Definition at line 241 of file CheckAppliedSFs.py.

◆ variationDrawn

CheckAppliedSFs.variationDrawn = "Nominal"

Definition at line 331 of file CheckAppliedSFs.py.

◆ weight_new

CheckAppliedSFs.weight_new

Definition at line 269 of file CheckAppliedSFs.py.

◆ weight_old

CheckAppliedSFs.weight_old

Definition at line 268 of file CheckAppliedSFs.py.

◆ WPs

list CheckAppliedSFs.WPs = userWPs

Definition at line 206 of file CheckAppliedSFs.py.

CheckAppliedSFs.getSystematics
def getSystematics(tree, wp, calib_release)
Definition: CheckAppliedSFs.py:191
CxxUtils::set
constexpr std::enable_if_t< is_bitmask_v< E >, E & > set(E &lhs, E rhs)
Convenience function to set bits in a class enum bitmask.
Definition: bitmask.h:232
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
CheckAppliedSFs.getArgParser
def getArgParser()
Definition: CheckAppliedSFs.py:159
CheckAppliedSFs.getCalibReleasesAndWP
def getCalibReleasesAndWP(tree)
Definition: CheckAppliedSFs.py:172