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.size() ? 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.size() ? 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.size() ? m_HLTTauIDs[0] : ""; } // Returns the main HLT tau leg ID algorithm
31 inline const std::vector<std::string>& getHLTTauIDs() const { return m_HLTTauIDs; }
32
33 inline const std::string& getTriggerL1Name() const { return m_L1Item; }
34 inline const std::vector<std::string>& getTriggerL1Items() const { return m_L1Items; }
35 inline const std::string getL1TauItem() const { return m_tauL1Items.size() ? m_tauL1Items[0] : ""; } // Returns the main L1 tau item
36 inline const std::vector<std::string>& getL1TauItems() const { return m_tauL1Items; }
37 inline float getL1TauThreshold() const { return m_tauL1Thr.size() ? m_tauL1Thr[0] : -1; } // Returns the main L1 item threshold
38 inline const std::vector<float>& getL1TauThresholds() const { return m_tauL1Thr; }
39 inline const std::string getL1TauType() const { return m_tauL1Items.size() ? m_tauL1Type[0] : ""; } // Returns the main L1 item type
40 inline const std::vector<std::string>& getL1TauTypes() const { return m_tauL1Type; }
41 inline const std::string getL1TauIsolation() const { return m_tauL1Iso.size() ? m_tauL1Iso[0] : ""; } // Returns the main L1 item isolation
42 inline const std::vector<std::string>& getL1TauIsolations() const { return m_tauL1Iso; }
43 inline bool isL1TauIsolated(const size_t idx = 0) const { return idx < m_tauL1Iso.size() ? m_tauL1Iso[idx].size() : false; } // Returns true if the (main by default) L1 item is isolated
44 inline bool areAnyL1TauIsolated() const { for(const std::string& iso : m_tauL1Iso) { if(iso.size()) return true; }; return false; } // Returns true any of the L1 items are isolated
45 inline int64_t getL1TauThresholdPattern() const { return m_tauL1ThresholdPattern.size() ? m_tauL1ThresholdPattern[0] : -1; } // Returns the main L1 item thresholdPattern mask
46 inline const std::vector<int64_t>& getL1TauThresholdPatterns() const { return m_tauL1ThresholdPattern; }
47 inline const std::vector<std::string>& getHLTBoostedDitauName() const { return m_HLTBoostedDitauName; }
48
49
50
51 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; }
52 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; }
53 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; }
54 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; }
55 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(); }
56 inline bool isTauStreamer() const { return m_isStreamer && !m_tauL1Items.empty(); }
57
58 inline bool hasHLTElectronLeg() const { return m_HLTElecThr.size() >= 1; }
59 inline bool hasHLTMuonLeg() const { return m_HLTMuonThr.size() >= 1; }
60 inline bool hasHLTGammaLeg() const { return m_HLTGammaThr.size() >= 1; }
61 inline bool hasHLTJetLeg() const { return m_HLTJetThr.size() >= 1; }
62 inline bool hasHLTMETLeg() const { return m_HLTMETThr.size() >= 1; }
63
64 inline float getHLTElecThreshold() const { return m_HLTElecThr.size() ? m_HLTElecThr[0] : -1; } // Returns the main leg threshold
65 inline const std::vector<float>& getHLTElecThresholds() const { return m_HLTElecThr; }
66 inline float getHLTMuonThreshold() const { return m_HLTMuonThr.size() ? m_HLTMuonThr[0] : -1; } // Returns the main leg threshold
67 inline const std::vector<float>& getHLTMuonThresholds() const { return m_HLTMuonThr; }
68 inline float getHLTGammaThreshold() const { return m_HLTGammaThr.size() ? m_HLTGammaThr[0] : -1; } // Returns the main leg threshold
69 inline const std::vector<float>& getHLTGammaThresholds() const { return m_HLTGammaThr; }
70 inline float getHLTJetThreshold() const { return m_HLTJetThr.size() ? m_HLTJetThr[0] : -1; } // Returns the main leg threshold
71 inline const std::vector<float>& getHLTJetThresholds() const { return m_HLTJetThr; }
72 inline float getHLTMETThreshold() const { return m_HLTMETThr.size() ? m_HLTMETThr[0] : -1; } // Returns the main leg threshold
73 inline const std::vector<float>& getHLTMETThresholds() const { return m_HLTMETThr; }
74
75private:
76 std::string m_trigger; // Full trigger name (e.g. HLT_tau25_mediumRNN_tracktwoMVA_L1eTAU20)
77 bool m_isStreamer = false; // Is a streamer HLT trigger
78 std::vector<float> m_HLTThr; // List of all tau thresholds
79 std::vector<std::string> m_HLTTauTypes; // Type for each tau leg (e.g. tracktwoMVA, trackwoLLP, etc...)
80 std::vector<std::string> m_HLTTauIDs; // Tau ID algorithm for each tau leg (e.g. DeepSet, RNNLLP, GNTau, etc...)
81
82 std::string m_L1Item; // full L1 trigger string (e.g. L1eTAU20, or L1eTAU80_2eTAU60)
83 std::vector<std::string> m_L1Items; // full L1 trigger items
84 std::vector<float> m_tauL1Thr; // L1 Tau item thresholds, corrected for Phase1 items
85 std::vector<std::string> m_tauL1Items; // Individual l1 tau items
86 std::vector<std::string> m_tauL1Type; // Individual l1 tau item type (eTAU, jTAU, cTAU, TAU)
87 std::vector<std::string> m_tauL1Iso; // Individual l1 tau item isolation ("", L, M, T, HL, HM, HT, H, IM)
88 std::vector<int64_t> m_tauL1ThresholdPattern; // Individual l1 tau item thresholdPattern mask
89
90 std::vector<float> m_HLTElecThr; // List of all electron leg thresholds
91 std::vector<float> m_HLTMuonThr; // List of all muon leg thresholds
92 std::vector<float> m_HLTGammaThr; // List of all photon leg thresholds
93 std::vector<float> m_HLTJetThr; // List of all jet leg thresholds
94 std::vector<float> m_HLTMETThr; // List of all MET leg thresholds
95
96 std::vector<std::string> m_HLTBoostedDitauName;
97
98
99 inline bool is_number(const std::string& s) {
100 return !s.empty() && std::find_if(s.begin(), s.end(), [](unsigned char c) {return !std::isdigit(c);}) == s.end();
101 }
102
103 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)
104 void parseTriggerString(const std::map<std::string, float>& L1Phase1_thresholds); // Parse the trigger string, applying the Phase1 ET mapping
105 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
106 void parseTriggerString(const std::map<int, int>& L1Phase1ThrMap_eTAU, const std::map<int, int>& L1Phase1ThrMap_jTAU); // Parse the trigger string, applying the Phase1 remapping
107};
108
109#endif
const std::string & getTriggerName() const
Definition TrigTauInfo.h:23
const std::vector< float > & getHLTMuonThresholds() const
Definition TrigTauInfo.h:67
const std::vector< std::string > & getHLTTauTypes() const
Definition TrigTauInfo.h:29
const std::vector< float > & getHLTJetThresholds() const
Definition TrigTauInfo.h:71
const std::string getL1TauIsolation() const
Definition TrigTauInfo.h:41
const std::vector< float > & getHLTMETThresholds() const
Definition TrigTauInfo.h:73
bool isHLTDiTau() const
Definition TrigTauInfo.h:52
float getHLTTauThreshold() const
Definition TrigTauInfo.h:26
std::vector< std::string > m_tauL1Iso
Definition TrigTauInfo.h:87
bool hasHLTMETLeg() const
Definition TrigTauInfo.h:62
std::vector< float > m_HLTMuonThr
Definition TrigTauInfo.h:91
bool m_isStreamer
Definition TrigTauInfo.h:77
std::vector< float > m_HLTGammaThr
Definition TrigTauInfo.h:92
float getHLTGammaThreshold() const
Definition TrigTauInfo.h:68
const std::vector< float > & getHLTElecThresholds() const
Definition TrigTauInfo.h:65
std::string m_L1Item
Definition TrigTauInfo.h:82
std::vector< std::string > m_L1Items
Definition TrigTauInfo.h:83
bool isL1TauOnly() const
Definition TrigTauInfo.h:55
std::vector< std::string > m_HLTBoostedDitauName
Definition TrigTauInfo.h:96
std::string m_trigger
Definition TrigTauInfo.h:76
bool isHLTBoostedDiTau() const
Definition TrigTauInfo.h:53
const std::vector< std::string > & getL1TauIsolations() const
Definition TrigTauInfo.h:42
std::vector< float > m_HLTElecThr
Definition TrigTauInfo.h:90
std::vector< std::string > m_tauL1Type
Definition TrigTauInfo.h:86
float getHLTMETThreshold() const
Definition TrigTauInfo.h:72
bool isHLTTandP() const
Definition TrigTauInfo.h:54
bool isStreamer() const
Definition TrigTauInfo.h:24
const std::vector< float > & getL1TauThresholds() const
Definition TrigTauInfo.h:38
float getL1TauThreshold() const
Definition TrigTauInfo.h:37
bool isHLTSingleTau() const
Definition TrigTauInfo.h:51
float getHLTElecThreshold() const
Definition TrigTauInfo.h:64
std::vector< std::string > m_tauL1Items
Definition TrigTauInfo.h:85
const std::vector< std::string > & getL1TauTypes() const
Definition TrigTauInfo.h:40
std::vector< std::string > m_HLTTauTypes
Definition TrigTauInfo.h:79
bool is_number(const std::string &s)
Definition TrigTauInfo.h:99
const std::string getHLTTauID() const
Definition TrigTauInfo.h:30
const std::vector< float > & getHLTGammaThresholds() const
Definition TrigTauInfo.h:69
void parseTriggerString(bool remove_L1_phase1_thresholds=true)
const std::vector< int64_t > & getL1TauThresholdPatterns() const
Definition TrigTauInfo.h:46
const std::vector< float > & getHLTTauThresholds() const
Definition TrigTauInfo.h:27
const std::string & getTriggerL1Name() const
Definition TrigTauInfo.h:33
const std::vector< std::string > & getHLTBoostedDitauName() const
Definition TrigTauInfo.h:47
const std::string getL1TauItem() const
Definition TrigTauInfo.h:35
bool areAnyL1TauIsolated() const
Definition TrigTauInfo.h:44
std::vector< std::string > m_HLTTauIDs
Definition TrigTauInfo.h:80
float getHLTJetThreshold() const
Definition TrigTauInfo.h:70
std::vector< int64_t > m_tauL1ThresholdPattern
Definition TrigTauInfo.h:88
const std::string getL1TauType() const
Definition TrigTauInfo.h:39
const std::vector< std::string > & getTriggerL1Items() const
Definition TrigTauInfo.h:34
std::vector< float > m_tauL1Thr
Definition TrigTauInfo.h:84
const std::vector< std::string > & getHLTTauIDs() const
Definition TrigTauInfo.h:31
int64_t getL1TauThresholdPattern() const
Definition TrigTauInfo.h:45
std::vector< float > m_HLTJetThr
Definition TrigTauInfo.h:93
bool hasHLTElectronLeg() const
Definition TrigTauInfo.h:58
bool isTauStreamer() const
Definition TrigTauInfo.h:56
float getHLTMuonThreshold() const
Definition TrigTauInfo.h:66
const std::vector< std::string > & getL1TauItems() const
Definition TrigTauInfo.h:36
bool hasHLTMuonLeg() const
Definition TrigTauInfo.h:59
bool isL1TauIsolated(const size_t idx=0) const
Definition TrigTauInfo.h:43
std::vector< float > m_HLTMETThr
Definition TrigTauInfo.h:94
bool hasHLTJetLeg() const
Definition TrigTauInfo.h:61
std::vector< float > m_HLTThr
Definition TrigTauInfo.h:78
const std::string getHLTTauType() const
Definition TrigTauInfo.h:28
bool hasHLTGammaLeg() const
Definition TrigTauInfo.h:60