ATLAS Offline Software
Loading...
Searching...
No Matches
TrigTauInfo.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGTAUMONITORING_TRIGTAUINFO_H
6#define TRIGTAUMONITORING_TRIGTAUINFO_H
7
8#include <string>
9#include <vector>
10#include <map>
11#include <algorithm> //for std::find_if
12#include <cctype> //for std::isdigit
13#include <cstdint> // int64_t
14
16public:
17 TrigTauInfo() {} // Required for the dictionary
18 TrigTauInfo(const std::string& trigger);
19 TrigTauInfo(const std::string& trigger, const std::map<std::string, float>& L1Phase1_thresholds);
20 TrigTauInfo(const std::string& trigger, const std::map<std::string, float>& L1Phase1_thresholds, const std::map<std::string, uint64_t>& L1Phase1_threshold_patterns);
21 TrigTauInfo(const std::string& trigger, const std::map<int, int>& L1Phase1ThrMap_eTAU, const std::map<int, int>& L1Phase1ThrMap_jTAU);
22
23 inline const std::string& getTriggerName() const { return m_trigger; }
24 inline bool isStreamer() const { return m_isStreamer; }
25
26 inline float getHLTTauThreshold() const { return !m_HLTThr.empty() ? m_HLTThr[0] : -1; } // Returns the main HLT threshold
27 inline const std::vector<float>& getHLTTauThresholds() const { return m_HLTThr; }
28 inline const std::string getHLTTauType() const { return !m_HLTTauTypes.empty() ? m_HLTTauTypes[0] : ""; } // Returns the main HLT tau leg type
29 inline const std::vector<std::string>& getHLTTauTypes() const { return m_HLTTauTypes; }
30 inline const std::string getHLTTauID() const { return !m_HLTTauIDs.empty() ? m_HLTTauIDs[0] : ""; } // Returns the main HLT tau leg ID algorithm
31 inline const std::vector<std::string>& getHLTTauIDs() const { return m_HLTTauIDs; }
32 inline const std::string getHLTTauCaloHitsPreselectionID() const { return !m_HLTTauCHPreselIDs.empty() ? m_HLTTauCHPreselIDs[0] : ""; } // Returns the main HLT tau leg Calo+Hits preselection ID algorithm
33 inline const std::vector<std::string>& getHLTTauCaloHitsPreselectionIDs() const { return m_HLTTauCHPreselIDs; }
34
35 inline const std::string getHLTTauHitZSelection() const { return !m_HLTTauHitZSelections.empty() ? m_HLTTauHitZSelections[0] : ""; } // Returns the main HLT HitZ selection
36 inline const std::vector<std::string>& getHLTTauHitZSelections() const { return m_HLTTauHitZSelections; }
37 inline const std::string getHLTTauHitZAlg() const { return !m_HLTTauHitZAlgs.empty() ? m_HLTTauHitZAlgs[0] : ""; } // Returns the main HLT HitZ algorithm
38 inline const std::vector<std::string>& getHLTTauHitZAlgs() const { return m_HLTTauHitZAlgs; }
39
41 inline const std::vector<int>& getHLTTauLegIndices() const { return m_HLTTauLegIndices; }
42
43 inline const std::string getHLTTauLegContainerSfx() const { return !m_HLTTauLegContainerSfxs.empty() ? m_HLTTauLegContainerSfxs[0] : ""; } // Returns the main HLT tau leg container suffixS
44 inline const std::vector<std::string>& getHLTTauLegContainerSfxs() const { return m_HLTTauLegContainerSfxs; }
45
46 inline const std::string& getTriggerL1Name() const { return m_L1Item; }
47 inline const std::vector<std::string>& getTriggerL1Items() const { return m_L1Items; }
48 inline const std::string getL1TauItem() const { return !m_tauL1Items.empty() ? m_tauL1Items[0] : ""; } // Returns the main L1 tau item
49 inline const std::vector<std::string>& getL1TauItems() const { return m_tauL1Items; }
50 inline float getL1TauThreshold() const { return !m_tauL1Thr.empty() ? m_tauL1Thr[0] : -1; } // Returns the main L1 item threshold
51 inline const std::vector<float>& getL1TauThresholds() const { return m_tauL1Thr; }
52 inline const std::string getL1TauType() const { return !m_tauL1Items.empty() ? m_tauL1Type[0] : ""; } // Returns the main L1 item type
53 inline const std::vector<std::string>& getL1TauTypes() const { return m_tauL1Type; }
54 inline const std::string getL1TauIsolation() const { return !m_tauL1Iso.empty() ? m_tauL1Iso[0] : ""; } // Returns the main L1 item isolation
55 inline const std::vector<std::string>& getL1TauIsolations() const { return m_tauL1Iso; }
56 inline bool isL1TauIsolated(const size_t idx = 0) const { return idx < m_tauL1Iso.size() ? !m_tauL1Iso[idx].empty() : false; } // Returns true if the (main by default) L1 item is isolated
57 inline bool areAnyL1TauIsolated() const { for(const std::string& iso : m_tauL1Iso) { if(!iso.empty()) return true; }; return false; } // Returns true any of the L1 items are isolated
58 inline int64_t getL1TauThresholdPattern() const { return !m_tauL1ThresholdPattern.empty() ? m_tauL1ThresholdPattern[0] : -1; } // Returns the main L1 item thresholdPattern mask
59 inline const std::vector<int64_t>& getL1TauThresholdPatterns() const { return m_tauL1ThresholdPattern; }
60 inline const std::vector<std::string>& getHLTBoostedDitauName() const { return m_HLTBoostedDitauName; }
61
62
63 inline bool isHLTSingleTau() const { return m_HLTThr.size() == 1 && (m_HLTElecThr.size() + m_HLTMuonThr.size() + m_HLTGammaThr.size() + m_HLTJetThr.size() + m_HLTMETThr.size()) == 0; }
64 inline bool isHLTDiTau() const { return m_HLTThr.size() > 1 && (m_HLTElecThr.size() + m_HLTMuonThr.size() + m_HLTGammaThr.size() + m_HLTJetThr.size() + m_HLTMETThr.size()) == 0; }
65 inline bool isHLTBoostedDiTau() const { return m_HLTBoostedDitauName.size() > 0 && (m_HLTThr.size() + m_HLTElecThr.size() + m_HLTMuonThr.size() + m_HLTGammaThr.size() + m_HLTMETThr.size()) == 0; }
66 inline bool isHLTTandP() const { return m_HLTThr.size() == 1 && (m_HLTElecThr.size() + m_HLTMuonThr.size()) == 1 && (m_HLTGammaThr.size() + m_HLTJetThr.size() + m_HLTMETThr.size()) == 0; }
67 inline bool isL1TauOnly() const { return (m_HLTThr.size() + m_HLTElecThr.size() + m_HLTMuonThr.size() + m_HLTGammaThr.size() + m_HLTJetThr.size() + m_HLTMETThr.size()) == 0 && !m_tauL1Items.empty(); }
68 inline bool isTauStreamer() const { return m_isStreamer && !m_tauL1Items.empty(); }
69
70 inline bool hasHLTElectronLeg() const { return !m_HLTElecThr.empty(); }
71 inline bool hasHLTMuonLeg() const { return !m_HLTMuonThr.empty(); }
72 inline bool hasHLTGammaLeg() const { return !m_HLTGammaThr.empty(); }
73 inline bool hasHLTJetLeg() const { return !m_HLTJetThr.empty(); }
74 inline bool hasHLTMETLeg() const { return !m_HLTMETThr.empty(); }
75
76 inline float getHLTElecThreshold() const { return !m_HLTElecThr.empty() ? m_HLTElecThr[0] : -1; } // Returns the main leg threshold
77 inline const std::vector<float>& getHLTElecThresholds() const { return m_HLTElecThr; }
78 inline float getHLTMuonThreshold() const { return !m_HLTMuonThr.empty() ? m_HLTMuonThr[0] : -1; } // Returns the main leg threshold
79 inline const std::vector<float>& getHLTMuonThresholds() const { return m_HLTMuonThr; }
80 inline float getHLTGammaThreshold() const { return !m_HLTGammaThr.empty() ? m_HLTGammaThr[0] : -1; } // Returns the main leg threshold
81 inline const std::vector<float>& getHLTGammaThresholds() const { return m_HLTGammaThr; }
82 inline float getHLTJetThreshold() const { return !m_HLTJetThr.empty() ? m_HLTJetThr[0] : -1; } // Returns the main leg threshold
83 inline const std::vector<float>& getHLTJetThresholds() const { return m_HLTJetThr; }
84 inline float getHLTMETThreshold() const { return !m_HLTMETThr.empty() ? m_HLTMETThr[0] : -1; } // Returns the main leg threshold
85 inline const std::vector<float>& getHLTMETThresholds() const { return m_HLTMETThr; }
86
87private:
88 std::string m_trigger; // Full trigger name (e.g. HLT_tau25_mediumRNN_tracktwoMVA_L1eTAU20)
89 bool m_isStreamer = false; // Is a streamer HLT trigger
90 std::vector<float> m_HLTThr; // List of all tau thresholds
91 std::vector<std::string> m_HLTTauTypes; // Type for each tau leg (e.g. tracktwoMVA, trackwoLLP, etc...)
92 std::vector<std::string> m_HLTTauIDs; // Tau ID algorithm for each tau leg (e.g. DeepSet, RNNLLP, GNTau, etc...)
93 std::vector<std::string> m_HLTTauHitZSelections; // HitZ selection for each tau leg (e.g. DeepSet, RNNLLP, GNTau, etc...)
94 std::vector<std::string> m_HLTTauHitZAlgs; // HitZ algorithm for each tau leg (e.g. DeepSet, RNNLLP, GNTau, etc...)
95 std::vector<std::string> m_HLTTauCHPreselIDs; // Tau Calo+Hits preselection ID for each tau leg
96 std::vector<int> m_HLTTauLegIndices; // Original leg indices of the tau legs, used for bootstrapped triggers where we only want to retrieve probe taus.
97 std::vector<std::string> m_HLTTauLegContainerSfxs; // Tau jet container suffixes for each tau leg eg. ("MVA", "LLP", "LRT", "MVA_HitZ", etc...)
98 bool m_isBootstrappedTauTrigger{}; // Whether this is a bootstrapped tau trigger (i.e. had originally both tag and probe tau legs with the same threshold, but we keep only the probe legs here)
99
100 std::string m_L1Item; // full L1 trigger string (e.g. L1eTAU20, or L1eTAU80_2eTAU60)
101 std::vector<std::string> m_L1Items; // full L1 trigger items
102 std::vector<float> m_tauL1Thr; // L1 Tau item thresholds, corrected for Phase1 items
103 std::vector<std::string> m_tauL1Items; // Individual l1 tau items
104 std::vector<std::string> m_tauL1Type; // Individual l1 tau item type (eTAU, jTAU, cTAU, TAU)
105 std::vector<std::string> m_tauL1Iso; // Individual l1 tau item isolation ("", L, M, T, HL, HM, HT, H, IM)
106 std::vector<int64_t> m_tauL1ThresholdPattern; // Individual l1 tau item thresholdPattern mask
107
108 std::vector<float> m_HLTElecThr; // List of all electron leg thresholds
109 std::vector<float> m_HLTMuonThr; // List of all muon leg thresholds
110 std::vector<float> m_HLTGammaThr; // List of all photon leg thresholds
111 std::vector<float> m_HLTJetThr; // List of all jet leg thresholds
112 std::vector<float> m_HLTMETThr; // List of all MET leg thresholds
113
114 std::vector<std::string> m_HLTBoostedDitauName;
115
116
117 inline bool is_number(const std::string& s) {
118 return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) {return !std::isdigit(c);}) == s.end();
119 }
120
121 void parseTriggerString(bool remove_L1_phase1_thresholds = true); // Parse the trigger string, without applying the Phase1 remapping (L1 thresholds will be set to -1 on Phase1 items)
122 void parseTriggerString(const std::map<std::string, float>& L1Phase1_thresholds); // Parse the trigger string, applying the Phase1 ET mapping
123 void parseTriggerString(const std::map<std::string, float>& L1Phase1_thresholds, const std::map<std::string, uint64_t>& L1Phase1_threshold_patterns); // Parse the trigger string, applying the Phase1 threshold mapping
124 void parseTriggerString(const std::map<int, int>& L1Phase1ThrMap_eTAU, const std::map<int, int>& L1Phase1ThrMap_jTAU); // Parse the trigger string, applying the Phase1 remapping
125};
126
127#endif
const std::vector< std::string > & getHLTTauHitZSelections() const
Definition TrigTauInfo.h:36
bool isBootstrappedTauTrigger() const
Definition TrigTauInfo.h:40
const std::string & getTriggerName() const
Definition TrigTauInfo.h:23
const std::vector< float > & getHLTMuonThresholds() const
Definition TrigTauInfo.h:79
const std::vector< std::string > & getHLTTauTypes() const
Definition TrigTauInfo.h:29
const std::vector< float > & getHLTJetThresholds() const
Definition TrigTauInfo.h:83
const std::string getL1TauIsolation() const
Definition TrigTauInfo.h:54
const std::vector< float > & getHLTMETThresholds() const
Definition TrigTauInfo.h:85
bool isHLTDiTau() const
Definition TrigTauInfo.h:64
float getHLTTauThreshold() const
Definition TrigTauInfo.h:26
const std::string getHLTTauHitZAlg() const
Definition TrigTauInfo.h:37
std::vector< std::string > m_tauL1Iso
bool m_isBootstrappedTauTrigger
Definition TrigTauInfo.h:98
std::vector< std::string > m_HLTTauLegContainerSfxs
Definition TrigTauInfo.h:97
bool hasHLTMETLeg() const
Definition TrigTauInfo.h:74
std::vector< float > m_HLTMuonThr
bool m_isStreamer
Definition TrigTauInfo.h:89
const std::vector< std::string > & getHLTTauHitZAlgs() const
Definition TrigTauInfo.h:38
std::vector< float > m_HLTGammaThr
float getHLTGammaThreshold() const
Definition TrigTauInfo.h:80
const std::vector< float > & getHLTElecThresholds() const
Definition TrigTauInfo.h:77
std::string m_L1Item
std::vector< std::string > m_L1Items
const std::string getHLTTauLegContainerSfx() const
Definition TrigTauInfo.h:43
bool isL1TauOnly() const
Definition TrigTauInfo.h:67
std::vector< std::string > m_HLTBoostedDitauName
std::string m_trigger
Definition TrigTauInfo.h:88
bool isHLTBoostedDiTau() const
Definition TrigTauInfo.h:65
const std::vector< std::string > & getL1TauIsolations() const
Definition TrigTauInfo.h:55
std::vector< float > m_HLTElecThr
std::vector< std::string > m_tauL1Type
float getHLTMETThreshold() const
Definition TrigTauInfo.h:84
bool isHLTTandP() const
Definition TrigTauInfo.h:66
bool isStreamer() const
Definition TrigTauInfo.h:24
std::vector< std::string > m_HLTTauHitZAlgs
Definition TrigTauInfo.h:94
const std::vector< std::string > & getHLTTauCaloHitsPreselectionIDs() const
Definition TrigTauInfo.h:33
const std::vector< float > & getL1TauThresholds() const
Definition TrigTauInfo.h:51
float getL1TauThreshold() const
Definition TrigTauInfo.h:50
bool isHLTSingleTau() const
Definition TrigTauInfo.h:63
float getHLTElecThreshold() const
Definition TrigTauInfo.h:76
std::vector< std::string > m_tauL1Items
const std::vector< std::string > & getL1TauTypes() const
Definition TrigTauInfo.h:53
std::vector< std::string > m_HLTTauTypes
Definition TrigTauInfo.h:91
std::vector< std::string > m_HLTTauHitZSelections
Definition TrigTauInfo.h:93
bool is_number(const std::string &s)
const std::string getHLTTauID() const
Definition TrigTauInfo.h:30
const std::vector< float > & getHLTGammaThresholds() const
Definition TrigTauInfo.h:81
void parseTriggerString(bool remove_L1_phase1_thresholds=true)
std::vector< std::string > m_HLTTauCHPreselIDs
Definition TrigTauInfo.h:95
const std::vector< int64_t > & getL1TauThresholdPatterns() const
Definition TrigTauInfo.h:59
const std::vector< std::string > & getHLTTauLegContainerSfxs() const
Definition TrigTauInfo.h:44
const std::vector< float > & getHLTTauThresholds() const
Definition TrigTauInfo.h:27
const std::string & getTriggerL1Name() const
Definition TrigTauInfo.h:46
const std::vector< std::string > & getHLTBoostedDitauName() const
Definition TrigTauInfo.h:60
const std::string getL1TauItem() const
Definition TrigTauInfo.h:48
bool areAnyL1TauIsolated() const
Definition TrigTauInfo.h:57
const std::string getHLTTauHitZSelection() const
Definition TrigTauInfo.h:35
std::vector< std::string > m_HLTTauIDs
Definition TrigTauInfo.h:92
float getHLTJetThreshold() const
Definition TrigTauInfo.h:82
std::vector< int64_t > m_tauL1ThresholdPattern
const std::string getL1TauType() const
Definition TrigTauInfo.h:52
const std::vector< std::string > & getTriggerL1Items() const
Definition TrigTauInfo.h:47
std::vector< float > m_tauL1Thr
const std::vector< std::string > & getHLTTauIDs() const
Definition TrigTauInfo.h:31
int64_t getL1TauThresholdPattern() const
Definition TrigTauInfo.h:58
std::vector< float > m_HLTJetThr
bool hasHLTElectronLeg() const
Definition TrigTauInfo.h:70
bool isTauStreamer() const
Definition TrigTauInfo.h:68
float getHLTMuonThreshold() const
Definition TrigTauInfo.h:78
const std::vector< std::string > & getL1TauItems() const
Definition TrigTauInfo.h:49
const std::string getHLTTauCaloHitsPreselectionID() const
Definition TrigTauInfo.h:32
bool hasHLTMuonLeg() const
Definition TrigTauInfo.h:71
bool isL1TauIsolated(const size_t idx=0) const
Definition TrigTauInfo.h:56
std::vector< float > m_HLTMETThr
bool hasHLTJetLeg() const
Definition TrigTauInfo.h:73
std::vector< float > m_HLTThr
Definition TrigTauInfo.h:90
const std::string getHLTTauType() const
Definition TrigTauInfo.h:28
bool hasHLTGammaLeg() const
Definition TrigTauInfo.h:72
const std::vector< int > & getHLTTauLegIndices() const
Definition TrigTauInfo.h:41
std::vector< int > m_HLTTauLegIndices
Definition TrigTauInfo.h:96