ATLAS Offline Software
HistogramDef.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <nlohmann/json.hpp>
7 
8 using namespace Monitored;
10 
11 const HistogramDef HistogramDef::parse(const std::string& histogramDefinition) {
12  const json& setting = json::parse(histogramDefinition);
14 
15  result.name = setting["allvars"].get<std::vector<std::string>>();
16  result.alias = static_cast<std::string>(setting["alias"]);
17  result.type = static_cast<std::string>(setting["type"]);
18  result.path = static_cast<std::string>(setting["path"]);
19  result.title = static_cast<std::string>(setting["title"]);
20  result.weight = static_cast<std::string>(setting["weight"]);
21  result.cutMask = static_cast<std::string>(setting["cutMask"]);
22 
23  result.convention = static_cast<std::string>(setting["convention"]);
24  size_t offline = result.convention.find("OFFLINE");
25  if (offline != std::string::npos) {
26  result.runmode = RunMode::Offline;
27  std::string durationString = result.convention.substr(offline);
28  if (durationString.find("run") != std::string::npos) {
29  result.runperiod = RunPeriod::Run;
30  } else if (durationString.find("lowStat") != std::string::npos) {
31  result.runperiod = RunPeriod::LowStat;
32  } else {
33  result.runperiod = RunPeriod::Lumiblock;
34  }
35  } else {
36  result.runmode = RunMode::Online;
37  }
38 
39  // all histogram options arising from 'opt'
40  result.Sumw2 = setting["Sumw2"];
41  result.kLBNHistoryDepth = setting["kLBNHistoryDepth"];
42  result.kAddBinsDynamically = setting["kAddBinsDynamically"];
43  result.kRebinAxes = setting["kRebinAxes"];
44  result.kCanRebin = setting["kCanRebin"];
45  result.kVec = setting["kVec"];
46  result.kVecUO = setting["kVecUO"];
47  result.kCumulative = setting["kCumulative"];
48  result.kLive = setting["kLive"];
49  result.kAlwaysCreate = setting["kAlwaysCreate"];
50 
51  result.xvar = static_cast<std::string>(setting["xvar"]);
52  result.xbins = setting["xbins"];
53  result.xmin = setting["xmin"];
54  result.xmax = setting["xmax"];
55  result.xlabels = setting["xlabels"].get<std::vector<std::string>>();
56  result.xarray = setting["xarray"].get<std::vector<double>>();
57 
58  result.yvar = static_cast<std::string>(setting["yvar"]);
59  result.ybins = setting["ybins"];
60  result.ymin = setting["ymin"];
61  result.ymax = setting["ymax"];
62  result.ylabels = setting["ylabels"].get<std::vector<std::string>>();
63  result.yarray = setting["yarray"].get<std::vector<double>>();
64 
65  result.zvar = static_cast<std::string>(setting["zvar"]);
66  result.zbins = setting["zbins"];
67  result.zmin = setting["zmin"];
68  result.zmax = setting["zmax"];
69  result.zlabels = setting["zlabels"].get<std::vector<std::string>>();
70 
71  result.merge = static_cast<std::string>(setting["merge"]);
72 
73  result.treeDef = static_cast<std::string>(setting["treeDef"]);
74 
75  result.ok = true;
76  return result;
77 }
Monitored::HistogramDef::RunPeriod::Lumiblock
@ Lumiblock
rebook histogram after every 1 lumiblock
get_generator_info.result
result
Definition: get_generator_info.py:21
json
nlohmann::json json
Definition: HistogramDef.cxx:9
HistogramDef.h
Monitored::HistogramDef::RunPeriod::Run
@ Run
rebook histogram after each run
parse
std::map< std::string, std::string > parse(const std::string &list)
Definition: egammaLayerRecalibTool.cxx:1054
offline
Monitored::HistogramDef::RunMode::Online
@ Online
monitoring data online
Monitored::HistogramDef
the internal class used to keep parsed Filler properties
Definition: HistogramDef.h:15
Monitored
Generic monitoring tool for athena components.
Definition: GenericMonitoringTool.h:30
Monitored::HistogramDef::parse
static const HistogramDef parse(const std::string &histogramDefinition)
Parses histogram defintion from json data.
Definition: HistogramDef.cxx:11
Monitored::HistogramDef::RunMode::Offline
@ Offline
monitoring data offline
Monitored::HistogramDef::RunPeriod::LowStat
@ LowStat
rebook histogram after every 20 lumiblocks