CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
 
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)
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
bool registeredToConsumeMany (TypeID const &, 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::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::JetTracksAssociationCollection
m_associator
 
const edm::EDGetTokenT
< reco::BeamSpot
m_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
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
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< B > consumes (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 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)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
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 ( 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 }
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const double m_pvErr_x
const edm::EDGetTokenT< reco::BeamSpot > m_beamSpot
const int32_t m_maxNjetsOutput
const double m_cutMinPtRatio
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

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

Definition at line 173 of file JetVertexChecker.cc.

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

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 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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(), beam_dqm_sourceclient-live_cfg::beamSpot, edm::RefVector< C, T, F >::begin(), reco::TrackBase::chi2(), alignCSCRings::e, edm::RefVector< C, T, F >::end(), edm::Event::getByToken(), mps_fire::i, 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(), edm::Event::put(), mps_fire::result, and 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  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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const double m_maxChi2
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const double m_maxTrackPt
const bool m_newMethod
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:44
const double m_pvErr_z
const double m_pvErr_y
auto const & tracks
cannot be loose
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:664
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:228
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:223
tuple result
Definition: mps_fire.py:311
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:587
const double m_cutMinPt
double pt() const
track transverse momentum
Definition: TrackBase.h:637
def move
Definition: eostools.py:511
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
T min(T a, T b)
Definition: MathUtil.h:58
const double m_maxETA
const edm::EDGetTokenT< reco::JetTracksAssociationCollection > m_associator
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
const double m_pvErr_x
const edm::EDGetTokenT< reco::BeamSpot > m_beamSpot
const double m_cutMinPtRatio

Member Data Documentation

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

Definition at line 57 of file JetVertexChecker.cc.

Referenced by filter().

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

Definition at line 58 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_cutMinPt
private

Definition at line 60 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_cutMinPtRatio
private

Definition at line 61 of file JetVertexChecker.cc.

Referenced by filter().

const bool JetVertexChecker::m_doFilter
private

Definition at line 59 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_maxChi2
private

Definition at line 63 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_maxETA
private

Definition at line 69 of file JetVertexChecker.cc.

Referenced by filter().

const int32_t JetVertexChecker::m_maxNjets
private

Definition at line 64 of file JetVertexChecker.cc.

Referenced by filter().

const int32_t JetVertexChecker::m_maxNjetsOutput
private

Definition at line 65 of file JetVertexChecker.cc.

const double JetVertexChecker::m_maxTrackPt
private

Definition at line 62 of file JetVertexChecker.cc.

Referenced by filter().

const bool JetVertexChecker::m_newMethod
private

Definition at line 67 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_pvErr_x
private

Definition at line 70 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_pvErr_y
private

Definition at line 71 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_pvErr_z
private

Definition at line 72 of file JetVertexChecker.cc.

Referenced by filter().