ATLAS Offline Software
PlotManager.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3  */
4 
5 #ifndef PLOTMANAGER_H_
6 #define PLOTMANAGER_H_
7 
8 #include <string>
9 #include <unordered_map>
10 
11 class TFile;
12 class TH1;
13 class TDirectory;
14 
15 namespace EL {
16  class Worker;
17 }
18 
19 namespace top {
25  class PlotManager {
26  public:
35  explicit PlotManager(const std::string& name, TFile* outputFile = nullptr, EL::Worker* wk = nullptr);
36 
37  PlotManager(const std::string& sample, const std::string& channel, const std::string& syst, TFile* outputFile);
38 
49  void addHist(const std::string& hname, const std::string& title, int bins, double start, double end) const;
50 
60  void addHist(const std::string& hname, const std::string& title, int bins, double* binArray) const;
61 
75  void addHist(const std::string& hname, const std::string& title,
76  int xbins, double xstart, double xend,
77  int ybins, double ystart, double yend) const;
78 
90  void addHist(const std::string& hname, const std::string& title,
91  int xbins, double* xbinArray,
92  int ybins, double* ybinArray) const;
93 
106  void addHist(const std::string& hname, const std::string& title,
107  int xbins, double* xbinArray,
108  int ybins, double ystart, double yend) const;
109 
116  TH1* hist(const std::string& name) const;
117 
125  void scaleHistograms(double sf = 1.) const;
126  private:
135  void checkDuplicate(const std::string& hname) const;
136 
138 
140  std::string m_name;
141 
143  mutable std::unordered_map<std::string, TH1*> m_histograms;
144 
145  mutable TDirectory* m_plotDir;
146  };
147 }
148 
149 #endif
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
python.App.bins
bins
Definition: App.py:410
top::PlotManager::m_histograms
std::unordered_map< std::string, TH1 * > m_histograms
A map that's hopefully quick to search because it'll be used a lot per event.
Definition: PlotManager.h:143
dqt_zlumi_pandas.hname
string hname
Definition: dqt_zlumi_pandas.py:272
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
PixelAthClusterMonAlgCfg.ybins
ybins
Definition: PixelAthClusterMonAlgCfg.py:163
top::PlotManager
A map that lets you create a bunch of histograms and get hold of them via a string name.
Definition: PlotManager.h:25
top::PlotManager::m_wk
EL::Worker * m_wk
Definition: PlotManager.h:137
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
compareGeometries.outputFile
string outputFile
Definition: compareGeometries.py:25
top::PlotManager::scaleHistograms
void scaleHistograms(double sf=1.) const
Save the histograms in alphabetical order.
Definition: PlotManager.cxx:177
EL::Worker
Definition: Worker.h:25
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
covarianceTool.title
title
Definition: covarianceTool.py:542
EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
Definition: AlgorithmWorkerData.h:24
top::PlotManager::hist
TH1 * hist(const std::string &name) const
Recover an existing histogram, to fill it for example.
Definition: PlotManager.cxx:169
ConvertOldHistosToNewHistos.binArray
binArray
Definition: ConvertOldHistosToNewHistos.py:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
LArCellBinning.xbins
int xbins
Definition: LArCellBinning.py:163
top::PlotManager::checkDuplicate
void checkDuplicate(const std::string &hname) const
Helper method to check for duplicates when adding histogram.
Definition: PlotManager.cxx:182
top::PlotManager::addHist
void addHist(const std::string &hname, const std::string &title, int bins, double start, double end) const
Add a 1D histogram to the output file.
Definition: PlotManager.cxx:60
mapkey::sf
@ sf
Definition: TElectronEfficiencyCorrectionTool.cxx:38
TH1
Definition: rootspy.cxx:268
top::PlotManager::PlotManager
PlotManager(const std::string &name, TFile *outputFile=nullptr, EL::Worker *wk=nullptr)
A name for the selection.
Definition: PlotManager.cxx:18
top::PlotManager::m_name
std::string m_name
Name of the folder to store the plots in, in the output file.
Definition: PlotManager.h:140
top::PlotManager::m_plotDir
TDirectory * m_plotDir
Definition: PlotManager.h:145