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, DigiComparisonTask.name, TestTask.name, TPComparisonTask.name, HcalOnlineHarvesting.name, HFRaddamTask.name, LaserTask.name, NoCQTask.name, DigiPhase1Task.name, QIE10Task.name, QIE11Task.name, HcalOfflineHarvesting.name, RecHitTask.name, PedestalTask.name, UMNioTask.name, ZDCTask.name, AlignableObjectId::entry.name, RawTask.name, average.Average.name, counter.Counter.name, TPTask.name, DigiTask.name, histograms.Histograms.name, LEDTask.name, TmModule.name, cond::persistency::TAG::NAME.name, cond::persistency::GTEditorData.name, FWLite.ElectronMVAID.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, cond::persistency::RUN_INFO::START_TIME.name, cond::persistency::TAG::OBJECT_TYPE.name, core.autovars.NTupleVariable.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, cms::dd::NameValuePair< T >.name, cond::persistency::TAG::DESCRIPTION.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, cond::persistency::TAG::INSERTION_TIME.name, FWTGeoRecoGeometry::Info.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::MODIFICATION_TIME.name, ParameterSet.name, preexistingValidation.PreexistingValidation.name, OutputMEPSet.name, PixelDCSObject< T >::Item.name, SummaryTableOutputBranches::NamedBranchPtr.name, cms::dd::ValuePair< T, U >.name, dataset.BaseDataset.name, fit::RootMinuitCommand.name, personalPlayback.Applet.name, EventStringOutputBranches::NamedBranchPtr.name, Types._Untracked.name, DQMRivetClient::LumiOption.name, MagCylinder.name, ParSet.name, analyzer.Analyzer.name, production_tasks.Task.name, cond::persistency::GTProxyData.name, DQMRivetClient::ScaleFactorOption.name, TableOutputBranches::NamedBranchPtr.name, TriggerOutputBranches::NamedBranchPtr.name, CharmTagger::MVAVar.name, Barrel.name, EgHLTOfflineSummaryClient::SumHistBinData.name, edm::PathTimingSummary.name, cms::DDAlgoArguments.name, SingleObjectCondition.name, perftools::EdmEventSize::BranchRecord.name, core.autovars.NTupleObjectType.name, MyWatcher.name, cond::TimeTypeSpecs.name, edm::PathSummary.name, EcalLogicID.name, DQMGenericClient::EfficOption.name, alignment.Alignment.name, lumi::TriggerInfo.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, PixelEndcapLinkMaker::Item.name, XMLProcessor::_loaderBaseConfig.name, MEtoEDM< T >::MEtoEDMObject.name, FWTableViewManager::TableEntry.name, PixelBarrelLinkMaker::Item.name, ExpressionHisto< T >.name, Supermodule.name, python.rootplot.utilities.Hist2D.name, DQMGenericClient::ProfileOption.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, TreeCrawler.Package.name, genericValidation.GenericValidation.name, options.ConnectionHLTMenu.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, DQMGenericClient::NormOption.name, MVAVar.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, DisplayManager.DisplayManager.name, FWLite.WorkingPoints.name, dqmoffline::l1t::HistDefinition.name, DQMGenericClient::CDOption.name, magneticfield::BaseVolumeHandle.name, FastHFShowerLibrary.name, PhysicsTools::Variable::Value.name, cms::DDParsingContext::CompositeMaterial.name, emtf::Node.name, h4DSegm.name, BTagProbabilityToDiscriminator::Discriminator.name, DQMGenericClient::NoFlowOption.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, cond::persistency::PAYLOAD::HASH.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, cond::persistency::PAYLOAD::DATA.name, CounterChecker.name, PhysicsTools::Calibration::Variable.name, cond::TagInfo_t.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, TriggerObjectTableProducer::SelectedObject.name, cond::persistency::PAYLOAD::VERSION.name, TrackerSectorStruct.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, MuonGeometrySanityCheckPoint.name, FCDTask.name, Mapper::definition< ScannerT >.name, looper.Looper.name, python.rootplot.tree2hists.Plot.name, EDMtoMEConverter.name, PhysicsTools::TreeReader::Value.name, classes.MonitorData.name, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >.name, HistogramManager.name, classes.OutputData.name, PhysicsTools::MVAModuleHelper< Record, Object, Filler >::Value.name, Crystal.name, cond::persistency::IOV::TAG_NAME.name, cond::persistency::IOV::SINCE.name, cond::persistency::IOV::PAYLOAD_HASH.name, cond::persistency::IOV::INSERTION_TIME.name, h2DSegm.name, options.HLTProcessOptions.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, python.rootplot.utilities.Hist.name, AlpgenParameterName.name, DQMNet::WaitObject.name, geometry.Structure.name, config.Analyzer.name, core.autovars.NTupleSubObject.name, Capsule.name, core.autovars.NTupleObject.name, Ceramic.name, SiStripMonitorDigi.name, PhysicsTools::Variable.name, BulkSilicon.name, config.Service.name, nanoaod::FlatTable::Column.name, APD.name, NanoAODDQM::SelGroupConfig.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, BPHRecoBuilder::BPHCompSource.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, InnerLayerVolume.name, personalPlayback.FrameworkJob.name, Grid.name, Grille.name, BackPipe.name, plotscripts.SawTeethFunction.name, PatchPanel.name, BackCoolTank.name, DryAirTube.name, python.rootplot.utilities.RootFile.name, MBCoolTube.name, crabFunctions.CrabTask.name, MBManif.name, cscdqm::ParHistoDef.name, hTMaxCell.name, BeautifulSoup.Tag.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, dqmMemoryStats.float, DisplayManager.DisplayManager.histos, SiStripLAProfileBooker.histos, DTVDriftCalibration::cellInfo.histos, VariablePlotter::SubDirectory.histos, CSCValidation.histos, SiStripPI.max, ElectronMVAID.ElectronMVAID.name, DigiComparisonTask.name, TestTask.name, TPComparisonTask.name, DigiPhase1Task.name, HcalOfflineHarvesting.name, HcalOnlineHarvesting.name, HFRaddamTask.name, LaserTask.name, NoCQTask.name, PedestalTask.name, QIE10Task.name, QIE11Task.name, RecHitTask.name, UMNioTask.name, ZDCTask.name, RawTask.name, AlignableObjectId::entry.name, average.Average.name, counter.Counter.name, TPTask.name, histograms.Histograms.name, DigiTask.name, LEDTask.name, cond::persistency::GTEditorData.name, cond::persistency::GLOBAL_TAG::NAME.name, cond::persistency::RUN_INFO::RUN_NUMBER.name, cond::persistency::TAG::NAME.name, FWLite.ElectronMVAID.name, TmModule.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, core.autovars.NTupleVariable.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, cond::persistency::TAG::END_OF_VALIDITY.name, MEPSet.name, cond::persistency::TAG::DESCRIPTION.name, cond::persistency::GLOBAL_TAG::INSERTION_TIME.name, cms::dd::NameValuePair< T >.name, cond::persistency::TAG::LAST_VALIDATED_TIME.name, FWTGeoRecoGeometry::Info.name, cond::persistency::TAG::INSERTION_TIME.name, nanoaod::MergeableCounterTable::SingleColumn< T >.name, cond::persistency::TAG::MODIFICATION_TIME.name, ParameterSet.name, preexistingValidation.PreexistingValidation.name, OutputMEPSet.name, PixelDCSObject< T >::Item.name, SummaryTableOutputBranches::NamedBranchPtr.name, cms::dd::ValuePair< T, U >.name, fit::RootMinuitCommand.name, dataset.BaseDataset.name, personalPlayback.Applet.name, EventStringOutputBranches::NamedBranchPtr.name, Types._Untracked.name, DQMRivetClient::LumiOption.name, MagCylinder.name, ParSet.name, analyzer.Analyzer.name, production_tasks.Task.name, cond::persistency::GTProxyData.name, DQMRivetClient::ScaleFactorOption.name, Barrel.name, TriggerOutputBranches::NamedBranchPtr.name, CharmTagger::MVAVar.name, TableOutputBranches::NamedBranchPtr.name, edm::PathTimingSummary.name, EgHLTOfflineSummaryClient::SumHistBinData.name, cms::DDAlgoArguments.name, SingleObjectCondition.name, cond::TimeTypeSpecs.name, perftools::EdmEventSize::BranchRecord.name, core.autovars.NTupleObjectType.name, MyWatcher.name, edm::PathSummary.name, EcalLogicID.name, DQMGenericClient::EfficOption.name, lumi::TriggerInfo.name, alignment.Alignment.name, nanoaod::MergeableCounterTable::VectorColumn< T >.name, XMLProcessor::_loaderBaseConfig.name, PixelEndcapLinkMaker::Item.name, FWTableViewManager::TableEntry.name, MEtoEDM< T >::MEtoEDMObject.name, PixelBarrelLinkMaker::Item.name, ExpressionHisto< T >.name, Supermodule.name, python.rootplot.utilities.Hist2D.name, DQMGenericClient::ProfileOption.name, TreeCrawler.Package.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, genericValidation.GenericValidation.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, options.ConnectionHLTMenu.name, DQMGenericClient::NormOption.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, MVAVar.name, DisplayManager.DisplayManager.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, FWLite.WorkingPoints.name, dqmoffline::l1t::HistDefinition.name, DQMGenericClient::CDOption.name, magneticfield::BaseVolumeHandle.name, FastHFShowerLibrary.name, PhysicsTools::Variable::Value.name, cms::DDParsingContext::CompositeMaterial.name, emtf::Node.name, h4DSegm.name, BTagProbabilityToDiscriminator::Discriminator.name, DQMGenericClient::NoFlowOption.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, cond::persistency::PAYLOAD::HASH.name, cond::persistency::PAYLOAD::OBJECT_TYPE.name, CounterChecker.name, cond::persistency::PAYLOAD::DATA.name, cond::TagInfo_t.name, PhysicsTools::Calibration::Variable.name, TriggerObjectTableProducer::SelectedObject.name, cond::persistency::PAYLOAD::STREAMER_INFO.name, cond::persistency::PAYLOAD::VERSION.name, cond::persistency::PAYLOAD::INSERTION_TIME.name, TrackerSectorStruct.name, MuonGeometrySanityCheckPoint.name, FCDTask.name, Mapper::definition< ScannerT >.name, looper.Looper.name, python.rootplot.tree2hists.Plot.name, EDMtoMEConverter.name, PhysicsTools::TreeReader::Value.name, classes.MonitorData.name, PhysicsTools::ProcessRegistry< Base_t, CalibBase_t, Parent_t >.name, HistogramManager.name, classes.OutputData.name, PhysicsTools::MVAModuleHelper< Record, Object, Filler >::Value.name, Crystal.name, cond::persistency::IOV::TAG_NAME.name, cond::persistency::IOV::SINCE.name, cond::persistency::IOV::PAYLOAD_HASH.name, h2DSegm.name, cond::persistency::IOV::INSERTION_TIME.name, options.HLTProcessOptions.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, python.rootplot.utilities.Hist.name, AlpgenParameterName.name, DQMNet::WaitObject.name, geometry.Structure.name, config.Analyzer.name, core.autovars.NTupleSubObject.name, Capsule.name, core.autovars.NTupleObject.name, Ceramic.name, SiStripMonitorDigi.name, PhysicsTools::Variable.name, BulkSilicon.name, config.Service.name, nanoaod::FlatTable::Column.name, APD.name, core.autovars.NTupleCollection.name, BPHRecoBuilder::BPHRecoSource.name, NanoAODDQM::SelGroupConfig.name, BPHRecoBuilder::BPHCompSource.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, InnerLayerVolume.name, personalPlayback.FrameworkJob.name, Grid.name, Grille.name, BackPipe.name, plotscripts.SawTeethFunction.name, PatchPanel.name, BackCoolTank.name, DryAirTube.name, python.rootplot.utilities.RootFile.name, MBCoolTube.name, crabFunctions.CrabTask.name, MBManif.name, cscdqm::ParHistoDef.name, hTMaxCell.name, BeautifulSoup.Tag.name, SummaryOutputProducer::GenericSummary.name, BeautifulSoup.SoupStrainer.name, DisplayManager.DisplayManager.pullRange, FastTimerService_cff.range, 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().