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:
35 
37 
39 
40  // Event is only needed for time-based quantities; row, col only if strcture within module is interesting.
41  void fill(DetId sourceModule, const edm::Event* sourceEvent = nullptr, int col = 0, int row = 0);
42  void fill(double value, DetId sourceModule, const edm::Event* sourceEvent = nullptr, int col = 0, int row = 0);
43  void fill(double x, double y, DetId sourceModule, const edm::Event* sourceEvent = nullptr, int col = 0, int row = 0);
44 
45  // This needs to be called after each event (in the analyzer) for per-event counting, like ndigis.
47 
48  // Initiate the geometry extraction and book all required frames. Requires the specs to be set.
49  void book(DQMStore::IBooker& iBooker, edm::EventSetup const& iSetup);
50 
51  // These functions perform step2, for online (per lumisection) or offline (endRun) respectively.
52  // Note that the EventSetup from PerLumi is used in offline as well, so PerLumi always has to be called first.
54  DQMStore::IGetter& iGetter,
55  edm::LuminosityBlock const& lumiBlock,
56  edm::EventSetup const& iSetup);
57  void executeHarvesting(DQMStore::IBooker& iBooker, DQMStore::IGetter& iGetter);
58 
59  typedef std::map<GeometryInterface::Values, AbstractHistogram> Table;
60 
61 private:
64 
65  std::vector<SummationSpecification> specs;
66  std::vector<Table> tables;
67  std::vector<Table> counters;
68 
69  std::pair<std::string, std::string> makePathName(SummationSpecification const& s,
71  SummationStep const* upto);
72 
73  void fillInternal(double x,
74  double y,
75  int n_parameters,
77  std::vector<SummationStep>::iterator first,
78  std::vector<SummationStep>::iterator last,
80 
83  void executeExtend(SummationStep const& step,
84  Table& t,
85  std::string const& reduction,
86  DQMStore::IBooker& iBooker,
87  SummationSpecification const& s);
88 
89 public: // these are available in config as is, and may be used in harvesting.
90  bool enabled;
94 
101  double range_x_min;
102  double range_x_max;
104  double range_y_min;
105  double range_y_max;
107 
108  // can be used in "custom" harvesting in online.
110 
111 private:
112  // These are actually more like local variables, and they might be shadowed
113  // by locals now and then. The point is to avoid reallocating the heap buffer
114  // of the Values on every call.
115  // iq/significantvalues are also used to cache the last set of columns
116  // per-spec, to avoid unnecessary extractions.
118  // "immutable" cache
119  std::vector<GeometryInterface::Values> significantvalues;
120  // Direct links to the Histogram if the caching above succeeds.
121  std::vector<AbstractHistogram*> fastpath;
122 };
123 
124 #endif
void executeHarvesting(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
void fill(DetId sourceModule, const edm::Event *sourceEvent=nullptr, int col=0, int row=0)
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)
std::string top_folder_name
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:17
std::vector< AbstractHistogram * > fastpath
std::vector< GeometryInterface::Values > significantvalues
std::map< GeometryInterface::Values, AbstractHistogram > Table
HistogramManager(const edm::ParameterSet &iConfig, GeometryInterface &geo)
dqm::legacy::MonitorElement MonitorElement
std::vector< Table > tables
edm::LuminosityBlock const * lumisection
const edm::ParameterSet & iConfig
col
Definition: cuy.py:1009
std::vector< Table > counters
step
Definition: StallMonitor.cc:98
void executePerEventHarvesting(edm::Event const *ev)
void book(DQMStore::IBooker &iBooker, edm::EventSetup const &iSetup)
GeometryInterface::InterestingQuantities iq
dqm::legacy::DQMStore DQMStore
GeometryInterface & geometryInterface