ATLAS Offline Software
Public Member Functions | List of all members
dqm_algorithms::BinContentDump Struct Reference

#include <BinContentDump.h>

Inheritance diagram for dqm_algorithms::BinContentDump:
Collaboration diagram for dqm_algorithms::BinContentDump:

Public Member Functions

 BinContentDump ()
 
 ~BinContentDump ()
 
BinContentDumpclone ()
 
dqm_core::Resultexecute (const std::string &, const TObject &, const dqm_core::AlgorithmConfig &)
 
virtual void printDescription (std::ostream &out)
 

Detailed Description

Definition at line 14 of file BinContentDump.h.

Constructor & Destructor Documentation

◆ BinContentDump()

dqm_algorithms::BinContentDump::BinContentDump ( )

Definition at line 22 of file BinContentDump.cxx.

23 {
24  dqm_core::AlgorithmManager::instance().registerAlgorithm("BinContentDump", this);
25 }

◆ ~BinContentDump()

dqm_algorithms::BinContentDump::~BinContentDump ( )

Definition at line 27 of file BinContentDump.cxx.

28 {
29 }

Member Function Documentation

◆ clone()

dqm_algorithms::BinContentDump * dqm_algorithms::BinContentDump::clone ( )

Definition at line 31 of file BinContentDump.cxx.

32 {
33  return new BinContentDump();
34 }

◆ execute()

dqm_core::Result * dqm_algorithms::BinContentDump::execute ( const std::string &  name,
const TObject &  object,
const dqm_core::AlgorithmConfig &  config 
)

Definition at line 36 of file BinContentDump.cxx.

37 {
38  const TH1 *histogram;
39 
40  if (object.IsA()->InheritsFrom("TH1")) {
41  histogram = static_cast<const TH1*>(&object);
42  if (histogram->GetDimension() > 2) {
43  throw dqm_core::BadConfig(ERS_HERE, name, "dimension > 2");
44  }
45  } else {
46  throw dqm_core::BadConfig(ERS_HERE, name, "does not inherit from TH1");
47  }
48 
49  const double minstat = dqm_algorithms::tools::GetFirstFromMap("MinStat", config.getParameters(), -1);
50  const unsigned int publishType = static_cast<unsigned int>(dqm_algorithms::tools::GetFirstFromMap("PublishType", config.getParameters(), 1));
51  // const int maxpublish = (int) dqm_algorithms::tools::GetFirstFromMap("MaxPublish", config.getParameters(), 20);
52 
53  if (histogram->GetEntries() < minstat) {
55  result->tags_["InsufficientEntries"] = histogram->GetEntries();
56  return result;
57  }
58 
60 
61  for (int i = 1; i <= histogram->GetNbinsX(); ++i) {
62  const double binContent = histogram->GetBinContent(i);
63  const double binError = histogram->GetBinError(i);
64  std::string label = histogram->GetXaxis()->GetBinLabel(i);
65 
66  // Check if user has defined a minimum value on this bin
67  const double undefined = -99999;
68  const double binThreshold = dqm_algorithms::tools::GetFirstFromMap(label, config.getParameters(), undefined);
69  if ((binThreshold != undefined) && (binContent < binThreshold)) result->status_ = dqm_core::Result::Red;
70 
71  if (label.empty()) {
72  std::ostringstream oss;
73  oss << "Bin_" << i;
74  label = oss.str();
75  }
76 
77  if (publishType & 0x01) result->tags_[label] = binContent;
78  if (publishType & 0x02) result->tags_[label + "Error"] = binError;
79  }
80  return result;
81 }

◆ printDescription()

void dqm_algorithms::BinContentDump::printDescription ( std::ostream &  out)
virtual

Definition at line 82 of file BinContentDump.cxx.

83 {
84  out << "BinContentDump: Dumps the contents of all bins, labelled either with their bin label or with \"Bin_N\". Returns green status.\n"
85  "Optional parameters: <label>: The bin with this label must be greater than the given value, otherwise the algorithm returns red status.\n"
86  "Optional parameter: PublishType: What to publish. 0 = nothing, 1 = bin contents (default), 2 = bin errors, 3 = both\n"
87  "Thresholds: None." << std::endl;
88 }

The documentation for this struct was generated from the following files:
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
IsA
#define IsA
Declare the TObject style functions.
Definition: xAODTEventBranch.h:59
PlotCalibFromCool.label
label
Definition: PlotCalibFromCool.py:78
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
HitType::undefined
@ undefined
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
lumiFormat.i
int i
Definition: lumiFormat.py:85
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
dqm_algorithms::BinContentDump::BinContentDump
BinContentDump()
Definition: BinContentDump.cxx:22
python.handimod.Red
Red
Definition: handimod.py:551
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
pickleTool.object
object
Definition: pickleTool.py:30
dqm_algorithms::tools::GetFirstFromMap
double GetFirstFromMap(const std::string &paramName, const std::map< std::string, double > &params)
Definition: AlgorithmHelper.cxx:339
histogram
std::string histogram
Definition: chains.cxx:52