7 #include "tbb/task_arena.h" 23 #include "fastjet/ClusterSequence.hh" 28 template <
typename TILES>
33 antikt_radius_(conf.getParameter<double>(
"antikt_radius")),
34 minNumLayerCluster_(conf.getParameter<
int>(
"minNumLayerCluster")),
35 computeLocalTime_(conf.getParameter<
bool>(
"computeLocalTime")){};
37 template <
typename TILES>
39 std::vector<ticl::Trackster> &
result) {
42 <<
"Creating FastJet with " << fjInputs.size() <<
" LayerClusters in input";
44 fastjet::ClusterSequence sequence(fjInputs, JetDefinition(antikt_algorithm, antikt_radius_));
45 auto jets = fastjet::sorted_by_pt(sequence.inclusive_jets(0));
47 edm::LogVerbatim(
"PatternRecogntionbyFastJet") <<
"FastJet produced " <<
jets.size() <<
" jets/trackster";
50 auto trackster_idx =
result.size();
51 auto jetsSize = std::count_if(
jets.begin(),
jets.end(), [
this](fastjet::PseudoJet
jet) {
52 return jet.constituents().size() >
static_cast<unsigned int>(minNumLayerCluster_);
54 result.resize(trackster_idx + jetsSize);
56 for (
const auto &pj :
jets) {
57 if (pj.constituents().size() >
static_cast<unsigned int>(minNumLayerCluster_)) {
58 for (
const auto &component : pj.constituents()) {
59 result[trackster_idx].vertices().push_back(component.user_index());
60 result[trackster_idx].vertex_multiplicity().push_back(1);
63 <<
"Jet has " << pj.constituents().size() <<
" components that are stored in trackster " << trackster_idx;
70 <<
"Jet with " << pj.constituents().size() <<
" constituents discarded since too small wrt " 71 << minNumLayerCluster_;
78 template <
typename TILES>
81 std::vector<Trackster> &
result,
82 std::unordered_map<
int, std::vector<int>> &seedToTracksterAssociation) {
84 if (
input.regions.empty())
89 rhtools_.setGeometry(
geom);
96 auto lastLayerPerSide =
static_cast<unsigned int>(rhtools_.lastLayer(isHFnose)) - 1;
97 unsigned int maxLayer = 2 * lastLayerPerSide - 1;
98 std::vector<fastjet::PseudoJet> fjInputs;
100 for (
unsigned int currentLayer = 0; currentLayer <= maxLayer; ++currentLayer) {
101 if (currentLayer == lastLayerPerSide) {
102 buildJetAndTracksters(fjInputs,
result);
104 const auto &tileOnLayer =
input.tiles[currentLayer];
115 for (
auto clusterIdx : tileOnLayer[
offset +
iphi]) {
117 if (
input.mask[clusterIdx] == 0.) {
119 edm::LogVerbatim(
"PatternRecogntionbyFastJet") <<
"Skipping masked layerIdx " << clusterIdx;
124 auto const &
cl =
input.layerClusters[clusterIdx];
126 direction = direction.Unit();
127 direction *=
cl.energy();
128 auto fpj = fastjet::PseudoJet(direction.X(), direction.Y(), direction.Z(),
cl.energy());
129 fpj.set_user_index(clusterIdx);
130 fjInputs.push_back(fpj);
137 buildJetAndTracksters(fjInputs,
result);
141 input.layerClustersTime,
142 rhtools_.getPositionLayer(rhtools_.lastLayerEE(isHFnose), isHFnose).z(),
149 edm::LogVerbatim(
"PatternRecogntionbyFastJet") <<
"Barycenter: " <<
t.barycenter();
150 edm::LogVerbatim(
"PatternRecogntionbyFastJet") <<
"LCs: " <<
t.vertices().size();
152 edm::LogVerbatim(
"PatternRecogntionbyFastJet") <<
"Regressed: " <<
t.regressed_energy();
157 template <
typename TILES>
159 const std::vector<Trackster> &inTracksters,
161 std::unordered_map<
int, std::vector<int>> &seedToTracksterAssociation) {
165 template <
typename TILES>
167 iDesc.
add<
int>(
"algo_verbosity", 0);
168 iDesc.
add<
double>(
"antikt_radius", 0.09)->
setComment(
"Radius to be used while running the Anti-kt clustering");
169 iDesc.
add<
int>(
"minNumLayerCluster", 5)->setComment(
"Not Inclusive");
170 iDesc.
add<
bool>(
"computeLocalTime",
false);
Log< level::Info, true > LogVerbatim
void setComment(std::string const &value)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void assignPCAtoTracksters(std::vector< Trackster > &tracksters, const std::vector< reco::CaloCluster > &layerClusters, const edm::ValueMap< std::pair< float, float >> &layerClustersTime, double z_limit_em, hgcal::RecHitTools const &rhTools, bool computeLocalTime=false, bool energyWeight=true, bool clean=false, int minLayer=10, int maxLayer=10)
static std::string const input
PatternRecognitionbyFastJet(const edm::ParameterSet &conf, edm::ConsumesCollector)
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void makeTracksters(const typename PatternRecognitionAlgoBaseT< TILES >::Inputs &input, std::vector< Trackster > &result, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation) override
void buildJetAndTracksters(std::vector< fastjet::PseudoJet > &, std::vector< ticl::Trackster > &)
void filter(std::vector< Trackster > &output, const std::vector< Trackster > &inTracksters, const typename PatternRecognitionAlgoBaseT< TILES >::Inputs &input, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation) override
XYZVectorD XYZVector
spatial vector with cartesian internal representation
static constexpr int nPhiBins