CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JVFJetIdProducer (const edm::ParameterSet &)
 
 ~JVFJetIdProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 Member Functions

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

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<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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

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_, edm::hlt::Exception, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), JVFcut_, kNeutralJetNoPU, kNeutralJetPU, minTrackPt_, neutralJetOption_, srcHardScatterVertex_, srcJets_, srcPFCandidates_, srcPFCandToVertexAssociations_, AlCaHLTBitMon_QueryRunRegistry::string, and verbosity_.

22 {
23  srcJets_ = consumes<reco::PFJetCollection>(cfg.getParameter<edm::InputTag>("srcJets"));
24 
25  srcPFCandidates_ = consumes<reco::PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCandidates"));
26  srcPFCandToVertexAssociations_ = 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" ) neutralJetOption_ = kNeutralJetPU;
35  else if ( neutralJetOption_string == "noPU" ) neutralJetOption_ = kNeutralJetNoPU;
36  else throw cms::Exception("JVFJetIdProducer")
37  << "Invalid Configuration Parameter 'neutralJetOption' = " << neutralJetOption_string << " !!\n";
38 
39  verbosity_ = ( cfg.exists("verbosity") ) ?
40  cfg.getParameter<int>("verbosity") : 0;
41 
42  produces<edm::ValueMap<double> >("Discriminant");
43  produces<edm::ValueMap<int> >("Id");
44 }
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 ( )

Definition at line 46 of file JVFJetIdProducer.cc.

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

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 110 of file JVFJetIdProducer.cc.

References dZcut_, edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), edm::helper::Filler< Map >::insert(), metsig::jet, fwrapper::jets, JVFcut_, kNeutralJetNoPU, minTrackPt_, neutralJetOption_, reco::tau::pfCandidates(), edm::Event::put(), srcHardScatterVertex_, srcJets_, srcPFCandidates_, srcPFCandToVertexAssociations_, and verbosity_.

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

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().