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
JVFJetIdProducer Class Reference

#include <JVFJetIdProducer.h>

Inheritance diagram for JVFJetIdProducer:
edm::stream::EDProducer<>

Public Member Functions

 JVFJetIdProducer (const edm::ParameterSet &)
 
 ~JVFJetIdProducer () 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

double dZcut_
 
double JVFcut_
 
double minTrackPt_
 
int neutralJetOption_
 
edm::EDGetTokenT
< reco::VertexCollection
srcHardScatterVertex_
 
edm::EDGetTokenT
< reco::PFJetCollection
srcJets_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
srcPFCandidates_
 
edm::EDGetTokenT
< PFCandToVertexAssMap
srcPFCandToVertexAssociations_
 
int verbosity_
 

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

Discriminate jets originating from the hard-scatter event from pile-up jets, based on the fraction of tracks within the jet that are associated to the hard-scatter vertex. Jets outside the tracking acceptance are considered to originate from the hard-scatter event per default. Optionally, they can be classified as pile-up.

Authors
Christian Veelken, LLR

Definition at line 25 of file JVFJetIdProducer.h.

Constructor & Destructor Documentation

JVFJetIdProducer::JVFJetIdProducer ( const edm::ParameterSet cfg)

Definition at line 21 of file JVFJetIdProducer.cc.

References dZcut_, Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), JVFcut_, kNeutralJetNoPU, kNeutralJetPU, minTrackPt_, neutralJetOption_, srcHardScatterVertex_, srcJets_, srcPFCandidates_, srcPFCandToVertexAssociations_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

21  {
22  srcJets_ = consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets"));
23 
24  srcPFCandidates_ = consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates"));
26  consumes<PFCandToVertexAssMap>(cfg.getParameter<edm::InputTag>("srcPFCandToVertexAssociations"));
27  srcHardScatterVertex_ = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("srcHardScatterVertex"));
28  minTrackPt_ = cfg.getParameter<double>("minTrackPt");
29  dZcut_ = cfg.getParameter<double>("dZcut");
30 
31  JVFcut_ = cfg.getParameter<double>("JVFcut");
32 
33  std::string neutralJetOption_string = cfg.getParameter<std::string>("neutralJetOption");
34  if (neutralJetOption_string == "PU")
36  else if (neutralJetOption_string == "noPU")
38  else
39  throw cms::Exception("JVFJetIdProducer")
40  << "Invalid Configuration Parameter 'neutralJetOption' = " << neutralJetOption_string << " !!\n";
41 
42  verbosity_ = (cfg.exists("verbosity")) ? cfg.getParameter<int>("verbosity") : 0;
43 
44  produces<edm::ValueMap<double>>("Discriminant");
45  produces<edm::ValueMap<int>>("Id");
46 }
edm::EDGetTokenT< reco::PFJetCollection > srcJets_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< PFCandToVertexAssMap > srcPFCandToVertexAssociations_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
edm::EDGetTokenT< reco::VertexCollection > srcHardScatterVertex_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
JVFJetIdProducer::~JVFJetIdProducer ( )
override

Definition at line 48 of file JVFJetIdProducer.cc.

48  {
49  // nothing to be done yet...
50 }

Member Function Documentation

void JVFJetIdProducer::produce ( edm::Event evt,
const edm::EventSetup es 
)
overrideprivate

Definition at line 120 of file JVFJetIdProducer.cc.

References dZcut_, edm::Event::getByToken(), metsig::jet, fwrapper::jets, JVFcut_, kNeutralJetNoPU, minTrackPt_, eostools::move(), neutralJetOption_, slimmedMuons_cfi::pfCandidates, edm::Event::put(), srcHardScatterVertex_, srcJets_, srcPFCandidates_, srcPFCandToVertexAssociations_, and verbosity_.

120  {
121  // get jets
123  evt.getByToken(srcJets_, jets);
124 
125  // get PFCandidates
127  evt.getByToken(srcPFCandidates_, pfCandidates);
128 
129  // get PFCandidate-to-vertex associations and "the" hard-scatter vertex
130  edm::Handle<PFCandToVertexAssMap> pfCandToVertexAssociations;
131  evt.getByToken(srcPFCandToVertexAssociations_, pfCandToVertexAssociations);
132 
133  edm::Handle<reco::VertexCollection> hardScatterVertex;
134  evt.getByToken(srcHardScatterVertex_, hardScatterVertex);
135 
136  std::vector<double> jetIdDiscriminants;
137  std::vector<int> jetIdFlags;
138 
139  size_t numJets = jets->size();
140  for (size_t iJet = 0; iJet < numJets; ++iJet) {
141  reco::PFJetRef jet(jets, iJet);
142 
143  double jetJVF = computeJVF(
144  *jet, *pfCandToVertexAssociations, *hardScatterVertex, dZcut_, minTrackPt_, verbosity_ && jet->pt() > 20.);
145  jetIdDiscriminants.push_back(jetJVF);
146 
147  int jetIdFlag = 0;
148  if (jetJVF > JVFcut_)
149  jetIdFlag = 255;
150  else if (jetJVF < -0.5 && neutralJetOption_ == kNeutralJetNoPU)
151  jetIdFlag = 255;
152  jetIdFlags.push_back(jetIdFlag);
153  }
154 
155  auto jetIdDiscriminants_ptr = std::make_unique<edm::ValueMap<double>>();
156  edm::ValueMap<double>::Filler jetIdDiscriminantFiller(*jetIdDiscriminants_ptr);
157  jetIdDiscriminantFiller.insert(jets, jetIdDiscriminants.begin(), jetIdDiscriminants.end());
158  jetIdDiscriminantFiller.fill();
159 
160  auto jetIdFlags_ptr = std::make_unique<edm::ValueMap<int>>();
161  edm::ValueMap<int>::Filler jetIdFlagFiller(*jetIdFlags_ptr);
162  jetIdFlagFiller.insert(jets, jetIdFlags.begin(), jetIdFlags.end());
163  jetIdFlagFiller.fill();
164 
165  evt.put(std::move(jetIdDiscriminants_ptr), "Discriminant");
166  evt.put(std::move(jetIdFlags_ptr), "Id");
167 }
edm::EDGetTokenT< reco::PFJetCollection > srcJets_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< PFCandToVertexAssMap > srcPFCandToVertexAssociations_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCandidates_
vector< PseudoJet > jets
def move
Definition: eostools.py:511
edm::EDGetTokenT< reco::VertexCollection > srcHardScatterVertex_

Member Data Documentation

double JVFJetIdProducer::dZcut_
private

Definition at line 39 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

double JVFJetIdProducer::JVFcut_
private

Definition at line 41 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

double JVFJetIdProducer::minTrackPt_
private

Definition at line 38 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

int JVFJetIdProducer::neutralJetOption_
private

Definition at line 43 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

edm::EDGetTokenT<reco::VertexCollection> JVFJetIdProducer::srcHardScatterVertex_
private

Definition at line 37 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

edm::EDGetTokenT<reco::PFJetCollection> JVFJetIdProducer::srcJets_
private

Definition at line 33 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

edm::EDGetTokenT<reco::PFCandidateCollection> JVFJetIdProducer::srcPFCandidates_
private

Definition at line 35 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

edm::EDGetTokenT<PFCandToVertexAssMap> JVFJetIdProducer::srcPFCandToVertexAssociations_
private

Definition at line 36 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

int JVFJetIdProducer::verbosity_
private

Definition at line 45 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().