CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
L2TauPixelTrackMatch Class Reference

#include <L2TauPixelTrackMatch.h>

Inheritance diagram for L2TauPixelTrackMatch:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  TinyTrack
 

Public Member Functions

 L2TauPixelTrackMatch (const edm::ParameterSet &)
 
void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 
 ~L2TauPixelTrackMatch () override
 
- Public Member Functions inherited from edm::global::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
 
EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotm_beamSpotTag
 
float m_deltaR
 
float m_jetMaxEta
 
float m_jetMinPt
 
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefsm_jetSrc
 
float m_trackMinPt
 
edm::EDGetTokenT< reco::TrackCollectionm_trackSrc
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

class L2TauPixelTrackMatch this producer creates a new L2 tau jet collection with jets' vertices redefined from vertex z (relative to beamspot) of dr-matched pixel tracks that are above some pt threshold and beamline x & y.

Definition at line 21 of file L2TauPixelTrackMatch.h.

Constructor & Destructor Documentation

◆ L2TauPixelTrackMatch()

L2TauPixelTrackMatch::L2TauPixelTrackMatch ( const edm::ParameterSet conf)
explicit

Definition at line 11 of file L2TauPixelTrackMatch.cc.

References edm::ParameterSet::getParameter(), m_beamSpotTag, m_deltaR, m_jetMaxEta, m_jetMinPt, m_jetSrc, m_trackMinPt, and m_trackSrc.

11  {
12  m_jetSrc = consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("JetSrc"));
13  m_jetMinPt = conf.getParameter<double>("JetMinPt");
14  m_jetMaxEta = conf.getParameter<double>("JetMaxEta");
15  //m_jetMinN = conf.getParameter<int>("JetMinN");
16  m_trackSrc = consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("TrackSrc"));
17  m_trackMinPt = conf.getParameter<double>("TrackMinPt");
18  m_deltaR = conf.getParameter<double>("deltaR");
19  m_beamSpotTag = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("BeamSpotSrc"));
20 
21  produces<reco::CaloJetCollection>();
22 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_jetSrc
edm::EDGetTokenT< reco::TrackCollection > m_trackSrc
edm::EDGetTokenT< reco::BeamSpot > m_beamSpotTag

◆ ~L2TauPixelTrackMatch()

L2TauPixelTrackMatch::~L2TauPixelTrackMatch ( )
override

Definition at line 24 of file L2TauPixelTrackMatch.cc.

24 {}

Member Function Documentation

◆ produce()

void L2TauPixelTrackMatch::produce ( edm::StreamID  ,
edm::Event ev,
const edm::EventSetup es 
) const
overridevirtual

if (jet_with_vertices.size()) new_tau_jets->push_back(jet_with_vertices);

Implements edm::global::EDProducerBase.

Definition at line 26 of file L2TauPixelTrackMatch.cc.

References funct::abs(), cms::cuda::bs, reco::deltaPhi(), PVValHelper::dz, L2TauPixelTrackMatch::TinyTrack::eta, makeMEIFBenchmarkPlots::ev, trigger::TriggerRefsCollections::getObjects(), mps_fire::i, metsig::jet, m_beamSpotTag, m_deltaR, m_jetMaxEta, m_jetMinPt, m_jetSrc, m_trackMinPt, m_trackSrc, eostools::move(), L2TauPixelTrackMatch::TinyTrack::phi, L2TauPixelTrackMatch::TinyTrack::pt, reco::LeafCandidate::setVertex(), trigger::TriggerTau, and L2TauPixelTrackMatch::TinyTrack::vtx.

26  {
27  using namespace std;
28  using namespace reco;
29 
30  // *** Pick up beam spot ***
31 
32  // use beam spot for vertex x,y
33  edm::Handle<BeamSpot> bsHandle;
34  ev.getByToken(m_beamSpotTag, bsHandle);
35  const reco::BeamSpot& bs = *bsHandle;
36  math::XYZPoint beam_spot(bs.x0(), bs.y0(), bs.z0());
37 
38  // *** Pick up pixel tracks ***
39 
40  edm::Handle<TrackCollection> tracksHandle;
41  ev.getByToken(m_trackSrc, tracksHandle);
42 
43  // *** Pick up L2 tau jets that were previously selected by some other filter ***
44 
45  // first, get L2 object refs by the label
47  ev.getByToken(m_jetSrc, jetsHandle);
48 
49  // now we can get pre-selected L2 tau jets
50  std::vector<CaloJetRef> tau_jets;
51  jetsHandle->getObjects(trigger::TriggerTau, tau_jets);
52  const size_t n_jets = tau_jets.size();
53 
54  // *** Selects interesting tracks ***
55 
56  vector<TinyTrack> good_tracks;
57  for (TrackCollection::const_iterator itrk = tracksHandle->begin(); itrk != tracksHandle->end(); ++itrk) {
58  if (itrk->pt() < m_trackMinPt)
59  continue;
60  if (std::abs(itrk->eta()) > m_jetMaxEta + m_deltaR)
61  continue;
62 
63  TinyTrack trk;
64  trk.pt = itrk->pt();
65  trk.phi = itrk->phi();
66  trk.eta = itrk->eta();
67  double dz = itrk->dz(beam_spot);
68  trk.vtx = math::XYZPoint(bs.x(dz), bs.y(dz), dz);
69  good_tracks.push_back(trk);
70  }
71 
72  // *** Match tau jets to intertesting tracks and assign them new vertices ***
73 
74  // the new product
75  std::unique_ptr<CaloJetCollection> new_tau_jets(new CaloJetCollection);
76  if (!good_tracks.empty())
77  for (size_t i = 0; i < n_jets; ++i) {
78  reco::CaloJetRef jet = tau_jets[i];
79  if (jet->pt() < m_jetMinPt || std::abs(jet->eta()) > m_jetMaxEta)
80  continue;
81 
82  for (vector<TinyTrack>::const_iterator itrk = good_tracks.begin(); itrk != good_tracks.end(); ++itrk) {
83  math::XYZTLorentzVector new_jet_dir = Jet::physicsP4(itrk->vtx, *jet, itrk->vtx);
84  float dphi = reco::deltaPhi(new_jet_dir.phi(), itrk->phi);
85  float deta = new_jet_dir.eta() - itrk->eta;
86 
87  if (dphi * dphi + deta * deta > m_deltaR * m_deltaR)
88  continue;
89 
90  // create a jet copy and assign a new vertex to it
91  CaloJet new_jet = *jet;
92  new_jet.setVertex(itrk->vtx);
93  new_tau_jets->push_back(new_jet);
94  }
96  }
97 
98  // store the result
99  ev.put(std::move(new_tau_jets));
100 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Jets made from CaloTowers.
Definition: CaloJet.h:27
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_jetSrc
void setVertex(const Point &vertex) override
set vertex
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
edm::EDGetTokenT< reco::TrackCollection > m_trackSrc
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::EDGetTokenT< reco::BeamSpot > m_beamSpotTag
fixed size matrix
def move(src, dest)
Definition: eostools.py:511
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects

Member Data Documentation

◆ m_beamSpotTag

edm::EDGetTokenT<reco::BeamSpot> L2TauPixelTrackMatch::m_beamSpotTag
private

Definition at line 39 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

◆ m_deltaR

float L2TauPixelTrackMatch::m_deltaR
private

Definition at line 38 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

◆ m_jetMaxEta

float L2TauPixelTrackMatch::m_jetMaxEta
private

Definition at line 35 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

◆ m_jetMinPt

float L2TauPixelTrackMatch::m_jetMinPt
private

Definition at line 34 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

◆ m_jetSrc

edm::EDGetTokenT<trigger::TriggerFilterObjectWithRefs> L2TauPixelTrackMatch::m_jetSrc
private

Definition at line 33 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

◆ m_trackMinPt

float L2TauPixelTrackMatch::m_trackMinPt
private

Definition at line 37 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

◆ m_trackSrc

edm::EDGetTokenT<reco::TrackCollection> L2TauPixelTrackMatch::m_trackSrc
private

Definition at line 36 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().