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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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 22 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_.

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

Definition at line 47 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 
)
privatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 112 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_.

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  std::auto_ptr<edm::ValueMap<double> > jetIdDiscriminants_ptr(new edm::ValueMap<double>());
146  edm::ValueMap<double>::Filler jetIdDiscriminantFiller(*jetIdDiscriminants_ptr);
147  jetIdDiscriminantFiller.insert(jets, jetIdDiscriminants.begin(), jetIdDiscriminants.end());
148  jetIdDiscriminantFiller.fill();
149 
150  std::auto_ptr<edm::ValueMap<int> > jetIdFlags_ptr(new 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(jetIdDiscriminants_ptr, "Discriminant");
156  evt.put(jetIdFlags_ptr, "Id");
157 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
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().