EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
JetReconstruction.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) 2024 Derek Anderson, Zhongling Ji, Dmitry Kalinkin, John Lajoie
3
4#pragma once
5
6#include <algorithms/algorithm.h>
7#include <edm4eic/EDM4eicVersion.h>
8#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 9, 0)
9#include <edm4eic/JetCollection.h>
10#else
11#include <edm4eic/ReconstructedParticleCollection.h>
12#endif
13#include <edm4hep/EventHeaderCollection.h>
14#include <fastjet/AreaDefinition.hh>
15#include <fastjet/JetDefinition.hh>
16#include <map>
17#include <memory>
18#include <string>
19#include <string_view>
20#include <utility>
21
23// for algorithm configuration
26
27namespace eicrecon {
28
29#if EDM4EIC_BUILD_VERSION >= EDM4EIC_VERSION(8, 9, 0)
30using JetOutputCollection = edm4eic::JetCollection;
31#else
32using JetOutputCollection = edm4eic::ReconstructedParticleCollection;
33#endif
34
35template <typename InputT>
36using JetReconstructionAlgorithm = algorithms::Algorithm<
37 algorithms::Input<edm4hep::EventHeaderCollection, typename InputT::collection_type>,
38 algorithms::Output<JetOutputCollection>>;
39
40template <typename InputT>
42 public WithPodConfig<JetReconstructionConfig> {
43
44public:
45 JetReconstruction(std::string_view name)
47 name,
48 {"eventHeaderCollection", "inputReconstructedParticles"},
49 {"outputReconstructedParticles"},
50 "Performs jet reconstruction using a FastJet algorithm."} {}
51
52public:
53 // algorithm initialization
54 void init() final;
55
56 // run algorithm
57 void process(const typename eicrecon::JetReconstructionAlgorithm<InputT>::Input&,
58 const typename eicrecon::JetReconstructionAlgorithm<InputT>::Output&) const final;
59
60private:
61 // fastjet components
62 std::unique_ptr<fastjet::JetDefinition> m_jet_def;
63 std::unique_ptr<fastjet::AreaDefinition> m_area_def;
64 std::unique_ptr<fastjet::JetDefinition::Plugin> m_jet_plugin;
65
66 // maps of user input onto fastjet options
67 std::map<std::string, fastjet::JetAlgorithm> m_mapJetAlgo = {
68 {"kt_algorithm", fastjet::JetAlgorithm::kt_algorithm},
69 {"cambridge_algorithm", fastjet::JetAlgorithm::cambridge_algorithm},
70 {"antikt_algorithm", fastjet::JetAlgorithm::antikt_algorithm},
71 {"genkt_algorithm", fastjet::JetAlgorithm::genkt_algorithm},
72 {"cambridge_for_passive_algorithm", fastjet::JetAlgorithm::cambridge_for_passive_algorithm},
73 {"genkt_for_passive_algorithm", fastjet::JetAlgorithm::genkt_for_passive_algorithm},
74 {"ee_kt_algorithm", fastjet::JetAlgorithm::ee_kt_algorithm},
75 {"ee_genkt_algorithm", fastjet::JetAlgorithm::ee_genkt_algorithm},
76 {"plugin_algorithm", fastjet::JetAlgorithm::plugin_algorithm}};
77 std::map<std::string, fastjet::RecombinationScheme> m_mapRecombScheme = {
78 {"E_scheme", fastjet::RecombinationScheme::E_scheme},
79 {"pt_scheme", fastjet::RecombinationScheme::pt_scheme},
80 {"pt2_scheme", fastjet::RecombinationScheme::pt2_scheme},
81 {"Et_scheme", fastjet::RecombinationScheme::Et_scheme},
82 {"Et2_scheme", fastjet::RecombinationScheme::Et2_scheme},
83 {"BIpt_scheme", fastjet::RecombinationScheme::BIpt_scheme},
84 {"BIpt2_scheme", fastjet::RecombinationScheme::BIpt2_scheme},
85 {"WTA_pt_scheme", fastjet::RecombinationScheme::WTA_pt_scheme},
86 {"WTA_modp_scheme", fastjet::RecombinationScheme::WTA_modp_scheme},
87 {"external_scheme", fastjet::RecombinationScheme::external_scheme}};
88 std::map<std::string, fastjet::AreaType> m_mapAreaType = {
89 {"active_area", fastjet::AreaType::active_area},
90 {"active_area_explicit_ghosts", fastjet::AreaType::active_area_explicit_ghosts},
91 {"one_ghost_passive_area", fastjet::AreaType::one_ghost_passive_area},
92 {"passive_area", fastjet::AreaType::passive_area},
93 {"voronoi_area", fastjet::AreaType::voronoi_area}};
94
95 // default fastjet options
96 const struct defaults {
97 std::string jetAlgo;
98 std::string recombScheme;
99 std::string areaType;
100 } m_defaultFastjetOpts = {"antikt_algorithm", "E_scheme", "active_area"};
101
102 // unique ID service for generating reproducible seeds
103 const algorithms::UniqueIDGenSvc& m_uid = algorithms::UniqueIDGenSvc::instance();
104
105}; // end JetReconstruction definition
106
107} // namespace eicrecon
Definition UniqueIDGenSvc.h:23
Definition JetReconstruction.h:42
JetReconstruction(std::string_view name)
Definition JetReconstruction.h:45
void init() final
Definition JetReconstruction.cc:32
void process(const typename eicrecon::JetReconstructionAlgorithm< InputT >::Input &, const typename eicrecon::JetReconstructionAlgorithm< InputT >::Output &) const final
Definition JetReconstruction.cc:108
Definition WithPodConfig.h:22
-client
Definition CalorimeterClusterRecoCoG.cc:37
edm4eic::JetCollection JetOutputCollection
Definition JetReconstruction.h:30
algorithms::Algorithm< algorithms::Input< edm4hep::EventHeaderCollection, typename InputT::collection_type >, algorithms::Output< JetOutputCollection > > JetReconstructionAlgorithm
Definition JetReconstruction.h:38
Definition SimCalorimeterHitProcessor.cc:35