19 return StatusCode::SUCCESS;
24 constexpr float threshold_offset = 10.0;
32 const std::vector<const xAOD::eFexTauRoI*> xtob_etau_rois =
getL1xTOBeTAUs();
37 if(!info.isL1TauOnly()) {
38 ATH_MSG_WARNING(
"Chain \"" << trigger <<
"\" is not an L1 tau trigger. Skipping...");
47 auto offline_taus =
classifyOfflineTaus(offline_taus_with_id, info.getL1TauThreshold() - threshold_offset);
48 std::vector<const xAOD::TauJet*> offline_taus_1p = offline_taus.first;
49 std::vector<const xAOD::TauJet*> offline_taus_3p = offline_taus.second;
51 if(info.getL1TauType() ==
"eTAU") {
52 std::vector<const xAOD::eFexTauRoI*> rois =
getL1eTAUs(ctx, info.getL1TauItem());
60 }
else if(info.getL1TauType() ==
"jTAU") {
61 std::vector<const xAOD::jFexTauRoI*> rois =
getL1jTAUs(ctx, info.getL1TauItem());
69 }
else if(info.getL1TauType() ==
"cTAU") {
70 std::vector<std::pair<const xAOD::eFexTauRoI*, const xAOD::jFexTauRoI*>> rois =
getL1cTAUs(ctx, info.getL1TauItem());
72 std::vector<const xAOD::eFexTauRoI*> eTau_rois;
73 eTau_rois.reserve(rois.size());
74for(
const auto& [eTau_roi, jTau_roi] : rois) eTau_rois.push_back(eTau_roi);
85 return StatusCode::SUCCESS;
93 auto monGroup =
getGroup(trigger+
"_L1Vars");
101 fill(monGroup, L1RoIEt, L1RoIEta, L1RoIPhi, L1RoIRCore, L1RoIRHad, L1RoIBDTScore);
111 auto monGroup =
getGroup(trigger+
"_L1Vars");
118 fill(monGroup, L1RoIEt, L1RoIEta, L1RoIPhi, L1jFexRoIIso);
125void TrigTauMonitorL1Algorithm::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
129 auto monGroup =
getGroup(trigger+
"_L1Vars");
131 auto L1RoIEt =
Monitored::Collection(
"L1RoIEt" , rois, [](
const auto L1roi){
return L1roi.first->et()/Gaudi::Units::GeV; });
132 auto L1RoIEta =
Monitored::Collection(
"L1RoIEta" , rois, [](
const auto L1roi){
return L1roi.first->eta(); });
133 auto L1RoIPhi =
Monitored::Collection(
"L1RoIPhi" , rois, [](
const auto L1roi){
return L1roi.first->phi(); });
134 auto L1eFexRoIRCore =
Monitored::Collection(
"L1eFexRoIRCore", rois, [](
const auto L1roi){
return L1roi.first->rCore(); });
135 auto L1eFexRoIRHad =
Monitored::Collection(
"L1eFexRoIRHad" , rois, [](
const auto L1roi){
return L1roi.first->rHad(); });
136 auto L1RoIBDTScore =
Monitored::Collection(
"L1eFexRoIBDTScore" , rois, [
this, &xtob_rois](
const auto L1roi){
return getBDTScore(L1roi.first, xtob_rois); });
138 std::vector<bool> jFex_isMatched;
139 std::vector<float> jFex_eFex_et_ratio;
140 std::vector<float> jFex_isolation;
141 std::vector<float> cTau_isolation;
142 for(
const auto& [eFexRoI, jFexRoI] : rois) {
144 jFex_isMatched.push_back(
false);
148 jFex_isMatched.push_back(
true);
149 jFex_eFex_et_ratio.push_back(jFexRoI->et()/eFexRoI->et());
150 jFex_isolation.push_back(jFexRoI->iso()/Gaudi::Units::GeV);
151 cTau_isolation.push_back(jFexRoI->iso()/eFexRoI->et());
158 fill(monGroup, L1RoIEt, L1RoIEta, L1RoIPhi, L1eFexRoIRCore, L1eFexRoIRHad, L1cTauRoITopoMatch, L1jFexRoIIso, L1cTauRoIIso, L1RoIcTauEtRatio, L1RoIBDTScore );
165 std::vector<const xAOD::eFexTauRoI*> roi_vec;
170 if(!rois.isValid()) {
171 ATH_MSG_WARNING(
"The L1_eTauxRoI container is not available! No e/cTAU BDT score will be retrieved");
181 if(xtob_rois.empty())
return 0;
184 if(xroi->eta() == roi->
eta() && xroi->phi() == roi->
phi())
return xroi->bdtScore();
186 ATH_MSG_DEBUG(
"Unmatched RoI! et=" << roi->
et() <<
", eta=" << roi->
eta() <<
", phi=" << roi->
phi());
188 ATH_MSG_DEBUG(
" - xRoI et=" << xroi->et() <<
", eta=" << xroi->eta() <<
", phi=" << xroi->phi());
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
std::vector< const xAOD::eFexTauRoI * > getL1eTAUs(const EventContext &ctx, const std::string &l1_item) const
Gaudi::Property< bool > m_do_efficiency_plots
virtual StatusCode initialize() override
initialize
TrigTauMonitorBaseAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< const xAOD::TauJet * > getOfflineTausAll(const EventContext &ctx, const float threshold=20.0) const
Gaudi::Property< std::vector< std::string > > m_triggers
const TrigTauInfo & getTrigInfo(const std::string &trigger) const
std::vector< const xAOD::jFexTauRoI * > getL1jTAUs(const EventContext &ctx, const std::string &l1_item) const
std::vector< std::pair< const xAOD::eFexTauRoI *, const xAOD::jFexTauRoI * > > getL1cTAUs(const EventContext &ctx, const std::string &l1_item) const
std::vector< const xAOD::TauJet * > classifyTausAll(const std::vector< const xAOD::TauJet * > &taus, const float threshold=0.0, const TauID tau_id=TauID::None) const
std::pair< std::vector< const xAOD::TauJet * >, std::vector< const xAOD::TauJet * > > classifyOfflineTaus(const std::vector< const xAOD::TauJet * > &taus, const float threshold=0.0, const TauID tau_id=TauID::None) const
Gaudi::Property< bool > m_do_variable_plots
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
float et() const
TOB ET (decoded from TOB, stored for convenience)
float phi() const
Seed supercell index within central tower (0 -> 3)
float rCore() const
Jet Discriminants Derived floating point values (not used in actual algorithm)
float eta() const
setter for the above
unsigned int iso() const
Iso on TOB scale.
unsigned int et() const
Methods that require combining results or applying scales.
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.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
jFexTauRoI_v1 jFexTauRoI
Define the latest version of the jFexSRJetRoI class.
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.