52 <<
") is inconsistent with jetAlgName '" <<
m_jetAlgName.value()
53 <<
"'; both must select JetTaggerLRJ together.");
54 return StatusCode::FAILURE;
60 return StatusCode::SUCCESS;
117 if (cfg.et_bit_length == 0 || cfg.eta_bit_length == 0 ||
118 cfg.phi_bit_length == 0 || cfg.deltaR_lut_length == 0) {
119 ATH_MSG_ERROR(
"JetTaggerLRJ digitization not configured (et/eta/phi/deltaR "
120 "bit length is 0); configure it via GepJetTaggerLRJAlgCfg.");
121 return StatusCode::FAILURE;
125 cfg.computeDerived();
135 ATH_MSG_ERROR(
"LRJSeedSource=WTACone requires LRJWTAConeSeedsKey to be set");
136 return StatusCode::FAILURE;
141 ATH_MSG_ERROR(
"LRJSeedSource=jFexSRJ requires jFexSRJetRoIs to be set");
142 return StatusCode::FAILURE;
147 ATH_MSG_ERROR(
"LRJSeedSource=gFexSRJ requires LRJgFexSRJetRoIs to be set");
148 return StatusCode::FAILURE;
152 return StatusCode::FAILURE;
162 return StatusCode::FAILURE;
165 ATH_MSG_INFO(
"Configured JetTaggerLRJ (v" << cfg.algoVersion
168 <<
"): r2Cut=" << cfg.r2Cut <<
", rMergeCut=" << cfg.rMergeCut
169 <<
", deltaR LUT size=" << cfg.lutR_8b.size());
171 return StatusCode::SUCCESS;
175template <
typename Container,
typename KinFn>
177 const EventContext& ctx,
179 std::vector<Gep::Jet>& seeds)
const {
182 seeds.reserve(seeds.size() +
h->size());
183 for (
const auto* j : *
h) {
184 const auto [pt,
eta,
phi, m] = kin(j);
186 s.vec.SetPtEtaPhiM(pt,
eta,
phi, m);
189 seeds.push_back(std::move(s));
191 return StatusCode::SUCCESS;
203 CHECK(h_outputJets.
record(std::make_unique<xAOD::JetContainer>(),
204 std::make_unique<xAOD::JetAuxContainer>()));
208 CHECK(h_caloClusters.isValid());
209 ATH_MSG_DEBUG(
"Read in " << h_caloClusters->size() <<
" clusters");
211 const auto& clusters = *h_caloClusters;
215 std::vector<Gep::Cluster> gepClusters;
216 std::transform(clusters.cbegin(),
218 std::back_inserter(gepClusters),
219 [](
const auto& cluster){
220 Gep::Cluster c(cluster->p4());
223 c.etaInput = cluster->eta();
224 c.phiInput = cluster->phi();
230 std::unique_ptr<Gep::IJetMaker> jetMaker{};
241 CHECK(h_seeds.isValid());
247 auto WTAConeJetMaker = std::make_unique<Gep::WTAConeJetMaker>();
249 #ifdef FLOATING_POINT_SIMULATION
250 WTAConeJetMaker->m_GEPWTAParameters.SetConstEtCut(
m_WTAConstEtCut * Athena::Units::GeV);
251 WTAConeJetMaker->m_GEPWTAParameters.SetSeedEtCut(
m_WTASeedEtCut * Athena::Units::GeV);
252 WTAConeJetMaker->m_GEPWTAParameters.SetJet_dR(
m_WTAJet_dR);
253 WTAConeJetMaker->m_GEPWTAParameters.SetIso_dR(
m_WTAJet_dR);
256 WTAConeJetMaker->m_GEPWTAParameters.SetConstEtCut(
static_cast<unsigned int>(
m_WTAConstEtCut * Athena::Units::GeV / LSB));
257 WTAConeJetMaker->m_GEPWTAParameters.SetSeedEtCut(
static_cast<unsigned int>(
m_WTASeedEtCut * Athena::Units::GeV / LSB));
258 WTAConeJetMaker->m_GEPWTAParameters.SetJet_dR(
static_cast<unsigned int>(
m_WTAJet_dR * 10));
259 WTAConeJetMaker->m_GEPWTAParameters.SetIso_dR(
static_cast<unsigned int>(
m_WTAJet_dR * 10));
266 WTAConeJetMaker->SetSeedCleaningAlgo(0);
269 jetMaker = std::move(WTAConeJetMaker);
281 std::vector<Gep::Jet> lrjSeeds;
286 return std::tuple{j->pt(), j->eta(), j->phi(), j->m()};
292 return std::tuple{
static_cast<double>(j->et()),
static_cast<double>(j->eta()),
static_cast<double>(j->phi()), 0.0};
298 return std::tuple{
static_cast<double>(j->et()),
static_cast<double>(j->eta()),
static_cast<double>(j->phi()), 0.0};
302 ATH_MSG_DEBUG(
"JetTaggerLRJ loaded " << lrjSeeds.size() <<
" seeds ("
311 const std::vector<Gep::Cluster>& lrjConstituents = gepClusters;
314 std::vector<Gep::LargeRJet> lrjs =
m_lrjMaker.makeLargeRJets(lrjSeeds, lrjConstituents);
315 ATH_MSG_DEBUG(
"JetTaggerLRJ produced " << lrjs.size() <<
" large-R jets");
318 for (
const auto& lrj : lrjs) {
319 std::unique_ptr<xAOD::Jet> xAODJet{
new xAOD::Jet()};
321 h_outputJets->push_back(std::move(xAODJet));
324 p4.SetPt (lrj.vec.Pt());
325 p4.SetEta(lrj.vec.Eta());
326 p4.SetPhi(lrj.vec.Phi());
327 p4.SetM (lrj.vec.M());
330 p->setAttribute(
"RCut", lrj.radius);
331 p->setAttribute(
"SeedEt", lrj.seedEt);
332 p->setAttribute(
"SeedEta", lrj.seedEta);
333 p->setAttribute(
"SeedPhi", lrj.seedPhi);
334 p->setAttribute(
"NSubjets", lrj.nSubjets);
335 p->setAttribute(
"Psi_R", lrj.psi_R);
336 p->setAttribute(
"Tau_1", lrj.tau_1);
337 p->setAttribute(
"Tau_2", lrj.tau_2);
338 p->setAttribute(
"Tau_21", lrj.tau_21);
339 p->setAttribute(
"MassApprox", lrj.massApprox);
344 for (
size_t is = 0; is < lrj.subjet_et.size(); ++is) {
345 const std::string s = std::to_string(is);
346 p->setAttribute(std::string(
"SubjetEt") + s, lrj.subjet_et[is]);
347 p->setAttribute(std::string(
"SubjetEta") + s, lrj.subjet_eta[is]);
348 p->setAttribute(std::string(
"SubjetPhi") + s, lrj.subjet_phi[is]);
354 for (
const int i : lrj.constituentsIndices) {
355 p->addConstituent(clusters.at(i));
359 return StatusCode::SUCCESS;
363 return StatusCode::FAILURE;
368 std::vector<Gep::Jet> gepJets = jetMaker->makeJets( gepClusters );
374 if( gepJets.empty() ){
375 return StatusCode::SUCCESS;
379 for(
const auto& gjet: gepJets){
381 std::unique_ptr<xAOD::Jet> xAODJet{
new xAOD::Jet()};
387 h_outputJets->push_back(std::move(xAODJet));
390 p4.SetPt(gjet.vec.Pt());
391 p4.SetEta(gjet.vec.Eta());
392 p4.SetPhi(gjet.vec.Phi());
393 p4.SetM(gjet.vec.M());
413 for (
const auto& i: gjet.constituentsIndices) {
419 return StatusCode::SUCCESS;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Header file for AthHistogramAlgorithm.
An algorithm that can be simultaneously executed in multiple threads.
Gaudi::Property< unsigned int > m_LRJEtBitLength
Gaudi::Property< unsigned int > m_LRJNumSubjetsLength
Gaudi::Property< float > m_LRJEtMax
Gaudi::Property< bool > m_LRJWriteSubjetKinematics
Gaudi::Property< float > m_LRJEtMin
StatusCode configureLRJMaker()
Gaudi::Property< float > m_LRJPhiMin
Gaudi::Property< float > m_LRJInputEtToGeV
Gaudi::Property< unsigned int > m_LRJNSeedsOutput
Gaudi::Property< float > m_LRJPhiMax
Gaudi::Property< bool > m_LRJMinEtSeedPosOptimization
StatusCode loadLRJSeeds(const SG::ReadHandleKey< Container > &key, const EventContext &ctx, KinFn &&kin, std::vector< Gep::Jet > &seeds) const
Gaudi::Property< float > m_WTAJet_dR
SG::ReadHandleKey< xAOD::jFexSRJetRoIContainer > m_jFexSRJetsKey
Gaudi::Property< float > m_WTASeedEtCut
Gaudi::Property< float > m_WTAConstEtCut
Gaudi::Property< bool > m_LRJWriteConstituentIndices
Gaudi::Property< std::string > m_jetAlgName
Gaudi::Property< unsigned int > m_LRJEtaBitLength
virtual StatusCode initialize() override
Gaudi::Property< unsigned int > m_LRJNSeedsInput
Gaudi::Property< unsigned int > m_LRJMassApproxBitLength
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_caloClustersKey
SG::ReadHandleKey< xAOD::gFexJetRoIContainer > m_lrjGFexSRJetsKey
virtual StatusCode execute(const EventContext &) const override
Gaudi::Property< std::string > m_WTASeedCleaningName
Gaudi::Property< unsigned int > m_WTABlockN
Gaudi::Property< unsigned int > m_WTAMaxConstN
Gaudi::Property< std::string > m_LRJSeedSource
Gaudi::Property< unsigned int > m_WTAMaxSeedSortingN
Gaudi::Property< unsigned int > m_LRJAlgoVersion
Gaudi::Property< float > m_LRJEtaMax
Gaudi::Property< unsigned int > m_LRJNSubjetinessBitLength
Gaudi::Property< float > m_LRJSubjetEtThresholdGeV
SG::WriteHandleKey< xAOD::JetContainer > m_outputGepJetsKey
Gaudi::Property< unsigned int > m_LRJNProtoSeeds
Gaudi::Property< float > m_LRJJetR
GepJetAlg(const std::string &name, ISvcLocator *pSvcLocator)
Gaudi::Property< bool > m_LRJWriteSubstructure
Gaudi::Property< bool > m_LRJEnableEtWeightedMidpoint
Gaudi::Property< unsigned int > m_LRJPsiRBitLength
Gaudi::Property< std::string > m_LRJConstSource
Gaudi::Property< float > m_LRJMassApproxMax
Gaudi::Property< bool > m_LRJEnableOverlapRemoval
Gaudi::Property< float > m_LRJDSearch
Gaudi::Property< float > m_LRJMinEtSeedPosOptCutGeV
Gaudi::Property< bool > m_configureLRJMaker
Gaudi::Property< unsigned int > m_LRJPhiBitLength
Gep::JetTaggerLRJMaker m_lrjMaker
Gaudi::Property< unsigned int > m_LRJDeltaRLutLength
Gaudi::Property< float > m_LRJEtaMin
Gaudi::Property< unsigned int > m_LRJMaxObjectsConsidered
SG::ReadHandleKey< xAOD::JetContainer > m_lrjWTAConeSeedsKey
Property holding a SG store/key/clid from which a ReadHandle is made.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
void setAttribute(const std::string &name, const T &v)
void addConstituent(const ElementLink< IParticleContainer > &link, float weight=1.0)
Add a constituent directly in the ElementLink format.
void setJetP4(const JetFourMom_t &p4)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Jet_v1 Jet
Definition of the current "jet version".
gFexJetRoI_v1 gFexJetRoI
Define the latest version of the gFexJetRoI class.
jFexSRJetRoI_v1 jFexSRJetRoI
Define the latest version of the jFexSRJetRoI class.
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.