ATLAS Offline Software
Loading...
Searching...
No Matches
CoWRecordStats.h
Go to the documentation of this file.
1// --*- c++ -*--
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef COWTOOLS_RECORDSTATS
8#define COWTOOLS_RECORDSTATS
9#include <map>
10#include <iostream>
11
12namespace CoWTools{
14 public:
15 CoWRecordStats(bool summary=true):m_summary(summary){};
33
34
36 for(int i=0;i<11;i++){
37 m_vals[i]+=rhs.m_vals[i];
38 }
39 m_vals[13]+=rhs.m_vals[13];
40 //needed only for very detailed
41 //m_vals[14]|=rhs.m_vals[14];
42 return *this;
43 }
44
46 for(int i=0;i<11;i++){
47 m_vals[i]-=rhs.m_vals[i];
48 }
49 m_vals[13]-=rhs.m_vals[13];
50 //needed only for very detailed
51 //m_vals[14]|=rhs.m_vals[14];
52 return *this;
53 }
54
57 for(int i=0;i<11;i++){
58 m.m_vals[i]=-m_vals[i];
59 }
60 m.m_vals[11]=m_vals[11];
61 m.m_vals[12]=m_vals[12];
62 m.m_vals[13]=-m_vals[13];
63 m.m_vals[14]=m_vals[14];
64 //needed only for very detailed
65 //m_vals[14]|=rhs.m_vals[14];
66 return m;
67 }
68 friend CoWRecordStats operator+(const CoWRecordStats& lhs, const CoWRecordStats& rhs){
69 return CoWRecordStats(lhs) += rhs;
70 }
71 friend CoWRecordStats operator-(const CoWRecordStats& lhs, const CoWRecordStats& rhs){
72 return CoWRecordStats(lhs) -= rhs;
73 }
74 explicit operator bool() const {
75 for(int i=0;i<11;i++){
76 if(m_vals[i])return true;
77 }
78 return false;
79 }
80 friend bool operator<(const CoWRecordStats& a,const CoWRecordStats &b){
81 if((a.m_vals[5]+a.m_vals[6])<(b.m_vals[5]+b.m_vals[6])){
82 return true;
83 }else if((a.m_vals[5]+a.m_vals[6])==(b.m_vals[5]+b.m_vals[6])){
84 if((a.m_vals[3]+a.m_vals[4])<(b.m_vals[3]+b.m_vals[4])){
85 return true;
86 }else if((a.m_vals[3]+a.m_vals[4])==(b.m_vals[3]+b.m_vals[4])){
87 return (a.m_vals[1]<b.m_vals[1]);
88 }
89 return false;
90 }
91 return false;
92 }
93 void parseRecord(std::istream &in);
94 long long * getValueArray(){return m_vals;}
95 const long long * getValueArray() const {return m_vals;}
96 private:
97 long long m_vals[20]={0,0,0,0,0,
98 0,0,0,0,0,
99 0,0,0,0,0,
100 0,0,0,0,0};
101
103 static const std::map<std::string,int> s_vmFlags;
104 friend std::ostream & operator<<(std::ostream &, const CoWTools::CoWRecordStats &m);
105 };
106
107}//end namespace
108
109#endif
110
static Double_t a
friend std::ostream & operator<<(std::ostream &, const CoWTools::CoWRecordStats &m)
CoWRecordStats operator-() const
CoWRecordStats & operator+=(const CoWRecordStats &rhs)
static const std::map< std::string, int > s_vmFlags
friend CoWRecordStats operator+(const CoWRecordStats &lhs, const CoWRecordStats &rhs)
friend bool operator<(const CoWRecordStats &a, const CoWRecordStats &b)
const long long * getValueArray() const
void parseRecord(std::istream &in)
CoWRecordStats & operator-=(const CoWRecordStats &rhs)
CoWRecordStats(bool summary=true)
friend CoWRecordStats operator-(const CoWRecordStats &lhs, const CoWRecordStats &rhs)