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
DDAxes::y
HistogramManager::tables
std::vector< Table > tables
Definition: HistogramManager.h:66
HistogramManager::significantvalues
std::vector< GeometryInterface::Values > significantvalues
Definition: HistogramManager.h:119
HistogramManager::executeExtend
void executeExtend(SummationStep const &step, Table &t, std::string const &reduction, DQMStore::IBooker &iBooker, SummationSpecification const &s)
Definition: HistogramManager.cc:613
HistogramManager::perLumiHarvesting
bool perLumiHarvesting
Definition: HistogramManager.h:91
HistogramManager::DQMStore
dqm::legacy::DQMStore DQMStore
Definition: HistogramManager.h:33
HistogramManager::range_x_nbins
int range_x_nbins
Definition: HistogramManager.h:100
HistogramManager::addSpec
void addSpec(SummationSpecification spec)
Definition: HistogramManager.cc:48
step
step
Definition: StallMonitor.cc:94
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
HistogramManager::executePerLumiHarvesting
void executePerLumiHarvesting(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, edm::LuminosityBlock const &lumiBlock, edm::EventSetup const &iSetup)
Definition: HistogramManager.cc:530
HistogramManager::lumisection
edm::LuminosityBlock const * lumisection
Definition: HistogramManager.h:109
cuy.col
col
Definition: cuy.py:1009
HistogramManager::bookUndefined
bool bookUndefined
Definition: HistogramManager.h:92
HistogramManager::iq
GeometryInterface::InterestingQuantities iq
Definition: HistogramManager.h:117
HistogramManager::executeGroupBy
void executeGroupBy(SummationStep const &step, Table &t, DQMStore::IBooker &iBooker, SummationSpecification const &s)
Definition: HistogramManager.cc:579
HistogramManager::counters
std::vector< Table > counters
Definition: HistogramManager.h:67
HistogramManager
Definition: HistogramManager.h:31
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
HistogramManager::range_y_nbins
int range_y_nbins
Definition: HistogramManager.h:103
AbstractHistogram.h
DDAxes::x
HistogramManager::fillInternal
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)
Definition: HistogramManager.cc:122
HistogramManager::fastpath
std::vector< AbstractHistogram * > fastpath
Definition: HistogramManager.h:121
GeometryInterface.h
AbstractHistogram
Definition: AbstractHistogram.h:21
DetId
Definition: DetId.h:17
Table
alignCSCRings.s
s
Definition: alignCSCRings.py:92
dqmdumpme.last
last
Definition: dqmdumpme.py:56
HistogramManager::executeHarvesting
void executeHarvesting(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
Definition: HistogramManager.cc:698
dqm::legacy::DQMStore
Definition: DQMStore.h:728
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
HistogramManager::dimensions
int dimensions
Definition: HistogramManager.h:99
HistogramManager::range_x_max
double range_x_max
Definition: HistogramManager.h:102
HistogramManager::executePerEventHarvesting
void executePerEventHarvesting(edm::Event const *ev)
Definition: HistogramManager.cc:190
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
HistogramManager::loadFromDQMStore
void loadFromDQMStore(SummationSpecification &s, Table &t, DQMStore::IGetter &iGetter)
Definition: HistogramManager.cc:548
HistogramManager::specs
std::vector< SummationSpecification > specs
Definition: HistogramManager.h:65
HistogramManager::name
std::string name
Definition: HistogramManager.h:95
SummationSpecification.h
value
Definition: value.py:1
HistogramManager::xlabel
std::string xlabel
Definition: HistogramManager.h:97
HistogramManager::range_y_max
double range_y_max
Definition: HistogramManager.h:105
edm::EventSetup
Definition: EventSetup.h:58
GeometryInterface::Values
std::vector< std::pair< Column, Value > > Values
Definition: GeometryInterface.h:46
HistogramManager::enabled
bool enabled
Definition: HistogramManager.h:90
HistogramManager::range_x_min
double range_x_min
Definition: HistogramManager.h:101
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HistogramManager::fill
void fill(DetId sourceModule, const edm::Event *sourceEvent=nullptr, int col=0, int row=0)
Definition: HistogramManager.cc:117
HistogramManager::HistogramManager
HistogramManager(const edm::ParameterSet &iConfig, GeometryInterface &geo)
Definition: HistogramManager.cc:18
HistogramManager::title
std::string title
Definition: HistogramManager.h:96
DetId.h
dqm::implementation::IGetter
Definition: DQMStore.h:484
HistogramManager::iConfig
const edm::ParameterSet & iConfig
Definition: HistogramManager.h:62
ev
bool ev
Definition: Hydjet2Hadronizer.cc:97
HistogramManager::MonitorElement
dqm::legacy::MonitorElement MonitorElement
Definition: HistogramManager.h:34
SummationSpecification
Definition: SummationSpecification.h:56
SummationStep
Definition: SummationSpecification.h:20
HistogramManager::geometryInterface
GeometryInterface & geometryInterface
Definition: HistogramManager.h:63
HistogramManager::Table
std::map< GeometryInterface::Values, AbstractHistogram > Table
Definition: HistogramManager.h:59
dqm::implementation::IBooker
Definition: DQMStore.h:43
HistogramManager::book
void book(DQMStore::IBooker &iBooker, edm::EventSetup const &iSetup)
Definition: HistogramManager.cc:277
HistogramManager::ylabel
std::string ylabel
Definition: HistogramManager.h:98
GeometryInterface::InterestingQuantities
Definition: GeometryInterface.h:57
HistogramManager::makePathName
std::pair< std::string, std::string > makePathName(SummationSpecification const &s, GeometryInterface::Values const &, SummationStep const *upto)
Definition: HistogramManager.cc:227
GeometryInterface
Definition: GeometryInterface.h:34
ParameterSet.h
HistogramManager::range_y_min
double range_y_min
Definition: HistogramManager.h:104
edm::Event
Definition: Event.h:73
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
HistogramManager::top_folder_name
std::string top_folder_name
Definition: HistogramManager.h:93
mps_fire.dest
dest
Definition: mps_fire.py:179
HistogramManager::statsOverflows
bool statsOverflows
Definition: HistogramManager.h:106