ATLAS Offline Software
TauPID.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
14 
15 //TauEvent includes
16 #include "tauEvent/TauPID.h"
17 #include "tauEvent/TauCmp.h"
18 //C/C++ includes
19 #include <vector>
20 
21 namespace Analysis {
22  //Comparison predicate for doubles
23  inline bool cmp(double a, double b) {
24  static const double epsilon=1.0e-6;
25  return (std::fabs(a-b)<epsilon);
26  }
27 
28  TauPID::TauPID (std::vector<std::pair<TauJetParameters::TauID, double> >&& params,
29  const std::bitset<32>& isTauFlags,
30  const std::bitset<32>& vetoFlags)
31  : m_params( std::move (params) ),
32  m_isTauFlags( isTauFlags ),
33  m_vetoFlags( vetoFlags )
34  {
35 
36  }
37 
38  TauPID::TauPID(const TauPID& rhs) :
39  m_params( rhs.m_params ),
40  m_isTauFlags( rhs.m_isTauFlags ),
41  m_vetoFlags( rhs.m_vetoFlags )
42  {
43 
44  }
45 
47  {
48  if(this != &rhs)
49  {
50  m_params=rhs.m_params;
53  }
54  return *this;
55  }
56 
58  {
59  if(this != &rhs)
60  {
61  m_params=std::move(rhs.m_params);
62  m_isTauFlags=std::move(rhs.m_isTauFlags);
63  m_vetoFlags=std::move(rhs.m_vetoFlags);
64  }
65  return *this;
66  }
67 
68  bool TauPID::operator==( const TauPID& rhs ) const
69  {
70  //Loop over both params and make sure every entry is equal
71  if ( !TauCmp::vcmp(m_params,rhs.m_params) ) return false;
72  // std::vector<std::pair<TauJetParameters::TauID,
73  // double> >::const_iterator iparam, iparamrhs;
74  // for (iparam = m_params.begin(), iparamrhs=rhs.m_params.begin();
75  // (iparam!=m_params.end()) && (iparamrhs!=rhs.m_params.end());
76  // ++iparam,++iparamrhs)
77  // if (cmp((*iparam).second,(*iparamrhs).second))
78  // return false;
79  if ( m_isTauFlags != rhs.m_isTauFlags )
80  return false;
81  if ( m_vetoFlags != rhs.m_vetoFlags )
82  return false;
83  return true;
84  }
85 
86  const std::vector<std::pair<TauJetParameters::TauID, double> >& TauPID::params() const
87  {
88  return m_params;
89  }
90  const std::bitset<32>& TauPID::isTauFlags() const
91  {
92  return m_isTauFlags;
93  }
94  const std::bitset<32>& TauPID::vetoFlags() const
95  {
96  return m_vetoFlags;
97  }
98 }
Analysis::TauPID
Class containing discriminants produced by identification algorithms.
Definition: TauPID.h:32
Analysis::TauPID::operator==
bool operator==(const TauPID &rhs) const
Equality operator.
Definition: TauPID.cxx:68
TauCmp.h
Analysis::TauPID::m_vetoFlags
std::bitset< 32 > m_vetoFlags
Definition: TauPID.h:112
Analysis::TauPID::TauPID
TauPID()
Constructor.
Analysis::TauPID::isTauFlags
const std::bitset< 32 > & isTauFlags() const
Definition: TauPID.cxx:90
Analysis::TauPID::m_params
std::vector< std::pair< TauJetParameters::TauID, double > > m_params
Definition: TauPID.h:110
Analysis::TauPID::vetoFlags
const std::bitset< 32 > & vetoFlags() const
Definition: TauPID.cxx:94
TauPID.h
Analysis
The namespace of all packages in PhysicsAnalysis/JetTagging.
Definition: BTaggingCnvAlg.h:20
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Analysis::cmp
bool cmp(double a, double b)
Definition: TauPID.cxx:23
Analysis::TauCmp::vcmp
bool vcmp(const std::vector< T > &a, const std::vector< T > &b)
Compare vectors using cmp predicate.
Definition: TauCmp.h:36
a
TList * a
Definition: liststreamerinfos.cxx:10
Analysis::TauPID::operator=
TauPID & operator=(const TauPID &rhs)
assignment operator
Definition: TauPID.cxx:46
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
Analysis::TauPID::m_isTauFlags
std::bitset< 32 > m_isTauFlags
Definition: TauPID.h:111
Analysis::TauPID::params
const std::vector< std::pair< TauJetParameters::TauID, double > > & params() const
Definition: TauPID.cxx:86