CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
create_public_pileup_plots Namespace Reference

Functions

def TweakPlot
 

Variables

tuple arg_parser = optparse.OptionParser(description=desc_str)
 
tuple ax = fig.add_subplot(111)
 
list bin_edges
 
tuple cache_file_dir = cfg_parser.get("general", "cache_dir")
 
dictionary cfg_defaults
 
tuple cfg_parser = ConfigParser.SafeConfigParser(cfg_defaults)
 
string cmd = "pileupCalc.py -i %s --inputLumiJSON=%s %s %s"
 
tuple cms_energy_str = cfg_parser.get("general", "cms_energy_str")
 
 color_fill_pileup = color_scheme.color_fill_pileup
 
 color_line_pileup = color_scheme.color_line_pileup
 
tuple color_scheme = ColorScheme(color_scheme_name)
 
list color_scheme_names = [i.strip() for i in color_scheme_names_tmp.split(",")]
 
tuple color_scheme_names_tmp = cfg_parser.get("general", "color_schemes")
 
list config_file_name = args[0]
 
string desc_str = "This script creates the official CMS pileup plots "
 
 edgecolor = color_line_pileup,
 
tuple exp = RoundAwayFromZero(math.log10(min_val))
 
 facecolor = color_fill_pileup)
 
tuple fig = plt.figure()
 
 file_suffix = color_scheme.file_suffix
 
 fontproperties = FONT_PROPS_SUPTITLE)
 
string help = "Ignore all cached PU results "
 
string histtype = "stepfilled"
 
string horizontalalignment = "right"
 
 ignore_cache = options.ignore_cache
 
tuple in_file = TFile.Open(tmp_file_name, "READ")
 
tuple input_json = cfg_parser.get("general", "input_json")
 
tuple input_lumi_json = cfg_parser.get("general", "input_lumi_json")
 
tuple is_log = (type == "log")
 
 log_setting = False
 
string log_suffix = ""
 
 logo_name = color_scheme.logo_name
 
tuple min_val = min(weights)
 
tuple particle_type_str = cfg_parser.get("general", "particle_type_str")
 
tuple pileup_hist = in_file.Get("pileup")
 
tuple pileupcalc_flags_from_cfg = cfg_parser.get("general", "pileupcalc_flags")
 
tuple tmp_file_name = os.path.join(cache_file_dir,"pileup_calc_tmp.root")
 
 transform = ax.transAxes,
 
list vals
 
tuple verbose = cfg_parser.getboolean("general", "verbose")
 
list weights
 
tuple year = int(cfg_parser.get("general", "year"))
 

Function Documentation

def create_public_pileup_plots.TweakPlot (   fig,
  ax,
  add_extra_head_room = False 
)

Definition at line 61 of file create_public_pileup_plots.py.

61 
62 def TweakPlot(fig, ax, add_extra_head_room=False):
63 
64  # Fiddle with axes ranges etc.
65  ax.relim()
66  ax.autoscale_view(False, True, True)
67  for label in ax.get_xticklabels():
68  label.set_ha("right")
69  label.set_rotation(30.)
70 
71  # Bit of magic here: increase vertical scale by one tick to make
72  # room for the legend.
73  if add_extra_head_room:
74  y_ticks = ax.get_yticks()
75  (y_min, y_max) = ax.get_ylim()
76  is_log = (ax.get_yscale() == "log")
77  y_max_new = y_max
78  if is_log:
79  tmp = y_ticks[-1] / y_ticks[-2]
80  y_max_new = y_max * math.pow(tmp, add_extra_head_room)
81  else:
82  tmp = y_ticks[-1] - y_ticks[-2]
83  y_max_new = y_max + add_extra_head_room * tmp
84  ax.set_ylim(y_min, y_max_new)
85 
86  # Add a second vertical axis on the right-hand side.
87  ax_sec = ax.twinx()
88  ax_sec.set_ylim(ax.get_ylim())
89  ax_sec.set_yscale(ax.get_yscale())
90 
91  for ax_tmp in fig.axes:
92  for sub_ax in [ax_tmp.xaxis, ax_tmp.yaxis]:
93  for label in sub_ax.get_ticklabels():
94  label.set_font_properties(FONT_PROPS_TICK_LABEL)
95 
96  if is_log:
97  fig.subplots_adjust(top=.89, bottom=.125, left=.11, right=.925)
98  else:
99  fig.subplots_adjust(top=.89, bottom=.125, left=.1, right=.925)
100 
101  # End of TweakPlot().

Variable Documentation

tuple create_public_pileup_plots.arg_parser = optparse.OptionParser(description=desc_str)

Definition at line 108 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.ax = fig.add_subplot(111)

Definition at line 232 of file create_public_pileup_plots.py.

list create_public_pileup_plots.bin_edges
Initial value:
1 = [pileup_hist.GetBinLowEdge(i) \
2  for i in xrange(1, pileup_hist.GetNbinsX() + 1)]

Definition at line 201 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.cache_file_dir = cfg_parser.get("general", "cache_dir")

Definition at line 134 of file create_public_pileup_plots.py.

dictionary create_public_pileup_plots.cfg_defaults
Initial value:
1 = {
2  "pileupcalc_flags" : "",
3  "color_schemes" : "Joe, Greg",
4  "verbose" : False
5  }

Definition at line 121 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.cfg_parser = ConfigParser.SafeConfigParser(cfg_defaults)

Definition at line 126 of file create_public_pileup_plots.py.

string create_public_pileup_plots.cmd = "pileupCalc.py -i %s --inputLumiJSON=%s %s %s"

Definition at line 171 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.cms_energy_str = cfg_parser.get("general", "cms_energy_str")

Definition at line 150 of file create_public_pileup_plots.py.

create_public_pileup_plots.color_fill_pileup = color_scheme.color_fill_pileup

Definition at line 217 of file create_public_pileup_plots.py.

create_public_pileup_plots.color_line_pileup = color_scheme.color_line_pileup

Definition at line 216 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.color_scheme = ColorScheme(color_scheme_name)

Definition at line 215 of file create_public_pileup_plots.py.

list create_public_pileup_plots.color_scheme_names = [i.strip() for i in color_scheme_names_tmp.split(",")]

Definition at line 138 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.color_scheme_names_tmp = cfg_parser.get("general", "color_schemes")

Definition at line 137 of file create_public_pileup_plots.py.

list create_public_pileup_plots.config_file_name = args[0]

Definition at line 118 of file create_public_pileup_plots.py.

string create_public_pileup_plots.desc_str = "This script creates the official CMS pileup plots "

Definition at line 106 of file create_public_pileup_plots.py.

create_public_pileup_plots.edgecolor = color_line_pileup,

Definition at line 236 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.exp = RoundAwayFromZero(math.log10(min_val))

Definition at line 228 of file create_public_pileup_plots.py.

create_public_pileup_plots.facecolor = color_fill_pileup)

Definition at line 237 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.fig = plt.figure()

Definition at line 221 of file create_public_pileup_plots.py.

create_public_pileup_plots.file_suffix = color_scheme.file_suffix

Definition at line 219 of file create_public_pileup_plots.py.

create_public_pileup_plots.fontproperties = FONT_PROPS_SUPTITLE)

Definition at line 243 of file create_public_pileup_plots.py.

string create_public_pileup_plots.help = "Ignore all cached PU results "

Definition at line 110 of file create_public_pileup_plots.py.

string create_public_pileup_plots.histtype = "stepfilled"

Definition at line 235 of file create_public_pileup_plots.py.

string create_public_pileup_plots.horizontalalignment = "right"

Definition at line 255 of file create_public_pileup_plots.py.

create_public_pileup_plots.ignore_cache = options.ignore_cache

Definition at line 119 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.in_file = TFile.Open(tmp_file_name, "READ")

Definition at line 185 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.input_json = cfg_parser.get("general", "input_json")

Definition at line 144 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.input_lumi_json = cfg_parser.get("general", "input_lumi_json")

Definition at line 145 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.is_log = (type == "log")

Definition at line 224 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.log_setting = False

Definition at line 225 of file create_public_pileup_plots.py.

string create_public_pileup_plots.log_suffix = ""

Definition at line 262 of file create_public_pileup_plots.py.

create_public_pileup_plots.logo_name = color_scheme.logo_name

Definition at line 218 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.min_val = min(weights)

Definition at line 227 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.particle_type_str = cfg_parser.get("general", "particle_type_str")

Definition at line 148 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.pileup_hist = in_file.Get("pileup")

Definition at line 190 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.pileupcalc_flags_from_cfg = cfg_parser.get("general", "pileupcalc_flags")

Definition at line 143 of file create_public_pileup_plots.py.

tuple create_public_pileup_plots.tmp_file_name = os.path.join(cache_file_dir,"pileup_calc_tmp.root")

Definition at line 169 of file create_public_pileup_plots.py.

create_public_pileup_plots.transform = ax.transAxes,

Definition at line 254 of file create_public_pileup_plots.py.

list create_public_pileup_plots.vals
Initial value:
1 = [pileup_hist.GetBinCenter(i) \
2  for i in xrange(1, pileup_hist.GetNbinsX() + 1)]

Definition at line 203 of file create_public_pileup_plots.py.

Referenced by fwlite::ObjectCountSelector< Collection >.accept(), fwlite::Scanner< Collection >.count(), DDConstant.createConstantsFromEvaluator(), CharmTagger.discriminator(), PhysicsTools::TrainProcessor.doTrainData(), fwlite::Scanner< Collection >.draw(), fwlite::Scanner< Collection >.draw2D(), fwlite::Scanner< Collection >.drawGraph(), fwlite::Scanner< Collection >.drawProf(), Vx3DHLTAnalyzer.endLuminosityBlock(), fwlite::Scanner< Collection >.fillDataSet(), ElectronEnergyRegressionEvaluate.regressionUncertaintyNoTrkVar(), ElectronEnergyRegressionEvaluate.regressionUncertaintyNoTrkVarV1(), ElectronEnergyRegressionEvaluate.regressionUncertaintyWithSubClusters(), ElectronEnergyRegressionEvaluate.regressionUncertaintyWithTrkVar(), ElectronEnergyRegressionEvaluate.regressionUncertaintyWithTrkVarV1(), ElectronEnergyRegressionEvaluate.regressionUncertaintyWithTrkVarV2(), ElectronEnergyRegressionEvaluate.regressionValueNoTrkVar(), ElectronEnergyRegressionEvaluate.regressionValueNoTrkVarV1(), ElectronEnergyRegressionEvaluate.regressionValueWithSubClusters(), ElectronEnergyRegressionEvaluate.regressionValueWithTrkVar(), ElectronEnergyRegressionEvaluate.regressionValueWithTrkVarV1(), ElectronEnergyRegressionEvaluate.regressionValueWithTrkVarV2(), fwlite::Scanner< Collection >.scan(), edm::MultiAssociation< C >::LazyFiller.setValues(), and DDStreamer.vars_write().

tuple create_public_pileup_plots.verbose = cfg_parser.getboolean("general", "verbose")

Definition at line 140 of file create_public_pileup_plots.py.

list create_public_pileup_plots.weights
Initial value:
1 = [pileup_hist.GetBinContent(i) \
2  for i in xrange(1, pileup_hist.GetNbinsX() + 1)]

Definition at line 205 of file create_public_pileup_plots.py.

Referenced by EWKSystUnc.analyze(), ZLONLOHistogrammer.analyze(), zPdfUnc.analyze(), ZMuPtScaleAnalyzer.analyze(), ZMCHistogrammer.analyze(), EcalTPGParamBuilder.analyze(), ecaldqm::SelectiveReadoutTask.beginRun(), EcalSelectiveReadoutProducer.checkWeights(), CSCSegFit.covarianceMatrix(), ME0SegFit.covarianceMatrix(), GEMCSCSegFit.covarianceMatrix(), GsfChi2MeasurementEstimator.estimate(), AdHocNTupler.fill(), npstat::HistoND< Numeric, Axis >.fillPreservingCentroid(), PdfSystematicsAnalyzer.filter(), EcalSelectiveReadoutValidation.frame2EnergyForTp(), PrimaryVertexValidation.getMAD(), popcon::EcalSRPHandler.getNewObjects(), goodseedhelpers::HeavyObjectCache.HeavyObjectCache(), MLP_Stochastic(), MuIsoByTrackPt.MuIsoByTrackPt(), PlotCombiner(), heppy::PdfWeightProducerTool.processEvent(), EcalTBWeightUncalibRecHitProducer.produce(), PdfWeightProducer.produce(), LHECOMWeightProducer.produce(), edm::BeamHaloProducer.produce(), EcalTrigPrimESProducer.produceWeight(), EndcapPiZeroDiscriminatorAlgo.readWeightFile(), muonisolation::IsolatorByDeposit.setWeights(), GsfMultiStateUpdator.update(), EcalDccWeightBuilder.writeWeightToAsciiFile(), EcalDccWeightBuilder.writeWeightToDB(), and EcalDccWeightBuilder.writeWeightToRootFile().

tuple create_public_pileup_plots.year = int(cfg_parser.get("general", "year"))

Definition at line 149 of file create_public_pileup_plots.py.