CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
JetVertexChecker Class Reference

#include <RecoBTag/JetVertexChecker/src/JetVertexChecker.cc>

Inheritance diagram for JetVertexChecker:
edm::stream::EDFilter<> edm::stream::EDFilterBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetVertexChecker (const edm::ParameterSet &)
 
 ~JetVertexChecker () override
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
 EDFilter (const EDFilter &)=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 EDFilteroperator= (const EDFilter &)=delete
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
 EDFilterBase (const EDFilterBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDFilterBaseoperator= (const EDFilterBase &)=delete
 
 ~EDFilterBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDFilterBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

const edm::EDGetTokenT< reco::JetTracksAssociationCollectionm_associator
 
const edm::EDGetTokenT< reco::BeamSpotm_beamSpot
 
const double m_cutMinPt
 
const double m_cutMinPtRatio
 
const bool m_doFilter
 
const double m_maxChi2
 
const double m_maxETA
 
const int32_t m_maxNjets
 
const int32_t m_maxNjetsOutput
 
const double m_maxTrackPt
 
const bool m_newMethod
 
const double m_pvErr_x
 
const double m_pvErr_y
 
const double m_pvErr_z
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDFilter<>
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
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 46 of file JetVertexChecker.cc.

Constructor & Destructor Documentation

◆ JetVertexChecker()

JetVertexChecker::JetVertexChecker ( const edm::ParameterSet iConfig)
explicit

Definition at line 86 of file JetVertexChecker.cc.

87  : m_associator(consumes<reco::JetTracksAssociationCollection>(iConfig.getParameter<edm::InputTag>("jetTracks"))),
88  m_beamSpot(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot"))),
89  m_doFilter(iConfig.getParameter<bool>("doFilter")),
90  m_cutMinPt(iConfig.getParameter<double>("minPt")),
91  m_cutMinPtRatio(iConfig.getParameter<double>("minPtRatio")),
92  m_maxTrackPt(iConfig.getParameter<double>("maxTrackPt")),
93  m_maxChi2(iConfig.getParameter<double>("maxChi2")),
94  m_maxNjets(iConfig.getParameter<int32_t>("maxNJetsToCheck")),
95  m_maxNjetsOutput(iConfig.getParameter<int32_t>("maxNjetsOutput")),
96  m_newMethod(iConfig.getParameter<bool>("newMethod")),
97  m_maxETA(iConfig.getParameter<double>("maxETA")),
98  m_pvErr_x(iConfig.getParameter<double>("pvErr_x")),
99  m_pvErr_y(iConfig.getParameter<double>("pvErr_y")),
100  m_pvErr_z(iConfig.getParameter<double>("pvErr_z")) {
101  //now do what ever initialization is needed
102  produces<std::vector<reco::CaloJet>>();
103  produces<reco::VertexCollection>();
104 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const double m_maxChi2
const double m_maxTrackPt
const bool m_newMethod
const double m_pvErr_z
const double m_pvErr_y
const double m_cutMinPt
const int32_t m_maxNjets
const double m_maxETA
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > m_associator
const double m_pvErr_x
const edm::EDGetTokenT< reco::BeamSpot > m_beamSpot
const int32_t m_maxNjetsOutput
const double m_cutMinPtRatio

◆ ~JetVertexChecker()

JetVertexChecker::~JetVertexChecker ( )
override

Definition at line 106 of file JetVertexChecker.cc.

106  {
107  // do anything here that needs to be done at desctruction time
108  // (e.g. close files, deallocate resources etc.)
109 }

Member Function Documentation

◆ fillDescriptions()

void JetVertexChecker::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 166 of file JetVertexChecker.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

166  {
168  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
169  desc.add<edm::InputTag>("jetTracks", edm::InputTag("hltFastPVJetTracksAssociator"));
170  desc.add<double>("minPtRatio", 0.1);
171  desc.add<double>("minPt", 0.0);
172  desc.add<bool>("doFilter", false);
173  desc.add<int>("maxNJetsToCheck", 2);
174  desc.add<int>("maxNjetsOutput", 2);
175  desc.add<double>("maxChi2", 20.0);
176  desc.add<double>("maxTrackPt", 20.0);
177  desc.add<bool>("newMethod", false); // <---- newMethod
178  desc.add<double>("maxETA", 2.4);
179  desc.add<double>("pvErr_x", 0.0015);
180  desc.add<double>("pvErr_y", 0.0015);
181  desc.add<double>("pvErr_z", 1.5);
182  descriptions.add("jetVertexChecker", desc);
183 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ filter()

bool JetVertexChecker::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDFilterBase.

Definition at line 116 of file JetVertexChecker.cc.

References funct::abs(), pwdgSkimBPark_cfi::beamSpot, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), reco::TrackBase::chi2(), MillePedeFileConverter_cfg::e, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::end(), EgHLTOffHistBins_cfi::et, mps_fire::i, iEvent, m_associator, m_beamSpot, m_cutMinPt, m_cutMinPtRatio, m_doFilter, m_maxChi2, m_maxETA, m_maxNjets, m_newMethod, m_pvErr_x, m_pvErr_y, m_pvErr_z, reco::TrackBase::momentum(), eostools::move(), AlCaHLTBitMon_ParallelJobs::p, mps_fire::result, and pwdgSkimBPark_cfi::tracks.

116  {
117  using namespace edm;
119  iEvent.getByToken(m_associator, jetTracksAssociation);
120  auto pOut = std::make_unique<std::vector<reco::CaloJet>>();
121 
122  bool result = true;
123  int i = 0;
124  //limit to first two jets
125  for (reco::JetTracksAssociationCollection::const_iterator it = jetTracksAssociation->begin(),
126  et = jetTracksAssociation->end();
127  it != et && i < m_maxNjets;
128  it++, i++) {
129  if (std::abs(it->first->eta()) < m_maxETA) {
130  reco::TrackRefVector tracks = it->second;
131  math::XYZVector jetMomentum = it->first->momentum();
132  math::XYZVector trMomentum;
133  for (reco::TrackRefVector::const_iterator itTrack = tracks.begin(); itTrack != tracks.end(); ++itTrack) {
134  const reco::Track& iTrack = **itTrack;
135  if (m_newMethod && iTrack.chi2() > m_maxChi2)
136  continue;
137  trMomentum += iTrack.momentum();
138  }
139  if (trMomentum.rho() / jetMomentum.rho() < m_cutMinPtRatio || trMomentum.rho() < m_cutMinPt) {
140  pOut->push_back(*dynamic_cast<const reco::CaloJet*>(&(*it->first)));
141  }
142  }
143  }
144  iEvent.put(std::move(pOut));
145 
147  iEvent.getByToken(m_beamSpot, beamSpot);
148 
150  e(0, 0) = m_pvErr_x * m_pvErr_x;
151  e(1, 1) = m_pvErr_y * m_pvErr_y;
152  e(2, 2) = m_pvErr_z * m_pvErr_z;
153  reco::Vertex::Point p(beamSpot->x0(), beamSpot->y0(), beamSpot->z0());
154  reco::Vertex thePV(p, e, 0, 0, 0);
155  auto pOut2 = std::make_unique<reco::VertexCollection>();
156  pOut2->push_back(thePV);
157  iEvent.put(std::move(pOut2));
158 
159  if (m_doFilter)
160  return result;
161  else
162  return true;
163 }
const double m_maxChi2
transient_vector_type::const_iterator const_iterator
const bool m_newMethod
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
const double m_pvErr_z
const_iterator begin() const
const double m_pvErr_y
int iEvent
Definition: GenABIO.cc:224
const double m_cutMinPt
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const int32_t m_maxNjets
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
const double m_maxETA
const_iterator end() const
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > m_associator
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:587
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
const double m_pvErr_x
HLT enums.
const edm::EDGetTokenT< reco::BeamSpot > m_beamSpot
def move(src, dest)
Definition: eostools.py:511
const double m_cutMinPtRatio

Member Data Documentation

◆ m_associator

const edm::EDGetTokenT<reco::JetTracksAssociationCollection> JetVertexChecker::m_associator
private

Definition at line 57 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_beamSpot

const edm::EDGetTokenT<reco::BeamSpot> JetVertexChecker::m_beamSpot
private

Definition at line 58 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_cutMinPt

const double JetVertexChecker::m_cutMinPt
private

Definition at line 60 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_cutMinPtRatio

const double JetVertexChecker::m_cutMinPtRatio
private

Definition at line 61 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_doFilter

const bool JetVertexChecker::m_doFilter
private

Definition at line 59 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_maxChi2

const double JetVertexChecker::m_maxChi2
private

Definition at line 63 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_maxETA

const double JetVertexChecker::m_maxETA
private

Definition at line 69 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_maxNjets

const int32_t JetVertexChecker::m_maxNjets
private

Definition at line 64 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_maxNjetsOutput

const int32_t JetVertexChecker::m_maxNjetsOutput
private

Definition at line 65 of file JetVertexChecker.cc.

◆ m_maxTrackPt

const double JetVertexChecker::m_maxTrackPt
private

Definition at line 62 of file JetVertexChecker.cc.

◆ m_newMethod

const bool JetVertexChecker::m_newMethod
private

Definition at line 67 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_pvErr_x

const double JetVertexChecker::m_pvErr_x
private

Definition at line 70 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_pvErr_y

const double JetVertexChecker::m_pvErr_y
private

Definition at line 71 of file JetVertexChecker.cc.

Referenced by filter().

◆ m_pvErr_z

const double JetVertexChecker::m_pvErr_z
private

Definition at line 72 of file JetVertexChecker.cc.

Referenced by filter().