Crombie Tools
TwoScaleFactorCorrector.py
Go to the documentation of this file.
1 """@package CrombieTools.SkimmingTools.Corrector
2 
3 Submodule of CrombieTools.SkimmingTools
4 Contains the constructor and default object for TwoScaleFactorCorrector.
5 
6 @author Daniel Abercrombie <dabercro@mit.edu>
7 """
8 
9 
10 from .. import Load
11 from .Corrector import MakeCorrector
12 
13 newTwoScaleFactorCorrector = Load('TwoScaleFactorCorrector')
14 """TwoScaleFactorCorrector constructor"""
15 
16 def MakeTwoScaleFactorCorrector(Name, inCut,
17  leg1_tightcut, leg2_tightcut,
18  leg1_loose_expr, leg1_tight_expr,
19  leg2_loose_expr, leg2_tight_expr,
20  looseFile, tightFile, looseHist, tightHist):
21 
22  """Make a TwoScaleFactorCorrector object
23 
24  @param Name is the name of the branch for this Corrector if the CorrectorApplicator
25  is saving all branches.
26  @param inCut is the cut that a tree must pass in order for the Correction to be applied.
27  @param leg*_tightcut is the cut that must be passed in order to read from the tight histogram for that leg
28  @param leg*_*_expr is the expression to evaluate before reading from the Correction histogram.
29  If the histogram is multi-dimensional, a list can be passed to this parameter.
30  @param looseFile is the name of the file holding the correction histogram
31  @param tightFile is the name of the file holding the correction histogram
32  @param looseHist is the name of the histograms to apply corrections with.
33  Two histograms from the same file can be divided by passing a list
34  of [numerator_name, denominator_name].
35  @param tightHist is the name of the histograms to apply corrections with.
36  Two histograms from the same file can be divided by passing a list
37  of [numerator_name, denominator_name].
38  @returns a filled Corrector object.
39  """
40 
41  corrector = newTwoScaleFactorCorrector(
42  Name,
43  MakeCorrector('', leg1_loose_expr, '1', looseFile, looseHist),
44  MakeCorrector('', leg1_tight_expr, leg1_tightcut, tightFile, tightHist),
45  MakeCorrector('', leg2_loose_expr, '1', looseFile, looseHist),
46  MakeCorrector('', leg2_tight_expr, leg2_tightcut, tightFile, tightHist)
47  )
48 
49  corrector.SetInCut(inCut)
50 
51  return corrector