CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~L2TauPixelTrackMatch ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

edm::EDGetTokenT< reco::BeamSpotm_beamSpotTag
 
float m_deltaR
 
float m_jetMaxEta
 
float m_jetMinPt
 
edm::EDGetTokenT
< trigger::TriggerFilterObjectWithRefs
m_jetSrc
 
float m_trackMinPt
 
edm::EDGetTokenT
< reco::TrackCollection
m_trackSrc
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 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 17 of file L2TauPixelTrackMatch.cc.

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

18 {
19  m_jetSrc = consumes<trigger::TriggerFilterObjectWithRefs>(conf.getParameter<edm::InputTag>("JetSrc"));
20  m_jetMinPt = conf.getParameter<double>("JetMinPt");
21  m_jetMaxEta = conf.getParameter<double>("JetMaxEta");
22  //m_jetMinN = conf.getParameter<int>("JetMinN");
23  m_trackSrc = consumes<reco::TrackCollection>(conf.getParameter<edm::InputTag>("TrackSrc"));
24  m_trackMinPt = conf.getParameter<double>("TrackMinPt");
25  m_deltaR = conf.getParameter<double>("deltaR");
26  m_beamSpotTag = consumes<reco::BeamSpot>(conf.getParameter<edm::InputTag>("BeamSpotSrc"));
27 
28  produces<reco::CaloJetCollection>();
29 }
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 ( )

Definition at line 32 of file L2TauPixelTrackMatch.cc.

32 {}

Member Function Documentation

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

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

Implements edm::EDProducer.

Definition at line 35 of file L2TauPixelTrackMatch.cc.

References funct::abs(), gather_cfg::cout, DBG_PRINT, reco::deltaPhi(), L2TauPixelTrackMatch::TinyTrack::eta, edm::Event::getByToken(), i, metsig::jet, m_beamSpotTag, m_deltaR, m_jetMaxEta, m_jetMinPt, m_jetSrc, m_trackMinPt, m_trackSrc, n0, L2TauPixelTrackMatch::TinyTrack::phi, L2TauPixelTrackMatch::TinyTrack::pt, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, reco::LeafCandidate::setVertex(), mathSSE::sqrt(), trigger::TriggerTau, and L2TauPixelTrackMatch::TinyTrack::vtx.

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

Member Data Documentation

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

Definition at line 43 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

float L2TauPixelTrackMatch::m_deltaR
private

Definition at line 42 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

float L2TauPixelTrackMatch::m_jetMaxEta
private

Definition at line 39 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

float L2TauPixelTrackMatch::m_jetMinPt
private

Definition at line 38 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

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

Definition at line 37 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

float L2TauPixelTrackMatch::m_trackMinPt
private

Definition at line 41 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().

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

Definition at line 40 of file L2TauPixelTrackMatch.h.

Referenced by L2TauPixelTrackMatch(), and produce().