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, AlignableObjectId::entry.name, histograms.Histograms.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, 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, cond::persistency::TAG::LAST_VALIDATED_TIME.name, FWTGeoRecoGeometry::Info.name, Types._Untracked.name, preexistingValidation.PreexistingValidation.name, cond::persistency::TAG::INSERTION_TIME.name, cond::persistency::TAG::MODIFICATION_TIME.name, dataset.BaseDataset.name, OutputMEPSet.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, ParSet.name, DQMRivetClient::ScaleFactorOption.name, SingleObjectCondition.name, EgHLTOfflineSummaryClient::SumHistBinData.name, PhysicsTools::Source.name, cond::persistency::GTProxyData.name, core.autovars.NTupleObjectType.name, MyWatcher.name, Mapper::definition< ScannerT >.name, edm::PathTimingSummary.name, alignment.Alignment.name, cond::TimeTypeSpecs.name, lumi::TriggerInfo.name, edm::PathSummary.name, PixelEndcapLinkMaker::Item.name, DQMGenericClient::EfficOption.name, perftools::EdmEventSize::BranchRecord.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, FWTableViewManager::TableEntry.name, PixelBarrelLinkMaker::Item.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, ExpressionHisto< T >.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, python.rootplot.utilities.Hist2D.name, XMLProcessor::_loaderBaseConfig.name, cond::persistency::PAYLOAD::HASH.name, TreeCrawler.Package.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::OBJECT_TYPE.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, emtf::Node.name, DQMGenericClient::NormOption.name, DeepFlavourJetTagsProducer::MVAVar.name, FastHFShowerLibrary.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, h4DSegm.name, PhysicsTools::Variable::Value.name, PhysicsTools::Calibration::Variable.name, DQMGenericClient::CDOption.name, CounterChecker.name, cond::TagInfo_t.name, EDMtoMEConverter.name, looper.Looper.name, ProcTMVA::Method.name, TreeSaver::Var.name, python.rootplot.tree2hists.Plot.name, MEtoEDM< T >::MEtoEDMObject.name, cond::persistency::IOV::TAG_NAME.name, cond::persistency::IOV::SINCE.name, TrackerSectorStruct.name, classes.MonitorData.name, cond::persistency::IOV::PAYLOAD_HASH.name, cond::persistency::IOV::INSERTION_TIME.name, PhysicsTools::TreeReader::Value.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, PhysicsTools::MVATrainer.name, options.HLTProcessOptions.name, h2DSegm.name, core.TriggerBitAnalyzer.TriggerBitAnalyzer.name, python.rootplot.utilities.Hist.name, config.Analyzer.name, geometry.Structure.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, SiStripMonitorDigi.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, 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, 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, ElectronStudy.histos, DisplayManager.DisplayManager.histos, SiStripLAProfileBooker.histos, DTVDriftCalibration::cellInfo.histos, VariablePlotter::SubDirectory.histos, CSCValidation.histos, hpstanc_transforms.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::GLOBAL_TAG::DESCRIPTION.name, cond::persistency::RUN_INFO::END_TIME.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, cond::persistency::TAG::LAST_VALIDATED_TIME.name, FWTGeoRecoGeometry::Info.name, Types._Untracked.name, preexistingValidation.PreexistingValidation.name, cond::persistency::TAG::INSERTION_TIME.name, dataset.BaseDataset.name, cond::persistency::TAG::MODIFICATION_TIME.name, OutputMEPSet.name, personalPlayback.Applet.name, production_tasks.Task.name, fit::RootMinuitCommand.name, ParameterSet.name, PixelDCSObject< T >::Item.name, analyzer.Analyzer.name, DQMRivetClient::LumiOption.name, MagCylinder.name, CharmTagger::MVAVar.name, ParSet.name, DQMRivetClient::ScaleFactorOption.name, SingleObjectCondition.name, EgHLTOfflineSummaryClient::SumHistBinData.name, cond::persistency::GTProxyData.name, PhysicsTools::Source.name, core.autovars.NTupleObjectType.name, MyWatcher.name, Mapper::definition< ScannerT >.name, edm::PathTimingSummary.name, alignment.Alignment.name, cond::TimeTypeSpecs.name, lumi::TriggerInfo.name, edm::PathSummary.name, cond::persistency::GLOBAL_TAG_MAP::GLOBAL_TAG_NAME.name, DQMGenericClient::EfficOption.name, PixelEndcapLinkMaker::Item.name, perftools::EdmEventSize::BranchRecord.name, FWTableViewManager::TableEntry.name, cond::persistency::GLOBAL_TAG_MAP::RECORD.name, PixelBarrelLinkMaker::Item.name, EcalLogicID.name, cond::persistency::GLOBAL_TAG_MAP::LABEL.name, cond::persistency::GLOBAL_TAG_MAP::TAG_NAME.name, ExpressionHisto< T >.name, python.rootplot.utilities.Hist2D.name, XMLProcessor::_loaderBaseConfig.name, TreeCrawler.Package.name, cond::persistency::PAYLOAD::HASH.name, genericValidation.GenericValidation.name, cond::persistency::PAYLOAD::OBJECT_TYPE.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, emtf::Node.name, DeepFlavourJetTagsProducer::MVAVar.name, DQMGenericClient::NormOption.name, FastHFShowerLibrary.name, h4DSegm.name, core.TriggerMatchAnalyzer.TriggerMatchAnalyzer.name, PhysicsTools::Calibration::Variable.name, PhysicsTools::Variable::Value.name, DQMGenericClient::CDOption.name, CounterChecker.name, EDMtoMEConverter.name, cond::TagInfo_t.name, looper.Looper.name, ProcTMVA::Method.name, TreeSaver::Var.name, python.rootplot.tree2hists.Plot.name, MEtoEDM< T >::MEtoEDMObject.name, cond::persistency::IOV::TAG_NAME.name, TrackerSectorStruct.name, cond::persistency::IOV::SINCE.name, classes.MonitorData.name, cond::persistency::IOV::PAYLOAD_HASH.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, config.Analyzer.name, geometry.Structure.name, core.autovars.NTupleSubObject.name, DQMNet::WaitObject.name, AlpgenParameterName.name, SiStripMonitorDigi.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, 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, hTMaxCell.name, cscdqm::ParHistoDef.name, BeautifulSoup.Tag.name, Id.name, SummaryOutputProducer::GenericSummary.name, BeautifulSoup.SoupStrainer.name, DisplayManager.DisplayManager.pullRange, and harvestTrackValidationPlots.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().