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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices 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<>
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
 
- Public Types inherited from edm::stream::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
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)
 
template<Transition B>
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 (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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 }

◆ ~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 173 of file JetVertexChecker.cc.

173  {
175  desc.add<edm::InputTag>("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
176  desc.add<edm::InputTag>("jetTracks", edm::InputTag("hltFastPVJetTracksAssociator"));
177  desc.add<double>("minPtRatio", 0.1);
178  desc.add<double>("minPt", 0.0);
179  desc.add<bool>("doFilter", false);
180  desc.add<int>("maxNJetsToCheck", 2);
181  desc.add<int>("maxNjetsOutput", 2);
182  desc.add<double>("maxChi2", 20.0);
183  desc.add<double>("maxTrackPt", 20.0);
184  desc.add<bool>("newMethod", false); // <---- newMethod
185  desc.add<double>("maxETA", 2.4);
186  desc.add<double>("pvErr_x", 0.0015);
187  desc.add<double>("pvErr_y", 0.0015);
188  desc.add<double>("pvErr_z", 1.5);
189  descriptions.add("jetVertexChecker", desc);
190 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

◆ filter()

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

Implements edm::stream::EDFilterBase.

Definition at line 116 of file JetVertexChecker.cc.

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  float calopt = 0;
125  float trkpt = 0;
126  //limit to first two jets
127  for (reco::JetTracksAssociationCollection::const_iterator it = jetTracksAssociation->begin(),
128  et = jetTracksAssociation->end();
129  it != et && i < m_maxNjets;
130  it++, i++) {
131  if (std::abs(it->first->eta()) < m_maxETA) {
132  reco::TrackRefVector tracks = it->second;
133  math::XYZVector jetMomentum = it->first->momentum();
134  math::XYZVector trMomentum;
135  for (reco::TrackRefVector::const_iterator itTrack = tracks.begin(); itTrack != tracks.end(); ++itTrack) {
136  const reco::Track& iTrack = **itTrack;
137  if (m_newMethod && iTrack.chi2() > m_maxChi2)
138  continue;
139  trMomentum += iTrack.momentum();
140  if (m_newMethod)
141  trkpt += std::min(m_maxTrackPt, (iTrack.pt()));
142  else
143  trkpt += iTrack.pt();
144  }
145  calopt += jetMomentum.rho();
146  if (trMomentum.rho() / jetMomentum.rho() < m_cutMinPtRatio || trMomentum.rho() < m_cutMinPt) {
147  pOut->push_back(*dynamic_cast<const reco::CaloJet*>(&(*it->first)));
148  }
149  }
150  }
151  iEvent.put(std::move(pOut));
152 
154  iEvent.getByToken(m_beamSpot, beamSpot);
155 
157  e(0, 0) = m_pvErr_x * m_pvErr_x;
158  e(1, 1) = m_pvErr_y * m_pvErr_y;
159  e(2, 2) = m_pvErr_z * m_pvErr_z;
160  reco::Vertex::Point p(beamSpot->x0(), beamSpot->y0(), beamSpot->z0());
161  reco::Vertex thePV(p, e, 0, 0, 0);
162  auto pOut2 = std::make_unique<reco::VertexCollection>();
163  pOut2->push_back(thePV);
164  iEvent.put(std::move(pOut2));
165 
166  if (m_doFilter)
167  return result;
168  else
169  return true;
170 }

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_maxTrackPt, m_newMethod, m_pvErr_x, m_pvErr_y, m_pvErr_z, min(), reco::TrackBase::momentum(), eostools::move(), AlCaHLTBitMon_ParallelJobs::p, reco::TrackBase::pt(), mps_fire::result, and PDWG_EXOHSCP_cff::tracks.

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.

Referenced by filter().

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

PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
JetVertexChecker::m_pvErr_y
const double m_pvErr_y
Definition: JetVertexChecker.cc:71
JetVertexChecker::m_beamSpot
const edm::EDGetTokenT< reco::BeamSpot > m_beamSpot
Definition: JetVertexChecker.cc:58
min
T min(T a, T b)
Definition: MathUtil.h:58
edm
HLT enums.
Definition: AlignableModifier.h:19
reco::Vertex::Error
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
JetVertexChecker::m_newMethod
const bool m_newMethod
Definition: JetVertexChecker.cc:67
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::RefVector< TrackCollection >
edm::Handle
Definition: AssociativeIterator.h:50
JetVertexChecker::m_maxNjetsOutput
const int32_t m_maxNjetsOutput
Definition: JetVertexChecker.cc:65
reco::TrackBase::pt
double pt() const
track transverse momentum
Definition: TrackBase.h:608
JetVertexChecker::m_maxNjets
const int32_t m_maxNjets
Definition: JetVertexChecker.cc:64
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
edm::AssociationVector::begin
const_iterator begin() const
Definition: AssociationVector.h:108
reco::Track
Definition: Track.h:27
edm::AssociationVector::end
const_iterator end() const
Definition: AssociationVector.h:109
JetVertexChecker::m_maxTrackPt
const double m_maxTrackPt
Definition: JetVertexChecker.cc:62
JetVertexChecker::m_maxETA
const double m_maxETA
Definition: JetVertexChecker.cc:69
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
JetVertexChecker::m_cutMinPt
const double m_cutMinPt
Definition: JetVertexChecker.cc:60
JetVertexChecker::m_doFilter
const bool m_doFilter
Definition: JetVertexChecker.cc:59
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::AssociationVector::const_iterator
transient_vector_type::const_iterator const_iterator
Definition: AssociationVector.h:106
JetVertexChecker::m_associator
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > m_associator
Definition: JetVertexChecker.cc:57
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
reco::TrackBase::chi2
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:572
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
JetVertexChecker::m_pvErr_x
const double m_pvErr_x
Definition: JetVertexChecker.cc:70
reco::Vertex::Point
math::XYZPoint Point
point in the space
Definition: Vertex.h:40
eostools.move
def move(src, dest)
Definition: eostools.py:511
JetVertexChecker::m_cutMinPtRatio
const double m_cutMinPtRatio
Definition: JetVertexChecker.cc:61
edm::RefVectorIterator
Definition: EDProductfwd.h:33
mps_fire.result
result
Definition: mps_fire.py:303
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
reco::TrackBase::momentum
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:635
edm::InputTag
Definition: InputTag.h:15
JetVertexChecker::m_pvErr_z
const double m_pvErr_z
Definition: JetVertexChecker.cc:72
reco::Vertex
Definition: Vertex.h:35
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
JetVertexChecker::m_maxChi2
const double m_maxChi2
Definition: JetVertexChecker.cc:63