ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
GNTauCondition Class Reference

#include <GNTauCondition.h>

Inheritance diagram for GNTauCondition:
Collaboration diagram for GNTauCondition:

Public Member Functions

 GNTauCondition (double workingPoint, const std::string &decName_ptau, const std::string &decName_pu, const std::string &decName_isValid="")
 
float getGNTauDecValue (const pHypoJet &ip, const std::unique_ptr< ITrigJetHypoInfoCollector > &collector, const std::string &decName) const
 
float evaluateGNTau (const float &gntau_ptau, const float &gntau_pu) const
 
bool isSatisfied (const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
 
virtual unsigned int capacity () const override
 
std::string toString () const override
 

Private Member Functions

bool isSatisfied (const pHypoJet &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const
 

Private Attributes

double m_workingPoint
 
std::string m_decName_ptau
 
std::string m_decName_pu
 
std::string m_decName_isValid
 

Static Private Attributes

static const unsigned int s_capacity {1}
 

Detailed Description

Definition at line 26 of file GNTauCondition.h.

Constructor & Destructor Documentation

◆ GNTauCondition()

GNTauCondition::GNTauCondition ( double  workingPoint,
const std::string &  decName_ptau,
const std::string &  decName_pu,
const std::string &  decName_isValid = "" 
)

Definition at line 15 of file GNTauCondition.cxx.

18  :
19  m_workingPoint(workingPoint),
20  m_decName_ptau(decName_ptau),
21  m_decName_pu(decName_pu),
22  m_decName_isValid(decName_isValid)
23 {
24 
25 }

Member Function Documentation

◆ capacity()

virtual unsigned int GNTauCondition::capacity ( ) const
inlineoverridevirtual

Implements ICondition.

Definition at line 43 of file GNTauCondition.h.

43 { return s_capacity; }

◆ evaluateGNTau()

float GNTauCondition::evaluateGNTau ( const float &  gntau_ptau,
const float &  gntau_pu 
) const

Definition at line 53 of file GNTauCondition.cxx.

54  {
55  return safeLogRatio(gntau_ptau, gntau_pu);
56 }

◆ getGNTauDecValue()

float GNTauCondition::getGNTauDecValue ( const pHypoJet ip,
const std::unique_ptr< ITrigJetHypoInfoCollector > &  collector,
const std::string &  decName 
) const

Definition at line 27 of file GNTauCondition.cxx.

30 {
31 
32  float momentValue = -1;
33  if (!(ip->getAttribute(decName, momentValue)))
34  {
35  if (collector)
36  {
37  auto j_addr = static_cast<const void *>(ip.get());
38 
39  std::stringstream ss0;
40  ss0 << "GNTauCondition: "
41  << " unable to retrieve " << decName << '\n';
42  std::stringstream ss1;
43  ss1 << " jet : (" << j_addr << ")";
44  collector->collect(ss0.str(), ss1.str());
45  }
46 
47  throw std::runtime_error("Impossible to retrieve decorator \'" + decName + "\' for jet hypo");
48  }
49 
50  return momentValue;
51 }

◆ isSatisfied() [1/2]

bool GNTauCondition::isSatisfied ( const HypoJetVector ips,
const std::unique_ptr< ITrigJetHypoInfoCollector > &  c 
) const
overridevirtual

Implements ICondition.

Definition at line 100 of file GNTauCondition.cxx.

101  {
102  auto result = isSatisfied(ips[0], c);
103  return result;
104 }

◆ isSatisfied() [2/2]

bool GNTauCondition::isSatisfied ( const pHypoJet ip,
const std::unique_ptr< ITrigJetHypoInfoCollector > &  collector 
) const
private

Definition at line 58 of file GNTauCondition.cxx.

60 {
61  if (!m_decName_isValid.empty()) {
62  // short circuit if gntau is invalid and we ask for a check
63  //
64  // we have to dynamic cast to xAOD jets here because there's no char
65  // accessor on IJet and it's not clear if we need one generally.
66  const auto* jet = dynamic_cast<const HypoJet::xAODJetAsIJet*>(ip.get());
67  if (!jet) throw std::runtime_error("Fast gntau has to run on xAOD::Jet");
68  char valid = (*jet->xAODJet())->getAttribute<char>(m_decName_isValid);
69  if (valid == 0) return false;
70  }
71 
72  // if we got this far check the gntau hypo
73  float gntau_ptau = getGNTauDecValue(ip, collector, m_decName_ptau);
74  float gntau_pu = getGNTauDecValue(ip, collector, m_decName_pu);
75  float gntau_output = evaluateGNTau(gntau_ptau, gntau_pu);
76 
77  bool pass = (gntau_output >= m_workingPoint);
78 
79  if (collector)
80  {
81  const void *address = static_cast<const void *>(this);
82 
83  std::stringstream ss0;
84  ss0 << "GNTauCondition: (" << address
85  << ")"
86  << " pass: " << std::boolalpha << pass << '\n';
87 
88  auto j_addr = static_cast<const void *>(ip.get());
89  std::stringstream ss1;
90  ss1 << " jet : (" << j_addr << ") "
91  << m_decName_ptau << " value: " << gntau_ptau << '\n';
92 
93  collector->collect(ss0.str(), ss1.str());
94  }
95 
96  return pass;
97 }

◆ toString()

std::string GNTauCondition::toString ( ) const
overridevirtual

Implements ICondition.

Definition at line 107 of file GNTauCondition.cxx.

107  {
108  std::stringstream ss;
109  ss << "GNTauCondition (" << this << ") "
110  << " Cleaning decs: "
111  << m_decName_ptau << ", "
112  << m_decName_pu << ", "
113  <<'\n';
114 
115  return ss.str();
116 }

Member Data Documentation

◆ m_decName_isValid

std::string GNTauCondition::m_decName_isValid
private

Definition at line 51 of file GNTauCondition.h.

◆ m_decName_ptau

std::string GNTauCondition::m_decName_ptau
private

Definition at line 49 of file GNTauCondition.h.

◆ m_decName_pu

std::string GNTauCondition::m_decName_pu
private

Definition at line 50 of file GNTauCondition.h.

◆ m_workingPoint

double GNTauCondition::m_workingPoint
private

Definition at line 48 of file GNTauCondition.h.

◆ s_capacity

const unsigned int GNTauCondition::s_capacity {1}
staticprivate

Definition at line 56 of file GNTauCondition.h.


The documentation for this class was generated from the following files:
GNTauCondition::m_decName_pu
std::string m_decName_pu
Definition: GNTauCondition.h:50
get_generator_info.result
result
Definition: get_generator_info.py:21
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
safeLogRatio
float safeLogRatio(float num, float denom)
Definition: safeLogRatio.cxx:9
GNTauCondition::m_decName_isValid
std::string m_decName_isValid
Definition: GNTauCondition.h:51
ITrigJetHypoInfoCollector::collect
virtual void collect(const std::string &, const std::string &)=0
GNTauCondition::s_capacity
static const unsigned int s_capacity
Definition: GNTauCondition.h:56
calibdata.valid
list valid
Definition: calibdata.py:45
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
GNTauCondition::getGNTauDecValue
float getGNTauDecValue(const pHypoJet &ip, const std::unique_ptr< ITrigJetHypoInfoCollector > &collector, const std::string &decName) const
Definition: GNTauCondition.cxx:27
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
GNTauCondition::m_decName_ptau
std::string m_decName_ptau
Definition: GNTauCondition.h:49
GNTauCondition::isSatisfied
bool isSatisfied(const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
Definition: GNTauCondition.cxx:100
GNTauCondition::m_workingPoint
double m_workingPoint
Definition: GNTauCondition.h:48
HypoJet::xAODJetAsIJet
Definition: xAODJetAsIJet.h:16
python.compressB64.c
def c
Definition: compressB64.py:93
GNTauCondition::evaluateGNTau
float evaluateGNTau(const float &gntau_ptau, const float &gntau_pu) const
Definition: GNTauCondition.cxx:53