CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 ()
 
- Public Member Functions inherited from edm::stream::EDFilter<>
 EDFilter ()=default
 
- Public Member Functions inherited from edm::stream::EDFilterBase
 EDFilterBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDFilterBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 ()
 

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

virtual 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<>
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::EDFilterBase
typedef EDFilterAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
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 ( )

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 HLT_25ns10e33_v2_cff::InputTag.

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

Implements edm::stream::EDFilterBase.

Definition at line 125 of file JetVertexChecker.cc.

References funct::abs(), SiPixelRawToDigiRegional_cfi::beamSpot, edm::RefVector< C, T, F >::begin(), reco::TrackBase::chi2(), alignCSCRings::e, edm::RefVector< C, T, F >::end(), edm::Event::getByToken(), 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(), AlCaHLTBitMon_ParallelJobs::p, reco::TrackBase::pt(), edm::Event::put(), mps_fire::result, and testEve_cfg::tracks.

126 {
127  using namespace edm;
129  iEvent.getByToken(m_associator, jetTracksAssociation);
130  std::auto_ptr<std::vector<reco::CaloJet> > pOut(new 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(pOut);
160 
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  std::auto_ptr<reco::VertexCollection> pOut2(new reco::VertexCollection);
171  pOut2->push_back(thePV);
172  iEvent.put(pOut2);
173 
174  if(m_doFilter) return result;
175  else
176  return true;
177 }
int i
Definition: DBlmapReader.cc:9
const double m_maxChi2
transient_vector_type::const_iterator const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
const double m_maxTrackPt
const bool m_newMethod
math::Error< dimension >::type Error
covariance error matrix (3x3)
Definition: Vertex.h:43
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const double m_pvErr_z
const double m_pvErr_y
const Vector & momentum() const
track momentum vector
Definition: TrackBase.h:670
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
tuple result
Definition: mps_fire.py:84
double chi2() const
chi-squared of the fit
Definition: TrackBase.h:544
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
const double m_cutMinPt
double pt() const
track transverse momentum
Definition: TrackBase.h:616
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
tuple tracks
Definition: testEve_cfg.py:39
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
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 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().