ATLAS Offline Software
Loading...
Searching...
No Matches
TrigOperationalInfo.cxx File Reference
#include "TrigSteeringEvent/TrigOperationalInfo.h"
#include "GaudiKernel/MsgStream.h"
#include <sstream>
#include <cmath>
#include <algorithm>
Include dependency graph for TrigOperationalInfo.cxx:

Go to the source code of this file.

Functions

std::string str (const TrigOperationalInfo &d)
MsgStream & operator<< (MsgStream &m, const TrigOperationalInfo &d)
bool operator== (const TrigOperationalInfo &a, const TrigOperationalInfo &b)
void diff (const TrigOperationalInfo &a, const TrigOperationalInfo &b, std::map< std::string, double > &variableChange)

Function Documentation

◆ diff()

void diff ( const TrigOperationalInfo & a,
const TrigOperationalInfo & b,
std::map< std::string, double > & variableChange )

Definition at line 93 of file TrigOperationalInfo.cxx.

93 {
94 std::pair<std::vector<std::string>, std::vector<float> > a_infos = a.infos();
95 std::pair<std::vector<std::string>, std::vector<float> > b_infos = b.infos();
96
97 if ( a_infos.first.size() != b_infos.first.size())
98 variableChange["size"] = a_infos.first.size() - b_infos.first.size();
99
100 std::vector<std::string>::const_iterator a_keyIt = a_infos.first.begin();
101 std::vector<float>::const_iterator a_valueIt = a_infos.second.begin();
102 for ( unsigned i = 0; i < a_infos.first.size(); i++ ) {
103 if ( b.defined(*a_keyIt) ) {
104 float b_val = b.get(*a_keyIt);
105 variableChange[*a_keyIt] = *a_valueIt - b_val;
106 } else {
107 variableChange[*a_keyIt+"_abs"] = *a_valueIt;
108 }
109
110 ++a_keyIt;
111 ++a_valueIt;
112 }
113}
static Double_t a

◆ operator<<()

MsgStream & operator<< ( MsgStream & m,
const TrigOperationalInfo & d )

Definition at line 73 of file TrigOperationalInfo.cxx.

73 {
74 m << str(d);
75 return m;
76}

◆ operator==()

bool operator== ( const TrigOperationalInfo & a,
const TrigOperationalInfo & b )

Definition at line 79 of file TrigOperationalInfo.cxx.

79 {
80
81 std::pair<std::vector<std::string>, std::vector<float> > a_infos = a.infos();
82 std::pair<std::vector<std::string>, std::vector<float> > b_infos = b.infos();
83 if ( a_infos.first.size() != b_infos.first.size())
84 return false;
85 if ( ! (a_infos.first == b_infos.first))
86 return false;
87
88 if ( ! (a_infos.second == b_infos.second))
89 return false;
90
91 return true;
92}

◆ str()

std::string str ( const TrigOperationalInfo & d)

Definition at line 60 of file TrigOperationalInfo.cxx.

60 {
61 std::stringstream ss;
62 std::pair<std::vector<std::string>, std::vector<float> > quantities = d.infos();
63 std::vector<std::string>::const_iterator keyIt = quantities.first.begin();
64 std::vector<float>::const_iterator valueIt = quantities.second.begin();
65 for (unsigned int i = 0; i < quantities.first.size(); i++ ) {
66 ss << " " << *keyIt << ": " << *valueIt;
67 ++keyIt;
68 ++valueIt;
69 }
70 return ss.str();
71}
static Double_t ss