ATLAS Offline Software
FractionSummary.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
9 #include <dqm_core/AlgorithmManager.h>
10 
11 
14 {
15  m_fractionRed = 0.1;
16  m_fractionYellow = 0.1;
17  dqm_core::AlgorithmManager::instance().registerSummaryMaker("FractionSummary",this);
18 }
19 
22 {
23  return new FractionSummary();
24 }
25 
28  const dqm_core::Result&,
29  const dqm_core::ParametersMap& map)
30 {
31  int g = 0 , y = 0 , r = 0 , u = 0;
32  dqm_core::ParametersMap::const_iterator iter = map.begin();
33  for ( ; iter != map.end() ; ++iter)
34  {
35  dqm_core::Result::Status mystatus = iter->second->getResult().get()->status_;
36  if (mystatus == dqm_core::Result::Green) { ++g; }
37  else if (mystatus == dqm_core::Result::Yellow) { ++y; }
38  else if (mystatus == dqm_core::Result::Red) { ++r; }
39  else { ++u; }
40  }
41  const int total = g + y + r + u;
42  const double RedFraction = total ? ((double)r / total) : 0; // avoid to divide by zero (should never happen)
43  const double YellowFraction = total ? ((double)y / total) : 0; // avoid to divide by zero (should never happen)
44 
46  result->tags_["NGreens"] = g;
47  result->tags_["NYellows"] = y;
48  result->tags_["NReds"] = r;
49  result->tags_["NUndefineds"] = u;
50  result->tags_["RedThresh"] = m_fractionRed;
51  result->tags_["YellowThresh"] = m_fractionYellow;
52  if (RedFraction > m_fractionRed)
53  {
54  result->status_ = dqm_core::Result::Red;
55  }
56  else if (YellowFraction > m_fractionYellow)
57  {
58  result->status_ = dqm_core::Result::Yellow;
59  }
60  else if (g > u)
61  {
63  }
64  // otherwise the status remains undefined, as constructed above
65  return result;
66 }
beamspotman.r
def r
Definition: beamspotman.py:676
Undefined
@ Undefined
Definition: MaterialTypes.h:8
get_generator_info.result
result
Definition: get_generator_info.py:21
FractionSummary.h
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
python.CaloCondTools.g
g
Definition: CaloCondTools.py:15
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
python.handimod.Red
Red
Definition: handimod.py:551
dqm_algorithms::summary::FractionSummary::execute
virtual dqm_core::Result * execute(const std::string &, const dqm_core::Result &, const dqm_core::ParametersMap &map)
Definition: FractionSummary.cxx:27
y
#define y
Athena::Status
Status
Athena specific StatusCode values.
Definition: AthStatusCode.h:22
dqm_algorithms::summary::FractionSummary::m_fractionRed
float m_fractionRed
Definition: FractionSummary.h:33
dqm_algorithms::summary::FractionSummary::FractionSummary
FractionSummary()
Definition: FractionSummary.cxx:13
dqm_algorithms::summary::FractionSummary::clone
FractionSummary * clone()
Definition: FractionSummary.cxx:21
dqm_algorithms::summary::FractionSummary::m_fractionYellow
float m_fractionYellow
Definition: FractionSummary.h:34
dqm_algorithms::summary::FractionSummary
Definition: FractionSummary.h:27