CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
DisplayManager.DisplayManager Class Reference
Inheritance diagram for DisplayManager.DisplayManager:

Public Member Functions

def __del__ (self)
 
def __init__ (self, name, ratio)
 
def Draw (self, histos, titles)
 

Public Attributes

 box
 
 canvas
 
 draw_ratio
 
 draw_ratioLegend
 
 histos
 
 Legend
 
 name
 
 pullRange
 

Detailed Description

Definition at line 53 of file DisplayManager.py.

Constructor & Destructor Documentation

def DisplayManager.DisplayManager.__init__ (   self,
  name,
  ratio 
)

Definition at line 54 of file DisplayManager.py.

54  def __init__(self, name, ratio):
55  if ratio:
56  self.canvas = createRatioCanvas(name.replace('pdf', ''))
57  else:
58  self.canvas = ROOT.TCanvas(name.replace('.pdf', ''))
59  self.name = name
60  self.draw_ratio = ratio
61  self.histos = []
62  self.Legend = ROOT.TLegend(0.15, 0.79, 0.5, 0.89)
64  self.draw_ratioLegend = ROOT.TLegend(0.15, 0.79, 0.5, 0.89)
66  self.pullRange = 0.5
67  self.box = ROOT.TPave(0.93,0.85,0.98,0.90)
68  self.canvas.Print(self.name + '[')
69 
def __init__(self, name, ratio)
def createRatioCanvas(name, errorBandFillColor=14, errorBandStyle=3354)
def applyLegendSettings(leg)
def DisplayManager.DisplayManager.__del__ (   self)

Definition at line 70 of file DisplayManager.py.

References ElectronMVAID.ElectronMVAID.name, counter.Counter.name, average.Average.name, histograms.Histograms.name, AlignableObjectId::entry.name, TmModule.name, cond::persistency::TAG::NAME.name, cond::persistency::GLOBAL_TAG::NAME.name, core.autovars.NTupleVariable.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::TIME_TYPE.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::TAG::OBJECT_TYPE.name, cond::persistency::GLOBAL_TAG::DESCRIPTION.name, cond::persistency::RUN_INFO::END_TIME.name, cond::persistency::TAG::SYNCHRONIZATION.name, cond::persistency::GLOBAL_TAG::RELEASE.name, cond::persistency::TAG::END_OF_VALIDITY.name, MEPSet.name, cond::persistency::GLOBAL_TAG::SNAPSHOT_TIME.name, cond::persistency::TAG::DESCRIPTION.name, cond::persistency::GTEditorData.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, FWTGeoRecoGeometry::Info.name, cond::persistency::TAG::INSERTION_TIME.name, preexistingValidation.PreexistingValidation.name, cond::persistency::TAG::MODIFICATION_TIME.name, Types._Untracked.name, dataset.BaseDataset.name, OutputMEPSet.name, SummaryTableOutputBranches::NamedBranchPtr.name, personalPlayback.Applet.name, fit::RootMinuitCommand.name, ParameterSet.name, PixelDCSObject< T >::Item.name, production_tasks.Task.name, analyzer.Analyzer.name, DQMRivetClient::LumiOption.name, MagCylinder.name, CharmTagger::MVAVar.name, TriggerOutputBranches::NamedBranchPtr.name, ParSet.name, TableOutputBranches::NamedBranchPtr.name, DQMRivetClient::ScaleFactorOption.name, EgHLTOfflineSummaryClient::SumHistBinData.name, SingleObjectCondition.name, PhysicsTools::Source.name, cond::persistency::GTProxyData.name, core.autovars.NTupleObjectType.name, MyWatcher.name, edm::PathTimingSummary.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, cms::DDAlgoArguments.name, lumi::TriggerInfo.name, alignment.Alignment.name, cond::TimeTypeSpecs.name, edm::PathSummary.name, PixelEndcapLinkMaker::Item.name, perftools::EdmEventSize::BranchRecord.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, DQMGenericClient::EfficOption.name, FWTableViewManager::TableEntry.name, PixelBarrelLinkMaker::Item.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, validateAlignments.ParallelMergeJob.name, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, MEtoEDM< T >::MEtoEDMObject.name, ExpressionHisto< T >.name, python.rootplot.utilities.Hist2D.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, TreeCrawler.Package.name, cond::persistency::PAYLOAD::DATA.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, cond::persistency::PAYLOAD::VERSION.name, MagGeoBuilderFromDDD::volumeHandle.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, options.ConnectionHLTMenu.name, DisplayManager.DisplayManager.name, DQMGenericClient::ProfileOption.name, MVAVar.name, dqmoffline::l1t::HistDefinition.name, DQMGenericClient::NormOption.name, BTagProbabilityToDiscriminator::Discriminator.name, emtf::Node.name, h4DSegm.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, PhysicsTools::Calibration::Variable.name, PhysicsTools::Variable::Value.name, FastHFShowerLibrary.name, DQMGenericClient::CDOption.name, TriggerObjectTableProducer::SelectedObject.name, CounterChecker.name, cond::TagInfo_t.name, ProcTMVA::Method.name, looper.Looper.name, TreeSaver::Var.name, DQMGenericClient::NoFlowOption.name, python.rootplot.tree2hists.Plot.name, cond::persistency::IOV::TAG_NAME.name, TrackerSectorStruct.name, EDMtoMEConverter.name, cond::persistency::IOV::SINCE.name, Mapper::definition< ScannerT >.name, cond::persistency::IOV::PAYLOAD_HASH.name, classes.MonitorData.name, PhysicsTools::TreeReader::Value.name, cond::persistency::IOV::INSERTION_TIME.name, HistogramManager.name, PhysicsTools::TrainProcessor.name, MuonGeometrySanityCheckPoint.name, classes.OutputData.name, PhysicsTools::MVAModuleHelper< Record, Object, Filler >::Value.name, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >.name, PhysicsTools::MVATrainer.name, options.HLTProcessOptions.name, h2DSegm.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, python.rootplot.utilities.Hist.name, nanoaod::FlatTable::Column.name, config.Analyzer.name, geometry.Structure.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, SiStripMonitorDigi.name, NanoAODDQM::SelGroupConfig.name, core.autovars.NTupleObject.name, config.Service.name, public_plots_tools.ColorScheme.name, PhysicsTools::Variable.name, cond::persistency::TAG_LOG::TAG_NAME.name, cond::persistency::TAG_LOG::EVENT_TIME.name, cond::persistency::TAG_LOG::USER_NAME.name, cond::persistency::TAG_LOG::HOST_NAME.name, cond::persistency::TAG_LOG::COMMAND.name, cond::persistency::TAG_LOG::ACTION.name, cond::persistency::TAG_LOG::USER_TEXT.name, PhysicsTools::TrainerMonitoring::Object.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, BPHRecoBuilder::BPHCompSource.name, personalPlayback.FrameworkJob.name, plotscripts.SawTeethFunction.name, python.rootplot.utilities.RootFile.name, crabFunctions.CrabTask.name, hTMaxCell.name, cscdqm::ParHistoDef.name, BeautifulSoup.Tag.name, Id.name, SummaryOutputProducer::GenericSummary.name, and BeautifulSoup.SoupStrainer.name.

70  def __del__(self):
71  self.canvas.Print(self.name + ']')
72 

Member Function Documentation

def DisplayManager.DisplayManager.Draw (   self,
  histos,
  titles 
)

Definition at line 73 of file DisplayManager.py.

References DisplayManager.checkDifferences(), DisplayManager.DisplayManager.draw_ratio, objects.autophobj.float, DisplayManager.DisplayManager.histos, SiStripLAProfileBooker.histos, DTVDriftCalibration::cellInfo.histos, VariablePlotter::SubDirectory.histos, CSCValidation.histos, SiStripPI.max, ElectronMVAID.ElectronMVAID.name, counter.Counter.name, average.Average.name, histograms.Histograms.name, AlignableObjectId::entry.name, cond::persistency::GLOBAL_TAG::NAME.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::NAME.name, TmModule.name, core.autovars.NTupleVariable.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::TAG::TIME_TYPE.name, cond::persistency::RUN_INFO::END_TIME.name, cond::persistency::GLOBAL_TAG::DESCRIPTION.name, cond::persistency::TAG::OBJECT_TYPE.name, cond::persistency::GLOBAL_TAG::RELEASE.name, cond::persistency::TAG::SYNCHRONIZATION.name, cond::persistency::GLOBAL_TAG::SNAPSHOT_TIME.name, MEPSet.name, cond::persistency::TAG::END_OF_VALIDITY.name, cond::persistency::GTEditorData.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, cond::persistency::TAG::DESCRIPTION.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, FWTGeoRecoGeometry::Info.name, cond::persistency::TAG::INSERTION_TIME.name, preexistingValidation.PreexistingValidation.name, cond::persistency::TAG::MODIFICATION_TIME.name, Types._Untracked.name, dataset.BaseDataset.name, OutputMEPSet.name, SummaryTableOutputBranches::NamedBranchPtr.name, personalPlayback.Applet.name, fit::RootMinuitCommand.name, ParameterSet.name, production_tasks.Task.name, PixelDCSObject< T >::Item.name, analyzer.Analyzer.name, DQMRivetClient::LumiOption.name, MagCylinder.name, CharmTagger::MVAVar.name, TriggerOutputBranches::NamedBranchPtr.name, ParSet.name, TableOutputBranches::NamedBranchPtr.name, DQMRivetClient::ScaleFactorOption.name, EgHLTOfflineSummaryClient::SumHistBinData.name, core.autovars.NTupleObjectType.name, cond::persistency::GTProxyData.name, PhysicsTools::Source.name, SingleObjectCondition.name, MyWatcher.name, edm::PathTimingSummary.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, cms::DDAlgoArguments.name, cond::TimeTypeSpecs.name, lumi::TriggerInfo.name, alignment.Alignment.name, edm::PathSummary.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, PixelEndcapLinkMaker::Item.name, perftools::EdmEventSize::BranchRecord.name, DQMGenericClient::EfficOption.name, FWTableViewManager::TableEntry.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, PixelBarrelLinkMaker::Item.name, validateAlignments.ParallelMergeJob.name, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, ExpressionHisto< T >.name, MEtoEDM< T >::MEtoEDMObject.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, python.rootplot.utilities.Hist2D.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, TreeCrawler.Package.name, cond::persistency::PAYLOAD::DATA.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, cond::persistency::PAYLOAD::VERSION.name, MagGeoBuilderFromDDD::volumeHandle.name, options.ConnectionHLTMenu.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, DisplayManager.DisplayManager.name, MVAVar.name, DQMGenericClient::ProfileOption.name, dqmoffline::l1t::HistDefinition.name, DQMGenericClient::NormOption.name, BTagProbabilityToDiscriminator::Discriminator.name, emtf::Node.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, h4DSegm.name, PhysicsTools::Variable::Value.name, PhysicsTools::Calibration::Variable.name, FastHFShowerLibrary.name, DQMGenericClient::CDOption.name, TriggerObjectTableProducer::SelectedObject.name, CounterChecker.name, cond::TagInfo_t.name, looper.Looper.name, ProcTMVA::Method.name, TreeSaver::Var.name, DQMGenericClient::NoFlowOption.name, python.rootplot.tree2hists.Plot.name, cond::persistency::IOV::TAG_NAME.name, EDMtoMEConverter.name, TrackerSectorStruct.name, cond::persistency::IOV::SINCE.name, classes.MonitorData.name, cond::persistency::IOV::PAYLOAD_HASH.name, Mapper::definition< ScannerT >.name, PhysicsTools::TreeReader::Value.name, cond::persistency::IOV::INSERTION_TIME.name, HistogramManager.name, PhysicsTools::TrainProcessor.name, MuonGeometrySanityCheckPoint.name, classes.OutputData.name, PhysicsTools::MVAModuleHelper< Record, Object, Filler >::Value.name, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >.name, PhysicsTools::MVATrainer.name, options.HLTProcessOptions.name, h2DSegm.name, python.rootplot.utilities.Hist.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, nanoaod::FlatTable::Column.name, config.Analyzer.name, geometry.Structure.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, NanoAODDQM::SelGroupConfig.name, SiStripMonitorDigi.name, core.autovars.NTupleObject.name, public_plots_tools.ColorScheme.name, config.Service.name, PhysicsTools::Variable.name, cond::persistency::TAG_LOG::TAG_NAME.name, cond::persistency::TAG_LOG::EVENT_TIME.name, cond::persistency::TAG_LOG::USER_NAME.name, cond::persistency::TAG_LOG::HOST_NAME.name, cond::persistency::TAG_LOG::COMMAND.name, cond::persistency::TAG_LOG::ACTION.name, PhysicsTools::TrainerMonitoring::Object.name, cond::persistency::TAG_LOG::USER_TEXT.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, BPHRecoBuilder::BPHCompSource.name, personalPlayback.FrameworkJob.name, plotscripts.SawTeethFunction.name, python.rootplot.utilities.RootFile.name, crabFunctions.CrabTask.name, hTMaxCell.name, cscdqm::ParHistoDef.name, BeautifulSoup.Tag.name, Id.name, SummaryOutputProducer::GenericSummary.name, BeautifulSoup.SoupStrainer.name, DisplayManager.DisplayManager.pullRange, and str.

73  def Draw(self, histos, titles):
74  self.histos = histos
75  ymax = max(h.GetMaximum() for h in self.histos)
76  self.Legend.Clear()
77  self.draw_ratioLegend.Clear()
78  for i, h in enumerate(self.histos):
79  title = titles[i]
80  h.GetYaxis().SetRangeUser(0., ymax * 1.3)
81  self.Legend.AddEntry(h, title + ': ' + str(h.Integral()))
82  if i == 0:
83  h.Draw('HIST E')
84  else:
85  h.Draw('SAME HIST E')
86  self.Legend.Draw()
87  ## add an assessment on the agreement
88  rel_diff = checkDifferences(self.histos)
89  self.box.SetLineColor(1)
90  self.box.SetLineWidth(1)
91  self.box.SetShadowColor(0)
92  if rel_diff <= 0.01:
93  self.box.SetFillColor(416) ## kGreen
94  elif rel_diff <= 0.10:
95  self.box.SetFillColor(797) ## kOrange
96  else:
97  self.box.SetFillColor(632) ## kRed
98  self.box.ConvertNDCtoPad()
99  self.box.Draw()
100 
101  pull_histos = []
102  if self.draw_ratio:
103  self.canvas.cd(2)
104  for ihist in range(1, len(self.histos)):
105  histPull = copy.deepcopy(self.histos[ihist])
106  pull_histos.append(histPull)
107  histPull.Divide(self.histos[0])
108  histPull.UseCurrentStyle()
109  histPull.SetLineColor(self.histos[ihist].GetLineColor())
110  histPull.SetMarkerColor(self.histos[ihist].GetLineColor())
111  histPull.SetLineStyle(self.histos[ihist].GetLineStyle())
112  histPull.SetLineWidth(self.histos[ihist].GetLineWidth())
113  histPull.GetYaxis().SetRangeUser(-self.pullRange + 1., self.pullRange + 1.)
114  # defaultYtoPixel = 408. # height in pixels of default canvas
115  defaultYtoPixel = self.canvas.GetPad(1).YtoPixel(0.)
116  pad2YtoPixel = float(self.canvas.GetPad(2).YtoPixel(0))
117  pad2XaxisFactor = defaultYtoPixel / pad2YtoPixel
118  histPull.GetXaxis().SetLabelSize(self.histos[0].GetXaxis().GetLabelSize()*pad2XaxisFactor)
119  histPull.GetXaxis().SetLabelOffset(self.histos[0].GetXaxis().GetLabelOffset()*pad2XaxisFactor)
120  histPull.GetXaxis().SetTitleSize(self.histos[0].GetXaxis().GetTitleSize()*pad2XaxisFactor)
121  histPull.GetXaxis().SetTitleOffset(self.histos[0].GetXaxis().GetTitleOffset()/pad2XaxisFactor*2.5)
122  histPull.GetYaxis().SetLabelSize(self.histos[0].GetYaxis().GetLabelSize()*pad2XaxisFactor)
123  histPull.GetYaxis().SetLabelOffset(self.histos[0].GetYaxis().GetLabelOffset()*pad2XaxisFactor)
124  histPull.GetYaxis().SetTitleSize(self.histos[0].GetYaxis().GetTitleSize()*pad2XaxisFactor)
125  histPull.GetYaxis().SetTitleOffset(self.histos[0].GetYaxis().GetTitleOffset()/pad2XaxisFactor)
126  histPull.GetYaxis().CenterTitle()
127  histPull.GetXaxis().SetTickLength(histPull.GetXaxis().GetTickLength()*pad2XaxisFactor)
128  histPull.GetYaxis().SetNdivisions(306)
129  histPull.GetYaxis().SetTitle("Ratio to " + titles[0])
130  histPull.SetTitle('')
131  if ihist == 1:
132  histPull.Draw("ep")
133  else:
134  histPull.Draw("same ep")
135  self.draw_ratioLegend.AddEntry(histPull, titles[ihist])
136  # This is a little bit ugly though ...
137  for i, h in enumerate(self.histos):
138  h.GetXaxis().SetLabelSize(0)
139  self.canvas.cd(1)
140  self.canvas.Update()
141  self.canvas.Print(self.name)

Member Data Documentation

DisplayManager.DisplayManager.box

Definition at line 67 of file DisplayManager.py.

DisplayManager.DisplayManager.canvas

Definition at line 56 of file DisplayManager.py.

DisplayManager.DisplayManager.draw_ratio

Definition at line 60 of file DisplayManager.py.

Referenced by DisplayManager.DisplayManager.Draw().

DisplayManager.DisplayManager.draw_ratioLegend

Definition at line 64 of file DisplayManager.py.

DisplayManager.DisplayManager.histos

Definition at line 61 of file DisplayManager.py.

Referenced by DisplayManager.DisplayManager.Draw().

DisplayManager.DisplayManager.Legend

Definition at line 62 of file DisplayManager.py.

DisplayManager.DisplayManager.pullRange

Definition at line 66 of file DisplayManager.py.

Referenced by DisplayManager.DisplayManager.Draw().