Skip to content

Commit

Permalink
Ported l1t-phase2-v3.3.0 - TkFastVertex(Histo): produce multiple vert…
Browse files Browse the repository at this point in the history
…ices (cms-sw#859)
  • Loading branch information
rekovic committed Jan 19, 2021
1 parent 5deb424 commit fb23f71
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 17 deletions.
43 changes: 26 additions & 17 deletions L1Trigger/L1TTrackMatch/plugins/L1TkFastVertexProducer.cc
Expand Up @@ -69,6 +69,7 @@ class L1TkFastVertexProducer : public edm::global::EDProducer<> {
float pTMax_; // in GeV, saturation / truncation value
int highPtTracks_; // saturate or truncate

int nVtx_; // the number of vertices to return
int nStubsmin_; // minimum number of stubs
int nStubsPSmin_; // minimum number of stubs in PS modules

Expand Down Expand Up @@ -116,6 +117,7 @@ L1TkFastVertexProducer::L1TkFastVertexProducer(const edm::ParameterSet& iConfig)
pTMax_ = (float)iConfig.getParameter<double>("PTMAX");
highPtTracks_ = iConfig.getParameter<int>("HighPtTracks");

nVtx_ = iConfig.getParameter<int>("nVtx");
nStubsmin_ = iConfig.getParameter<int>("nStubsmin");
nStubsPSmin_ = iConfig.getParameter<int>("nStubsPSmin");
nBinning_ = iConfig.getParameter<int>("nBinning");
Expand Down Expand Up @@ -309,6 +311,7 @@ void L1TkFastVertexProducer::produce(edm::StreamID, edm::Event& iEvent, const ed

float zvtx_sliding = -999;
float sigma_max = -999;
int imax = -999;
int nb = htmp.GetNbinsX();
for (int i = 2; i <= nb - 1; i++) {
float a0 = htmp.GetBinContent(i - 1);
Expand All @@ -317,33 +320,39 @@ void L1TkFastVertexProducer::produce(edm::StreamID, edm::Event& iEvent, const ed
float sigma = a0 + a1 + a2;
if (sigma > sigma_max) {
sigma_max = sigma;
imax = i;
float z0 = htmp.GetBinCenter(i - 1);
float z1 = htmp.GetBinCenter(i);
float z2 = htmp.GetBinCenter(i + 1);
zvtx_sliding = (a0 * z0 + a1 * z1 + a2 * z2) / sigma;
}
}

zvtx_sliding = -999;
sigma_max = -999;
for (int i = 2; i <= nb - 1; i++) {
float a0 = htmp_weight.GetBinContent(i - 1);
float a1 = htmp_weight.GetBinContent(i);
float a2 = htmp_weight.GetBinContent(i + 1);
float sigma = a0 + a1 + a2;
if (sigma > sigma_max) {
sigma_max = sigma;
float z0 = htmp_weight.GetBinCenter(i - 1);
float z1 = htmp_weight.GetBinCenter(i);
float z2 = htmp_weight.GetBinCenter(i + 1);
zvtx_sliding = (a0 * z0 + a1 * z1 + a2 * z2) / sigma;
std::vector<int> found;
found.reserve(nVtx_);
for (int ivtx = 0; ivtx < nVtx_; ivtx++) {
zvtx_sliding = -999;
sigma_max = -999;
imax = -999;
for (int i = 2; i <= nb - 1; i++) {
float a0 = htmp_weight.GetBinContent(i - 1);
float a1 = htmp_weight.GetBinContent(i);
float a2 = htmp_weight.GetBinContent(i + 1);
float sigma = a0 + a1 + a2;
if ((sigma > sigma_max) && (find(found.begin(), found.end(), i) == found.end())) {
sigma_max = sigma;
imax = i;
float z0 = htmp_weight.GetBinCenter(i - 1);
float z1 = htmp_weight.GetBinCenter(i);
float z2 = htmp_weight.GetBinCenter(i + 1);
zvtx_sliding = (a0 * z0 + a1 * z1 + a2 * z2) / sigma;
}
}
found.push_back(imax);
TkPrimaryVertex vtx4(zvtx_sliding, sigma_max);
result->push_back(vtx4);
}

TkPrimaryVertex vtx4(zvtx_sliding, sigma_max);

result->push_back(vtx4);

iEvent.put(std::move(result));
}

Expand Down
Expand Up @@ -11,6 +11,7 @@
ZMAX = cms.double ( 25. ) , # in cm
CHI2MAX = cms.double( 100. ),
PTMINTRA = cms.double( 2.), # PTMIN of L1Tracks, in GeV
nVtx = cms.int32( 1 ), # number of vertices to return
nStubsmin = cms.int32( 4 ) , # minimum number of stubs
nStubsPSmin = cms.int32( 3 ), # minimum number of stubs in PS modules
nBinning = cms.int32( 601 ), # number of bins for the temp histo (from -30 cm to + 30 cm)
Expand Down

0 comments on commit fb23f71

Please sign in to comment.