ATLAS Offline Software
SimpleSummary.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 <iostream>
10 
11 #include <dqm_core/AlgorithmManager.h>
12 
14 #include <dqm_core/Result.h>
15 #include <dqm_core/Parameter.h>
16 
17 using namespace std;
18 
20 
22  dqm_core::AlgorithmManager::instance().registerSummaryMaker( "SimpleSummary", this );
23 }
24 
26 }
27 
30  return new SimpleSummary();
31 }
32 
35  const dqm_core::Result & ,
36  const dqm_core::ParametersMap & map){
37 
38  dqm_core::ParametersMap::const_iterator iter;
39 
40  float rweight = 0;
41  float yweight = 0;
42  float gweight = 0;
43 
44  float ngrey = 0;
45  float nblack = 0;
46 
47  for (iter=map.begin();iter!=map.end();++iter){
48 
49  dqm_core::Result::Status status=iter->second->getResult().get()->status_;
50 
51  if ( status == dqm_core::Result::Red ) {
52  rweight+=iter->second->getWeight();
53  }else if ( status == dqm_core::Result::Yellow ) {
54  yweight+=iter->second->getWeight();
55  }else if ( status == dqm_core::Result::Green ) {
56  gweight+=iter->second->getWeight();
57  }else if ( status == dqm_core::Result::Undefined ) {
58  ++ngrey;
59  }else if ( status==dqm_core::Result::Disabled ) {
60  ++nblack;
61  }
62  }
63 
64 
65  dqm_core::Result *newresult = new dqm_core::Result();
66 
67  if ( nblack == map.size() ) {
68  newresult->status_=dqm_core::Result::Disabled;
69  return newresult;
70  }
71  if ( ( ngrey + nblack ) == map.size() ) {
72  newresult->status_=dqm_core::Result::Undefined;
73  return newresult;
74  }
75 
76  float weight = gweight > ((rweight >= yweight) ? rweight : yweight) ? gweight : ((rweight >= yweight) ? rweight : yweight);
77 
78  if ( weight == 0 ) {
79  newresult->status_=dqm_core::Result::Undefined;
80  return newresult;
81  }
82 
83  if ( weight == rweight ) {
84  newresult->status_=dqm_core::Result::Red;
85  }else if ( weight == yweight ) {
86  newresult->status_=dqm_core::Result::Yellow;
87  } else {
88  newresult->status_=dqm_core::Result::Green;
89  }
90 
91  return newresult;
92 
93 }
Undefined
@ Undefined
Definition: MaterialTypes.h:8
dqm_algorithms::summary::SimpleSummary::SimpleSummary
SimpleSummary()
Definition: SimpleSummary.cxx:21
SimpleSummary.h
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
dqm_algorithms::summary::SimpleSummary::execute
dqm_core::Result * execute(const std::string &, const dqm_core::Result &result, const dqm_core::ParametersMap &)
Definition: SimpleSummary.cxx:34
python.handimod.Red
Red
Definition: handimod.py:551
dqm_algorithms::summary::SimpleSummary::~SimpleSummary
~SimpleSummary()
Definition: SimpleSummary.cxx:25
Athena::Status
Status
Athena specific StatusCode values.
Definition: AthStatusCode.h:22
merge.status
status
Definition: merge.py:17
dqm_algorithms::summary::SimpleSummary
Definition: SimpleSummary.h:20
dqm_algorithms::summary::SimpleSummary::clone
SimpleSummary * clone()
Definition: SimpleSummary.cxx:29