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

Go to the source code of this file.

Functions

std::string str (const CombinedMuonFeature &d)
 Helper function for printing the object.
MsgStream & operator<< (MsgStream &m, const CombinedMuonFeature &d)
 Helper operator for printing the object.
bool operator== (const CombinedMuonFeature &a, const CombinedMuonFeature &b)
 Operator comparing two CombinedMuonFeature objects for equality.
void diff (const CombinedMuonFeature &a, const CombinedMuonFeature &b, std::map< std::string, double > &variableChange)
 Function compares two objects and returns "semi verbose" output in the form of map where there are varaible names and relative differences between two obejcts.

Variables

static const double DELTA = 0.001

Function Documentation

◆ diff()

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

Function compares two objects and returns "semi verbose" output in the form of map where there are varaible names and relative differences between two obejcts.

Comparison with feedback.

Parameters
variableChangeMap to record the differences In case of collections (or objects when the size may be different) that information can also be returned in varaibleChange

Definition at line 212 of file CombinedMuonFeature.cxx.

213 {
214
215 if( std::abs( a.pt() - b.pt() ) > DELTA ) {
216 variableChange[ "Pt" ] = a.pt() - b.pt();
217 }
218 if( std::abs( a.charge() - b.charge() ) > DELTA ) {
219 variableChange[ "Charge" ] = a.charge() - b.charge();
220 }
221 if( std::abs( a.sigma_pt() - b.sigma_pt() ) > DELTA ) {
222 variableChange[ "sigmaPt" ] = a.sigma_pt() - b.sigma_pt();
223 }
224 if( std::abs( a.getFlag() - b.getFlag() ) > DELTA ) {
225 variableChange[ "flag" ] = a.getFlag() - b.getFlag();
226 }
227 if( std::abs( a.eta() - b.eta() ) > DELTA ) {
228 variableChange[ "Eta" ] = a.eta() - b.eta();
229 }
230 if( std::abs( a.phi() - b.phi() ) > DELTA ) {
231 variableChange[ "Phi" ] = a.phi() - b.phi();
232 }
233
234 return;
235}
static const double DELTA
static Double_t a

◆ operator<<()

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

Helper operator for printing the object.

Definition at line 186 of file CombinedMuonFeature.cxx.

186 {
187
188 return ( m << str( d ) );
189}

◆ operator==()

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

Operator comparing two CombinedMuonFeature objects for equality.

Definition at line 191 of file CombinedMuonFeature.cxx.

191 {
192
193 if( std::abs( a.pt() - b.pt() ) > DELTA ) return false;
194 if( std::abs( a.charge() - b.charge() ) > DELTA ) return false;
195 if( std::abs( a.sigma_pt() - b.sigma_pt() ) > DELTA ) return false;
196 if( std::abs( a.getFlag() - b.getFlag() ) > DELTA ) return false;
197 if( std::abs( a.eta() - b.eta() ) > DELTA ) return false;
198 if( std::abs( a.phi() - b.phi() ) > DELTA ) return false;
199
200 return true;
201}

◆ str()

std::string str ( const CombinedMuonFeature & d)

Helper function for printing the object.

Definition at line 174 of file CombinedMuonFeature.cxx.

174 {
175 std::stringstream ss;
176 ss << "Pt: " << d.pt()
177 << "; sigmaPt: " << d.sigma_pt()
178 << "; charge: " << d.charge()
179 << "; flag: " << d.getFlag()
180 << "; Eta: " << d.eta()
181 << "; Phi: " << d.phi();
182
183 return ss.str();
184}
static Double_t ss

Variable Documentation

◆ DELTA

const double DELTA = 0.001
static

Definition at line 19 of file CombinedMuonFeature.cxx.