Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TICL reconstruction update #31907

Merged
merged 65 commits into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
e0fd35e
Backport of #29837, w/o Configuration/StandardSequences changes
mariadalfonso Apr 1, 2020
48fec35
Backport #30007
felicepantaleo May 28, 2020
e46e054
Backport of #30815
gartung Jul 17, 2020
8f2f836
Backport #31031
Dr15Jones Aug 3, 2020
15b625e
Partial backport of #31013
JamminJones Jul 30, 2020
e46b82f
Created a ClusterFilter by Algo, Size and Layer Range
felicepantaleo Sep 29, 2020
0f4894b
include an Electromagnetic TrackSeeded iteration as first iteration
felicepantaleo Sep 30, 2020
f787aa2
Add the range of layers to the filter parameters
felicepantaleo Sep 30, 2020
b9ab9e7
Inject tracksters from the track seeded electromagnetic interation in…
felicepantaleo Sep 30, 2020
4347004
create empty multiclusters
felicepantaleo Oct 2, 2020
26aa9f5
Add TrkEM tracksters into the Merge collection
rovere Oct 5, 2020
bc34f00
Select trackster-PID also on EM/Total trackster energy ratio
rovere Oct 5, 2020
4f31467
Fix merge conflict.
rovere Oct 5, 2020
8ff5c2d
Fix input collection for TRK iteration to be the output of EM iteration
felicepantaleo Oct 7, 2020
ff3a586
Sorting seeding regions by track momentum
felicepantaleo Oct 7, 2020
d928499
Use only clusters with minimum size of 3
felicepantaleo Oct 7, 2020
70c6b79
Filter only with a maxLayerId in TRKEM iteration.
felicepantaleo Oct 7, 2020
58aea39
Remove MIP iteration
felicepantaleo Oct 7, 2020
88b0d1f
clang format
felicepantaleo Oct 7, 2020
12b8e60
Limit Global EM iteration to layer 30
felicepantaleo Oct 8, 2020
621b988
Limit track seeded iterations to tracks with at most 2 missing outer …
felicepantaleo Oct 8, 2020
3ededa0
Add TrkEM products to EventContent
felicepantaleo Oct 8, 2020
c14afde
Remove missing layers cut for EM based iterations
felicepantaleo Oct 8, 2020
87e3a55
Introducing a shower_start_max_layer cut
felicepantaleo Oct 8, 2020
5bcbd52
raising shower_start_max_layer from 3 to 7 in EM iterations
felicepantaleo Oct 9, 2020
3ea65f4
Count usage of layer clusters, only for those tracksters passing the …
felicepantaleo Oct 9, 2020
c631951
Increasing missing outer hits from 3 to 5
felicepantaleo Oct 12, 2020
8b6864f
increase missing layer from 0 to 1 and loosen min_cos_theta to 0.961 …
felicepantaleo Oct 12, 2020
a62c80e
tighten min_cos_theta from 0.961 to 0.978 in EM iterations
felicepantaleo Oct 12, 2020
b4236de
Rename parameter missing_layers to skip_layers.
felicepantaleo Oct 13, 2020
de00290
Retuning of PR cuts in EM iterations
felicepantaleo Oct 13, 2020
3f970bd
Introducing two cuts: a max_missing_layers_in_trackster and a minimum…
felicepantaleo Oct 13, 2020
2b87632
Refactoring
felicepantaleo Oct 13, 2020
256c445
Update cuts
rovere Oct 13, 2020
e6ab6a9
Make max_missing_layers_in_trackster cut inclusive
felicepantaleo Oct 13, 2020
8fc2b44
code format
felicepantaleo Oct 13, 2020
9562a23
Move trackster energy calculation after the selections are applied
felicepantaleo Oct 13, 2020
21ee285
Add a new max_longitudinal_sigmaPCA cut for EM iterations, with an in…
felicepantaleo Oct 13, 2020
98218d5
Add a new cut: root_doublet_max_distance_from_seed for TrkEM iteratio…
felicepantaleo Oct 13, 2020
e9fbbfc
clang format
felicepantaleo Oct 13, 2020
f31f7da
fix trackster to seed association
felicepantaleo Oct 14, 2020
c25bd47
Setting max_missing_layers_in_trackster to 2 from 0 in EM iterations
felicepantaleo Oct 14, 2020
e59e5a7
Fix compilation error in C++
rovere Oct 14, 2020
da6d868
Remove duplicate python parameter
rovere Oct 14, 2020
b3a4525
Protect against empty multiclusters (was 7f2d245ca24)
rovere Oct 22, 2020
56631af
Sorting seeding regions by pT rather than p
felicepantaleo Oct 16, 2020
22767df
Added TICL PF interpretation.
felicepantaleo Oct 16, 2020
784b132
Feed PFTICL the correct InputTag
felicepantaleo Oct 19, 2020
672e616
Adapt event content
felicepantaleo Oct 19, 2020
1d1783a
Fix hitpattern call
rovere Oct 22, 2020
36d97c1
Code format
rovere Oct 22, 2020
ac0cdff
Backport of #31881
rovere Oct 30, 2020
244b754
Review comments
felicepantaleo Oct 23, 2020
51092c3
Provide EM and HAD fraction in HGCAL for JetMET for calibration
felicepantaleo Oct 30, 2020
a67b0cb
Manual port of f4c1e2f1f7b and 55110b5d259
rovere Oct 30, 2020
de2521e
Code format
rovere Oct 30, 2020
3cbd1ed
assign track momentum direction at point of closest approach instead …
felicepantaleo Nov 1, 2020
bf70afc
Additional review comments
felicepantaleo Nov 1, 2020
7548442
Make track cuts configurable
felicepantaleo Nov 2, 2020
7884c35
Backport of #31730
apsallid May 11, 2020
02d8281
Backport of #32021
apsallid Nov 2, 2020
48bcd31
Remove unused code
felicepantaleo Nov 9, 2020
6bcf479
Backport of #32022
Nov 4, 2020
d5a3616
Backport(partcial) of #31344
rovere Nov 20, 2020
de99de0
Backport(partial) of #30806
rovere Nov 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions DataFormats/HGCalReco/interface/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,20 @@ namespace ticl {
static constexpr int nLayers = 104;
static constexpr int iterations = 4;
static constexpr int nBins = nEtaBins * nPhiBins;
static constexpr int type = 0;
};

struct TileConstantsHFNose {
static constexpr float minEta = 3.0f;
static constexpr float maxEta = 4.2f;
static constexpr int nEtaBins = 24;
static constexpr int nPhiBins = 126;
static constexpr int nLayers = 16; // 8x2
static constexpr int iterations = 4;
static constexpr int nBins = nEtaBins * nPhiBins;
static constexpr int type = 1;
};

} // namespace ticl

namespace ticl {
Expand Down
17 changes: 17 additions & 0 deletions DataFormats/HGCalReco/interface/TICLLayerTile.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class TICLLayerTileT {
tile_[globalBin(eta, phi)].push_back(layerClusterId);
}

int typeT() const { return T::type; }

int etaBin(float eta) const {
constexpr float etaRange = T::maxEta - T::minEta;
static_assert(etaRange >= 0.f);
Expand All @@ -31,6 +33,14 @@ class TICLLayerTileT {
return phiBin;
}

std::array<int, 4> searchBoxEtaPhi(float etaMin, float etaMax, float phiMin, float phiMax) const {
int etaBinMin = etaBin(etaMin);
int etaBinMax = etaBin(etaMax);
int phiBinMin = phiBin(phiMin);
int phiBinMax = phiBin(phiMax);
return std::array<int, 4>({{etaBinMin, etaBinMax, phiBinMin, phiBinMax}});
}

int globalBin(int etaBin, int phiBin) const { return phiBin + etaBin * T::nPhiBins; }

int globalBin(double eta, double phi) const { return phiBin(phi) + etaBin(eta) * T::nPhiBins; }
Expand All @@ -51,6 +61,11 @@ namespace ticl {
using TICLLayerTile = TICLLayerTileT<TileConstants>;
using Tiles = std::array<TICLLayerTile, TileConstants::nLayers>;
using TracksterTiles = std::array<TICLLayerTile, TileConstants::iterations>;

using TICLLayerTileHFNose = TICLLayerTileT<TileConstantsHFNose>;
using TilesHFNose = std::array<TICLLayerTileHFNose, TileConstantsHFNose::nLayers>;
using TracksterTilesHFNose = std::array<TICLLayerTileHFNose, TileConstantsHFNose::iterations>;

} // namespace ticl

template <typename T>
Expand All @@ -68,5 +83,7 @@ class TICLGenericTile {

using TICLLayerTiles = TICLGenericTile<ticl::Tiles>;
using TICLTracksterTiles = TICLGenericTile<ticl::TracksterTiles>;
using TICLLayerTilesHFNose = TICLGenericTile<ticl::TilesHFNose>;
using TICLTracksterTilesHFNose = TICLGenericTile<ticl::TracksterTilesHFNose>;

#endif
14 changes: 14 additions & 0 deletions DataFormats/HGCalReco/src/classes_def.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@
</class>
<class name="edm::Wrapper<TICLGenericTile<ticl::TracksterTiles>>" persistent="false"/>

<class name="ticl::TICLLayerTileHFNose" persistent="false">
<field name="tile_" transient="true"/>
</class>

<class name="TICLGenericTile<ticl::TilesHFNose>" persistent="false">
<field name="tiles_" transient="true"/>
</class>
<class name="edm::Wrapper<TICLGenericTile<ticl::TilesHFNose>>" persistent="false"/>

<class name="TICLGenericTile<ticl::TracksterTilesHFNose>" persistent="false">
<field name="tiles_" transient="true"/>
</class>
<class name="edm::Wrapper<TICLGenericTile<ticl::TracksterTilesHFNose>>" persistent="false"/>

<class name="TICLSeedingRegion" ClassVersion="3">
<version ClassVersion="3" checksum="2409655320"/>
</class>
Expand Down
2 changes: 2 additions & 0 deletions RecoEgamma/EgammaTools/interface/HGCalEgammaIDHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/ESGetToken.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"

Expand Down Expand Up @@ -78,6 +79,7 @@ class HGCalEgammaIDHelper {
edm::EDGetTokenT<HGCRecHitCollection> recHitsEE_;
edm::EDGetTokenT<HGCRecHitCollection> recHitsFH_;
edm::EDGetTokenT<HGCRecHitCollection> recHitsBH_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_;
hgcal::RecHitTools recHitTools_;
bool debug_;
};
Expand Down
4 changes: 3 additions & 1 deletion RecoEgamma/EgammaTools/src/HGCalEgammaIDHelper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ HGCalEgammaIDHelper::HGCalEgammaIDHelper(const edm::ParameterSet& iConfig, edm::
recHitsEE_ = iC.consumes<HGCRecHitCollection>(eeRecHitInputTag_);
recHitsFH_ = iC.consumes<HGCRecHitCollection>(fhRecHitInputTag_);
recHitsBH_ = iC.consumes<HGCRecHitCollection>(bhRecHitInputTag_);
caloGeometry_ = iC.esConsumes<CaloGeometry, CaloGeometryRecord>();
pcaHelper_.setdEdXWeights(dEdXWeights_);
debug_ = iConfig.getUntrackedParameter<bool>("debug", false);
}
Expand All @@ -26,7 +27,8 @@ void HGCalEgammaIDHelper::eventInit(const edm::Event& iEvent, const edm::EventSe
edm::Handle<HGCRecHitCollection> recHitHandleBH;
iEvent.getByToken(recHitsBH_, recHitHandleBH);

recHitTools_.getEventSetup(iSetup);
edm::ESHandle<CaloGeometry> geom = iSetup.getHandle(caloGeometry_);
recHitTools_.setGeometry(*geom);
pcaHelper_.setRecHitTools(&recHitTools_);
isoHelper_.setRecHitTools(&recHitTools_);
pcaHelper_.fillHitMap(*recHitHandleEE, *recHitHandleFH, *recHitHandleBH);
Expand Down
6 changes: 5 additions & 1 deletion RecoHGCal/Configuration/python/RecoHGCal_EventContent_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
'keep *_ticlMultiClustersFromTrackstersEM_*_*',
'keep *_ticlMultiClustersFromTrackstersHAD_*_*',
'keep *_ticlMultiClustersFromTrackstersTrk_*_*',
'keep *_ticlMultiClustersFromTrackstersTrkEM_*_*',
'keep *_ticlMultiClustersFromTrackstersMIP_*_*',
'keep *_ticlMultiClustersFromTrackstersMerge_*_*',
)
Expand All @@ -15,12 +16,15 @@
#RECO content
TICL_RECO = cms.PSet(
outputCommands = cms.untracked.vstring(
'keep *_ticlTrackstersTrkEM_*_*',
'keep *_ticlTrackstersEM_*_*',
'keep *_ticlTrackstersHAD_*_*',
'keep *_ticlTrackstersTrk_*_*',
'keep *_ticlTrackstersMIP_*_*',
'keep *_ticlTrackstersMerge_*_*',
'keep *_ticlCandidateFromTracksters_*_*',
'keep *_ticlTrackstersHFNoseEM_*_*',
'keep *_ticlTrackstersHFNoseMIP_*_*',
'keep *_ticlTrackstersHFNoseMerge_*_*',
'keep *_pfTICL_*_*'
)
)
Expand Down
55 changes: 55 additions & 0 deletions RecoHGCal/TICL/plugins/ClusterFilterByAlgoAndSizeAndLayerRange.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// Authors: Marco Rovere - marco.rovere@cern.ch, Felice Pantaleo - felice.pantaleo@cern.ch
// Date: 09/2020

#ifndef RecoHGCal_TICL_ClusterFilterByAlgoAndSizeAndLayerRange_H__
#define RecoHGCal_TICL_ClusterFilterByAlgoAndSizeAndLayerRange_H__

#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include "ClusterFilterBase.h"

#include <memory>
#include <utility>

// Filter clusters that belong to a specific algorithm
namespace ticl {
class ClusterFilterByAlgoAndSizeAndLayerRange final : public ClusterFilterBase {
public:
ClusterFilterByAlgoAndSizeAndLayerRange(const edm::ParameterSet& ps)
: ClusterFilterBase(ps),
algo_number_(ps.getParameter<int>("algo_number")),
min_cluster_size_(ps.getParameter<int>("min_cluster_size")),
max_cluster_size_(ps.getParameter<int>("max_cluster_size")),
min_layerId_(ps.getParameter<int>("min_layerId")),
max_layerId_(ps.getParameter<int>("max_layerId")) {}
~ClusterFilterByAlgoAndSizeAndLayerRange() override{};

void filter(const std::vector<reco::CaloCluster>& layerClusters,
const HgcalClusterFilterMask& availableLayerClusters,
std::vector<float>& layerClustersMask,
hgcal::RecHitTools& rhtools) const override {
auto filteredLayerClusters = std::make_unique<HgcalClusterFilterMask>();
for (auto const& cl : availableLayerClusters) {
auto const& layerCluster = layerClusters[cl.first];
auto const& haf = layerCluster.hitsAndFractions();
auto layerId = rhtools.getLayerWithOffset(haf[0].first);

if (layerCluster.algo() == algo_number_ and layerId <= max_layerId_ and layerId >= min_layerId_ and
haf.size() <= max_cluster_size_ and
(haf.size() >= min_cluster_size_ or !(rhtools.isSilicon(haf[0].first)))) {
filteredLayerClusters->emplace_back(cl);
} else {
layerClustersMask[cl.first] = 0.;
}
}
}

private:
int algo_number_;
unsigned int min_cluster_size_;
unsigned int max_cluster_size_;
unsigned int min_layerId_;
unsigned int max_layerId_;
};
} // namespace ticl

#endif
14 changes: 11 additions & 3 deletions RecoHGCal/TICL/plugins/FilteredLayerClustersProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/ESGetToken.h"

#include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h"
Expand All @@ -30,6 +31,7 @@ class FilteredLayerClustersProducer : public edm::stream::EDProducer<> {
private:
edm::EDGetTokenT<std::vector<reco::CaloCluster>> clusters_token_;
edm::EDGetTokenT<std::vector<float>> clustersMask_token_;
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeometry_token_;
std::string clusterFilter_;
std::string iteration_label_;
std::unique_ptr<const ticl::ClusterFilterBase> theFilter_;
Expand All @@ -39,26 +41,32 @@ class FilteredLayerClustersProducer : public edm::stream::EDProducer<> {
DEFINE_FWK_MODULE(FilteredLayerClustersProducer);

FilteredLayerClustersProducer::FilteredLayerClustersProducer(const edm::ParameterSet& ps) {
clusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("HGCLayerClusters"));
clusters_token_ = consumes<std::vector<reco::CaloCluster>>(ps.getParameter<edm::InputTag>("LayerClusters"));
clustersMask_token_ = consumes<std::vector<float>>(ps.getParameter<edm::InputTag>("LayerClustersInputMask"));
caloGeometry_token_ = esConsumes<CaloGeometry, CaloGeometryRecord, edm::Transition::BeginRun>();
clusterFilter_ = ps.getParameter<std::string>("clusterFilter");
theFilter_ = ClusterFilterFactory::get()->create(clusterFilter_, ps);
iteration_label_ = ps.getParameter<std::string>("iteration_label");
produces<std::vector<float>>(iteration_label_);
}

void FilteredLayerClustersProducer::beginRun(edm::Run const&, edm::EventSetup const& es) { rhtools_.getEventSetup(es); }
void FilteredLayerClustersProducer::beginRun(edm::Run const&, edm::EventSetup const& es) {
edm::ESHandle<CaloGeometry> geom = es.getHandle(caloGeometry_token_);
rhtools_.setGeometry(*geom);
}

void FilteredLayerClustersProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
// hgcalMultiClusters
edm::ParameterSetDescription desc;
desc.add<edm::InputTag>("HGCLayerClusters", edm::InputTag("hgcalLayerClusters"));
desc.add<edm::InputTag>("LayerClusters", edm::InputTag("hgcalLayerClusters"));
desc.add<edm::InputTag>("LayerClustersInputMask", edm::InputTag("hgcalLayerClusters", "InitialLayerClustersMask"));
desc.add<std::string>("iteration_label", "iterationLabelGoesHere");
desc.add<std::string>("clusterFilter", "ClusterFilterByAlgoAndSize");
desc.add<int>("algo_number", 9);
desc.add<int>("min_cluster_size", 0);
desc.add<int>("max_cluster_size", 9999);
desc.add<int>("min_layerId", 0);
desc.add<int>("max_layerId", 9999);
descriptions.add("filteredLayerClustersProducer", desc);
}

Expand Down
32 changes: 19 additions & 13 deletions RecoHGCal/TICL/plugins/HGCDoublet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,17 @@ int HGCDoublet::areAligned(double xi,

// inner product
auto dot = dx1 * dx2 + dy1 * dy2 + dz1 * dz2;
auto dotsq = dot * dot;
// magnitudes
auto mag1 = std::sqrt(dx1 * dx1 + dy1 * dy1 + dz1 * dz1);
auto mag2 = std::sqrt(dx2 * dx2 + dy2 * dy2 + dz2 * dz2);
// angle between the vectors
auto cosTheta = dot / (mag1 * mag2);
auto mag1sq = dx1 * dx1 + dy1 * dy1 + dz1 * dz1;
auto mag2sq = dx2 * dx2 + dy2 * dy2 + dz2 * dz2;

auto minCosTheta_sq = minCosTheta * minCosTheta;
bool isWithinLimits = (dotsq > minCosTheta_sq * mag1sq * mag2sq);

if (debug) {
LogDebug("HGCDoublet") << "-- Are Aligned -- dot: " << dot << " mag1: " << mag1 << " mag2: " << mag2
<< " cosTheta: " << cosTheta << " isWithinLimits: " << (cosTheta > minCosTheta) << std::endl;
LogDebug("HGCDoublet") << "-- Are Aligned -- dotsq: " << dotsq << " mag1sq: " << mag1sq << " mag2sq: " << mag2sq
<< "minCosTheta_sq:" << minCosTheta_sq << " isWithinLimits: " << isWithinLimits << std::endl;
}

// Now check the compatibility with the pointing origin.
Expand All @@ -102,15 +105,18 @@ int HGCDoublet::areAligned(double xi,
const GlobalVector pointingDir = (seedIndex_ == -1) ? GlobalVector(innerX(), innerY(), innerZ()) : refDir;

auto dot_pointing = pointingDir.dot(firstDoublet);
auto mag_pointing = sqrt(pointingDir.mag2());
auto cosTheta_pointing = dot_pointing / (mag2 * mag_pointing);
auto dot_pointing_sq = dot_pointing * dot_pointing;
auto mag_pointing_sq = pointingDir.mag2();
auto minCosPointing_sq = minCosPointing * minCosPointing;
bool isWithinLimitsPointing = (dot_pointing_sq > minCosPointing_sq * mag_pointing_sq * mag2sq);
if (debug) {
LogDebug("HGCDoublet") << "-- Are Aligned -- dot_pointing: " << dot_pointing << " mag_pointing: " << mag_pointing
<< " mag2: " << mag2 << " cosTheta_pointing: " << cosTheta_pointing
<< " isWithinLimits: " << (cosTheta_pointing > minCosPointing) << std::endl;
LogDebug("HGCDoublet") << "-- Are Aligned -- dot_pointing_sq: " << dot_pointing * dot_pointing
<< " mag_pointing_sq: " << mag_pointing_sq << " mag2sq: " << mag2sq
<< " isWithinLimits: " << isWithinLimitsPointing << std::endl;
}

return (cosTheta > minCosTheta) && (cosTheta_pointing > minCosPointing);
// by squaring cosTheta and multiplying by the squares of the magnitudes
// an equivalent comparison is made without the division and square root which are costly FP ops.
return isWithinLimits && isWithinLimitsPointing;
}

void HGCDoublet::findNtuplets(std::vector<HGCDoublet> &allDoublets,
Expand Down
Loading