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