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

#include <DipsCondition.h>

Inheritance diagram for DipsCondition:
Collaboration diagram for DipsCondition:

Public Member Functions

 DipsCondition (double workingPoint, const float &cfrac, const std::string &decName_pb, const std::string &decName_pc, const std::string &decName_pu, const std::string &decName_isValid="")
 
float getDipsDecValue (const pHypoJet &ip, const std::unique_ptr< ITrigJetHypoInfoCollector > &collector, const std::string &decName) const
 
float evaluateDips (const float &dips_pb, const float &dips_pc, const float &dips_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
 
float m_cfrac
 
std::string m_decName_pb
 
std::string m_decName_pc
 
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 DipsCondition.h.

Constructor & Destructor Documentation

◆ DipsCondition()

DipsCondition::DipsCondition ( double  workingPoint,
const float &  cfrac,
const std::string &  decName_pb,
const std::string &  decName_pc,
const std::string &  decName_pu,
const std::string &  decName_isValid = "" 
)

Definition at line 15 of file DipsCondition.cxx.

20  :
21  m_workingPoint(workingPoint),
22  m_cfrac(cfrac),
23  m_decName_pb(decName_pb),
24  m_decName_pc(decName_pc),
25  m_decName_pu(decName_pu),
26  m_decName_isValid(decName_isValid)
27 {
28 
29 }

Member Function Documentation

◆ capacity()

virtual unsigned int DipsCondition::capacity ( ) const
inlineoverridevirtual

Implements ICondition.

Definition at line 46 of file DipsCondition.h.

46 { return s_capacity; }

◆ evaluateDips()

float DipsCondition::evaluateDips ( const float &  dips_pb,
const float &  dips_pc,
const float &  dips_pu 
) const

Definition at line 57 of file DipsCondition.cxx.

59  {
60  return safeLogRatio(dips_pb, (m_cfrac * dips_pc + (1 - m_cfrac) * dips_pu));
61 }

◆ getDipsDecValue()

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

Definition at line 31 of file DipsCondition.cxx.

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

◆ isSatisfied() [1/2]

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

Implements ICondition.

Definition at line 107 of file DipsCondition.cxx.

108  {
109  auto result = isSatisfied(ips[0], c);
110  return result;
111 }

◆ isSatisfied() [2/2]

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

Definition at line 63 of file DipsCondition.cxx.

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

◆ toString()

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

Implements ICondition.

Definition at line 114 of file DipsCondition.cxx.

114  {
115  std::stringstream ss;
116  ss << "DipsCondition (" << this << ") "
117  << " Cleaning decs: "
118  << m_decName_pb << ", "
119  << m_decName_pu << ", "
120  << m_decName_pc << ", "
121  <<'\n';
122 
123  return ss.str();
124 }

Member Data Documentation

◆ m_cfrac

float DipsCondition::m_cfrac
private

Definition at line 52 of file DipsCondition.h.

◆ m_decName_isValid

std::string DipsCondition::m_decName_isValid
private

Definition at line 56 of file DipsCondition.h.

◆ m_decName_pb

std::string DipsCondition::m_decName_pb
private

Definition at line 53 of file DipsCondition.h.

◆ m_decName_pc

std::string DipsCondition::m_decName_pc
private

Definition at line 54 of file DipsCondition.h.

◆ m_decName_pu

std::string DipsCondition::m_decName_pu
private

Definition at line 55 of file DipsCondition.h.

◆ m_workingPoint

double DipsCondition::m_workingPoint
private

Definition at line 51 of file DipsCondition.h.

◆ s_capacity

const unsigned int DipsCondition::s_capacity {1}
staticprivate

Definition at line 61 of file DipsCondition.h.


The documentation for this class was generated from the following files:
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
DipsCondition::getDipsDecValue
float getDipsDecValue(const pHypoJet &ip, const std::unique_ptr< ITrigJetHypoInfoCollector > &collector, const std::string &decName) const
Definition: DipsCondition.cxx:31
DipsCondition::m_decName_pu
std::string m_decName_pu
Definition: DipsCondition.h:55
ITrigJetHypoInfoCollector::collect
virtual void collect(const std::string &, const std::string &)=0
DipsCondition::m_cfrac
float m_cfrac
Definition: DipsCondition.h:52
DipsCondition::m_decName_isValid
std::string m_decName_isValid
Definition: DipsCondition.h:56
calibdata.valid
list valid
Definition: calibdata.py:45
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
DipsCondition::m_decName_pb
std::string m_decName_pb
Definition: DipsCondition.h:53
DipsCondition::s_capacity
static const unsigned int s_capacity
Definition: DipsCondition.h:61
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
DipsCondition::isSatisfied
bool isSatisfied(const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
Definition: DipsCondition.cxx:107
HypoJet::xAODJetAsIJet
Definition: xAODJetAsIJet.h:16
DipsCondition::evaluateDips
float evaluateDips(const float &dips_pb, const float &dips_pc, const float &dips_pu) const
Definition: DipsCondition.cxx:57
DipsCondition::m_workingPoint
double m_workingPoint
Definition: DipsCondition.h:51
python.compressB64.c
def c
Definition: compressB64.py:93
DipsCondition::m_decName_pc
std::string m_decName_pc
Definition: DipsCondition.h:54