CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
l1tpf::PFTrackProducerFromL1Tracks Class Reference
Inheritance diagram for l1tpf::PFTrackProducerFromL1Tracks:
edm::stream::EDProducer<>

Public Member Functions

 PFTrackProducerFromL1Tracks (const edm::ParameterSet &)
 
 ~PFTrackProducerFromL1Tracks () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ESGetToken< MagneticField, IdealMagneticFieldRecordBFieldTag_
 
edm::ESWatcher< IdealMagneticFieldRecordBFieldWatcher_
 
float fBz_
 
int nParam_
 
std::vector< StringCutObjectSelector< l1t::PFTrack::L1TTTrackType > > qualityBitSetters_
 
bool redigitizeTrackWord_
 
l1tpf::ParametricResolution resolCalo_
 
l1tpf::ParametricResolution resolTrk_
 
edm::EDGetTokenT< std::vector< l1t::PFTrack::L1TTTrackType > > TrackTag_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 18 of file PFTrackProducerFromL1Tracks.cc.

Constructor & Destructor Documentation

◆ PFTrackProducerFromL1Tracks()

l1tpf::PFTrackProducerFromL1Tracks::PFTrackProducerFromL1Tracks ( const edm::ParameterSet iConfig)
explicit

Definition at line 38 of file PFTrackProducerFromL1Tracks.cc.

39  : TrackTag_(consumes<std::vector<l1t::PFTrack::L1TTTrackType>>(iConfig.getParameter<edm::InputTag>("L1TrackTag"))),
40  BFieldTag_{esConsumes<MagneticField, IdealMagneticFieldRecord>()},
41  nParam_(iConfig.getParameter<unsigned int>("nParam")),
42  resolCalo_(iConfig.getParameter<edm::ParameterSet>("resolCalo")),
43  resolTrk_(iConfig.getParameter<edm::ParameterSet>("resolTrack")),
44  redigitizeTrackWord_(iConfig.getParameter<bool>("redigitizeTrackWord")) {
45  for (const auto &cut : iConfig.getParameter<std::vector<std::string>>("qualityBits")) {
46  qualityBitSetters_.emplace_back(cut);
47  }
48  produces<l1t::PFTrackCollection>();
49 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< StringCutObjectSelector< l1t::PFTrack::L1TTTrackType > > qualityBitSetters_
edm::EDGetTokenT< std::vector< l1t::PFTrack::L1TTTrackType > > TrackTag_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > BFieldTag_

◆ ~PFTrackProducerFromL1Tracks()

l1tpf::PFTrackProducerFromL1Tracks::~PFTrackProducerFromL1Tracks ( )
inlineoverride

Definition at line 21 of file PFTrackProducerFromL1Tracks.cc.

21 {}

Member Function Documentation

◆ produce()

void l1tpf::PFTrackProducerFromL1Tracks::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 51 of file PFTrackProducerFromL1Tracks.cc.

References funct::abs(), triggerObjects_cff::bit, ALCARECOTkAlJpsiMuMu_cff::charge, PVValHelper::eta, TTTrack_TrackWord::getBendChi2Word(), TTTrack_TrackWord::getChi2RPhiWord(), TTTrack_TrackWord::getChi2RZWord(), TTTrack_TrackWord::getD0Word(), edm::EventSetup::getData(), TTTrack_TrackWord::getHitPatternWord(), TTTrack_TrackWord::getMVAQualityWord(), TTTrack_TrackWord::getPhiWord(), TTTrack_TrackWord::getRinvWord(), TTTrack_TrackWord::getTanlWord(), TTTrack_TrackWord::getValidWord(), TTTrack_TrackWord::getZ0Word(), mps_fire::i, iEvent, eostools::move(), create_idmaps::n, MillePedeFileConverter_cfg::out, l1tpf::propagateToCalo(), DiDispStaMuonMonitor_cfi::pt, quality, TTTrack_TrackWord::setTrackWord(), TTTrack< T >::setTrackWordBits(), DiMuonV_cfg::tracks, and L1BJetProducer_cff::vtx.

51  {
52  if (BFieldWatcher_.check(iSetup)) {
53  fBz_ = iSetup.getData(BFieldTag_).inTesla(GlobalPoint(0, 0, 0)).z();
54  }
55 
56  std::unique_ptr<l1t::PFTrackCollection> out(new l1t::PFTrackCollection());
57 
58  // https://github.com/skinnari/cmssw/blob/80c19f1b721325c3a02ee0482f72fb974a4c3bf7/L1Trigger/TrackFindingTracklet/test/L1TrackNtupleMaker.cc
60  iEvent.getByToken(TrackTag_, htracks);
61  const auto &tracks = *htracks;
62 
63  for (unsigned int i = 0, n = tracks.size(); i < n; ++i) {
64  const auto &tk = tracks[i];
65 
66  float pt = tk.momentum().perp();
67  float eta = tk.momentum().eta();
68  float phi = tk.momentum().phi();
69  float z0 = tk.POCA().z(); //cm
70  int charge = tk.rInv() > 0 ? +1 : -1;
71 
72  reco::Candidate::PolarLorentzVector p4p(pt, eta, phi, 0.137); // pion mass
73  reco::Particle::LorentzVector p4(p4p.X(), p4p.Y(), p4p.Z(), p4p.E());
74  reco::Particle::Point vtx(tk.POCA().x(), tk.POCA().y(), z0);
75 
76  auto caloetaphi = l1tpf::propagateToCalo(p4, math::XYZTLorentzVector(0., 0., z0, 0.), charge, fBz_);
77 
78  float trkErr = resolTrk_(pt, std::abs(eta));
79  float caloErr = resolCalo_(pt, std::abs(eta));
80  int quality = 0;
81  for (int i = 0, n = qualityBitSetters_.size(), bit = 1; i < n; ++i, bit <<= 1) {
82  if (qualityBitSetters_[i](tk))
83  quality += bit;
84  }
85  out->emplace_back(charge,
86  p4,
87  vtx,
88  l1t::PFTrack::TrackRef(htracks, i),
89  nParam_,
90  caloetaphi.first,
91  caloetaphi.second,
92  trkErr,
93  caloErr,
94  quality);
95 
97  // Force re-digitization if an old TTrack object is read from an EDM file, and update the quaility bit for now
98  l1t::PFTrack::L1TTTrackType trackCopy = tk;
99  trackCopy.setTrackWordBits(); // important
100  TTTrack_TrackWord &tw = out->back().trackWord();
101  tw.setTrackWord(trackCopy.getValidWord(),
102  trackCopy.getRinvWord(),
103  trackCopy.getPhiWord(),
104  trackCopy.getTanlWord(),
105  trackCopy.getZ0Word(),
106  trackCopy.getD0Word(),
107  trackCopy.getChi2RPhiWord(),
108  trackCopy.getChi2RZWord(),
109  trackCopy.getBendChi2Word(),
110  trackCopy.getHitPatternWord(),
111  trackCopy.getMVAQualityWord(),
112  ap_uint<TTTrack_TrackWord::kMVAOtherSize>(quality));
113  }
114  }
115  iEvent.put(std::move(out));
116 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESWatcher< IdealMagneticFieldRecord > BFieldWatcher_
std::pair< float, float > propagateToCalo(const math::XYZTLorentzVector &iMom, const math::XYZTLorentzVector &iVtx, double iCharge, double iBField)
Definition: L1TPFUtils.cc:7
chi2rphi_t getChi2RPhiWord() const
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
valid_t getValidWord() const
d0_t getD0Word() const
std::vector< StringCutObjectSelector< l1t::PFTrack::L1TTTrackType > > qualityBitSetters_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
string quality
int iEvent
Definition: GenABIO.cc:224
void setTrackWord(unsigned int valid, const GlobalVector &momentum, const GlobalPoint &POCA, double rInv, double chi2RPhi, double chi2RZ, double bendChi2, unsigned int hitPattern, double mvaQuality, double mvaOther, unsigned int sector)
edm::EDGetTokenT< std::vector< l1t::PFTrack::L1TTTrackType > > TrackTag_
math::XYZPoint Point
point in the space
Definition: Particle.h:25
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
rinv_t getRinvWord() const
bendChi2_t getBendChi2Word() const
qualityMVA_t getMVAQualityWord() const
phi_t getPhiWord() const
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > BFieldTag_
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::vector< l1t::PFTrack > PFTrackCollection
Definition: PFTrack.h:89
z0_t getZ0Word() const
chi2rz_t getChi2RZWord() const
hit_t getHitPatternWord() const
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
void setTrackWordBits()
Set bits in 96-bit Track word.
Definition: TTTrack.h:440
tanl_t getTanlWord() const
def move(src, dest)
Definition: eostools.py:511
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38

Member Data Documentation

◆ BFieldTag_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> l1tpf::PFTrackProducerFromL1Tracks::BFieldTag_
private

Definition at line 26 of file PFTrackProducerFromL1Tracks.cc.

◆ BFieldWatcher_

edm::ESWatcher<IdealMagneticFieldRecord> l1tpf::PFTrackProducerFromL1Tracks::BFieldWatcher_
private

Definition at line 25 of file PFTrackProducerFromL1Tracks.cc.

◆ fBz_

float l1tpf::PFTrackProducerFromL1Tracks::fBz_
private

Definition at line 28 of file PFTrackProducerFromL1Tracks.cc.

◆ nParam_

int l1tpf::PFTrackProducerFromL1Tracks::nParam_
private

Definition at line 27 of file PFTrackProducerFromL1Tracks.cc.

◆ qualityBitSetters_

std::vector<StringCutObjectSelector<l1t::PFTrack::L1TTTrackType> > l1tpf::PFTrackProducerFromL1Tracks::qualityBitSetters_
private

Definition at line 30 of file PFTrackProducerFromL1Tracks.cc.

◆ redigitizeTrackWord_

bool l1tpf::PFTrackProducerFromL1Tracks::redigitizeTrackWord_
private

Definition at line 31 of file PFTrackProducerFromL1Tracks.cc.

◆ resolCalo_

l1tpf::ParametricResolution l1tpf::PFTrackProducerFromL1Tracks::resolCalo_
private

Definition at line 29 of file PFTrackProducerFromL1Tracks.cc.

◆ resolTrk_

l1tpf::ParametricResolution l1tpf::PFTrackProducerFromL1Tracks::resolTrk_
private

Definition at line 29 of file PFTrackProducerFromL1Tracks.cc.

◆ TrackTag_

edm::EDGetTokenT<std::vector<l1t::PFTrack::L1TTTrackType> > l1tpf::PFTrackProducerFromL1Tracks::TrackTag_
private

Definition at line 24 of file PFTrackProducerFromL1Tracks.cc.