diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetCondition.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetCondition.h new file mode 100644 index 0000000000000000000000000000000000000000..5ff7487c70f89a6cb599f9155b615435f45c4443 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetCondition.h @@ -0,0 +1,75 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGHLTJETHYPO_DIJETCONDITION_H +#define TRIGHLTJETHYPO_DIJETCONDITION_H + +/******************************************************************** + * + * NAME: DijetCondition.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * AUTHOR: P. Sherwood + * CREATED: March 21, 2015 + * + *********************************************************************/ + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICondition.h" + + +class DijetCondition: public ICondition{ + public: + DijetCondition( + double etThreshold0, + double etThreshold1, + double etaMin0, + double etaMax0, + double etaMin1, + double etaMax1, + double massMin, + double massMax, + double detaMin, + double detaMax, + double dphiMin, + double dphiMax + ); + + ~DijetCondition() override {} + + bool isSatisfied(const HypoJetVector&) const override; + + double orderingParameter() const noexcept override; + + std::string toString() const noexcept override; + + private: + + bool passJetCuts(pHypoJet, pHypoJet) const; + bool passDijetCuts(pHypoJet, pHypoJet) const; + + + // individual jet cut values + double m_etThreshold0; + double m_etThreshold1; + + double m_etaMin0; + double m_etaMax0; + + double m_etaMin1; + double m_etaMax1; + + // dijet cut values + double m_massMin; + double m_massMax; + + double m_detaMin; + double m_detaMax; + + double m_dphiMin; + double m_dphiMax; + +}; + +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetDPhiCondition.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetDPhiCondition.h new file mode 100644 index 0000000000000000000000000000000000000000..984d5b2eb74655ac43f3973f8207d025999628e4 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetDPhiCondition.h @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGHLTJETHYPO_DIJETDPHICONDITION_H +#define TRIGHLTJETHYPO_DIJETDPHICONDITION_H + +/******************************************************************** + * + * NAME: DijetDPhiCondition.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * AUTHOR: P. Sherwood + * CREATED: January, 2018 + * + *********************************************************************/ + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/IJet.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ICondition.h" + + +class DijetDPhiCondition: public ICondition{ + public: + DijetDPhiCondition(const std::vector<double>& dPhiMins, + const std::vector<double>& dPhiMaxs); + + + ~DijetDPhiCondition() override {} + + bool isSatisfied(const HypoJetVector&) const override; + + double orderingParameter() const noexcept override; + + std::string toString() const noexcept override; + + private: + + double m_dPhiMin; + double m_dPhiMax; +}; + +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h index e55828494a669f9ac714eb68b34027938383b70e..92078f82269f0328f5fc45aa584dc8f0a15a4d51 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h @@ -30,6 +30,21 @@ Conditions conditionsFactorysinglemass(const std::vector<double>& etasMin, const std::vector<double>& jetMassMin, const std::vector<double>& jetMassMax); + +Conditions conditionsFactoryDijet(const std::vector<double>& etThresholds1, + const std::vector<double>& etThresholds2, + const std::vector<double>& etaMins1, + const std::vector<double>& etaMaxs1, + const std::vector<double>& etaMins2, + const std::vector<double>& etaMaxs2, + const std::vector<double>& massMins, + const std::vector<double>& massMaxs, + const std::vector<double>& detaMins, + const std::vector<double>& detaMaxs, + const std::vector<double>& dphiMins, + const std::vector<double>& dphiMaxs); + + // for conditionsFactory2 Conditions conditionsFactoryDijetEtaMass(const std::vector<double>& etasMin, const std::vector<double>& etasMax, @@ -48,6 +63,10 @@ Conditions conditionsFactoryDijetEtaMass(double etasMin, double massesMax); +Conditions conditionsFactoryDijetDPhi(const std::vector<double>& dPhiMins, + const std::vector<double>& dPhiMaxs); + + Conditions conditionsFactoryTLA(const std::vector<double>& etasMin, const std::vector<double>& etasMax, const std::vector<double>& ystarsMin, diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypo_Dijet.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypo_Dijet.h new file mode 100644 index 0000000000000000000000000000000000000000..94233628f18afe81578a17aee2aa834d4fb9c426 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypo_Dijet.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGHLTJETHYPO_DIJET_H +#define TRIGHLTJETHYPO_DIJET_H +/******************************************************************** + * + * NAME: Trighltjethypo_Dijet.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * AUTHOR: P. Sherwood + * + * + * Selects events with dijet pairs. + *********************************************************************/ + +#include "TrigHLTJetHypo/TrigHLTJetHypoBase.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" + +class TrigHLTJetHypo_Dijet : public TrigHLTJetHypoBase { + + public: + + TrigHLTJetHypo_Dijet(const std::string& name, + ISvcLocator* pSvcLocator); + HLT::ErrorCode hltInitialize(); + + ~TrigHLTJetHypo_Dijet(); + + + std::vector<std::shared_ptr<ICleaner>> getCleaners() const override; + Conditions getConditions() const override; + std::shared_ptr<IJetGrouper> getJetGrouper() const override; + bool checkVals() const override; + + private: + + std::vector<double> m_EtThresholds1; + std::vector<double> m_EtThresholds2; + std::vector<double> m_etaMins1; + std::vector<double> m_etaMaxs1; + std::vector<double> m_etaMins2; + std::vector<double> m_etaMaxs2; + std::vector<double> m_massMins; + std::vector<double> m_massMaxs; + std::vector<double> m_dEtaMins; + std::vector<double> m_dEtaMaxs; + std::vector<double> m_dPhiMins; + std::vector<double> m_dPhiMaxs; + +}; +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypo_DijetMassDEtaDPhi.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypo_DijetMassDEtaDPhi.h new file mode 100644 index 0000000000000000000000000000000000000000..1799cba1dc69542fd12e4ed1fbfc5ef48942f321 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypo_DijetMassDEtaDPhi.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGHLTJETHYPO_DIJETMASSDETADPHI_H +#define TRIGHLTJETHYPO_DIJETMASSDETADPHI_H +/******************************************************************** + * + * NAME: Trighltjethypo_DijetMassDetaDPhi.h + * PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo + * + * AUTHOR: P. Sherwood + * + * + *********************************************************************/ + +#include "TrigHLTJetHypo/TrigHLTJetHypo_DijetMassDEta.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsDefs.h" + +class TrigHLTJetHypo_DijetMassDEtaDPhi : public TrigHLTJetHypo_DijetMassDEta { + + public: + + TrigHLTJetHypo_DijetMassDEtaDPhi(const std::string& name, + ISvcLocator* pSvcLocator); + + ~TrigHLTJetHypo_DijetMassDEtaDPhi(); + + + Conditions getConditions() const override; + bool checkVals() const override; + + private: + + std::vector<double> m_dPhiMins; + std::vector<double> m_dPhiMaxs; + +}; +#endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigHLTJetHypoConfig.py b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigHLTJetHypoConfig.py index 9d7c292bbd44f51788b8e902c83029bfde424d92..3e7b3e407a860eeda46ade409bd4bae5593226de 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigHLTJetHypoConfig.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/python/TrigHLTJetHypoConfig.py @@ -16,7 +16,12 @@ from TrigHLTJetHypo.TrigHLTJetHypo2Monitoring import ( from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig - +from GaudiKernel.Constants import (VERBOSE, + DEBUG, + INFO, + WARNING, + ERROR, + FATAL,) class TrigHLTJetHypo2 (TrigHLTJetHypoConf.TrigHLTJetHypo2): __slots__ = [] def __init__(self, name, **kwargs): @@ -32,3 +37,127 @@ class TrigHLTJetHypo2 (TrigHLTJetHypoConf.TrigHLTJetHypo2): time = TrigTimeHistToolConfig("HLTJetHypo2_Time") self.AthenaMonTools = [ time, validation, online, cosmic ] + + +class TrigHLTJetHypo_DijetMassDEta ( + TrigHLTJetHypoConf.TrigHLTJetHypo_DijetMassDEta): + __slots__ = [] + def __init__(self, name, **kwargs): + super( TrigHLTJetHypo_DijetMassDEta, self ).__init__( name, **kwargs ) + + if KeepMonitoring(self.chain_name, + JetChainsToKeepMonitoring, + strictComparison=True): + validation = TrigHLTJetHypo2ValidationMonitoring() + online = TrigHLTJetHypo2OnlineMonitoring() + cosmic = TrigHLTJetHypo2CosmicMonitoring() + + time = TrigTimeHistToolConfig("HLTJetHypo_DijetDEta_Time") + + self.AthenaMonTools = [ time, validation, online, cosmic ] + + +class TrigHLTJetHypo_DijetMassDEtaDPhi ( + TrigHLTJetHypoConf.TrigHLTJetHypo_DijetMassDEtaDPhi): + __slots__ = [] + def __init__(self, name, **kwargs): + super( TrigHLTJetHypo_DijetMassDEtaDPhi, self ).__init__( name, **kwargs ) + + if KeepMonitoring(self.chain_name, + JetChainsToKeepMonitoring, + strictComparison=True): + validation = TrigHLTJetHypo2ValidationMonitoring() + online = TrigHLTJetHypo2OnlineMonitoring() + cosmic = TrigHLTJetHypo2CosmicMonitoring() + + time = TrigTimeHistToolConfig("HLTJetHypo_DijetDEtaDPhi_Time") + + self.AthenaMonTools = [ time, validation, online, cosmic ] + + +class TrigHLTJetHypo_EtaEt (TrigHLTJetHypoConf.TrigHLTJetHypo_EtaEt): + __slots__ = [] + def __init__(self, name, **kwargs): + super( TrigHLTJetHypo_EtaEt, self ).__init__( name, **kwargs ) + + if KeepMonitoring(self.chain_name, + JetChainsToKeepMonitoring, + strictComparison=True): + validation = TrigHLTJetHypo2ValidationMonitoring() + online = TrigHLTJetHypo2OnlineMonitoring() + cosmic = TrigHLTJetHypo2CosmicMonitoring() + + time = TrigTimeHistToolConfig("HLTJetHypo_EtaEt_Time") + + self.AthenaMonTools = [ time, validation, online, cosmic ] + + +class TrigHLTJetHypo_SMC (TrigHLTJetHypoConf.TrigHLTJetHypo_SMC): + __slots__ = [] + def __init__(self, name, **kwargs): + super( TrigHLTJetHypo_SMC, self ).__init__( name, **kwargs ) + + if KeepMonitoring(self.chain_name, + JetChainsToKeepMonitoring, + strictComparison=True): + validation = TrigHLTJetHypo2ValidationMonitoring() + online = TrigHLTJetHypo2OnlineMonitoring() + cosmic = TrigHLTJetHypo2CosmicMonitoring() + + time = TrigTimeHistToolConfig("HLTJetHypo_SMC_Time") + + self.AthenaMonTools = [ time, validation, online, cosmic ] + + +class TrigHLTJetHypo_HT (TrigHLTJetHypoConf.TrigHLTJetHypo_HT): + __slots__ = [] + def __init__(self, name, **kwargs): + super( TrigHLTJetHypo_HT, self ).__init__( name, **kwargs ) + + if KeepMonitoring(self.chain_name, + JetChainsToKeepMonitoring, + strictComparison=True): + validation = TrigHLTJetHypo2ValidationMonitoring() + online = TrigHLTJetHypo2OnlineMonitoring() + cosmic = TrigHLTJetHypo2CosmicMonitoring() + + time = TrigTimeHistToolConfig("HLTJetHypo_HT_Time") + + self.AthenaMonTools = [ time, validation, online, cosmic ] + + +class TrigHLTJetHypo_TLA (TrigHLTJetHypoConf.TrigHLTJetHypo_TLA): + __slots__ = [] + def __init__(self, name, **kwargs): + super( TrigHLTJetHypo_TLA, self ).__init__( name, **kwargs ) + + if KeepMonitoring(self.chain_name, + JetChainsToKeepMonitoring, + strictComparison=True): + validation = TrigHLTJetHypo2ValidationMonitoring() + online = TrigHLTJetHypo2OnlineMonitoring() + cosmic = TrigHLTJetHypo2CosmicMonitoring() + + time = TrigTimeHistToolConfig("HLTJetHypo_TLA_Time") + + self.AthenaMonTools = [ time, validation, online, cosmic ] + + + + +class TrigHLTJetHypo_Dijet (TrigHLTJetHypoConf.TrigHLTJetHypo_Dijet): + __slots__ = [] + def __init__(self, name, **kwargs): + super( TrigHLTJetHypo_Dijet, self ).__init__( name, **kwargs ) + + + if KeepMonitoring(self.chain_name, + JetChainsToKeepMonitoring, + strictComparison=True): + validation = TrigHLTJetHypo2ValidationMonitoring() + online = TrigHLTJetHypo2OnlineMonitoring() + cosmic = TrigHLTJetHypo2CosmicMonitoring() + + time = TrigTimeHistToolConfig("HLTJetHypo_Dijet_Time") + + self.AthenaMonTools = [ time, validation, online, cosmic ] diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFDPhiMetJetAllTE.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFDPhiMetJetAllTE.cxx index 6a6e20258142f40d093fb01555663382ab003faf..a7c547ca2ee7cb58c1652d82376e5d68599cae74 100755 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFDPhiMetJetAllTE.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFDPhiMetJetAllTE.cxx @@ -80,13 +80,6 @@ TrigEFDPhiMetJetAllTE::~TrigEFDPhiMetJetAllTE(){ HLT::ErrorCode TrigEFDPhiMetJetAllTE::hltExecute(std::vector<std::vector<HLT::TriggerElement*> >& tes_in, unsigned int output) { - - // if (m_executedEvent_EFDPhiMetJet) { - // if (msgLvl() <= MSG::DEBUG) { - // msg() << MSG::DEBUG << "*** Not Executing this TrigCheckForTracks " << name() << ", already executed" << endmsg; - // } - // return HLT::OK; - // } ATH_MSG_DEBUG("*** Executing this TrigJetHypo : " << name()); @@ -311,11 +304,6 @@ HLT::ErrorCode TrigEFDPhiMetJetAllTE::hltExecute(std::vector<std::vector<HLT::Tr - // attach the bits - // if ( attachFeature(out_te, bits, "passbits") != HLT::OK ) { - // msg() << MSG::ERROR << "Problem attaching TrigPassBits for the Jets " << endmsg; - // } - auto sc = attachFeature(out_te, xBits.release(), "passbits"); if(sc != HLT::OK) { ATH_MSG_ERROR("Could not store TrigPassBits"); @@ -342,12 +330,3 @@ HLT::ErrorCode TrigEFDPhiMetJetAllTE::hltFinalize(){ return HLT::OK; } - -/* PS 9/2/2015 remove as does not appear to do anything useful - bool TrigEFDPhiMetJetAllTE::reset() { - if ( !AllTEAlgo::reset() ) return false; - // m_executedEvent_EFDPhiMetJet = false; - AllTEAlgo::reset(); - return true; - } -*/ diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetCondition.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetCondition.cxx new file mode 100644 index 0000000000000000000000000000000000000000..35928de193f6a74b720f05e1bcd4c84035131101 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetCondition.cxx @@ -0,0 +1,159 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetCondition.h" +#include <sstream> +#include <stdexcept> +#include <TLorentzVector.h> +#include <limits> +// #include <iostream> +DijetCondition::DijetCondition( + double etThreshold0, + double etThreshold1, + double etaMin0, + double etaMax0, + double etaMin1, + double etaMax1, + double massMin, + double massMax, + double detaMin, + double detaMax, + double dphiMin, + double dphiMax + ){ + + m_etThreshold0 = etThreshold0; + m_etThreshold1 = etThreshold1; + m_etaMin0 = etaMin0; + m_etaMax0 = etaMax0; + m_etaMin1 = etaMin1; + m_etaMax1 = etaMax1; + m_massMin = massMin; + m_massMax = massMax; + m_detaMin = detaMin; + m_detaMax = detaMax; + m_dphiMin = dphiMin; + m_dphiMax = dphiMax; +} + + +bool DijetCondition::isSatisfied(const HypoJetVector& ips) const{ + if(ips.size() != 2){ + std::stringstream ss; + ss << "Dijet::isSatisfied must see exactly 2 particles, but received " + << ips.size() + << '\n'; + + throw std::runtime_error(ss.str()); + } + + auto j0 = ips[0]; + auto j1 = ips[1]; + return ( (passJetCuts(j0, j1) or passJetCuts(j1, j0)) and + passDijetCuts(j0, j1)); +} + +bool DijetCondition::passJetCuts(pHypoJet j0, pHypoJet j1) const { + + auto et0 = 0.001 * j0->et(); + auto et1 = 0.001 * j1->et(); + + auto eta0 = j0->eta(); + auto eta1 = j1->eta(); + + auto absEta0 = std::abs(eta0); + auto absEta1 = std::abs(eta1); + + return (m_etThreshold0 <= et0 and + m_etThreshold1 <= et1 and + + m_etaMin0 <= absEta0 and + m_etaMin1 <= absEta1 and + + m_etaMax0 > absEta0 and + m_etaMax1 > absEta1); +} + + +bool DijetCondition::passDijetCuts(pHypoJet j0, pHypoJet j1) const { + + + auto rj0 = 0.001 * (j0 -> p4()); + auto rj1 = 0.001 * (j1 -> p4()); + + auto mass = (rj0 + rj1).M(); + if (m_massMin > mass or mass >= m_massMax){return false;} + + + auto eta0 = j0->eta(); + auto eta1 = j1->eta(); + auto adeta = std::abs(eta0 -eta1); + if (m_detaMin > adeta or adeta >= m_detaMax){return false;} + + + auto dphi = std::abs(rj0.DeltaPhi(rj1)); + if (m_dphiMin > dphi or dphi >= m_dphiMax){return false;} + + return true; + + /* + auto result = test(et0, et1, absEta0, absEta1, dEta, mass); + std::cout << "DijetCondition : " << std::boolalpha << result << '\n' + << std::setprecision(3) << std::scientific + << "jet 0 et " << m_etThreshold0 << " " << et0 << '\n' + << "jet 1 et " << m_etThreshold1 << " " << et1 << '\n' + << "jet 0 eta " << m_etaMin0 << " " << eta0 << " " << m_etaMax0 << '\n' + << "jet 1 eta " << m_etaMin1 << " " << eta1 << " " << m_etaMax1 << '\n' + << "dEta " << m_dEtaMin << " " << dEta << " " << m_dEtaMax << '\n' + << "mass " << m_massMin << " " << mass << " " <<m_massMax << '\n'; + + return result; + */ + +} + +std::string DijetCondition::toString() const noexcept { + std::stringstream ss; + ss << "DijetCondition: " + + << "cuts jet0: " + << "etThreshold " + << m_etThreshold0 + << " etaMin " + << m_etaMin0 + << " etaMax " + << m_etaMax0 + + << " cuts jet1:" + << " etThreshold " + << m_etThreshold1 + << " etaMin " + << m_etaMin1 + << " etaMax " + << m_etaMax1 + + << " mass min: " + << m_massMin + << " mass max: " + << m_massMax + + << " dEta min: " + << m_detaMin + << " dEta max: " + << m_detaMax + + << " dPhi min: " + << m_dphiMin + << " dPhi max: " + << m_dphiMax + + <<'\n'; + + return ss.str(); +} + + +double DijetCondition::orderingParameter() const noexcept { + return m_massMin; +} diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetDPhiCondition.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetDPhiCondition.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0dfb5b8c289ef48656ef3c534ff9286eb7229d46 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/DijetDPhiCondition.cxx @@ -0,0 +1,61 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetDPhiCondition.h" +#include <sstream> +#include <stdexcept> +#include <TLorentzVector.h> +#include <limits> +// #include <iostream> +DijetDPhiCondition::DijetDPhiCondition(const std::vector<double>& dPhiMins, + const std::vector<double>& dPhiMaxs){ + + m_dPhiMin = 0.; + m_dPhiMax = std::numeric_limits<double>::max(); + + if (!dPhiMins.empty()){ + m_dPhiMin = dPhiMins[0]; + } + + if (!dPhiMaxs.empty()){ + m_dPhiMax = dPhiMaxs[0]; + } + +} + +bool DijetDPhiCondition::isSatisfied(const HypoJetVector& ips) const{ + if(ips.size() != 2){ + std::stringstream ss; + ss << "DijetDPhi::isSatisfied must see exactly 2 particles, but received " + << ips.size() + << '\n'; + + throw std::runtime_error(ss.str()); + } + + double dPhi = std::abs( (ips[0]->p4()).DeltaPhi(ips[1]->p4()) ); + + return m_dPhiMin <= dPhi and m_dPhiMax > dPhi; + +} + + +std::string DijetDPhiCondition::toString() const noexcept { + std::stringstream ss; + ss << "DijetDPhiCondition: " + + << " dPhi min: " + << m_dPhiMin + << " dPhi max: " + << m_dPhiMax + << " mass min: " + <<'\n'; + + return ss.str(); +} + + +double DijetDPhiCondition::orderingParameter() const noexcept { + return m_dPhiMin; +} diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/IndexedJetsGrouper.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/IndexedJetsGrouper.cxx index 9838882586f2adb8c07e8a6094888c2b1399a30c..2fb0aa2c56195eaec4f93e5f8cac831398ab50d9 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/IndexedJetsGrouper.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/IndexedJetsGrouper.cxx @@ -28,11 +28,11 @@ IndexedJetsGrouper::IndexedJetsGrouper(const std::vector<unsigned int>& indices) std::string m = "IndexedJetsGrouper: Attempt to iniatialize with an "; m += "empty indices vector"; throw std::out_of_range(m); - - //sort the indices because the last one will be used to - // check there are enough jets to process; - std::sort(m_indices.begin(), m_indices.end()); } + + //sort the indices because the last one will be used to + // check there are enough jets to process; + std::sort(m_indices.begin(), m_indices.end()); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/conditionsFactory2.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/conditionsFactory2.cxx index d4554ca037889112e6696a4e5a974d40967f8b0f..20299f147eed95deb91560997067108c5b3dea34 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/conditionsFactory2.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypoUtils/conditionsFactory2.cxx @@ -17,6 +17,8 @@ #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/SingleJetMassCondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/EtaEtAsymmetricCondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetDEtaMassCondition.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetDPhiCondition.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/DijetCondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HTCondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/TLACondition.h" #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h" @@ -65,6 +67,43 @@ Conditions conditionsFactorysinglemass(const std::vector<double>& etaMins, return conditions; } + +Conditions conditionsFactoryDijet(const std::vector<double>& etThresholds1, + const std::vector<double>& etThresholds2, + const std::vector<double>& etaMins1, + const std::vector<double>& etaMaxs1, + const std::vector<double>& etaMins2, + const std::vector<double>& etaMaxs2, + const std::vector<double>& massMins, + const std::vector<double>& massMaxs, + const std::vector<double>& detaMins, + const std::vector<double>& detaMaxs, + const std::vector<double>& dphiMins, + const std::vector<double>& dphiMaxs){ + + Conditions conditions; + + + for(std::size_t i = 0; i < etThresholds1.size(); ++i){ + std::shared_ptr<ICondition> + pCondition(new DijetCondition(etThresholds1[i], + etThresholds2[i], + etaMins1[i], + etaMaxs1[i], + etaMins2[i], + etaMaxs2[i], + massMins[i], + massMaxs[i], + detaMins[i], + detaMaxs[i], + dphiMins[i], + dphiMaxs[i])); + + conditions.push_back(ConditionBridge(pCondition)); + } + return conditions; +} + Conditions conditionsFactoryDijetEtaMass(const std::vector<double>& etaMins, const std::vector<double>& etaMaxs, const std::vector<double>& etMins, @@ -88,6 +127,19 @@ Conditions conditionsFactoryDijetEtaMass(const std::vector<double>& etaMins, } +Conditions conditionsFactoryDijetDPhi(const std::vector<double>& dPhiMins, + const std::vector<double>& dPhiMaxs){ + + Conditions conditions; + + std::shared_ptr<ICondition> pCondition(new DijetDPhiCondition(dPhiMins, + dPhiMaxs)); + conditions.push_back(ConditionBridge(pCondition)); + + return conditions; +} + + Conditions conditionsFactoryTLA(const std::vector<double>& etaMins, const std::vector<double>& etaMaxs, const std::vector<double>& ystarMins, diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_Dijet.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_Dijet.cxx new file mode 100644 index 0000000000000000000000000000000000000000..439e78489a37b0a913b8a31307713a08118e990f --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_Dijet.cxx @@ -0,0 +1,179 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigHLTJet_Dijet.cxx +// PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo +// +// AUTHOR: P Sherwood +// +// ******************************************************************** + +#include "TrigHLTJetHypo/TrigHLTJetHypo_Dijet.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsSorter.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CombinationsGrouper.h" + +#include <limits> + +TrigHLTJetHypo_Dijet::TrigHLTJetHypo_Dijet(const std::string& name, + ISvcLocator* pSvcLocator): +TrigHLTJetHypoBase(name, pSvcLocator) { + + //Cuts on the individual jets in a pair + + declareProperty("aet_mins", m_EtThresholds1); + declareProperty("bet_mins", m_EtThresholds2); + + declareProperty("aeta_mins", m_etaMins1); + declareProperty("aeta_maxs", m_etaMaxs1); + + declareProperty("beta_mins", m_etaMins2); + declareProperty("beta_maxs", m_etaMaxs2); + + // cuts on the dijet properties. + + declareProperty("m_mins", m_massMins); + declareProperty("m_maxs", m_massMaxs); + + declareProperty("deta_mins", m_dEtaMins); + declareProperty("deta_maxs", m_dEtaMaxs); + + declareProperty("dphi_mins", m_dPhiMins); + declareProperty("dphi_maxs", m_dPhiMaxs); + +} + +TrigHLTJetHypo_Dijet::~TrigHLTJetHypo_Dijet(){ +} + +HLT::ErrorCode TrigHLTJetHypo_Dijet::hltInitialize() +{ + ATH_MSG_INFO("in initialize()"); + // positive inifinities are carrid over from the python config as -1. + for(auto& d : m_etaMaxs1) { + if (d < 0){d = std::numeric_limits<double>::max();} + } + + for(auto& d : m_etaMaxs2) { + if (d < 0){d = std::numeric_limits<double>::max();} + } + + for(auto& d : m_massMaxs) { + if (d < 0){d = std::numeric_limits<double>::max();} + } + + for(auto& d : m_dEtaMaxs) { + if (d < 0){d = std::numeric_limits<double>::max();} + } + + for(auto& d : m_dPhiMaxs) { + if (d < 0){d = std::numeric_limits<double>::max();} + } + + return TrigHLTJetHypoBase::hltInitialize(); +} + + Conditions TrigHLTJetHypo_Dijet::getConditions() const { + + auto conditions = conditionsFactoryDijet(m_EtThresholds1, + m_EtThresholds2, + m_etaMins1, + m_etaMaxs1, + m_etaMins2, + m_etaMaxs2, + m_massMins, + m_massMaxs, + m_dEtaMins, + m_dEtaMaxs, + m_dPhiMins, + m_dPhiMaxs); + + std::sort(conditions.begin(), conditions.end(), ConditionsSorter()); + + ATH_MSG_DEBUG("getConditions() no of conditions " + << conditions.size() + << " no of thresholds " + << m_EtThresholds1.size()); + + for(auto& c : conditions){ATH_MSG_DEBUG(c.toString());} + + return conditions; + } + + + +std::shared_ptr<IJetGrouper> TrigHLTJetHypo_Dijet::getJetGrouper() const{ + + return std::make_shared<CombinationsGrouper>(2); +} + + +bool TrigHLTJetHypo_Dijet::checkVals() const { + + + + std::size_t n_dijets = m_EtThresholds1.size(); + if (n_dijets != m_EtThresholds2.size() or + n_dijets != m_etaMins1.size() or + n_dijets != m_etaMaxs1.size() or + n_dijets != m_etaMins2.size() or + n_dijets != m_etaMaxs2.size() or + n_dijets != m_massMins.size() or + n_dijets != m_massMaxs.size() or + n_dijets != m_dEtaMins.size() or + n_dijets != m_dEtaMaxs.size() or + n_dijets != m_dPhiMins.size() or + n_dijets != m_dPhiMaxs.size() + ){ + ATH_MSG_ERROR(name() + << "dijets configuration inconsistent for " <<n_dijets + << " dijets " + << m_etaMins1.size() << " " + << m_etaMaxs1.size() << " " + << m_etaMins2.size() << " " + << m_etaMaxs2.size() << " " + << m_massMins.size() << " " + << m_massMaxs.size() << " " + << m_dEtaMins.size() << " " + << m_dEtaMaxs.size() << " " + << m_dPhiMins.size() << " " + << m_dPhiMaxs.size() + ); + + return false; + } + + bool multOK = n_dijets > 0; + + if (not multOK){ + ATH_MSG_ERROR(name() << "no dijet cuts specified "); + return false; + } + + bool orderOK = true; + for(std::size_t i = 0; i < n_dijets; ++i){ + if (m_etaMins1[i] > m_etaMaxs1[i]) {orderOK = false;} + if (m_etaMins2[i] > m_etaMaxs2[i]) {orderOK = false;} + if (m_massMins[i] > m_massMaxs[i]) {orderOK = false;} + if (m_dEtaMins[i] > m_dEtaMaxs[i]) {orderOK = false;} + if (m_dPhiMins[i] > m_dPhiMaxs[i]) {orderOK = false;} + } + + if(!orderOK){ + ATH_MSG_ERROR("a lower cut value exceeds an upper cut value "); + return false; + } + + return true; +} + + +std::vector<std::shared_ptr<ICleaner>> TrigHLTJetHypo_Dijet::getCleaners () const { + std::vector<std::shared_ptr<ICleaner>> v; + return v; +} diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_DijetMassDEtaDPhi.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_DijetMassDEtaDPhi.cxx new file mode 100644 index 0000000000000000000000000000000000000000..2a6cef0352173ae97a56cd7e4b8e94d26dbcfdd5 --- /dev/null +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_DijetMassDEtaDPhi.cxx @@ -0,0 +1,65 @@ +/* + Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +*/ + +// ******************************************************************** +// +// NAME: TrigHLTJet_DijetMassDEtaDPhi.cxx +// PACKAGE: Trigger/TrigHypothesis/TrigHLTJetHypo +// +// AUTHOR: P Sherwood +// +// ******************************************************************** + +#include "GaudiKernel/StatusCode.h" +#include "TrigHLTJetHypo/TrigHLTJetHypo_DijetMassDEtaDPhi.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/conditionsFactory2.h" +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/ConditionsSorter.h" + +#include "TrigHLTJetHypo/TrigHLTJetHypoUtils/CombinationsGrouper.h" + + +TrigHLTJetHypo_DijetMassDEtaDPhi::TrigHLTJetHypo_DijetMassDEtaDPhi( +const std::string& name, ISvcLocator* pSvcLocator): +TrigHLTJetHypo_DijetMassDEta(name, pSvcLocator) { + + //Dimass dEta + declareProperty("dPhi_mins", m_dPhiMins); + declareProperty("dPhi_maxs", m_dPhiMaxs); +} + +TrigHLTJetHypo_DijetMassDEtaDPhi::~TrigHLTJetHypo_DijetMassDEtaDPhi(){ +} + + + Conditions TrigHLTJetHypo_DijetMassDEtaDPhi::getConditions() const { + + auto conditions = TrigHLTJetHypo_DijetMassDEta::getConditions(); + auto n_conditions = conditionsFactoryDijetDPhi(m_dPhiMins, m_dPhiMaxs); + + conditions.insert(conditions.end(), + n_conditions.begin(), + n_conditions.end()); + std::sort(conditions.begin(), conditions.end(), ConditionsSorter()); + return conditions; + } + + +bool TrigHLTJetHypo_DijetMassDEtaDPhi::checkVals() const { + + if(!TrigHLTJetHypo_DijetMassDEta::checkVals()){return false;} + + auto ndphis = m_dPhiMaxs.size(); + bool dPhiOK = ndphis == 1; + + if (not dPhiOK){ + ATH_MSG_ERROR(name() << ": phi limit size error, expected 1, found " + << ndphis); + ATH_MSG_ERROR(name() << " dPhi_mins " << m_dPhiMins.size()); + ATH_MSG_ERROR(name() << " dPhi_maxs " << m_dPhiMaxs.size()); + } + + return dPhiOK; +} + diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx index e75c676ac63e7ada5b942d48d3b9a121ee3c17ff..6b4ad114a9a9651af3433fb79ae05503e7ef20eb 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/components/TrigHLTJetHypo_entries.cxx @@ -1,10 +1,13 @@ - #include "TrigHLTJetHypo/TrigHLTJetHypo2.h" #include "TrigHLTJetHypo/TrigEFRazorAllTE.h" #include "TrigHLTJetHypo/TrigEFDPhiMetJetAllTE.h" -// #include "TrigHLTJetHypo/TrigHLTJetHypo_HT.h" - - +#include "TrigHLTJetHypo/TrigHLTJetHypo_Dijet.h" +#include "TrigHLTJetHypo/TrigHLTJetHypo_DijetMassDEta.h" +#include "TrigHLTJetHypo/TrigHLTJetHypo_DijetMassDEtaDPhi.h" +#include "TrigHLTJetHypo/TrigHLTJetHypo_EtaEt.h" +#include "TrigHLTJetHypo/TrigHLTJetHypo_HT.h" +#include "TrigHLTJetHypo/TrigHLTJetHypo_TLA.h" +#include "TrigHLTJetHypo/TrigHLTJetHypo_SMC.h" #include "../TrigJetHypoAlgMT.h" #include "../TrigJetHypoToolConfig_EtaEt.h" #include "../TrigJetHypoToolMT.h" @@ -13,7 +16,14 @@ DECLARE_COMPONENT( TrigHLTJetHypo2 ) DECLARE_COMPONENT( TrigEFRazorAllTE ) DECLARE_COMPONENT( TrigEFDPhiMetJetAllTE ) +DECLARE_COMPONENT( TrigHLTJetHypo_Dijet ) +DECLARE_COMPONENT( TrigHLTJetHypo_DijetMassDEta ) +DECLARE_COMPONENT( TrigHLTJetHypo_DijetMassDEtaDPhi ) +DECLARE_COMPONENT( TrigHLTJetHypo_EtaEt ) +DECLARE_COMPONENT( TrigHLTJetHypo_SMC ) +DECLARE_COMPONENT( TrigHLTJetHypo_HT ) +DECLARE_COMPONENT( TrigHLTJetHypo_TLA ) -DECLARE_COMPONENT(TrigJetHypoAlgMT) -DECLARE_COMPONENT(TrigJetHypoToolMT) -DECLARE_COMPONENT(TrigJetHypoToolConfig_EtaEt) +DECLARE_COMPONENT( TrigJetHypoAlgMT ) +DECLARE_COMPONENT( TrigJetHypoToolMT ) +DECLARE_COMPONENT( TrigJetHypoToolConfig_EtaEt )