CMS 3D CMS Logo

HistogramManager.h
Go to the documentation of this file.
1 #ifndef SiPixel_HistogramManager_h
2 #define SiPixel_HistogramManager_h
3 // -*- C++ -*-
4 //
5 // Package: SiPixelPhase1Common
6 // Class : HistogramManager
7 //
8 // This helper is used by the DQM plugins to create histograms for different
9 // sub-partitions of the detector. It records all the samples that go into
10 // histograms and takes a SummationSpecification. From these, it generates all
11 // the histograms in the right places and with consistent labels.
12 //
13 // One HistogramManager records one quantity, which may be multidimensional.
14 // A plugin can use more than one HistogramManager, which can be held in a
15 // HistogramManagerHolder (SiPixelPhase1Base.h)
16 //
17 
18 // CMSSW
22 
23 // DQM stuff
25 
26 // Own Stuff
30 
32 public:
34 
36 
37  // Event is only needed for time-based quantities; row, col only if strcture within module is interesting.
38  void fill(DetId sourceModule, const edm::Event *sourceEvent = nullptr, int col = 0, int row = 0);
39  void fill(double value, DetId sourceModule, const edm::Event *sourceEvent = nullptr, int col = 0, int row = 0);
40  void fill(double x, double y, DetId sourceModule, const edm::Event *sourceEvent = nullptr, int col = 0, int row = 0);
41 
42  // This needs to be called after each event (in the analyzer) for per-event counting, like ndigis.
44 
45  // Initiate the geometry extraction and book all required frames. Requires the specs to be set.
46  void book(DQMStore::IBooker& iBooker, edm::EventSetup const& iSetup);
47 
48  // These functions perform step2, for online (per lumisection) or offline (endRun) respectively.
49  // Note that the EventSetup from PerLumi is used in offline as well, so PerLumi always has to be called first.
51  edm::LuminosityBlock const& lumiBlock, edm::EventSetup const& iSetup);
52  void executeHarvesting(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter);
53 
54  typedef std::map<GeometryInterface::Values, AbstractHistogram> Table;
55 
56 private:
59 
60  std::vector<SummationSpecification> specs;
61  std::vector<Table> tables;
62  std::vector<Table> counters;
63 
64  std::pair<std::string, std::string> makePathName(SummationSpecification const& s,
65  GeometryInterface::Values const&, SummationStep const* upto);
66 
67  void fillInternal(double x, double y, int n_parameters,
69  std::vector<SummationStep>::iterator first,
70  std::vector<SummationStep>::iterator last,
72 
74  void executeGroupBy(SummationStep const& step, Table& t, DQMStore::IBooker& iBooker,
75  SummationSpecification const& s);
76  void executeExtend(SummationStep const& step, Table& t, std::string const& reduction,
77  DQMStore::IBooker& iBooker, SummationSpecification const& s);
78 
79 public: // these are available in config as is, and may be used in harvesting.
80  bool enabled;
84 
91  double range_x_min;
92  double range_x_max;
94  double range_y_min;
95  double range_y_max;
96 
97  // can be used in "custom" harvesting in online.
98  edm::LuminosityBlock const* lumisection = nullptr;
99 
100 private:
101  // These are actually more like local variables, and they might be shadowed
102  // by locals now and then. The point is to avoid reallocating the heap buffer
103  // of the Values on every call.
104  // iq/significantvalues are also used to cache the last set of columns
105  // per-spec, to avoid unnecessary extractions.
107  // "immutable" cache
108  std::vector<GeometryInterface::Values> significantvalues;
109  // Direct links to the Histogram if the caching above succeeds.
110  std::vector<AbstractHistogram*> fastpath;
111 };
112 
113 
114 #endif
void executeHarvesting(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
void addSpec(SummationSpecification spec)
void executePerLumiHarvesting(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &iSetup)
void executeGroupBy(SummationStep const &step, Table &t, DQMStore::IBooker &iBooker, SummationSpecification const &s)
std::vector< SummationSpecification > specs
std::pair< std::string, std::string > makePathName(SummationSpecification const &s, GeometryInterface::Values const &, SummationStep const *upto)
bool ev
std::string top_folder_name
void fill(DetId sourceModule, const edm::Event *sourceEvent=0, int col=0, int row=0)
void fillInternal(double x, double y, int n_parameters, GeometryInterface::InterestingQuantities const &iq, std::vector< SummationStep >::iterator first, std::vector< SummationStep >::iterator last, AbstractHistogram &dest)
std::string xlabel
void executeExtend(SummationStep const &step, Table &t, std::string const &reduction, DQMStore::IBooker &iBooker, SummationSpecification const &s)
void loadFromDQMStore(SummationSpecification &s, Table &t, DQMStore::IGetter &iGetter)
Definition: value.py:1
std::string ylabel
std::vector< std::pair< Column, Value > > Values
Definition: DetId.h:18
std::vector< AbstractHistogram * > fastpath
std::vector< GeometryInterface::Values > significantvalues
std::map< GeometryInterface::Values, AbstractHistogram > Table
HistogramManager(const edm::ParameterSet &iConfig, GeometryInterface &geo)
std::vector< Table > tables
edm::LuminosityBlock const * lumisection
const edm::ParameterSet & iConfig
col
Definition: cuy.py:1010
std::vector< Table > counters
step
Definition: StallMonitor.cc:94
void executePerEventHarvesting(edm::Event const *ev)
void book(DQMStore::IBooker &iBooker, edm::EventSetup const &iSetup)
GeometryInterface::InterestingQuantities iq
GeometryInterface & geometryInterface