ATLAS Offline Software
CumulativeHistogramFiller1D.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 AthenaMonitoringKernel_HistogramFiller_CumulativeHistogramFiller1D_h
6 #define AthenaMonitoringKernel_HistogramFiller_CumulativeHistogramFiller1D_h
7 
8 #include "HistogramFiller1D.h"
9 
10 namespace Monitored {
15  public:
16  CumulativeHistogramFiller1D(const HistogramDef& definition, std::shared_ptr<IHistogramProvider> provider)
17  : HistogramFiller1D(definition, provider) {}
18 
19 
20 
21  virtual unsigned fill( const HistogramFiller::VariablesPack& vars ) const override {
22  if ( vars.size() != 1) {
23  return 0;
24  }
25 
26  const size_t varVecSize = vars.var[0]->size();
27 
28  // handling of the cutmask
29  auto cutMaskValuePair = getCutMaskFunc( vars.cut );
30  if (cutMaskValuePair.first == 0) { return 0; }
31  if (ATH_UNLIKELY(cutMaskValuePair.first > 1 && cutMaskValuePair.first != varVecSize)) {
32  MsgStream log(Athena::getMessageSvc(), "CumulativeHistogramFiller1D");
33  log << MSG::ERROR << "CutMask does not match the size of plotted variable: "
34  << cutMaskValuePair.first << " " << varVecSize << endmsg;
35  }
36  auto cutMaskValue = cutMaskValuePair.second;
37  unsigned i{0};
38  auto histogram = this->histogram<TH1>();
39  for (; i < varVecSize; i++) {
40  if (!cutMaskValue(i)) { continue; }
41  const unsigned bin = histogram->FindBin(vars.var[0]->get(i));
42 
43  for (unsigned j = bin; j > 0; --j) {
44  histogram->AddBinContent(j);
45  }
46  }
47 
48  return i;
49  }
50  };
51 }
52 
53 #endif /* AthenaMonitoringKernel_HistogramFiller_CumulativeHistogramFiller1D_h */
Monitored::CumulativeHistogramFiller1D::fill
virtual unsigned fill(const HistogramFiller::VariablesPack &vars) const override
Method that actually fills the ROOT object.
Definition: CumulativeHistogramFiller1D.h:21
Monitored::HistogramFiller::histogram
H * histogram() const
Definition: HistogramFiller.h:150
Monitored::HistogramFiller1D
Filler for plain 1D histograms.
Definition: HistogramFiller1D.h:21
Monitored::HistogramFiller::VariablesPack::cut
const Monitored::IMonitoredVariable * cut
pointer to cut mask variable, typically absent
Definition: HistogramFiller.h:115
bin
Definition: BinsDiffFromStripMedian.h:43
ATH_UNLIKELY
#define ATH_UNLIKELY(x)
Definition: AthUnlikelyMacros.h:17
Monitored::HistogramDef
the internal class used to keep parsed Filler properties
Definition: HistogramDef.h:15
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
Monitored::CumulativeHistogramFiller1D::CumulativeHistogramFiller1D
CumulativeHistogramFiller1D(const HistogramDef &definition, std::shared_ptr< IHistogramProvider > provider)
Definition: CumulativeHistogramFiller1D.h:16
Monitored::CumulativeHistogramFiller1D
Filler for 1D histograms filled in cummulative mode.
Definition: CumulativeHistogramFiller1D.h:14
Monitored::HistogramFiller::VariablesPack
helper class to pass variables to fillers
Definition: HistogramFiller.h:71
lumiFormat.i
int i
Definition: lumiFormat.py:92
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:30
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Monitored::HistogramFiller::VariablesPack::size
size_t size() const
number of variables in the pack ( not counting the weight and mask )
Definition: HistogramFiller.h:79
HistogramFiller1D.h
Monitored::HistogramFiller::VariablesPack::var
std::vector< const Monitored::IMonitoredVariable * > var
storage for variables, default size of 4, serves all histograming uses
Definition: HistogramFiller.h:113
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
Monitored::HistogramFiller::getCutMaskFunc
std::pair< size_t, std::function< bool(size_t)> > getCutMaskFunc(const Monitored::IMonitoredVariable *mask) const
Definition: HistogramFiller.h:155