Skip to content

Commit

Permalink
Merge pull request #32681 from cms-l1t-offline/pr111x-phase2-MultPrim…
Browse files Browse the repository at this point in the history
…Vtx-TkMuonsFix

(11_1_X) L1 Phase2 for HLT TDR - Multy Primary Vtx, TkMuons Fix for low-pt
  • Loading branch information
cmsbuild committed Jan 21, 2021
2 parents bbf3d5e + 31d2640 commit fe7f622
Show file tree
Hide file tree
Showing 7 changed files with 169 additions and 34 deletions.
8 changes: 8 additions & 0 deletions DataFormats/L1TCorrelator/interface/TkMuon.h
Expand Up @@ -7,6 +7,7 @@
#include "DataFormats/L1TrackTrigger/interface/TTTypes.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonCand.h"
#include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h"
#include "DataFormats/L1TMuon/interface/EMTFTrack.h"

namespace l1t {
class TkMuon : public L1Candidate {
Expand All @@ -21,6 +22,11 @@ namespace l1t {
const edm::Ptr<L1TTTrackType>& trkPtr,
float tkisol = -999.);

TkMuon(const LorentzVector& p4,
const edm::Ref<l1t::EMTFTrackCollection>& emtfTrk,
const edm::Ptr<L1TTTrackType>& trkPtr,
float tkisol = -999.);

//One more constructor for Tracker+ Stubs algorithm not requiring the Muon candidate
TkMuon(const LorentzVector& p4, const edm::Ptr<L1TTTrackType>& trkPtr, float tkisol = -999.);

Expand All @@ -30,6 +36,7 @@ namespace l1t {
const edm::Ptr<L1TTTrackType>& trkPtr() const { return trkPtr_; }

const edm::Ref<l1t::RegionalMuonCandBxCollection>& muRef() const { return muRef_; }
const edm::Ref<l1t::EMTFTrackCollection>& emtfTrk() const { return emtfTrk_; }

float trkIsol() const { return theIsolation; }
float trkzVtx() const { return TrkzVtx_; }
Expand Down Expand Up @@ -58,6 +65,7 @@ namespace l1t {
private:
// used for the Naive producer
edm::Ref<l1t::RegionalMuonCandBxCollection> muRef_;
edm::Ref<l1t::EMTFTrackCollection> emtfTrk_;

edm::Ptr<L1TTTrackType> trkPtr_;

Expand Down
10 changes: 10 additions & 0 deletions DataFormats/L1TCorrelator/src/TkMuon.cc
Expand Up @@ -17,6 +17,16 @@ TkMuon::TkMuon(const LorentzVector& p4,
}
}

TkMuon::TkMuon(const LorentzVector& p4,
const edm::Ref<EMTFTrackCollection>& emtfRef,
const edm::Ptr<L1TTTrackType>& trackPtr,
float tkisol)
: L1Candidate(p4), emtfTrk_(emtfRef), trkPtr_(trackPtr), theIsolation(tkisol), TrkzVtx_(999), quality_(999) {
if (trkPtr_.isNonnull()) {
setTrkzVtx(trkPtr()->POCA().z());
}
}

TkMuon::TkMuon(const LorentzVector& p4, const edm::Ptr<L1TTTrackType>& trackPtr, float tkisol)
: L1Candidate(p4), trkPtr_(trackPtr), theIsolation(tkisol), TrkzVtx_(999), quality_(999) {
if (trkPtr_.isNonnull()) {
Expand Down
23 changes: 12 additions & 11 deletions DataFormats/L1TCorrelator/src/classes_def.xml
@@ -1,20 +1,19 @@

<lcgdict>

<class name="l1t::TkPrimaryVertex" ClassVersion="3">
<version ClassVersion="3" checksum="2843779965"/>
</class>
<class name="std::vector<l1t::TkPrimaryVertex>"/>
<class name="edm::Wrapper<std::vector<l1t::TkPrimaryVertex> >"/>
<class name="edm::Ref<std::vector<l1t::TkPrimaryVertex>,l1t::TkPrimaryVertex,edm::refhelper::FindUsingAdvance<std::vector<l1t::TkPrimaryVertex>,l1t::TkPrimaryVertex> >"/>
<class name="std::vector<edm::Ref<std::vector<l1t::TkPrimaryVertex>,l1t::TkPrimaryVertex,edm::refhelper::FindUsingAdvance<std::vector<l1t::TkPrimaryVertex>,l1t::TkPrimaryVertex> > >"/>

<class name="l1t::TkPrimaryVertex" ClassVersion="3">
<version ClassVersion="3" checksum="2843779965"/>
</class>
<class name="std::vector<l1t::TkPrimaryVertex>"/>
<class name="edm::Wrapper<std::vector<l1t::TkPrimaryVertex> >"/>
<class name="edm::Ref<std::vector<l1t::TkPrimaryVertex>,l1t::TkPrimaryVertex,edm::refhelper::FindUsingAdvance<std::vector<l1t::TkPrimaryVertex>,l1t::TkPrimaryVertex> >"/>
<class name="std::vector<edm::Ref<std::vector<l1t::TkPrimaryVertex>,l1t::TkPrimaryVertex,edm::refhelper::FindUsingAdvance<std::vector<l1t::TkPrimaryVertex>,l1t::TkPrimaryVertex> > >"/>

<class name="l1t::TkEtMiss" ClassVersion="3">
<version ClassVersion="3" checksum="77762919"/>
</class>
<class name="std::vector<l1t::TkEtMiss>"/>
<class name="edm::Wrapper<l1t::TkEtMiss>"/>
<class name="edm::Wrapper<l1t::TkEtMiss>"/>
<class name="edm::Wrapper<std::vector<l1t::TkEtMiss> >"/>

<class name="l1t::TkEm" ClassVersion="3">
Expand All @@ -25,7 +24,6 @@
<class name="edm::Ref<std::vector<l1t::TkEm>,l1t::TkEm,edm::refhelper::FindUsingAdvance<std::vector<l1t::TkEm>,l1t::TkEm> >"/>
<class name="std::vector<edm::Ref<std::vector<l1t::TkEm>,l1t::TkEm,edm::refhelper::FindUsingAdvance<std::vector<l1t::TkEm>,l1t::TkEm> > >"/>


<class name="l1t::TkEGTau" ClassVersion="3">
<version ClassVersion="3" checksum="3759113668"/>
</class>
Expand Down Expand Up @@ -71,13 +69,16 @@
<class name="edm::Wrapper<l1t::TkHTMiss>"/>
<class name="edm::Wrapper<std::vector<l1t::TkHTMiss> >"/>

<class name="l1t::TkMuon" ClassVersion="3">
<class name="l1t::TkMuon" ClassVersion="4">
<version ClassVersion="4" checksum="2325700664"/>
<version ClassVersion="3" checksum="4118337663"/>

</class>
<class name="std::vector<l1t::TkMuon>"/>
<class name="edm::Wrapper<std::vector<l1t::TkMuon> >"/>
<class name="edm::Ref<std::vector<l1t::TkMuon>,l1t::TkMuon,edm::refhelper::FindUsingAdvance<std::vector<l1t::TkMuon>,l1t::TkMuon> >"/>
<class name="std::vector<edm::Ref<std::vector<l1t::TkMuon>,l1t::TkMuon,edm::refhelper::FindUsingAdvance<std::vector<l1t::TkMuon>,l1t::TkMuon> > >"/>
<class name="edm::Ref<vector<l1t::EMTFTrack>,l1t::EMTFTrack,edm::refhelper::FindUsingAdvance<vector<l1t::EMTFTrack>,l1t::EMTFTrack> >" />

<class name="l1t::TkGlbMuon" ClassVersion="3">
<version ClassVersion="3" checksum="2811548892"/>
Expand Down
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

0 comments on commit fe7f622

Please sign in to comment.