ATLAS Offline Software
Loading...
Searching...
No Matches
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
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
17using namespace std;
18
20
22 dqm_core::AlgorithmManager::instance().registerSummaryMaker( "SimpleSummary", this );
23}
24
27
32
33dqm_core::Result *
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}
static dqm_algorithms::BinContentComp myInstance
file declares the dqm_algorithms::summary::SimpleSummary class.
STL namespace.
dqm_core::Result * execute(const std::string &, const dqm_core::Result &result, const dqm_core::ParametersMap &)