47 return StatusCode::SUCCESS;
58 std::regex l1NameParser(
"(\\d*)(J)(\\d*)((p|\\.)(\\d*)ETA(\\d*))?");
73 std::unordered_map<std::string, std::vector<std::pair<const xAOD::Jet*, bool>>> emulatedJets = {};
93 float minDRL1 =
m_dR.value();
94 std::set<int> L1Thresholds = {};
98 for (
const auto l1_jet : *l1Jets) {
99 TLorentzVector l1_jet_p4;
100 l1_jet_p4.SetPtEtaPhiM(l1_jet->et8x8(), l1_jet->eta(), l1_jet->phi(), 0.);
101 float dR =
jet->p4().DeltaR(l1_jet_p4);
106 std::vector<std::string> thrNames = l1_jet->
thrNames();
107 std::stringstream
ss(std::regex_replace(l1Name, std::regex(
"-"),
"_"));
111 while (getline(
ss, legName,
'_')) {
112 if (std::regex_match(legName,
match, l1NameParser)) {
113 std::string legName_noMultiplicity =
match[2].str() +
match[3].str() +
match[4].str();
116 for (
const auto &thr : thrNames) {
117 if (thr == legName_noMultiplicity)
131 std::vector<int> l1Thresh;
132 if(bestL1) l1Thresh = std::vector<int>(L1Thresholds.begin(), L1Thresholds.end());
142 float minDRHLT =
m_dR.value();
143 std::set<int> HLTThresholds = {};
149 if (legInfo.signature ==
"j") {
151 <<
" " << legInfo.legName() <<
" "
152 << legInfo.type() <<
" " << legInfo.signature
153 <<
" " << legInfo.threshold);
160 auto hlt_emulated_jets = emulatedJets[legInfo.legName()];
161 ANA_MSG_DEBUG(
" Emulated jets for " << legInfo.legName() <<
": " << hlt_emulated_jets.size());
163 for (
const auto& [hlt_jet, passBtag]: hlt_emulated_jets) {
164 float dR =
jet->p4().DeltaR(hlt_jet->p4());
166 <<
" eta: " << hlt_jet->eta()
167 <<
" phi: " << hlt_jet->phi()
170 if (bestHLT &&
isSameJet(bestHLT, hlt_jet))
171 HLTThresholds.insert(legInfo.threshold);
172 else if (dR < minDRHLT) {
175 HLTThresholds.clear();
176 HLTThresholds.insert(legInfo.threshold);
188 std::vector<const xAOD::IParticle*> allHLTJets;
190 for (
const auto& hlt_jet_link : hlt_jetsFromtrigDec) {
192 if (!hlt_jetFromtrigDec)
continue;
193 allHLTJets.push_back(hlt_jetFromtrigDec);
200 for (
const xAOD::Jet* jetFromCont : *hltJetsFromCont) {
201 bool alreadyIn =
false;
208 if (alreadyIn)
continue;
210 allHLTJets.push_back(jetFromCont);
212 << jetFromCont->pt() <<
" eta=" << jetFromCont->eta()
213 <<
" phi=" << jetFromCont->phi());
218 float dR =
jet->p4().DeltaR(hlt_jet->p4());
219 bool fromtrigDec =
false;
220 for (
const auto& hlt_jet_link : hlt_jetsFromtrigDec) {
221 if (*hlt_jet_link.link == hlt_jet) {
228 << hlt_jet->pt() <<
" eta: " << hlt_jet->eta()
229 <<
" phi: " << hlt_jet->phi() <<
" dR: " << dR
230 <<
" (fromContainer=" << !fromtrigDec <<
")");
232 if (bestHLT &&
isSameJet(bestHLT, hlt_jet))
233 HLTThresholds.insert(legInfo.threshold);
234 else if (dR < minDRHLT)
238 HLTThresholds.clear();
239 HLTThresholds.insert(legInfo.threshold);
253 std::vector<int> hltThresh;
254 if(bestHLT) hltThresh = std::vector<int>(HLTThresholds.begin(), HLTThresholds.end());
258 << (bestHLT ? bestHLT->
pt() : -99.));
263 return StatusCode::SUCCESS;
270 return (jet1->
p4().DeltaR(jet2->
p4()) < 0.01) && (std::abs(jet1->
pt() - jet2->
pt()) < 100);
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SysListHandle m_systematicsList
the systematics list we run
Gaudi::Property< bool > m_doHLTMatching
JetTriggerDecoratorAlg(const std::string &name, ISvcLocator *svcLoc=nullptr)
Gaudi::Property< bool > m_useEmulationTool
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
Gaudi::Property< std::vector< std::string > > m_triggerNavBug
CP::SysWriteDecorHandle< float > m_L1Eta_decor
StatusCode execute() override
CP::SysWriteDecorHandle< float > m_L1DR_decor
CP::SysReadHandle< xAOD::JetContainer > m_jetsHandle
SG::ReadHandleKey< xAOD::JetContainer > m_HLTJetsInKey
CP::SysWriteDecorHandle< float > m_HLTEta_decor
Gaudi::Property< std::string > m_trigger
Gaudi::Property< float > m_dR
ToolHandle< Trig::TrigDecisionTool > m_trigDecisionTool
CP::SysWriteDecorHandle< float > m_HLTDR_decor
CP::SysWriteDecorHandle< float > m_L1Et_decor
SG::ReadHandleKey< xAOD::JetRoIContainer > m_L1JetsInKey
StatusCode initialize() override
Gaudi::Property< bool > m_doL1Matching
CP::SysWriteDecorHandle< float > m_L1Phi_decor
Helper class that provides access to information about individual legs.
AnaAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
constructor with parameters
virtual bool isValid() override final
Can the handle be successfully dereferenced?
HLT chain configuration information.
const std::string & lower_chain_name() const
FeatureRequestDescriptor & setChainGroup(const std::string &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.
float eta() const
The pseudorapidity ( ) of the jet candidate.
float phi() const
The azimuthal angle ( ) of the jet candidate.
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Select isolated Photons, Electrons and Muons.
This module defines the arguments passed from the BATCH driver to the BATCH worker.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Jet_v1 Jet
Definition of the current "jet version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
Struct containing information on each leg of a chain.