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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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
 
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 () 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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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::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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 47 of file JetVertexChecker.cc.

Constructor & Destructor Documentation

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

Definition at line 88 of file JetVertexChecker.cc.

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

Definition at line 110 of file JetVertexChecker.cc.

111 {
112 
113  // do anything here that needs to be done at desctruction time
114  // (e.g. close files, deallocate resources etc.)
115 
116 }

Member Function Documentation

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

Definition at line 181 of file JetVertexChecker.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and DEFINE_FWK_MODULE.

181  {
183  desc.add<edm::InputTag> ("beamSpot", edm::InputTag("hltOnlineBeamSpot"));
184  desc.add<edm::InputTag> ("jetTracks",edm::InputTag("hltFastPVJetTracksAssociator"));
185  desc.add<double> ("minPtRatio", 0.1);
186  desc.add<double> ("minPt", 0.0);
187  desc.add<bool> ("doFilter", false);
188  desc.add<int> ("maxNJetsToCheck",2);
189  desc.add<int> ("maxNjetsOutput", 2);
190  desc.add<double> ("maxChi2", 20.0);
191  desc.add<double> ("maxTrackPt", 20.0);
192  desc.add<bool> ("newMethod", false); // <---- newMethod
193  desc.add<double> ("maxETA", 2.4 );
194  desc.add<double> ("pvErr_x", 0.0015);
195  desc.add<double> ("pvErr_y", 0.0015);
196  desc.add<double> ("pvErr_z", 1.5 );
197  descriptions.add("jetVertexChecker",desc);
198 }
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 
)
overrideprivate

Definition at line 125 of file JetVertexChecker.cc.

References funct::abs(), ecalDrivenElectronSeedsParameters_cff::beamSpot, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::begin(), edm::RefVector< C, T, F >::begin(), reco::TrackBase::chi2(), MillePedeFileConverter_cfg::e, edm::AssociationVector< KeyRefProd, CVal, KeyRef, SizeType, KeyReferenceHelper >::end(), edm::RefVector< C, T, F >::end(), stringResolutionProvider_cfi::et, 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, l1t::tracks, reco::BeamSpot::x0(), reco::BeamSpot::y0(), and reco::BeamSpot::z0().

126 {
127  using namespace edm;
129  iEvent.getByToken(m_associator, jetTracksAssociation);
130  auto pOut = std::make_unique<std::vector<reco::CaloJet>>();
131 
132  bool result=true;
133  int i = 0;
134  float calopt=0;
135  float trkpt=0;
136  //limit to first two jets
137  for (reco::JetTracksAssociationCollection::const_iterator it = jetTracksAssociation->begin(), et = jetTracksAssociation->end();
138  it != et && i < m_maxNjets; it++, i++) {
139  if(std::abs(it->first->eta()) < m_maxETA)
140  {
141  reco::TrackRefVector tracks = it->second;
142  math::XYZVector jetMomentum = it->first->momentum();
143  math::XYZVector trMomentum;
144  for(reco::TrackRefVector::const_iterator itTrack = tracks.begin(); itTrack != tracks.end(); ++itTrack)
145  {
146  const reco::Track& iTrack = **itTrack;
147  if(m_newMethod && iTrack.chi2()>m_maxChi2) continue;
148  trMomentum += iTrack.momentum();
149  if(m_newMethod) trkpt += std::min(m_maxTrackPt,( iTrack.pt()));
150  else trkpt += iTrack.pt();
151  }
152  calopt += jetMomentum.rho();
153  if(trMomentum.rho()/jetMomentum.rho() < m_cutMinPtRatio || trMomentum.rho() < m_cutMinPt)
154  {
155  pOut->push_back(* dynamic_cast<const reco::CaloJet *>(&(*it->first)));
156  }
157  }
158  }
159  iEvent.put(std::move(pOut));
160 
162  iEvent.getByToken(m_beamSpot,beamSpot);
163 
165  e(0, 0) = m_pvErr_x * m_pvErr_x;
166  e(1, 1) = m_pvErr_y * m_pvErr_y;
167  e(2, 2) = m_pvErr_z * m_pvErr_z;
168  reco::Vertex::Point p(beamSpot->x0(), beamSpot->y0(), beamSpot->z0());
169  reco::Vertex thePV(p, e, 0, 0, 0);
170  auto pOut2 = std::make_unique<reco::VertexCollection>();
171  pOut2->push_back(thePV);
172  iEvent.put(std::move(pOut2));
173 
174  if(m_doFilter) return result;
175  else
176  return true;
177 }
double z0() const
z coordinate
Definition: BeamSpot.h:68
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
const double m_maxChi2
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
const double m_maxTrackPt
const bool m_newMethod
const_iterator end() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
const double m_pvErr_z
const double m_pvErr_y
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:675
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:253
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:248
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:549
const double m_cutMinPt
double pt() const
track transverse momentum
Definition: TrackBase.h:621
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:39
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:30
et
define resolution functions of each parameter
const double m_pvErr_x
HLT enums.
double y0() const
y coordinate
Definition: BeamSpot.h:66
const edm::EDGetTokenT< reco::BeamSpot > m_beamSpot
const_iterator begin() const
def move(src, dest)
Definition: eostools.py:510
const double m_cutMinPtRatio
double x0() const
x coordinate
Definition: BeamSpot.h:64

Member Data Documentation

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

Definition at line 58 of file JetVertexChecker.cc.

Referenced by filter().

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

Definition at line 59 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_cutMinPt
private

Definition at line 61 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_cutMinPtRatio
private

Definition at line 62 of file JetVertexChecker.cc.

Referenced by filter().

const bool JetVertexChecker::m_doFilter
private

Definition at line 60 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_maxChi2
private

Definition at line 64 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_maxETA
private

Definition at line 70 of file JetVertexChecker.cc.

Referenced by filter().

const int32_t JetVertexChecker::m_maxNjets
private

Definition at line 65 of file JetVertexChecker.cc.

Referenced by filter().

const int32_t JetVertexChecker::m_maxNjetsOutput
private

Definition at line 66 of file JetVertexChecker.cc.

const double JetVertexChecker::m_maxTrackPt
private

Definition at line 63 of file JetVertexChecker.cc.

Referenced by filter().

const bool JetVertexChecker::m_newMethod
private

Definition at line 68 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_pvErr_x
private

Definition at line 71 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_pvErr_y
private

Definition at line 72 of file JetVertexChecker.cc.

Referenced by filter().

const double JetVertexChecker::m_pvErr_z
private

Definition at line 73 of file JetVertexChecker.cc.

Referenced by filter().