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.
Electron superclustering in TICL using a DNN
- Loading branch information
Showing
35 changed files
with
2,641 additions
and
1,594 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
10 changes: 10 additions & 0 deletions
10
Configuration/ProcessModifiers/python/ticl_superclustering_dnn_cff.py
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,10 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
from Configuration.ProcessModifiers.ticl_v5_cff import ticl_v5 | ||
from Configuration.ProcessModifiers.ticl_superclustering_mustache_pf_cff import ticl_superclustering_mustache_pf | ||
from Configuration.ProcessModifiers.ticl_superclustering_mustache_ticl_cff import ticl_superclustering_mustache_ticl | ||
|
||
# Modifier to run superclustering with DNN | ||
# It is not to be used directly in a Process since it is currently the default for ticl_v5 | ||
# It only exists as convenience in configuration files | ||
ticl_superclustering_dnn = ticl_v5 & (~ticl_superclustering_mustache_pf) & (~ticl_superclustering_mustache_ticl) |
4 changes: 4 additions & 0 deletions
4
Configuration/ProcessModifiers/python/ticl_superclustering_mustache_pf_cff.py
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,4 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# Modifier (to be applied on top of ticl_v5 modifier) to use the pre-TICLv5 superclustering code (that translates tracksters to PFClusters before running Mustache) | ||
ticl_superclustering_mustache_pf = cms.Modifier() |
4 changes: 4 additions & 0 deletions
4
Configuration/ProcessModifiers/python/ticl_superclustering_mustache_ticl_cff.py
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,4 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
# Modifier (to be applied on top of ticl_v5 modifier) to run superclustering using Mustache inside TICL (with tracksters as inputs) | ||
ticl_superclustering_mustache_ticl = cms.Modifier() |
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
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,93 @@ | ||
/** Computation of input features for superclustering DNN. Used by plugins/TracksterLinkingBySuperClustering.cc and plugins/SuperclusteringSampleDumper.cc */ | ||
// Author: Theo Cuisset - [email protected] | ||
// Date: 11/2023 | ||
|
||
#ifndef __RecoHGCal_TICL_SuperclusteringDNNInputs_H__ | ||
#define __RecoHGCal_TICL_SuperclusteringDNNInputs_H__ | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <memory> | ||
|
||
namespace ticl { | ||
class Trackster; | ||
|
||
// Abstract base class for DNN input preparation. | ||
class AbstractSuperclusteringDNNInput { | ||
public: | ||
virtual ~AbstractSuperclusteringDNNInput() = default; | ||
|
||
virtual unsigned int featureCount() const { return featureNames().size(); }; | ||
|
||
/** Get name of features. Used for SuperclusteringSampleDumper branch names (inference does not use the names, only the indices) | ||
* The default implementation is meant to be overriden by inheriting classes | ||
*/ | ||
virtual std::vector<std::string> featureNames() const { | ||
std::vector<std::string> defaultNames; | ||
defaultNames.reserve(featureCount()); | ||
for (unsigned int i = 1; i <= featureCount(); i++) { | ||
defaultNames.push_back(std::string("nb_") + std::to_string(i)); | ||
} | ||
return defaultNames; | ||
} | ||
|
||
/** Compute feature for seed and candidate pair */ | ||
virtual std::vector<float> computeVector(ticl::Trackster const& ts_base, ticl::Trackster const& ts_toCluster) = 0; | ||
}; | ||
|
||
/* First version of DNN by Alessandro Tarabini. Meant as a DNN equivalent of Mustache algorithm (superclustering algo in ECAL) | ||
Uses features : ['DeltaEta', 'DeltaPhi', 'multi_en', 'multi_eta', 'multi_pt', 'seedEta','seedPhi','seedEn', 'seedPt'] | ||
*/ | ||
class SuperclusteringDNNInputV1 : public AbstractSuperclusteringDNNInput { | ||
public: | ||
unsigned int featureCount() const override { return 9; } | ||
|
||
std::vector<float> computeVector(ticl::Trackster const& ts_base, ticl::Trackster const& ts_toCluster) override; | ||
|
||
std::vector<std::string> featureNames() const override { | ||
return {"DeltaEtaBaryc", | ||
"DeltaPhiBaryc", | ||
"multi_en", | ||
"multi_eta", | ||
"multi_pt", | ||
"seedEta", | ||
"seedPhi", | ||
"seedEn", | ||
"seedPt"}; | ||
} | ||
}; | ||
|
||
/* Second version of DNN by Alessandro Tarabini, making use of HGCAL-specific features. | ||
Uses features : ['DeltaEta', 'DeltaPhi', 'multi_en', 'multi_eta', 'multi_pt', 'seedEta','seedPhi','seedEn', 'seedPt', 'theta', 'theta_xz_seedFrame', 'theta_yz_seedFrame', 'theta_xy_cmsFrame', 'theta_yz_cmsFrame', 'theta_xz_cmsFrame', 'explVar', 'explVarRatio'] | ||
*/ | ||
class SuperclusteringDNNInputV2 : public AbstractSuperclusteringDNNInput { | ||
public: | ||
unsigned int featureCount() const override { return 17; } | ||
|
||
std::vector<float> computeVector(ticl::Trackster const& ts_base, ticl::Trackster const& ts_toCluster) override; | ||
|
||
std::vector<std::string> featureNames() const override { | ||
return {"DeltaEtaBaryc", | ||
"DeltaPhiBaryc", | ||
"multi_en", | ||
"multi_eta", | ||
"multi_pt", | ||
"seedEta", | ||
"seedPhi", | ||
"seedEn", | ||
"seedPt", | ||
"theta", | ||
"theta_xz_seedFrame", | ||
"theta_yz_seedFrame", | ||
"theta_xy_cmsFrame", | ||
"theta_yz_cmsFrame", | ||
"theta_xz_cmsFrame", | ||
"explVar", | ||
"explVarRatio"}; | ||
} | ||
}; | ||
|
||
std::unique_ptr<AbstractSuperclusteringDNNInput> makeSuperclusteringDNNInputFromString(std::string dnnVersion); | ||
} // namespace ticl | ||
|
||
#endif |
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
Oops, something went wrong.