ATLAS Offline Software
Loading...
Searching...
No Matches
TrigTauMonitorL1Algorithm.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 TRIGTAUMONITORING_TRIGTAUMONITORL1ALGORITHM_H
6#define TRIGTAUMONITORING_TRIGTAUMONITORL1ALGORITHM_H
7
9
11public:
12 TrigTauMonitorL1Algorithm(const std::string& name, ISvcLocator* pSvcLocator);
13
14 virtual StatusCode initialize() override;
15
16private:
17 // Require at least 1 offline Tau per event (will bias the variable distributions for background events)
18 Gaudi::Property<bool> m_requireOfflineTaus{this, "RequireOfflineTaus", true, "Require at leat 1 offline tau per event"};
19 Gaudi::Property<unsigned int> m_offline_tau_id{this, "OfflineTauID", TauID::RNN, "Offline TauID (1: RNN, 2: GNTau)"};
20
21 // We need access to the xTOB-based RoI container to retrieve the BDT score
22 SG::ReadHandleKey<xAOD::eFexTauRoIContainer> m_phase1l1eTauxRoIKey{this, "Phase1L1eTauxRoIKey", "L1_eTauxRoI", "eTau Phase1 L1 xRoI key"};
23
24 std::vector<const xAOD::eFexTauRoI*> getL1xTOBeTAUs() const;
25 unsigned int getBDTScore(const xAOD::eFexTauRoI* roi, const std::vector<const xAOD::eFexTauRoI*>& xtob_rois) const;
26
27 virtual StatusCode processEvent(const EventContext& ctx) const override;
28
29 template <typename T = xAOD::eFexTauRoI>
30 void fillL1Efficiencies(const EventContext& ctx, const std::vector<const xAOD::TauJet*>& offline_tau_vec, const std::string& nProng, const std::string& trigger, const std::vector<const T*>& rois) const
31 {
32 ATH_MSG_DEBUG("Fill L1 efficiencies: " << trigger);
33
34 const TrigTauInfo& info = getTrigInfo(trigger);
35
36 auto monGroup = getGroup(trigger+"_L1_Efficiency_"+nProng);
37
38 auto tauPt = Monitored::Scalar<float>("tauPt", 0.0);
39 auto tauEta = Monitored::Scalar<float>("tauEta", 0.0);
40 auto tauPhi = Monitored::Scalar<float>("tauPhi", 0.0);
41 auto averageMu = Monitored::Scalar<float>("averageMu", 0.0);
42 auto L1_match = Monitored::Scalar<bool>("L1_pass", false);
43 auto L1_match_highPt = Monitored::Scalar<bool>("L1_pass_highPt", false);
44
45 averageMu = lbAverageInteractionsPerCrossing(ctx);
46
47 for(const xAOD::TauJet* offline_tau : offline_tau_vec) {
48 tauPt = offline_tau->pt()/Gaudi::Units::GeV;
49 tauEta = offline_tau->eta();
50 tauPhi = offline_tau->phi();
51
52 bool is_highPt = tauPt > info.getL1TauThreshold() + 20.0;
53
54 L1_match = false;
55 for(const T* roi : rois) {
56 L1_match = matchObjects(offline_tau, roi, 0.3);
57 if(L1_match) break;
58 }
59
60 fill(monGroup, tauPt, tauEta, tauPhi, averageMu, L1_match);
61
62 if(is_highPt) {
63 L1_match_highPt = static_cast<bool>(L1_match);
64 fill(monGroup, tauEta, tauPhi, L1_match_highPt);
65 }
66 }
67
68 ATH_MSG_DEBUG("After fill L1 efficiencies: " << trigger);
69 }
70
71 void fillL1eTauVars(const std::string& trigger, const std::vector<const xAOD::eFexTauRoI*>& rois, const std::vector<const xAOD::eFexTauRoI*>& xtob_rois) const;
72 void fillL1jTauVars(const std::string& trigger, const std::vector<const xAOD::jFexTauRoI*>& rois) const;
73 void fillL1cTauVars(const std::string& trigger, const std::vector<std::pair<const xAOD::eFexTauRoI*, const xAOD::jFexTauRoI*>>& rois, const std::vector<const xAOD::eFexTauRoI*>& xtob_rois) const;
74};
75
76#endif
#define ATH_MSG_DEBUG(x)
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
Declare a monitored scalar variable.
Property holding a SG store/key/clid from which a ReadHandle is made.
TrigTauMonitorBaseAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
bool matchObjects(const T1 *tau, const std::vector< const T2 * > &tau_vec, float threshold) const
const TrigTauInfo & getTrigInfo(const std::string &trigger) const
void fillL1jTauVars(const std::string &trigger, const std::vector< const xAOD::jFexTauRoI * > &rois) const
Gaudi::Property< unsigned int > m_offline_tau_id
virtual StatusCode processEvent(const EventContext &ctx) const override
void fillL1Efficiencies(const EventContext &ctx, const std::vector< const xAOD::TauJet * > &offline_tau_vec, const std::string &nProng, const std::string &trigger, const std::vector< const T * > &rois) const
void fillL1eTauVars(const std::string &trigger, const std::vector< const xAOD::eFexTauRoI * > &rois, const std::vector< const xAOD::eFexTauRoI * > &xtob_rois) const
void fillL1cTauVars(const std::string &trigger, const std::vector< std::pair< const xAOD::eFexTauRoI *, const xAOD::jFexTauRoI * > > &rois, const std::vector< const xAOD::eFexTauRoI * > &xtob_rois) const
SG::ReadHandleKey< xAOD::eFexTauRoIContainer > m_phase1l1eTauxRoIKey
TrigTauMonitorL1Algorithm(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< const xAOD::eFexTauRoI * > getL1xTOBeTAUs() const
unsigned int getBDTScore(const xAOD::eFexTauRoI *roi, const std::vector< const xAOD::eFexTauRoI * > &xtob_rois) const
Gaudi::Property< bool > m_requireOfflineTaus
virtual StatusCode initialize() override
initialize
void fill(const ToolHandle< GenericMonitoringTool > &groupHandle, std::vector< std::reference_wrapper< Monitored::IMonitoredVariable > > &&variables) const
Fills a vector of variables to a group by reference.
virtual float lbAverageInteractionsPerCrossing(const EventContext &ctx=Gaudi::Hive::currentContext()) const
Calculate the average mu, i.e.
TauJet_v3 TauJet
Definition of the current "tau version".
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.
Definition eFexTauRoI.h:16