ATLAS Offline Software
PercentSummary.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 
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 {
23  dqm_core::AlgorithmManager::instance().registerSummaryMaker( "PercentSummary", this );
24 }
25 
27 {
28 }
29 
32 {
33  return new PercentSummary();
34 }
35 
38  const dqm_core::Result & ,
39  const dqm_core::ParametersMap & map)
40 {
41 
42  dqm_core::ParametersMap::const_iterator iter;
43  double rweight=0;
44  double yweight=0;
45  double gweight=0;
46 
47  double red=0;
48  double yellow=0;
49  double green=0;
50  double undefined=0;
51 
52  double weight=0;
53  double y_percent=0;
54  double r_percent=0;
55  double ry_percent=0;
56 
57  dqm_core::Result *newresult = new dqm_core::Result();
58 
59  for (iter=map.begin();iter!=map.end();++iter){
60  dqm_core::Result::Status status=iter->second->getResult().get()->status_;
62  rweight+=iter->second->getWeight();
63  red++;
64  } else if (status==dqm_core::Result::Yellow) {
65  yweight+=iter->second->getWeight();
66  yellow++;
67  } else if (status==dqm_core::Result::Green) {
68  gweight+=iter->second->getWeight();
69  green++;
70  } else{
71  undefined++;
72  }
73  }
74 
75  weight=rweight+yweight+gweight;
76 
77  if( red+green+yellow == 0){
78  newresult->status_=dqm_core::Result::Undefined;
79  return newresult;
80  } else{
81  if(weight==0){
82  y_percent=yellow/(red+green+yellow+undefined);
83  r_percent=red/(red+green+yellow+undefined);
84  ry_percent=(red+yellow)/(red+green+yellow+undefined);
85  } else{
86  y_percent=yweight/(red+green+yellow+undefined);
87  r_percent=rweight/(red+green+yellow+undefined);
88  ry_percent=(yweight+rweight)/(red+green+yellow+undefined);
89  }
90  }
91 
92 
93  if (r_percent>=0.50 || (ry_percent >= 0.50 && r_percent>0)) {
94  newresult->status_=dqm_core::Result::Red;
95  }else if (y_percent >= 0.50 || (r_percent>0.25 && r_percent<0.50)) {
96  newresult->status_=dqm_core::Result::Yellow;
97  }else {
98  newresult->status_=dqm_core::Result::Green;
99  }
100 
101  return newresult;
102 
103 }
PercentSummary.h
Undefined
@ Undefined
Definition: MaterialTypes.h:8
dqm_algorithms::summary::PercentSummary::~PercentSummary
~PercentSummary()
Definition: PercentSummary.cxx:26
dqm_algorithms::summary::PercentSummary::execute
dqm_core::Result * execute(const std::string &, const dqm_core::Result &result, const dqm_core::ParametersMap &)
Definition: PercentSummary.cxx:37
dqm_algorithms::summary::PercentSummary::clone
PercentSummary * clone()
Definition: PercentSummary.cxx:31
HitType::undefined
@ undefined
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
dqm_algorithms::summary::PercentSummary
Definition: PercentSummary.h:19
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
yellow
@ yellow
Definition: BinsDiffFromStripMedian.h:18
Result
ICscStripFitter::Result Result
Definition: CalibCscStripFitter.cxx:13
python.handimod.Green
int Green
Definition: handimod.py:524
python.handimod.Red
Red
Definition: handimod.py:551
green
@ green
Definition: BinsDiffFromStripMedian.h:18
Athena::Status
Status
Athena specific StatusCode values.
Definition: AthStatusCode.h:22
merge.status
status
Definition: merge.py:17
red
@ red
Definition: BinsDiffFromStripMedian.h:18
dqm_algorithms::summary::PercentSummary::PercentSummary
PercentSummary()
Definition: PercentSummary.cxx:21