ATLAS Offline Software
Loading...
Searching...
No Matches
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
11NNJVTCondition::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
18bool 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
57std::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}
std::vector< pHypoJet > HypoJetVector
Definition HypoJetDefs.h:27
static Double_t ss
std::string m_nnjvt_name
std::string toString() const override
std::unique_ptr< SG::ConstAccessor< float > > m_nnjvt_acc
NNJVTCondition(const std::string &nnjvt_name)
std::unique_ptr< SG::ConstAccessor< char > > m_nnjvtpass_acc
bool isSatisfied(const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
static const unsigned int s_capacity