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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  TinyTrack
 

Public Member Functions

 L2TauPixelTrackMatch (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~L2TauPixelTrackMatch () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () 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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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<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)
 

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 ( const edm::ParameterSet conf)
explicit

Definition at line 15 of file L2TauPixelTrackMatch.cc.

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

15  {
16  m_jetSrc = consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("JetSrc"));
17  m_jetMinPt = conf.getParameter<double>("JetMinPt");
18  m_jetMaxEta = conf.getParameter<double>("JetMaxEta");
19  //m_jetMinN = conf.getParameter<int>("JetMinN");
20  m_trackSrc = consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("TrackSrc"));
21  m_trackMinPt = conf.getParameter<double>("TrackMinPt");
22  m_deltaR = conf.getParameter<double>("deltaR");
23  m_beamSpotTag = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("BeamSpotSrc"));
24 
25  produces<reco::CaloJetCollection>();
26 }
T getParameter(std::string const &) const
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > m_jetSrc
edm::EDGetTokenT< reco::TrackCollection > m_trackSrc
edm::EDGetTokenT< reco::BeamSpot > m_beamSpotTag
L2TauPixelTrackMatch::~L2TauPixelTrackMatch ( )
override

Definition at line 28 of file L2TauPixelTrackMatch.cc.

28 {}

Member Function Documentation

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

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

Definition at line 30 of file L2TauPixelTrackMatch.cc.

References funct::abs(), gather_cfg::cout, DBG_PRINT, reco::deltaPhi(), PVValHelper::dz, L2TauPixelTrackMatch::TinyTrack::eta, edm::Event::getByToken(), trigger::TriggerRefsCollections::getObjects(), mps_fire::i, metsig::jet, m_beamSpotTag, m_deltaR, m_jetMaxEta, m_jetMinPt, m_jetSrc, m_trackMinPt, m_trackSrc, eostools::move(), n0, L2TauPixelTrackMatch::TinyTrack::phi, L2TauPixelTrackMatch::TinyTrack::pt, edm::Event::put(), reco::LeafCandidate::setVertex(), mathSSE::sqrt(), trigger::TriggerTau, L2TauPixelTrackMatch::TinyTrack::vtx, reco::BeamSpot::x(), reco::BeamSpot::x0(), reco::BeamSpot::y(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

30  {
31  using namespace std;
32  using namespace reco;
33 
34  // *** Pick up beam spot ***
35 
36  // use beam spot for vertex x,y
37  edm::Handle<BeamSpot> bsHandle;
38  ev.getByToken(m_beamSpotTag, bsHandle);
39  const reco::BeamSpot& bs = *bsHandle;
40  math::XYZPoint beam_spot(bs.x0(), bs.y0(), bs.z0());
41  DBG_PRINT(cout << endl << "beamspot " << beam_spot << endl);
42 
43  // *** Pick up pixel tracks ***
44 
45  edm::Handle<TrackCollection> tracksHandle;
46  ev.getByToken(m_trackSrc, tracksHandle);
47 
48  // *** Pick up L2 tau jets that were previously selected by some other filter ***
49 
50  // first, get L2 object refs by the label
52  ev.getByToken(m_jetSrc, jetsHandle);
53 
54  // now we can get pre-selected L2 tau jets
55  std::vector<CaloJetRef> tau_jets;
56  jetsHandle->getObjects(trigger::TriggerTau, tau_jets);
57  const size_t n_jets = tau_jets.size();
58 
59  // *** Selects interesting tracks ***
60 
61  vector<TinyTrack> good_tracks;
62  for (TrackCollection::const_iterator itrk = tracksHandle->begin(); itrk != tracksHandle->end(); ++itrk) {
63  if (itrk->pt() < m_trackMinPt)
64  continue;
65  if (std::abs(itrk->eta()) > m_jetMaxEta + m_deltaR)
66  continue;
67 
68  TinyTrack trk;
69  trk.pt = itrk->pt();
70  trk.phi = itrk->phi();
71  trk.eta = itrk->eta();
72  double dz = itrk->dz(beam_spot);
73  trk.vtx = math::XYZPoint(bs.x(dz), bs.y(dz), dz);
74  good_tracks.push_back(trk);
75  }
76  DBG_PRINT(cout << "got " << good_tracks.size() << " good tracks; " << n_jets << " tau jets" << endl);
77 
78  // *** Match tau jets to intertesting tracks and assign them new vertices ***
79 
80  // the new product
81  std::unique_ptr<CaloJetCollection> new_tau_jets(new CaloJetCollection);
82  int n_uniq = 0;
83  if (!good_tracks.empty())
84  for (size_t i = 0; i < n_jets; ++i) {
85  reco::CaloJetRef jet = tau_jets[i];
86  if (jet->pt() < m_jetMinPt || std::abs(jet->eta()) > m_jetMaxEta)
87  continue;
88 
89  DBG_PRINT(cout << i << " :" << endl);
90 
91  size_t n0 = new_tau_jets->size();
92 
93  for (vector<TinyTrack>::const_iterator itrk = good_tracks.begin(); itrk != good_tracks.end(); ++itrk) {
94  DBG_PRINT(cout << " trk pt,eta,phi,z: " << itrk->pt << " " << itrk->eta << " " << itrk->phi << " "
95  << itrk->vtx.z() << " \t\t ");
96 
97  math::XYZTLorentzVector new_jet_dir = Jet::physicsP4(itrk->vtx, *jet, itrk->vtx);
98  float dphi = reco::deltaPhi(new_jet_dir.phi(), itrk->phi);
99  float deta = new_jet_dir.eta() - itrk->eta;
100 
101  DBG_PRINT(cout << " jet pt,deta,dphi,dr: " << jet->pt() << " " << deta << " " << dphi << " "
102  << sqrt(dphi * dphi + deta * deta) << endl);
103 
104  if (dphi * dphi + deta * deta > m_deltaR * m_deltaR)
105  continue;
106 
107  DBG_PRINT(cout << " jet-trk match!" << endl);
108 
109  // create a jet copy and assign a new vertex to it
110  CaloJet new_jet = *jet;
111  new_jet.setVertex(itrk->vtx);
112 
113  new_tau_jets->push_back(new_jet);
114  }
115  DBG_PRINT(cout << " nmatchedjets " << new_tau_jets->size() - n0 << endl);
116  if (new_tau_jets->size() - n0 > 0)
117  n_uniq++;
118 
120  }
121  DBG_PRINT(cout << "n_uniq_matched_jets " << n_uniq << endl << "storing njets " << new_tau_jets->size() << endl);
122 
123  // store the result
124  ev.put(std::move(new_tau_jets));
125 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
double z0() const
z coordinate
Definition: BeamSpot.h:65
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
void getObjects(Vids &ids, VRphoton &refs) const
various physics-level getters:
Jets made from CaloTowers.
Definition: CaloJet.h:27
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
#define DBG_PRINT(arg)
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
int n0
Definition: AMPTWrapper.h:44
T sqrt(T t)
Definition: SSEVec.h:19
edm::EDGetTokenT< reco::TrackCollection > m_trackSrc
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double x(const double z) const
x coordinate of the beeam spot position at a given z value (it takes into account the dxdz slope) ...
Definition: BeamSpot.h:68
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
edm::EDGetTokenT< reco::BeamSpot > m_beamSpotTag
fixed size matrix
double y(const double z) const
y coordinate of the beeam spot position at a given z value (it takes into account the dydz slope) ...
Definition: BeamSpot.h:70
double y0() const
y coordinate
Definition: BeamSpot.h:63
def move(src, dest)
Definition: eostools.py:511
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
double x0() const
x coordinate
Definition: BeamSpot.h:61

Member Data Documentation

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

Definition at line 39 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

float L2TauPixelTrackMatch::m_deltaR
private

Definition at line 38 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

float L2TauPixelTrackMatch::m_jetMaxEta
private

Definition at line 35 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

float L2TauPixelTrackMatch::m_jetMinPt
private

Definition at line 34 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

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

Definition at line 33 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

float L2TauPixelTrackMatch::m_trackMinPt
private

Definition at line 37 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

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

Definition at line 36 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().