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 54 of file DisplayManager.py.

Constructor & Destructor Documentation

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

Definition at line 55 of file DisplayManager.py.

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

Definition at line 71 of file DisplayManager.py.

References ElectronMVAID.ElectronMVAID.name, average.Average.name, counter.Counter.name, histograms.Histograms.name, AlignableObjectId::entry.name, FWLite.ElectronMVAID.name, TmModule.name, cond::persistency::TAG::NAME.name, cond::persistency::GLOBAL_TAG::NAME.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::TIME_TYPE.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, core.autovars.NTupleVariable.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, MEPSet.name, cond::persistency::TAG::END_OF_VALIDITY.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, cond::persistency::TAG::INSERTION_TIME.name, cond::persistency::TAG::MODIFICATION_TIME.name, FWTGeoRecoGeometry::Info.name, preexistingValidation.PreexistingValidation.name, OutputMEPSet.name, EventStringOutputBranches::NamedBranchPtr.name, SummaryTableOutputBranches::NamedBranchPtr.name, dataset.BaseDataset.name, fit::RootMinuitCommand.name, personalPlayback.Applet.name, Types._Untracked.name, ParameterSet.name, PixelDCSObject< T >::Item.name, DQMRivetClient::LumiOption.name, MagCylinder.name, analyzer.Analyzer.name, production_tasks.Task.name, CharmTagger::MVAVar.name, TriggerOutputBranches::NamedBranchPtr.name, ParSet.name, TableOutputBranches::NamedBranchPtr.name, edm::PathTimingSummary.name, DQMRivetClient::ScaleFactorOption.name, EgHLTOfflineSummaryClient::SumHistBinData.name, PhysicsTools::Source.name, SingleObjectCondition.name, cond::persistency::GTProxyData.name, MyWatcher.name, core.autovars.NTupleObjectType.name, edm::PathSummary.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, lumi::TriggerInfo.name, cond::TimeTypeSpecs.name, alignment.Alignment.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, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, MEtoEDM< T >::MEtoEDMObject.name, cms::DDAlgoArguments.name, ExpressionHisto< T >.name, validateAlignments.ParallelMergeJob.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, python.rootplot.utilities.Hist2D.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, cond::persistency::PAYLOAD::DATA.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, TreeCrawler.Package.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::VERSION.name, options.ConnectionHLTMenu.name, MagGeoBuilderFromDDD::volumeHandle.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, MVAVar.name, DisplayManager.DisplayManager.name, DQMGenericClient::ProfileOption.name, dqmoffline::l1t::HistDefinition.name, FWLite.WorkingPoints.name, DQMGenericClient::NormOption.name, BTagProbabilityToDiscriminator::Discriminator.name, emtf::Node.name, FastHFShowerLibrary.name, h4DSegm.name, PhysicsTools::Calibration::Variable.name, PhysicsTools::Variable::Value.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, DQMGenericClient::CDOption.name, TriggerObjectTableProducer::SelectedObject.name, CounterChecker.name, TrackerSectorStruct.name, cond::TagInfo_t.name, ProcTMVA::Method.name, TreeSaver::Var.name, DQMGenericClient::NoFlowOption.name, looper.Looper.name, python.rootplot.tree2hists.Plot.name, cond::persistency::IOV::TAG_NAME.name, EDMtoMEConverter.name, cond::persistency::IOV::SINCE.name, Mapper::definition< ScannerT >.name, cond::persistency::IOV::PAYLOAD_HASH.name, PhysicsTools::TreeReader::Value.name, cond::persistency::IOV::INSERTION_TIME.name, classes.MonitorData.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, geometry.Structure.name, config.Analyzer.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, NanoAODDQM::SelGroupConfig.name, SiStripMonitorDigi.name, core.autovars.NTupleObject.name, public_plots_tools.ColorScheme.name, PhysicsTools::Variable.name, config.Service.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, and BeautifulSoup.SoupStrainer.name.

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

Member Function Documentation

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

Definition at line 74 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, average.Average.name, counter.Counter.name, histograms.Histograms.name, AlignableObjectId::entry.name, FWLite.ElectronMVAID.name, cond::persistency::GLOBAL_TAG::NAME.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::NAME.name, TmModule.name, cond::persistency::GLOBAL_TAG::VALIDITY.name, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::TAG::TIME_TYPE.name, core.autovars.NTupleVariable.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, cond::persistency::TAG::INSERTION_TIME.name, cond::persistency::TAG::MODIFICATION_TIME.name, FWTGeoRecoGeometry::Info.name, preexistingValidation.PreexistingValidation.name, OutputMEPSet.name, EventStringOutputBranches::NamedBranchPtr.name, SummaryTableOutputBranches::NamedBranchPtr.name, dataset.BaseDataset.name, fit::RootMinuitCommand.name, personalPlayback.Applet.name, Types._Untracked.name, ParameterSet.name, PixelDCSObject< T >::Item.name, analyzer.Analyzer.name, DQMRivetClient::LumiOption.name, MagCylinder.name, production_tasks.Task.name, CharmTagger::MVAVar.name, TriggerOutputBranches::NamedBranchPtr.name, ParSet.name, TableOutputBranches::NamedBranchPtr.name, edm::PathTimingSummary.name, DQMRivetClient::ScaleFactorOption.name, EgHLTOfflineSummaryClient::SumHistBinData.name, cond::persistency::GTProxyData.name, PhysicsTools::Source.name, SingleObjectCondition.name, core.autovars.NTupleObjectType.name, MyWatcher.name, edm::PathSummary.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, cond::TimeTypeSpecs.name, lumi::TriggerInfo.name, alignment.Alignment.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, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, ExpressionHisto< T >.name, cms::DDAlgoArguments.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, validateAlignments.ParallelMergeJob.name, MEtoEDM< T >::MEtoEDMObject.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, python.rootplot.utilities.Hist2D.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, cond::persistency::PAYLOAD::DATA.name, TreeCrawler.Package.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::VERSION.name, options.ConnectionHLTMenu.name, MagGeoBuilderFromDDD::volumeHandle.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, MVAVar.name, DisplayManager.DisplayManager.name, DQMGenericClient::ProfileOption.name, dqmoffline::l1t::HistDefinition.name, FWLite.WorkingPoints.name, DQMGenericClient::NormOption.name, BTagProbabilityToDiscriminator::Discriminator.name, emtf::Node.name, h4DSegm.name, FastHFShowerLibrary.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, PhysicsTools::Variable::Value.name, PhysicsTools::Calibration::Variable.name, DQMGenericClient::CDOption.name, CounterChecker.name, TriggerObjectTableProducer::SelectedObject.name, cond::TagInfo_t.name, TrackerSectorStruct.name, ProcTMVA::Method.name, TreeSaver::Var.name, DQMGenericClient::NoFlowOption.name, looper.Looper.name, python.rootplot.tree2hists.Plot.name, cond::persistency::IOV::TAG_NAME.name, cond::persistency::IOV::SINCE.name, EDMtoMEConverter.name, Mapper::definition< ScannerT >.name, cond::persistency::IOV::PAYLOAD_HASH.name, cond::persistency::IOV::INSERTION_TIME.name, PhysicsTools::TreeReader::Value.name, classes.MonitorData.name, HistogramManager.name, MuonGeometrySanityCheckPoint.name, PhysicsTools::TrainProcessor.name, classes.OutputData.name, PhysicsTools::MVAModuleHelper< Record, Object, Filler >::Value.name, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >.name, options.HLTProcessOptions.name, PhysicsTools::MVATrainer.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, 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.

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

Member Data Documentation

DisplayManager.DisplayManager.box

Definition at line 68 of file DisplayManager.py.

DisplayManager.DisplayManager.canvas

Definition at line 57 of file DisplayManager.py.

DisplayManager.DisplayManager.draw_ratio

Definition at line 61 of file DisplayManager.py.

Referenced by DisplayManager.DisplayManager.Draw().

DisplayManager.DisplayManager.draw_ratioLegend

Definition at line 65 of file DisplayManager.py.

DisplayManager.DisplayManager.histos

Definition at line 62 of file DisplayManager.py.

Referenced by DisplayManager.DisplayManager.Draw().

DisplayManager.DisplayManager.Legend

Definition at line 63 of file DisplayManager.py.

DisplayManager.DisplayManager.pullRange

Definition at line 67 of file DisplayManager.py.

Referenced by DisplayManager.DisplayManager.Draw().