31 return static_cast<float>(roi->
et());
35inline const std::vector<std::string>&
54inline std::vector<L1LegToken> parseL1LegTokens(
const std::string& l1Name) {
55 static const std::regex l1NameParser(
56 "(\\d*)(j?J)(\\d*)((p|\\.)(\\d*)ETA(\\d*))?");
57 static const std::regex dashToUnderscore(
"-");
59 std::vector<L1LegToken>
tokens;
60 std::stringstream
ss(std::regex_replace(l1Name, dashToUnderscore,
"_"));
63 while (getline(
ss, legName,
'_')) {
64 if (std::regex_match(legName,
match, l1NameParser)) {
65 std::string legName_noMultiplicity =
74template <
typename RoI,
typename Container,
typename ThrAccessor>
75std::tuple<float, float, float, float, std::vector<int>> matchL1Container(
76 const TLorentzVector& jetP4,
const Container& container,
77 ThrAccessor thrAccessor,
const std::vector<L1LegToken>& l1LegTokens,
79 const RoI* bestL1 =
nullptr;
80 float minDRL1 = drMax;
81 std::set<int> L1Thresholds;
83 for (
const RoI* l1_jet : container) {
84 TLorentzVector l1_jet_p4;
85 l1_jet_p4.SetPtEtaPhiM(
86 getL1JetEt(l1_jet), l1_jet->eta(), l1_jet->phi(), 0.);
87 const float dR =
static_cast<float>(jetP4.DeltaR(l1_jet_p4));
96 const auto& thrNames = thrAccessor(bestL1);
97 for (
const L1LegToken& tok : l1LegTokens) {
98 for (
const auto& thr : thrNames) {
99 if (thr == tok.name) {
100 L1Thresholds.insert(tok.threshold);
107 bestL1 ? getL1JetEt(bestL1) : -99.f,
108 bestL1 ? bestL1->
eta() : -99.f,
109 bestL1 ? bestL1->
phi() : -99.f,
155 if (legInfo.signature ==
"j") {
157 <<
" " << legInfo.legName() <<
" "
158 << legInfo.type() <<
" "
159 << legInfo.signature <<
" "
160 << legInfo.threshold);
162 int legThreshold = legInfo.threshold;
164 if (legInfo.legName().find(
"gsc") != std::string::npos) {
165 for (
const std::string& part : legInfo.legParts) {
166 if (part.find(
"gsc") != std::string::npos) {
167 legThreshold = std::stoi(part.substr(3));
175 m_jetLegs.push_back({ileg, legThreshold, legInfo.legName()});
186 return StatusCode::SUCCESS;
218 std::unordered_map<std::string,
219 std::vector<std::pair<const xAOD::Jet*, bool>>>
226 .getChainConfigurationDetails(
m_trigger);
227 std::vector<L1LegToken> l1LegTokens;
235 <<
" not found in the trigger menu; writing default "
236 "matching decorations (warning printed once)");
239 isTrigPassed =
false;
246 std::vector<std::vector<const xAOD::IParticle*>> hltCandidates(
248 std::vector<std::size_t> nNavCandidates(
m_jetLegs.size(), 0);
250 for (std::size_t i = 0; i <
m_jetLegs.size(); ++i) {
252 std::vector<const xAOD::IParticle*>& candidates = hltCandidates[i];
259 const auto emulated = emulatedJets.find(leg.name);
260 if (emulated != emulatedJets.end()) {
261 candidates.reserve(emulated->second.size());
262 for (
const auto& jetAndBtag : emulated->second)
263 candidates.push_back(jetAndBtag.first);
266 << candidates.size());
267 nNavCandidates[i] = candidates.size();
276 const auto hlt_jetsFromtrigDec =
279 for (
const auto& hlt_jet_link : hlt_jetsFromtrigDec) {
281 if (!hlt_jetFromtrigDec)
283 candidates.push_back(hlt_jetFromtrigDec);
285 nNavCandidates[i] = candidates.size();
289 for (
const xAOD::Jet* jetFromCont : *hltJetsFromCont) {
290 bool alreadyIn =
false;
300 candidates.push_back(jetFromCont);
303 <<
" eta=" << jetFromCont->eta()
304 <<
" phi=" << jetFromCont->phi());
316 const TLorentzVector jetP4 =
jet->p4();
326 float minDRL1 =
m_l1dR.value();
327 std::vector<int> l1ThresholdsVec;
332 std::tie(l1Et, l1Eta, l1Phi, minDRL1, l1ThresholdsVec) =
333 matchL1Container<xAOD::jFexSRJetRoI>(
334 jetP4, *l1JetsPhaseI,
338 l1LegTokens,
m_l1dR.value());
341 std::tie(l1Et, l1Eta, l1Phi, minDRL1, l1ThresholdsVec) =
342 matchL1Container<xAOD::JetRoI>(
345 ->
const std::vector<std::string>& {
346 return getL1JetThresholds(
r);
348 l1LegTokens,
m_l1dR.value());
365 float minDRHLT =
m_hltDR.value();
366 std::set<int> HLTThresholds = {};
368 for (std::size_t i = 0; i <
m_jetLegs.size(); ++i) {
369 const int legThreshold =
m_jetLegs[i].threshold;
370 const std::vector<const xAOD::IParticle*>& candidates =
373 for (std::size_t j = 0; j < candidates.size(); ++j) {
375 float dR = jetP4.DeltaR(hlt_jet->
p4());
378 " pt: " << hlt_jet->
pt() <<
" eta: " << hlt_jet->
eta()
379 <<
" phi: " << hlt_jet->
phi() <<
" dR: " << dR
380 <<
" (fromContainer=" << (j >= nNavCandidates[i])
383 if (bestHLT &&
isSameJet(bestHLT, hlt_jet))
384 HLTThresholds.insert(legThreshold);
385 else if (dR < minDRHLT) {
388 HLTThresholds.clear();
389 HLTThresholds.insert(legThreshold);
399 std::vector<int> hltThresh;
401 hltThresh = std::vector<int>(HLTThresholds.begin(),
402 HLTThresholds.end());
406 <<
" Trigger: " <<
m_trigger <<
" bestHLT pT: "
407 << (bestHLT ? bestHLT->
pt() : -99.));
411 return StatusCode::SUCCESS;
417 return (jet1->
p4().DeltaR(jet2->
p4()) < 0.01) && (std::abs(jet1->
pt() - jet2->
pt()) < 100);
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_MSG_DEBUG(x,...)
SysListHandle m_systematicsList
the systematics list we run
ToolHandle< TrigConf::ITrigConfigTool > m_trigConfigTool
Gaudi::Property< bool > m_doHLTMatching
Gaudi::Property< float > m_l1dR
Gaudi::Property< bool > m_useEmulationTool
Gaudi::Property< bool > m_usePhaseIL1
CP::SysWriteDecorHandle< std::vector< int > > m_L1Threshold_decor
CP::SysWriteDecorHandle< float > m_HLTPt_decor
CP::SysWriteDecorHandle< float > m_HLTPhi_decor
CP::SysWriteDecorHandle< std::vector< int > > m_HLTThreshold_decor
ToolHandle< Trig::ITrigBtagEmulationTool > m_emulationTool
bool isSameJet(const xAOD::IParticle *jet1, const xAOD::IParticle *jet2) const
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_L1JetsPhaseIInKey
Gaudi::Property< std::vector< std::string > > m_triggerNavBug
CP::SysWriteDecorHandle< float > m_L1Eta_decor
bool m_isNavBugTrigger
whether m_trigger is in m_triggerNavBug
Gaudi::Property< float > m_hltDR
CP::SysWriteDecorHandle< float > m_L1DR_decor
PublicToolHandle< Trig::TrigDecisionTool > m_trigDecisionTool
CP::SysReadHandle< xAOD::JetContainer > m_jetsHandle
SG::ReadHandleKey< xAOD::JetContainer > m_HLTJetsInKey
CP::SysWriteDecorHandle< float > m_HLTEta_decor
Gaudi::Property< std::string > m_trigger
JfexThresholdTable m_jfexThresholdTable
CP::SysWriteDecorHandle< float > m_HLTDR_decor
CP::SysWriteDecorHandle< float > m_L1Et_decor
SG::ReadHandleKey< xAOD::JetRoIContainer > m_L1JetsInKey
Gaudi::Property< std::string > m_l1ThresholdType
StatusCode initialize() override
bool m_warnedMissingChain
whether we already warned about m_trigger missing from the menu
std::vector< JetLeg > m_jetLegs
Gaudi::Property< bool > m_doL1Matching
CP::SysWriteDecorHandle< float > m_L1Phi_decor
the Phase-I L1 jFEX threshold bit-to-name table, taken from the L1 menu, shared by the algorithms dec...
std::vector< std::string > decode(const xAOD::jFexSRJetRoI &roi) const
the names of the menu thresholds whose bits are set in the RoI's thresholdPatterns (empty if the patt...
Helper class that provides access to information about individual legs.
virtual::StatusCode execute()
execute this algorithm
storage of the time histories of all the cells
virtual bool isValid() override final
Can the handle be successfully dereferenced?
HLT chain configuration information.
const std::string & lower_chain_name() const
FeatureRequestDescriptor & setChainGroup(std::string_view chainGroupName)
Set the desired Chain or Chain Group.
FeatureRequestDescriptor & setRestrictRequestToLeg(const int restrictToLegIndex)
Set to -1 by default, indicating that all legs of multi-leg chains are searched.
Class providing the definition of the 4-vector interface.
virtual double eta() const =0
The pseudorapidity ( ) of the particle.
virtual FourMom_t p4() const =0
The full 4-momentum of the particle.
virtual double pt() const =0
The transverse momentum ( ) of the particle.
virtual double phi() const =0
The azimuthal angle ( ) of the particle.
float et8x8() const
The energy deposited in a 0.8x0.8 area around the RoI.
const std::vector< std::string > & thrNames() const
The names of the thresholds passed by jet candidate.
unsigned int et() const
Methods that require combining results or applying scales.
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Select isolated Photons, Electrons and Muons.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
legName(chainName, legCounter)
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
jFexSRJetRoI_v1 jFexSRJetRoI
Define the latest version of the jFexSRJetRoI class.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
a "j" leg of the chain, parsed once in initialize()
Struct containing information on each leg of a chain.