forked from cms-sw/cmssw
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ticlv5: Introduce a Passthrough pattern recognition for converting la…
…yerclusters directly to tracksters
- Loading branch information
1 parent
1527313
commit 92e6a7f
Showing
6 changed files
with
149 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Author: Felice Pantaleo - [email protected] | ||
// Date: 05/2024 | ||
|
||
#include <vector> | ||
#include "DataFormats/Math/interface/deltaR.h" | ||
#include "FWCore/Framework/interface/Event.h" | ||
#include "FWCore/MessageLogger/interface/MessageLogger.h" | ||
#include "FWCore/Utilities/interface/Exception.h" | ||
#include "PatternRecognitionbyPassthrough.h" | ||
#include "DataFormats/HGCalReco/interface/Trackster.h" | ||
#include "Geometry/CaloGeometry/interface/CaloGeometry.h" | ||
#include "Geometry/Records/interface/CaloGeometryRecord.h" | ||
#include "FWCore/Framework/interface/EventSetup.h" | ||
#include "TrackstersPCA.h" | ||
|
||
using namespace ticl; | ||
|
||
template <typename TILES> | ||
PatternRecognitionbyPassthrough<TILES>::PatternRecognitionbyPassthrough(const edm::ParameterSet &conf, | ||
edm::ConsumesCollector iC) | ||
: PatternRecognitionAlgoBaseT<TILES>(conf, iC), caloGeomToken_(iC.esConsumes<CaloGeometry, CaloGeometryRecord>()) {} | ||
|
||
template <typename TILES> | ||
void PatternRecognitionbyPassthrough<TILES>::makeTracksters( | ||
const typename PatternRecognitionAlgoBaseT<TILES>::Inputs &input, | ||
std::vector<Trackster> &result, | ||
std::unordered_map<int, std::vector<int>> &seedToTracksterAssociation) { | ||
// Get the geometry setup | ||
edm::EventSetup const &es = input.es; | ||
const CaloGeometry &geom = es.getData(caloGeomToken_); | ||
rhtools_.setGeometry(geom); | ||
|
||
// Clear the result vector | ||
result.clear(); | ||
|
||
// Iterate over all layer clusters | ||
for (size_t i = 0; i < input.layerClusters.size(); ++i) { | ||
if (input.mask[i] == 0.) { | ||
continue; // Skip masked clusters | ||
} | ||
|
||
// Create a new trackster for each layer cluster | ||
Trackster trackster; | ||
trackster.vertices().push_back(i); | ||
trackster.vertex_multiplicity().push_back(1); | ||
|
||
// Add the trackster to the result vector | ||
result.push_back(trackster); | ||
} | ||
|
||
// Assign PCA to tracksters | ||
ticl::assignPCAtoTracksters(result, | ||
input.layerClusters, | ||
input.layerClustersTime, | ||
rhtools_.getPositionLayer(rhtools_.lastLayerEE(false), false).z(), | ||
false); | ||
|
||
// Log the number of tracksters created | ||
if (PatternRecognitionAlgoBaseT<TILES>::algo_verbosity_ > VerbosityLevel::Advanced) { | ||
edm::LogVerbatim("PatternRecognitionbyPassthrough") << "Created " << result.size() << " tracksters"; | ||
} | ||
} | ||
|
||
template <typename TILES> | ||
void PatternRecognitionbyPassthrough<TILES>::fillPSetDescription(edm::ParameterSetDescription &iDesc) { | ||
iDesc.add<int>("algo_verbosity", 0); | ||
} | ||
|
||
// Explicitly instantiate the templates | ||
template class ticl::PatternRecognitionbyPassthrough<TICLLayerTiles>; | ||
template class ticl::PatternRecognitionbyPassthrough<TICLLayerTilesHFNose>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Author: Felice Pantaleo - [email protected] | ||
// Date: 05/2024 | ||
|
||
#ifndef __RecoHGCal_TICL_PatternRecognitionbyPassthrough_H__ | ||
#define __RecoHGCal_TICL_PatternRecognitionbyPassthrough_H__ | ||
#include <memory> // unique_ptr | ||
#include "RecoHGCal/TICL/interface/PatternRecognitionAlgoBase.h" | ||
#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" | ||
|
||
namespace ticl { | ||
template <typename TILES> | ||
class PatternRecognitionbyPassthrough final : public PatternRecognitionAlgoBaseT<TILES> { | ||
public: | ||
PatternRecognitionbyPassthrough(const edm::ParameterSet& conf, edm::ConsumesCollector); | ||
~PatternRecognitionbyPassthrough() override = default; | ||
|
||
void makeTracksters(const typename PatternRecognitionAlgoBaseT<TILES>::Inputs& input, | ||
std::vector<Trackster>& result, | ||
std::unordered_map<int, std::vector<int>>& seedToTracksterAssociation) override; | ||
|
||
static void fillPSetDescription(edm::ParameterSetDescription& iDesc); | ||
|
||
private: | ||
edm::ESGetToken<CaloGeometry, CaloGeometryRecord> caloGeomToken_; | ||
hgcal::RecHitTools rhtools_; | ||
}; | ||
|
||
} // namespace ticl | ||
|
||
#endif // __RecoHGCal_TICL_PatternRecognitionbyPassthrough_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
from RecoHGCal.TICL.TICLSeedingRegions_cff import ticlSeedingGlobal, ticlSeedingGlobalHFNose | ||
from RecoHGCal.TICL.trackstersProducer_cfi import trackstersProducer as _trackstersProducer | ||
from RecoHGCal.TICL.filteredLayerClustersProducer_cfi import filteredLayerClustersProducer as _filteredLayerClustersProducer | ||
|
||
# CLUSTER FILTERING/MASKING | ||
|
||
filteredLayerClustersPassthrough = _filteredLayerClustersProducer.clone( | ||
clusterFilter = "ClusterFilterBySize", | ||
min_cluster_size = 2, # inclusive | ||
iteration_label = "Passthrough", | ||
LayerClustersInputMask = 'ticlTrackstersCLUE3DHigh', | ||
) | ||
|
||
# PATTERN RECOGNITION | ||
|
||
ticlTrackstersPassthrough = _trackstersProducer.clone( | ||
filtered_mask = "filteredLayerClustersPassthrough:Passthrough", | ||
original_mask = 'ticlTrackstersCLUE3DHigh', | ||
seeding_regions = "ticlSeedingGlobal", | ||
itername = "PassThrough", | ||
patternRecognitionBy = "Passthrough", | ||
pluginPatternRecognitionByPassthrough = dict ( | ||
algo_verbosity = 0 | ||
) | ||
) | ||
|
||
from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 | ||
|
||
ticlPassthroughStepTask = cms.Task(ticlSeedingGlobal | ||
,filteredLayerClustersPassthrough | ||
,ticlTrackstersPassthrough) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters