ATLAS Offline Software
TrigADComboHypoTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGADCOMBOHYPO_TRIGADCOMBOHYPOTOOL_H
6 #define TRIGADCOMBOHYPO_TRIGADCOMBOHYPOTOOL_H
7 
11 
12 #include "xAODJet/Jet.h"
13 #include "xAODMuon/Muon.h"
14 #include "xAODEgamma/Electron.h"
15 #include "xAODEgamma/Photon.h"
16 #include "xAODTau/TauJet.h"
19 
21 
22 #include <iostream>
23 #include <cmath>
24 #include <numbers>
25 
27 
28 public:
29  TrigADComboHypoTool(const std::string& type, const std::string& name, const IInterface* parent);
30  virtual StatusCode initialize() override;
31  //need to see all jets at once not a series of combinations
32  virtual StatusCode decide(Combo::LegDecisionsMap& passingLegs, const EventContext& context) const override;
33 
34 private:
35  Gaudi::Property<unsigned int> m_maxjs{this, "max_jets",{6}, "Maximum number of jets allowed in the event"};
36  Gaudi::Property<unsigned int> m_maxes{this, "max_electrons",{3}, "Maximum number of electrons allowed in the event"};
37  Gaudi::Property<unsigned int> m_maxms{this, "max_muons",{3}, "Maximum number of muons allowed in the event"};
38  Gaudi::Property<unsigned int> m_maxgs{this, "max_photons",{3}, "Maximum number of photons allowed in the event"};
39 
40  Gaudi::Property<double> m_adScoreThres{this, "adScoreThres", {0.}, "HLT AD score threshold"};
41 
42  SG::WriteHandleKey<xAOD::TrigCompositeContainer> m_adScoreKey{this, "adScoreKey", "Undefined", ""};
43  ToolHandle<GenericMonitoringTool> m_monTool{this, "monTool", "", "Monitoring tool"};
44  Gaudi::Property<bool> m_monFlag{this, "monFlag", false, "Monitoring flag"};
45 
46  float getAdScore(
47  const std::vector<const xAOD::Jet*> &input_jets,
48  const std::vector<const xAOD::Muon*> &input_muons,
49  const std::vector<const xAOD::Electron*> &input_electrons,
50  const std::vector<const xAOD::Photon*> &input_photons,
51  const std::vector<const xAOD::TauJet*> &input_taus,
52  const std::vector<const xAOD::TrigMissingET*> &input_mets) const;
53 
54  float runInference(std::vector<float> &tensor) const;
55 
56  ServiceHandle<AthOnnx::IOnnxRuntimeSvc> m_svc{this, "ONNXRuntimeSvc", "AthOnnx::OnnxRuntimeSvc", "TrigADComboHypoTool ONNXRuntimeSvc"};
57 
58  std::unique_ptr<Ort::Session> m_session;
59 
60  std::vector<const char *> m_input_node_names;
61 
62  std::vector<const char *> m_output_node_names;
63 
64  std::vector<int64_t> m_input_node_dims;
65 
66  // This path needs to point to the ATLAS calibration area (https://atlas-groupdata.web.cern.ch/atlas-groupdata/, /cvmfs/atlas.cern.ch/repo/sw/database/GroupData/)
67  Gaudi::Property<std::string> m_modelFileName{this, "ModelFileName", "TrigAnomalyDetectionHypo/2025-03-10/HLT_AD_v1.onnx"}; // main area v1 (2025.03.10)
68 
69 };
70 
71 #endif
TrigADComboHypoTool::m_maxes
Gaudi::Property< unsigned int > m_maxes
Definition: TrigADComboHypoTool.h:36
TrigADComboHypoTool::m_maxjs
Gaudi::Property< unsigned int > m_maxjs
Definition: TrigADComboHypoTool.h:35
TrigMissingET.h
Jet.h
Muon.h
TrigADComboHypoTool::getAdScore
float getAdScore(const std::vector< const xAOD::Jet * > &input_jets, const std::vector< const xAOD::Muon * > &input_muons, const std::vector< const xAOD::Electron * > &input_electrons, const std::vector< const xAOD::Photon * > &input_photons, const std::vector< const xAOD::TauJet * > &input_taus, const std::vector< const xAOD::TrigMissingET * > &input_mets) const
Definition: TrigADComboHypoTool.cxx:265
TrigADComboHypoTool
Definition: TrigADComboHypoTool.h:26
TrigADComboHypoTool::m_input_node_names
std::vector< const char * > m_input_node_names
Definition: TrigADComboHypoTool.h:60
TrigADComboHypoTool::m_session
std::unique_ptr< Ort::Session > m_session
Definition: TrigADComboHypoTool.h:58
ComboHypoToolBase
Base class for tools which cut on properties of multi-object or multi-leg chains. User should derive ...
Definition: ComboHypoToolBase.h:26
Combo::LegDecisionsMap
std::map< TrigCompositeUtils::DecisionID, std::vector< ElementLink< TrigCompositeUtils::DecisionContainer > > > LegDecisionsMap
LegDecisionsMap For a given chain leg key, this map holds all Decision Objects which are active on th...
Definition: IComboHypoTool.h:28
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
TrigADComboHypoTool::m_maxgs
Gaudi::Property< unsigned int > m_maxgs
Definition: TrigADComboHypoTool.h:38
TrigCompositeUtils.h
TrigADComboHypoTool::decide
virtual StatusCode decide(Combo::LegDecisionsMap &passingLegs, const EventContext &context) const override
retrieves the decisions associated to this decId, make their combinations and apply the algorithm
Definition: TrigADComboHypoTool.cxx:104
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
TrigADComboHypoTool::TrigADComboHypoTool
TrigADComboHypoTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: TrigADComboHypoTool.cxx:24
TrigADComboHypoTool::m_monFlag
Gaudi::Property< bool > m_monFlag
Definition: TrigADComboHypoTool.h:44
Photon.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigADComboHypoTool::m_svc
ServiceHandle< AthOnnx::IOnnxRuntimeSvc > m_svc
Definition: TrigADComboHypoTool.h:56
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TrigADComboHypoTool::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigADComboHypoTool.h:43
Monitored.h
Header file to be included by clients of the Monitored infrastructure.
TrigCompositeContainer.h
ComboHypoToolBase.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TrigADComboHypoTool::m_maxms
Gaudi::Property< unsigned int > m_maxms
Definition: TrigADComboHypoTool.h:37
TrigADComboHypoTool::initialize
virtual StatusCode initialize() override
Definition: TrigADComboHypoTool.cxx:26
IOnnxRuntimeSvc.h
TrigADComboHypoTool::runInference
float runInference(std::vector< float > &tensor) const
Definition: TrigADComboHypoTool.cxx:372
TrigADComboHypoTool::m_input_node_dims
std::vector< int64_t > m_input_node_dims
Definition: TrigADComboHypoTool.h:64
TauJet.h
TrigADComboHypoTool::m_adScoreKey
SG::WriteHandleKey< xAOD::TrigCompositeContainer > m_adScoreKey
Definition: TrigADComboHypoTool.h:42
TrigADComboHypoTool::m_output_node_names
std::vector< const char * > m_output_node_names
Definition: TrigADComboHypoTool.h:62
Electron.h
TrigADComboHypoTool::m_adScoreThres
Gaudi::Property< double > m_adScoreThres
Definition: TrigADComboHypoTool.h:40
TrigADComboHypoTool::m_modelFileName
Gaudi::Property< std::string > m_modelFileName
Definition: TrigADComboHypoTool.h:67
ServiceHandle< AthOnnx::IOnnxRuntimeSvc >