CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
IdealMagneticFieldRecord
BFieldTag_
 
edm::ESWatcher
< IdealMagneticFieldRecord
BFieldWatcher_
 
float fBz_
 
int nParam_
 
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 17 of file PFTrackProducerFromL1Tracks.cc.

Constructor & Destructor Documentation

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

Definition at line 35 of file PFTrackProducerFromL1Tracks.cc.

References edm::ParameterSet::getParameter(), nParam_, resolCalo_, and resolTrk_.

36  : TrackTag_(consumes<std::vector<l1t::PFTrack::L1TTTrackType>>(iConfig.getParameter<edm::InputTag>("L1TrackTag"))),
37  BFieldTag_{esConsumes<MagneticField, IdealMagneticFieldRecord>()},
38  nParam_(iConfig.getParameter<unsigned int>("nParam")),
39  resolCalo_(iConfig.getParameter<edm::ParameterSet>("resolCalo")),
40  resolTrk_(iConfig.getParameter<edm::ParameterSet>("resolTrack")) {
41  produces<l1t::PFTrackCollection>();
42 }
edm::EDGetTokenT< std::vector< l1t::PFTrack::L1TTTrackType > > TrackTag_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > BFieldTag_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
l1tpf::PFTrackProducerFromL1Tracks::~PFTrackProducerFromL1Tracks ( )
inlineoverride

Definition at line 20 of file PFTrackProducerFromL1Tracks.cc.

20 {}

Member Function Documentation

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

Definition at line 44 of file PFTrackProducerFromL1Tracks.cc.

References funct::abs(), BFieldTag_, BFieldWatcher_, RecoTauCleanerPlugins::charge, edm::ESWatcher< T >::check(), PVValHelper::eta, fBz_, edm::Event::getByToken(), edm::EventSetup::getData(), mps_fire::i, eostools::move(), dqmiodumpmetadata::n, nParam_, submitPVResolutionJobs::out, l1tpf::propagateToCalo(), DiDispStaMuonMonitor_cfi::pt, edm::Event::put(), quality, resolCalo_, resolTrk_, tracks, and TrackTag_.

44  {
45  if (BFieldWatcher_.check(iSetup)) {
46  fBz_ = iSetup.getData(BFieldTag_).inTesla(GlobalPoint(0, 0, 0)).z();
47  }
48 
49  std::unique_ptr<l1t::PFTrackCollection> out(new l1t::PFTrackCollection());
50 
51  // https://github.com/skinnari/cmssw/blob/80c19f1b721325c3a02ee0482f72fb974a4c3bf7/L1Trigger/TrackFindingTracklet/test/L1TrackNtupleMaker.cc
53  iEvent.getByToken(TrackTag_, htracks);
54  const auto &tracks = *htracks;
55 
56  for (unsigned int i = 0, n = tracks.size(); i < n; ++i) {
57  const auto &tk = tracks[i];
58 
59  float pt = tk.momentum().perp();
60  float eta = tk.momentum().eta();
61  float phi = tk.momentum().phi();
62  float z0 = tk.POCA().z(); //cm
63  int charge = tk.rInv() > 0 ? +1 : -1;
64 
65  reco::Candidate::PolarLorentzVector p4p(pt, eta, phi, 0.137); // pion mass
66  reco::Particle::LorentzVector p4(p4p.X(), p4p.Y(), p4p.Z(), p4p.E());
67  reco::Particle::Point vtx(0., 0., z0);
68 
69  auto caloetaphi = l1tpf::propagateToCalo(p4, math::XYZTLorentzVector(0., 0., z0, 0.), charge, fBz_);
70 
71  float trkErr = resolTrk_(pt, std::abs(eta));
72  float caloErr = resolCalo_(pt, std::abs(eta));
73  int quality = 1;
74  out->emplace_back(charge,
75  p4,
76  vtx,
77  l1t::PFTrack::TrackRef(htracks, i),
78  nParam_,
79  caloetaphi.first,
80  caloetaphi.second,
81  trkErr,
82  caloErr,
83  quality);
84  }
85  iEvent.put(std::move(out));
86 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
uint32_t const *__restrict__ Quality * quality
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
auto const & tracks
cannot be loose
bool getData(T &iHolder) const
Definition: EventSetup.h:122
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
def move
Definition: eostools.py:511
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
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > BFieldTag_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
std::vector< l1t::PFTrack > PFTrackCollection
Definition: PFTrack.h:84
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Particle.h:21
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.
Definition: Candidate.h:38

Member Data Documentation

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

Definition at line 25 of file PFTrackProducerFromL1Tracks.cc.

Referenced by produce().

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

Definition at line 24 of file PFTrackProducerFromL1Tracks.cc.

Referenced by produce().

float l1tpf::PFTrackProducerFromL1Tracks::fBz_
private

Definition at line 27 of file PFTrackProducerFromL1Tracks.cc.

Referenced by produce().

int l1tpf::PFTrackProducerFromL1Tracks::nParam_
private

Definition at line 26 of file PFTrackProducerFromL1Tracks.cc.

Referenced by PFTrackProducerFromL1Tracks(), and produce().

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

Definition at line 28 of file PFTrackProducerFromL1Tracks.cc.

Referenced by PFTrackProducerFromL1Tracks(), and produce().

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

Definition at line 28 of file PFTrackProducerFromL1Tracks.cc.

Referenced by PFTrackProducerFromL1Tracks(), and produce().

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

Definition at line 23 of file PFTrackProducerFromL1Tracks.cc.

Referenced by produce().