23 for(
const auto& [key, p] : m) {
24 if(p.first.empty() || p.second.empty()) {
25 ATH_MSG_WARNING(
"Invalid HLT TauID score variable names; skipping this entry for the monitoring!");
42 if(p.first.empty() || p.second.empty()) {
43 ATH_MSG_WARNING(
"Invalid Offline TauID score variable names; skipping this entry for the monitoring!");
58 return StatusCode::SUCCESS;
64 constexpr float threshold_offset = 10.0;
73 if(!info.isHLTSingleTau()) {
74 ATH_MSG_WARNING(
"Chain \"" << trigger <<
"\" is not a single tau trigger. Skipping...");
87 auto offline_taus =
classifyOfflineTaus(offline_taus_with_id, info.getHLTTauThreshold() - threshold_offset);
88 std::vector<const xAOD::TauJet*> offline_taus_1p = offline_taus.first;
89 std::vector<const xAOD::TauJet*> offline_taus_3p = offline_taus.second;
92 std::vector<const xAOD::TauJet*> hlt_taus_all =
getOnlineTausAll(trigger,
true);
94 std::vector<const xAOD::TauJet*> hlt_taus_0p = std::get<0>(hlt_taus);
95 std::vector<const xAOD::TauJet*> hlt_taus_1p = std::get<1>(hlt_taus);
96 std::vector<const xAOD::TauJet*> hlt_taus_mp = std::get<2>(hlt_taus);
102 fillIDScores(ctx, trigger, offline_taus_1p,
"1P",
false);
109 fillIDScores(ctx, trigger, offline_taus_3p,
"3P",
false);
116 if(!hlt_taus_0p.empty()) {
125 if(!hlt_taus_1p.empty()) {
134 if(!hlt_taus_mp.empty()) {
149 return StatusCode::SUCCESS;
153void TrigTauMonitorSingleAlgorithm::fillHLTEfficiencies(
const EventContext& ctx,
const std::string& trigger,
const bool l1_accept_flag,
const std::vector<const xAOD::TauJet*>& offline_tau_vec,
const std::vector<const xAOD::TauJet*>& online_tau_vec,
const std::string& nProng)
const
155 ATH_MSG_DEBUG(
"Fill HLT " << nProng <<
" efficiencies: " << trigger);
163 auto monGroup =
getGroup(trigger+
"_HLT_Efficiency_"+nProng);
176 std::vector<TLorentzVector> rois =
getRoIsVector(ctx, trigger);
177 for(
const auto *offline_tau : offline_tau_vec) {
178 bool L1_match =
false;
182 for(
const TLorentzVector& roi : rois) {
183 L1_match = offline_tau->p4().DeltaR(roi) <= 0.3;
187 tauPt = offline_tau->pt()/Gaudi::Units::GeV;
188 tauEta = offline_tau->eta();
189 tauPhi = offline_tau->phi();
192 bool is_highPt = tauPt > info.getHLTTauThreshold() + 20.0;
195 HLT_match =
matchObjects(offline_tau, online_tau_vec, 0.2) && hlt_fires;
199 Total_match =
static_cast<bool>(HLT_match);
200 fill(monGroup, tauPt, tauEta, tauPhi, Total_match);
203 Total_match_highPt =
static_cast<bool>(HLT_match);
204 fill(monGroup, tauEta, tauPhi, Total_match_highPt);
208 if(!L1_match || !l1_accept_flag)
continue;
210 fill(monGroup, tauPt, tauEta, tauPhi, averageMu, HLT_match);
213 HLT_match_highPt =
static_cast<bool>(HLT_match);
214 fill(monGroup, tauEta, tauPhi, HLT_match_highPt);
226 auto monGroup =
getGroup(trigger+
"_ID_"+(
online ?
"HLT" :
"Offline")+
"_InputScalar_"+nProng);
285 fill(monGroup, centFrac, etOverPtLeadTrk, dRmax, absipSigLeadTrk, sumPtTrkFrac, emPOverTrkSysP, ptRatioEflowApprox, mEflowApprox, ptDetectorAxis, massTrkSys, trFlightPathSig);
295 auto monGroup =
getGroup(trigger+
"_ID_"+(
online ?
"HLT" :
"Offline")+
"_InputTrack");
298 fill(monGroup, track_pt_jetseed_log);
300 for(
const auto *tau : tau_vec) {
303 bool linksValid =
true;
305 if(!trackEL.isValid()) {
311 ATH_MSG_WARNING(
"Invalid track element links from TauJet in " << trigger);
331 uint8_t inner_pixel_hits, inner_pixel_exp;
335 if(success1_innerPixel_hits && success2_innerPixel_exp) {
detail = inner_pixel_exp ? inner_pixel_hits : 1.; };
339 uint8_t pixel_hits, pixel_dead;
343 if(success1_pixel_hits && success2_pixel_dead) {
detail = pixel_hits + pixel_dead; };
347 uint8_t sct_hits, sct_dead;
351 if(success1_sct_hits && success2_sct_dead) {
detail = sct_hits + sct_dead; };
355 fill(monGroup, n_track, track_pt_log, track_eta, track_phi, track_dEta, track_dPhi, track_z0sinthetaTJVA_abs_log, track_d0_abs_log, track_nIBLHitsAndExp, track_nPixelHitsPlusDeadSensors, track_nSCTHitsPlusDeadSensors);
366 auto monGroup =
getGroup(trigger+
"_ID_"+(
online ?
"HLT" :
"Offline")+
"_InputCluster");
368 for(
const auto *tau : tau_vec){
371 std::vector<const xAOD::CaloCluster*> clusters;
374 clusters.push_back(cluster);
379 n_cluster = clusters.size();
396 if(success_SECOND_LAMBDA)
detail = std::log10(
detail + 0.1);
403 if(success_CENTER_LAMBDA)
detail = std::log10(
detail + 1e-6);
407 fill(monGroup, n_cluster, cluster_pt_jetseed_log, cluster_et_log, cluster_eta, cluster_phi, cluster_dEta, cluster_dPhi, cluster_SECOND_R_log10, cluster_SECOND_LAMBDA_log10, cluster_CENTER_LAMBDA_log10);
418 auto monGroup =
getGroup(trigger+
"_"+(
online ?
"HLT" :
"Offline")+
"_basicVars_"+nProng);
450 fill(monGroup, Pt, Eta, Phi, nTrack, nIsoTrack, averageMu, TauVertexX, TauVertexY, TauVertexZ);
461 const std::string tau_id = info.getHLTTauID();
462 bool store_all = tau_id ==
"idperf" || tau_id ==
"perf";
474 auto monGroup =
getGroup(trigger+
"_"+(
online ?
"HLT" :
"Offline")+
"_IDScores_"+nProng);
476 for(
const auto& [key, p] : decor_handle_keys) {
478 if(
online && !store_all && tau_id != key)
continue;
486 std::vector<float> score, score_sig_trans;
488 score.push_back(score_handle(*tau));
489 score_sig_trans.push_back(score_sig_trans_handle(*tau));
494 fill(monGroup, IDScore, IDScoreSigTrans);
503 std::vector<TLorentzVector> ret;
508 if(info.getL1TauType() ==
"eTAU") {
510 v.SetPtEtaPhiM(roi->et(), roi->eta(), roi->phi(), 0);
513 }
else if(info.getL1TauType() ==
"jTAU") {
515 v.SetPtEtaPhiM(roi->et(), roi->eta(), roi->phi(), 0);
518 }
else if(info.getL1TauType() ==
"cTAU") {
519 for(
const auto& [eTau_roi, jTau_roi] :
getL1cTAUs(ctx, info.getL1TauItem())) {
520 v.SetPtEtaPhiM(eTau_roi->et(), eTau_roi->eta(), eTau_roi->phi(), 0);
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Handle class for reading a decoration on an object.
const ToolHandle< GenericMonitoringTool > & getGroup(const std::string &name) const
Get a specific monitoring tool from the tool handle array.
PublicToolHandle< Trig::TrigDecisionTool > m_trigDecTool
Tool to tell whether a specific trigger is passed.
ElementLink implementation for ROOT usage.
Declare a monitored scalar variable.
Helper class to provide constant type-safe access to aux data.
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Handle class for reading a decoration on an object.
bool isAvailable()
Test to see if this variable exists in the store, for the referenced object.
std::vector< const xAOD::eFexTauRoI * > getL1eTAUs(const EventContext &ctx, const std::string &l1_item) const
const SG::ReadHandleKey< xAOD::TauJetContainer > & getOnlineContainerKey(const std::string &sequence) 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
bool matchObjects(const T1 *tau, const std::vector< const T2 * > &tau_vec, float threshold) 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
SG::ReadHandleKey< xAOD::TauJetContainer > m_offlineTauJetKey
std::tuple< std::vector< const xAOD::TauJet * >, std::vector< const xAOD::TauJet * >, std::vector< const xAOD::TauJet * > > classifyOnlineTaus(const std::vector< const xAOD::TauJet * > &taus, const float threshold=0.0) const
std::vector< const xAOD::TauJet * > getOnlineTausAll(const std::string &trigger, bool include_0P=true) const
void fillIDScores(const EventContext &ctx, const std::string &trigger, const std::vector< const xAOD::TauJet * > &tau_vec, const std::string &nProng, bool online) const
virtual StatusCode initialize() override
initialize
std::map< std::string, std::map< std::string, std::pair< SG::ReadDecorHandleKey< xAOD::TauJetContainer >, SG::ReadDecorHandleKey< xAOD::TauJetContainer > > > > m_monitoredHLTIdDecorHandleKeys
Gaudi::Property< std::map< std::string, std::map< std::string, std::pair< std::string, std::string > > > > m_monitoredHLTIdScores
TrigTauMonitorSingleAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< bool > m_doTotalEfficiency
void fillIDInputVars(const std::string &trigger, const std::vector< const xAOD::TauJet * > &tau_vec, const std::string &nProng, bool online) const
Gaudi::Property< bool > m_requireOfflineTaus
Gaudi::Property< std::map< std::string, std::pair< std::string, std::string > > > m_monitoredOfflineIdScores
virtual StatusCode processEvent(const EventContext &ctx) const override
void fillHLTEfficiencies(const EventContext &ctx, const std::string &trigger, const bool l1_accept_flag, const std::vector< const xAOD::TauJet * > &offline_tau_vec, const std::vector< const xAOD::TauJet * > &online_tau_vec, const std::string &nProng) const
Gaudi::Property< unsigned int > m_offline_tau_id
std::map< std::string, std::pair< SG::ReadDecorHandleKey< xAOD::TauJetContainer >, SG::ReadDecorHandleKey< xAOD::TauJetContainer > > > m_monitoredOfflineIdDecorHandleKeys
void fillIDCluster(const std::string &trigger, const std::vector< const xAOD::TauJet * > &tau_vec, bool online) const
Gaudi::Property< bool > m_doOfflineTausDistributions
void fillBasicVars(const EventContext &ctx, const std::string &trigger, const std::vector< const xAOD::TauJet * > &tau_vec, const std::string &nProng, bool online) const
void fillIDTrack(const std::string &trigger, const std::vector< const xAOD::TauJet * > &tau_vec, bool online) const
std::vector< TLorentzVector > getRoIsVector(const EventContext &ctx, const std::string &trigger) const
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual double phi() const
The azimuthal angle ( ) of the particle.
@ SECOND_LAMBDA
Second Moment in .
@ SECOND_R
Second Moment in .
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Class providing the definition of the 4-vector interface.
virtual double phi() const
The azimuthal angle ( ) of the particle.
double ptDetectorAxis() const
virtual FourMom_t p4() const
The full 4-momentum of the particle.
virtual double pt() const
The transverse momentum ( ) of the particle.
bool detail(TauJetParameters::Detail detail, int &value) const
Get and set values of common details variables via enum.
const TauTrack * track(size_t i, TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged, int *container_index=0) const
Get the pointer to a given tauTrack associated with this tau /*container index needed by trackNonCons...
const Vertex * vertex() const
std::vector< const IParticle * > clusters() const
size_t nTracksIsolation() const
std::vector< const TauTrack * > allTracks() const
Get the v<const pointer> to all tracks associated with this tau, regardless of classification.
virtual double eta() const
The pseudorapidity ( ) of the particle.
size_t nTracks(TauJetParameters::TauTrackFlag flag=TauJetParameters::TauTrackFlag::classifiedCharged) const
float z() const
Returns the z position.
float y() const
Returns the y position.
float x() const
Returns the x position.
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.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
static const unsigned int allowResurrectedDecision
static const unsigned int EF_prescaled
static const unsigned int L1_isPassedAfterVeto
static const unsigned int Physics
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
@ centFrac
Get centrality fraction.
@ dRmax
Get maximal dR of tracks associated to calo-seeded tau.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
TauTrack_v1 TauTrack
Definition of the current version.
TauJet_v3 TauJet
Definition of the current "tau version".
jFexTauRoI_v1 jFexTauRoI
Define the latest version of the jFexSRJetRoI class.
eFexTauRoI_v1 eFexTauRoI
Define the latest version of the eFexTauRoI class.
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
@ numberOfSCTDeadSensors
number of dead SCT sensors crossed [unit8_t].
@ numberOfSCTHits
number of hits in SCT [unit8_t].
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer
@ numberOfPixelHits
these are the pixel hits, including the b-layer [unit8_t].
@ numberOfPixelDeadSensors
number of dead pixel sensors crossed [unit8_t].