CMS 3D CMS Logo

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
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double dZcut_
 
double JVFcut_
 
double minTrackPt_
 
int neutralJetOption_
 
edm::EDGetTokenT< reco::VertexCollectionsrcHardScatterVertex_
 
edm::EDGetTokenT< reco::PFJetCollectionsrcJets_
 
edm::EDGetTokenT< reco::PFCandidateCollectionsrcPFCandidates_
 
edm::EDGetTokenT< PFCandToVertexAssMapsrcPFCandToVertexAssociations_
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache 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 22 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_.

23 {
24  srcJets_ = consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets"));
25 
26  srcPFCandidates_ = consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates"));
27  srcPFCandToVertexAssociations_ = consumes<PFCandToVertexAssMap>(cfg.getParameter<edm::InputTag>("srcPFCandToVertexAssociations") );
28  srcHardScatterVertex_ = consumes<reco::VertexCollection>(cfg.getParameter<edm::InputTag>("srcHardScatterVertex") );
29  minTrackPt_ = cfg.getParameter<double>("minTrackPt");
30  dZcut_ = cfg.getParameter<double>("dZcut");
31 
32  JVFcut_ = cfg.getParameter<double>("JVFcut");
33 
34  std::string neutralJetOption_string = cfg.getParameter<std::string>("neutralJetOption");
35  if ( neutralJetOption_string == "PU" ) neutralJetOption_ = kNeutralJetPU;
36  else if ( neutralJetOption_string == "noPU" ) neutralJetOption_ = kNeutralJetNoPU;
37  else throw cms::Exception("JVFJetIdProducer")
38  << "Invalid Configuration Parameter 'neutralJetOption' = " << neutralJetOption_string << " !!\n";
39 
40  verbosity_ = ( cfg.exists("verbosity") ) ?
41  cfg.getParameter<int>("verbosity") : 0;
42 
43  produces<edm::ValueMap<double> >("Discriminant");
44  produces<edm::ValueMap<int> >("Id");
45 }
T getParameter(std::string const &) const
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_
edm::EDGetTokenT< reco::PFJetCollection > srcJets_
JVFJetIdProducer::~JVFJetIdProducer ( )
override

Member Function Documentation

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

Definition at line 112 of file JVFJetIdProducer.cc.

References DEFINE_FWK_MODULE, 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_.

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

Member Data Documentation

double JVFJetIdProducer::dZcut_
private

Definition at line 42 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

double JVFJetIdProducer::JVFcut_
private

Definition at line 44 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

double JVFJetIdProducer::minTrackPt_
private

Definition at line 41 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

int JVFJetIdProducer::neutralJetOption_
private

Definition at line 46 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

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

Definition at line 40 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

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

Definition at line 36 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

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

Definition at line 38 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

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

Definition at line 39 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().

int JVFJetIdProducer::verbosity_
private

Definition at line 48 of file JVFJetIdProducer.h.

Referenced by JVFJetIdProducer(), and produce().