Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
NNJVTCondition.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./NNJVTCondition.h"
7 #include <sstream>
8 #include <stdexcept>
9 #include <memory>
10 
11 NNJVTCondition::NNJVTCondition(const std::string& nnjvt_name) :
12  m_nnjvt_name(nnjvt_name)
13 {
14  m_nnjvt_acc = std::make_unique<SG::ConstAccessor<float> >(m_nnjvt_name);
15  m_nnjvtpass_acc = std::make_unique<SG::ConstAccessor<char> >(m_nnjvt_name+"Pass");
16 }
17 
18 bool NNJVTCondition::isSatisfied(const HypoJetVector& ips, const std::unique_ptr<ITrigJetHypoInfoCollector>& collector) const{
19 
20  if(ips.size() != 1){
21  std::stringstream ss;
22  ss << "NNJVTCondition::isSatisfied must see exactly 1 particle, but received "
23  << ips.size()
24  << '\n';
25  throw std::runtime_error(ss.str());
26  }
27 
28  auto jet = ips[0];
29  auto xJet = *jet->xAODJet();
30 
31  // Rely on the pass decorations to assess the NNJVT decision
32  bool pass = (*m_nnjvtpass_acc)(*xJet);
33  float nnjvt = (*m_nnjvt_acc)(*xJet);
34 
35  if(collector){
36  std::stringstream ss0;
37  const void* address = static_cast<const void*>(this);
38  ss0 << "NNJVTCondition: (" << address
39  << ") nnjvt " << nnjvt
40  << " pt " << jet->pt()
41  << " eta " << jet->eta()
42  << " pass: " <<std::boolalpha << pass << " jet group: \n";
43 
44  std::stringstream ss1;
45 
46  for(const auto& ip : ips){
47  address = static_cast<const void*>(ip.get());
48  ss1 << " " << address << " " << ip->eta() << " pt " << ip->pt() << '\n';
49  }
50  ss1 << '\n';
51  collector -> collect(ss0.str(), ss1.str());
52  }
53  return pass;
54 
55 }
56 
57 std::string NNJVTCondition::toString() const {
58 
59  std::stringstream ss;
60  const void* address = static_cast<const void*>(this);
61  ss << "NNJVTCondition: (" << address << ") Capacity: " << s_capacity
62  << " decoration name: " << m_nnjvt_name << '\n';
63 
64  return ss.str();
65 }
NNJVTCondition::s_capacity
static const unsigned int s_capacity
Definition: NNJVTCondition.h:41
NNJVTCondition::m_nnjvtpass_acc
std::unique_ptr< SG::ConstAccessor< char > > m_nnjvtpass_acc
Definition: NNJVTCondition.h:39
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
NNJVTCondition::m_nnjvt_acc
std::unique_ptr< SG::ConstAccessor< float > > m_nnjvt_acc
Definition: NNJVTCondition.h:38
NNJVTCondition.h
NNJVTCondition::toString
std::string toString() const override
Definition: NNJVTCondition.cxx:57
NNJVTCondition::m_nnjvt_name
std::string m_nnjvt_name
Definition: NNJVTCondition.h:36
NNJVTCondition::isSatisfied
bool isSatisfied(const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
Definition: NNJVTCondition.cxx:18
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
NNJVTCondition::NNJVTCondition
NNJVTCondition(const std::string &nnjvt_name)
Definition: NNJVTCondition.cxx:11
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition: HypoJetDefs.h:27
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
ITrigJetHypoInfoCollector.h
Trig::FeatureAccessImpl::collect
void collect(const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, const std::string &label, unsigned int condition, const std::string &teName, const HLT::TrigNavStructure *navstructure)
actual feature acceess implementation It has (thanks to the ClassTraits) functionality to flatten con...
Definition: FeatureCollectAthena.h:299