Skip to content

Commit a68f857

Browse files
committed
Add Giovanna's PFA as an option for vertex simulation
1 parent 6c30957 commit a68f857

File tree

6 files changed

+326
-7
lines changed

6 files changed

+326
-7
lines changed

L1Trigger/VertexFinder/interface/AlgoSettings.h

+29
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
namespace l1tVertexFinder {
1212

1313
enum class Algorithm {
14+
PFA,
15+
PFASingleVertex,
1416
fastHisto,
1517
fastHistoEmulation,
1618
fastHistoLooseAssociation,
@@ -49,6 +51,25 @@ namespace l1tVertexFinder {
4951
float vx_chi2cut() const { return vx_chi2cut_; }
5052
// Do track quality cuts in emulation algorithms
5153
bool vx_DoQualityCuts() const { return vx_DoQualityCuts_; }
54+
// PFA scan parameters (min, max, width)
55+
std::vector<double> vx_pfa_scanparameters() const { return vx_pfa_scanparameters_; }
56+
double vx_pfa_min() const { return vx_pfa_scanparameters_.at(0); }
57+
double vx_pfa_max() const { return vx_pfa_scanparameters_.at(1); }
58+
double vx_pfa_binwidth() const { return vx_pfa_scanparameters_.at(2); }
59+
// Include eta-dependence of the estimated track resolution used in PFA
60+
bool vx_pfa_etadependentresolution() const { return vx_pfa_etadependentresolution_; }
61+
// Scale factor for the PFA track resolution parameter (where the nominal values with and without eta-dependence are hard-coded using the fit results from Giovanna's thesis)
62+
double vx_pfa_resolutionSF() const { return vx_pfa_resolutionSF_; }
63+
// PFA Gaussian width cutoff
64+
double vx_pfa_width() const { return vx_pfa_width_; }
65+
// Enable 2-step process where the weighted pT sum is only calculated at positions where the weighted multiplicity is maximum ("local maxima"). In the second step, the local maximum with the largest weighted pT sum is chosen as the vertex.
66+
bool vx_pfa_usemultiplicitymaxima() const { return vx_pfa_usemultiplicitymaxima_; }
67+
// Weight function to use in PFA. 0: Gaussian, 1: Gaussian without width normalisation, 2: Complementary error function
68+
unsigned int vx_pfa_weightfunction() const { return vx_pfa_weightfunction_; }
69+
// Instead of taking the z0 value from the discrete PFA scan (0), calculate it from the Gaussian and pT-weighted sum of track z0 (1) or the optimal (1/variance) weighted mean of associated tracks, weighted also by pT and association probability (2)
70+
unsigned int vx_pfa_weightedz0() const { return vx_pfa_weightedz0_; }
71+
// Use vx_TrackMinPt cut specified below (otherwise no additional track selection is applied)
72+
bool vx_pfa_doqualitycuts() const { return vx_pfa_doqualitycuts_; }
5273
// Window size of the sliding window
5374
unsigned int vx_windowSize() const { return vx_windowSize_; }
5475
// fastHisto histogram parameters (min, max, width)
@@ -112,6 +133,14 @@ namespace l1tVertexFinder {
112133
unsigned int vx_weightedmean_;
113134
float vx_chi2cut_;
114135
bool vx_DoQualityCuts_;
136+
std::vector<double> vx_pfa_scanparameters_;
137+
bool vx_pfa_etadependentresolution_;
138+
double vx_pfa_resolutionSF_;
139+
double vx_pfa_width_;
140+
bool vx_pfa_usemultiplicitymaxima_;
141+
unsigned int vx_pfa_weightfunction_;
142+
unsigned int vx_pfa_weightedz0_;
143+
bool vx_pfa_doqualitycuts_;
115144
bool vx_DoPtComp_;
116145
bool vx_DoTightChi2_;
117146
std::vector<double> vx_histogram_parameters_;

L1Trigger/VertexFinder/interface/VertexFinder.h

+6
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ namespace l1tVertexFinder {
135135
void computeAndSetVertexParameters(RecoVertex<>& vertex,
136136
const std::vector<float>& bin_centers,
137137
const std::vector<unsigned int>& counts);
138+
139+
double computeAndSetVertexParametersPFA(RecoVertex<>& vertex);
140+
/// Peak finding algorithm
141+
void PFA();
142+
/// Peak finding algorithm, single vertex
143+
void PFASingleVertex();
138144
/// DBSCAN algorithm
139145
void DBSCAN();
140146
/// High pT Vertex Algorithm

L1Trigger/VertexFinder/plugins/VertexProducer.cc

+12
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ VertexProducer::VertexProducer(const edm::ParameterSet& iConfig)
2323
// Get configuration parameters
2424

2525
switch (settings_.vx_algo()) {
26+
case Algorithm::PFA:
27+
edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using the PFA algorithm";
28+
break;
29+
case Algorithm::PFASingleVertex:
30+
edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using the PFASingleVertex algorithm";
31+
break;
2632
case Algorithm::fastHisto:
2733
edm::LogInfo("VertexProducer") << "VertexProducer::Finding vertices using the fastHisto binning algorithm";
2834
break;
@@ -110,6 +116,12 @@ void VertexProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::Event
110116
VertexFinder vf(l1Tracks, settings_);
111117

112118
switch (settings_.vx_algo()) {
119+
case Algorithm::PFA:
120+
vf.PFA();
121+
break;
122+
case Algorithm::PFASingleVertex:
123+
vf.PFASingleVertex();
124+
break;
113125
case Algorithm::fastHisto: {
114126
const TrackerTopology& tTopo = iSetup.getData(tTopoToken);
115127
vf.fastHisto(&tTopo);

L1Trigger/VertexFinder/python/l1tVertexProducer_cfi.py

+23-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# === Vertex Reconstruction configuration
99
VertexReconstruction = cms.PSet(
1010
# Vertex Reconstruction Algorithm
11-
Algorithm = cms.string("fastHisto"),
11+
Algorithm = cms.string("PFA"),
1212
# Vertex distance [cm]
1313
VertexDistance = cms.double(.15),
1414
# Assumed Vertex Resolution [cm]
@@ -21,15 +21,31 @@
2121
# 0 = unweighted
2222
# 1 = pT weighted
2323
# 2 = pT^2 weighted
24-
WeightedMean = cms.uint32(1),
24+
WeightedMean = cms.uint32(2),
2525
# Chi2 cut for the Adaptive Vertex Reconstruction Algorithm
2626
AVR_chi2cut = cms.double(5.),
2727
# Do track quality cuts in emulation algorithms
2828
EM_DoQualityCuts = cms.bool(False),
2929
# Track-stubs Pt compatibility cut
30-
FH_DoPtComp = cms.bool(True),
30+
FH_DoPtComp = cms.bool(False),
3131
# chi2dof < 5 for tracks with Pt > 10
3232
FH_DoTightChi2 = cms.bool(False),
33+
# PFA algorithm scan parameters (min,max,width) [cm]
34+
PFA_ScanParameters = cms.vdouble(-20.46912512, 20.46912512, 0.03997876),
35+
# Include eta-dependence of the estimated track resolution used in PFA
36+
PFA_EtaDependentResolution = cms.bool(True),
37+
# Scale factor for the PFA track resolution parameter (where the nominal values with and without eta-dependence are hard-coded using the fit results from Giovanna's thesis)
38+
PFA_ResolutionSF = cms.double(2.),
39+
# PFA Gaussian width cutoff [cm]
40+
PFA_VertexWidth = cms.double(1.31), # Giovanna's recommendation of 3*sigma(lowest-resolution tracks).
41+
# Enable 2-step process where the weighted pT sum is only calculated at positions where the weighted multiplicity is maximum ("local maxima"). In the second step, the local maximum with the largest weighted pT sum is chosen as the vertex.
42+
PFA_UseMultiplicityMaxima = cms.bool(False),
43+
# Weight function to use in PFA. 0: Gaussian, 1: Gaussian without width normalisation, 2: Complementary error function
44+
PFA_WeightFunction = cms.uint32(1),
45+
# Instead of taking the z0 value from the discrete PFA scan (0), calculate it from the Gaussian and pT-weighted sum of track z0 (1) or the optimal (1/variance) weighted mean of associated tracks, weighted also by pT and association probability (2)
46+
PFA_WeightedZ0 = cms.uint32(1),
47+
# Use VxMinTrackPt cut specified below (otherwise no additional track selection is applied)
48+
PFA_DoQualityCuts = cms.bool(False),
3349
# fastHisto algorithm histogram parameters (min,max,width) [cm]
3450
# TDR settings: [-14.95, 15.0, 0.1]
3551
# L1TkPrimaryVertexProducer: [-30.0, 30.0, 0.09983361065]
@@ -38,7 +54,7 @@
3854
# Track word limits (256 binns): [-20.46912512, 20.46912512, 0.15991504]
3955
FH_HistogramParameters = cms.vdouble(-20.46912512, 20.46912512, 0.15991504),
4056
# The number of vertixes to return (i.e. N windows with the highest combined pT)
41-
FH_NVtx = cms.uint32(1),
57+
FH_NVtx = cms.uint32(10),
4258
# fastHisto algorithm assumed vertex half-width [cm]
4359
FH_VertexWidth = cms.double(.15),
4460
# Window size of the sliding window
@@ -62,11 +78,11 @@
6278
# Option '0' was used for the TDR, but '1' is used for the firmware
6379
VxMaxTrackPtBehavior = cms.int32(1),
6480
# Maximum chi2 of tracks used to create vertex
65-
VxMaxTrackChi2 = cms.double(100.),
81+
VxMaxTrackChi2 = cms.double(99999999.),
6682
# Minimum number of stubs associated to a track
67-
VxMinNStub = cms.uint32(4),
83+
VxMinNStub = cms.uint32(0),
6884
# Minimum number of stubs in PS modules associated to a track
69-
VxMinNStubPS = cms.uint32(3),
85+
VxMinNStubPS = cms.uint32(0),
7086
# Track weight NN graph
7187
TrackWeightGraph = cms.FileInPath("L1Trigger/VertexFinder/data/NNVtx_WeightModelGraph.pb"),
7288
# Pattern recognition NN graph

L1Trigger/VertexFinder/src/AlgoSettings.cc

+12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ namespace l1tVertexFinder {
1313
vx_weightedmean_(vertex_.getParameter<unsigned int>("WeightedMean")),
1414
vx_chi2cut_(vertex_.getParameter<double>("AVR_chi2cut")),
1515
vx_DoQualityCuts_(vertex_.getParameter<bool>("EM_DoQualityCuts")),
16+
vx_pfa_scanparameters_(vertex_.getParameter<std::vector<double> >("PFA_ScanParameters")),
17+
vx_pfa_etadependentresolution_(vertex_.getParameter<bool>("PFA_EtaDependentResolution")),
18+
vx_pfa_resolutionSF_(vertex_.getParameter<double>("PFA_ResolutionSF")),
19+
vx_pfa_width_(vertex_.getParameter<double>("PFA_VertexWidth")),
20+
vx_pfa_usemultiplicitymaxima_(vertex_.getParameter<bool>("PFA_UseMultiplicityMaxima")),
21+
vx_pfa_weightfunction_(vertex_.getParameter<unsigned int>("PFA_WeightFunction")),
22+
vx_pfa_weightedz0_(vertex_.getParameter<unsigned int>("PFA_WeightedZ0")),
23+
vx_pfa_doqualitycuts_(vertex_.getParameter<bool>("PFA_DoQualityCuts")),
1624
vx_DoPtComp_(vertex_.getParameter<bool>("FH_DoPtComp")),
1725
vx_DoTightChi2_(vertex_.getParameter<bool>("FH_DoTightChi2")),
1826
vx_histogram_parameters_(vertex_.getParameter<std::vector<double> >("FH_HistogramParameters")),
@@ -57,6 +65,8 @@ namespace l1tVertexFinder {
5765
}
5866

5967
const std::map<std::string, Algorithm> AlgoSettings::algoNameMap = {
68+
{"PFA", Algorithm::PFA},
69+
{"PFASingleVertex", Algorithm::PFASingleVertex},
6070
{"fastHisto", Algorithm::fastHisto},
6171
{"fastHistoEmulation", Algorithm::fastHistoEmulation},
6272
{"fastHistoLooseAssociation", Algorithm::fastHistoLooseAssociation},
@@ -70,6 +80,8 @@ namespace l1tVertexFinder {
7080
{"NNEmulation", Algorithm::NNEmulation}};
7181

7282
const std::map<Algorithm, Precision> AlgoSettings::algoPrecisionMap = {
83+
{Algorithm::PFA, Precision::Simulation},
84+
{Algorithm::PFASingleVertex, Precision::Simulation},
7385
{Algorithm::fastHisto, Precision::Simulation},
7486
{Algorithm::fastHistoEmulation, Precision::Emulation},
7587
{Algorithm::fastHistoLooseAssociation, Precision::Simulation},

0 commit comments

Comments
 (0)