CMS 3D CMS Logo

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

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

Inheritance diagram for PixelJetPuId:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PixelJetPuId (const edm::ParameterSet &)
 
 ~PixelJetPuId () override
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducerBase () 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
 
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)
 
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::global::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::StreamID sid, edm::Event &, const edm::EventSetup &) const override
 

Private Attributes

edm::EDGetTokenT< edm::View< reco::Jet > > generaljetsToken
 
edm::EDGetTokenT< edm::View< reco::CaloJet > > jetsToken
 
bool m_fwjets
 
edm::InputTag m_jets
 
double m_MaxTrackChi2
 
double m_MaxTrackDistanceToJet
 
double m_minet_fwjets
 
double m_mineta_fwjets
 
double m_MinGoodJetTrackPt
 
double m_MinGoodJetTrackPtRatio
 
double m_MinTrackPt
 
edm::InputTag m_primaryVertex
 
edm::InputTag m_tracks
 
edm::EDGetTokenT< reco::VertexCollectionprimaryVertexToken
 
edm::EDGetTokenT< std::vector< reco::Track > > tracksToken
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase 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)
 
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<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: The PixelJetPuId module select all the pixel tracks compatible with a jet. If the sum of the tracks momentum is under a threshold the jet is tagged as "PUjets".

Implementation: [Notes on implementation]

Definition at line 55 of file PixelJetPuId.cc.

Constructor & Destructor Documentation

PixelJetPuId::PixelJetPuId ( const edm::ParameterSet iConfig)

Definition at line 89 of file PixelJetPuId.cc.

References generaljetsToken, edm::ParameterSet::getParameter(), jetsToken, m_fwjets, m_jets, m_MaxTrackChi2, m_MaxTrackDistanceToJet, m_minet_fwjets, m_mineta_fwjets, m_MinGoodJetTrackPt, m_MinGoodJetTrackPtRatio, m_MinTrackPt, m_primaryVertex, m_tracks, primaryVertexToken, tracksToken, and ~PixelJetPuId().

89  {
90  //InputTag
91  m_tracks = iConfig.getParameter<edm::InputTag>("tracks");
92  tracksToken = consumes<std::vector<reco::Track> >(m_tracks);
93  m_jets = iConfig.getParameter<edm::InputTag>("jets");
94  jetsToken = consumes<edm::View<reco::CaloJet> >(m_jets);
95  generaljetsToken = consumes<edm::View<reco::Jet> >(m_jets);
96  m_primaryVertex = iConfig.getParameter<edm::InputTag>("primaryVertex");
97  primaryVertexToken = consumes<reco::VertexCollection>(m_primaryVertex);
98 
99  //Tracks Selection
100  m_MinTrackPt = iConfig.getParameter<double>("MinTrackPt");
101  m_MaxTrackDistanceToJet = iConfig.getParameter<double>("MaxTrackDistanceToJet");
102  m_MaxTrackChi2 = iConfig.getParameter<double>("MaxTrackChi2");
103 
104  //A jet is defined as a signal jet if Sum(trackPt) > minPt or Sum(comp.trackPt)/CaloJetPt > minPtRatio
105  m_MinGoodJetTrackPt = iConfig.getParameter<double>("MinGoodJetTrackPt");
106  m_MinGoodJetTrackPtRatio = iConfig.getParameter<double>("MinGoodJetTrackPtRatio");
107 
108  m_fwjets = iConfig.getParameter<bool>("UseForwardJetsAsNoPU");
109  m_mineta_fwjets = iConfig.getParameter<double>("MinEtaForwardJets");
110  m_minet_fwjets = iConfig.getParameter<double>("MinEtForwardJets");
111 
112  produces<std::vector<reco::CaloJet> >();
113  produces<std::vector<reco::CaloJet> >("PUjets");
114  produces<reco::JetTagCollection>();
115 }
T getParameter(std::string const &) const
double m_MinGoodJetTrackPt
Definition: PixelJetPuId.cc:82
edm::InputTag m_jets
Definition: PixelJetPuId.cc:68
double m_MaxTrackChi2
Definition: PixelJetPuId.cc:75
edm::EDGetTokenT< edm::View< reco::Jet > > generaljetsToken
Definition: PixelJetPuId.cc:71
edm::EDGetTokenT< edm::View< reco::CaloJet > > jetsToken
Definition: PixelJetPuId.cc:70
edm::InputTag m_primaryVertex
Definition: PixelJetPuId.cc:66
edm::EDGetTokenT< reco::VertexCollection > primaryVertexToken
Definition: PixelJetPuId.cc:72
double m_MaxTrackDistanceToJet
Definition: PixelJetPuId.cc:76
double m_minet_fwjets
Definition: PixelJetPuId.cc:80
double m_mineta_fwjets
Definition: PixelJetPuId.cc:79
edm::EDGetTokenT< std::vector< reco::Track > > tracksToken
Definition: PixelJetPuId.cc:69
edm::InputTag m_tracks
Definition: PixelJetPuId.cc:67
double m_MinTrackPt
Definition: PixelJetPuId.cc:74
double m_MinGoodJetTrackPtRatio
Definition: PixelJetPuId.cc:83
PixelJetPuId::~PixelJetPuId ( )
overridedefault

Referenced by PixelJetPuId().

Member Function Documentation

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

Definition at line 119 of file PixelJetPuId.cc.

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

119  {
121  desc.add<edm::InputTag>("jets", edm::InputTag("hltCaloJetL1FastJetCorrected"));
122  desc.add<edm::InputTag>("tracks", edm::InputTag("hltPixelTracksNoPU"));
123  desc.add<edm::InputTag>("primaryVertex", edm::InputTag("hltFastPVPixelVertices"));
124  desc.add<double>("MinGoodJetTrackPtRatio", 0.045);
125  desc.add<double>("MinGoodJetTrackPt", 1.8);
126  desc.add<double>("MaxTrackDistanceToJet", 0.04);
127  desc.add<double>("MinTrackPt", 0.6);
128  desc.add<double>("MaxTrackChi2", 20.);
129  desc.add<bool>("UseForwardJetsAsNoPU", true);
130  desc.add<double>("MinEtaForwardJets", 2.4);
131  desc.add<double>("MinEtForwardJets", 40.);
132  descriptions.add("pixelJetPuId", desc);
133 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void PixelJetPuId::produce ( edm::StreamID  sid,
edm::Event iEvent,
const edm::EventSetup iSetup 
) const
overrideprivate

Definition at line 140 of file PixelJetPuId.cc.

References TransientTrackBuilder::build(), DEFINE_FWK_MODULE, reco::deltaR2(), HLTMuonOfflineAnalyzer_cfi::deltaR2, generaljetsToken, edm::EventSetup::get(), edm::Event::getByToken(), mps_fire::i, singleTopDQM_cfi::jets, jetsToken, IPTools::jetTrackDistance(), findQualityFiles::jj, m_fwjets, m_MaxTrackChi2, m_MaxTrackDistanceToJet, m_minet_fwjets, m_mineta_fwjets, m_MinGoodJetTrackPt, m_MinGoodJetTrackPtRatio, m_MinTrackPt, edm::makeRefToBaseProdFrom(), eostools::move(), BeamMonitor_cff::primaryVertex, primaryVertexToken, edm::Handle< T >::product(), edm::Event::put(), MetAnalyzer::pv(), edm::second(), PDWG_EXOHSCP_cff::tracks, and tracksToken.

140  {
141  using namespace edm;
142  std::unique_ptr<std::vector<reco::CaloJet> > pOut(new std::vector<reco::CaloJet>);
143  std::unique_ptr<std::vector<reco::CaloJet> > pOut_PUjets(new std::vector<reco::CaloJet>);
144  std::unique_ptr<reco::JetTagCollection> pOut_jetTagCollection(new reco::JetTagCollection);
145 
146  //get tracks
148  iEvent.getByToken(tracksToken, tracks);
149  unsigned int tsize = tracks->size();
150  float teta[tsize], tphi[tsize];
151  unsigned int i = 0;
152  for (auto const& tr : *tracks) {
153  teta[i] = tr.eta();
154  tphi[i] = tr.phi();
155  ++i;
156  }
157 
158  //get jets
160  iEvent.getByToken(jetsToken, jets);
161 
162  Handle<edm::View<reco::Jet> > generaljets;
163  iEvent.getByToken(generaljetsToken, generaljets);
164 
165  //get primary vertices
167  iEvent.getByToken(primaryVertexToken, primaryVertex);
168 
169  //get Transient Track Builder
171  iSetup.get<TransientTrackRecord>().get("TransientTrackBuilder", builder);
172 
173  //init JetTagCollection
174  if (!generaljets.product()->empty()) {
176  pOut_jetTagCollection.reset(new reco::JetTagCollection(edm::makeRefToBaseProdFrom(jj, iEvent)));
177  }
178 
179  //loop on trackIPTagInfos
180  if (!primaryVertex->empty()) {
181  const reco::Vertex* pv = &*primaryVertex->begin();
182  //loop on jets
183  for (edm::View<reco::CaloJet>::const_iterator itJet = jets->begin(); itJet != jets->end(); itJet++) {
184  math::XYZVector jetMomentum = itJet->momentum();
185  GlobalVector direction(jetMomentum.x(), jetMomentum.y(), jetMomentum.z());
186 
187  math::XYZVector trMomentum;
188 
189  if (fabs(itJet->eta()) > m_mineta_fwjets) {
190  if ((m_fwjets) && (itJet->et() > m_minet_fwjets))
191  pOut->push_back(*itJet); // fill forward jet as signal jet
192  } else {
193  //loop on tracks
194  auto itTrack = tracks->begin();
195  for (unsigned int i = 0; i < tsize; ++i) {
196  float deltaR2 = reco::deltaR2(itJet->eta(), itJet->phi(), teta[i], tphi[i]);
197  if (deltaR2 < 0.25) {
198  reco::TransientTrack transientTrack = builder->build(*itTrack);
199  float jetTrackDistance = -((IPTools::jetTrackDistance(transientTrack, direction, *pv)).second).value();
200 
201  //select the tracks compabible with the jet
202  if ((itTrack->pt() > m_MinTrackPt) && (itTrack->normalizedChi2() < m_MaxTrackChi2) &&
203  (jetTrackDistance < m_MaxTrackDistanceToJet)) {
204  trMomentum += itTrack->momentum(); //calculate the Sum(trackPt)
205  }
206  }
207  itTrack++;
208  }
209  //if Sum(comp.trackPt)/CaloJetPt > minPtRatio or Sum(trackPt) > minPt the jet is a signal jet
210  if (trMomentum.rho() / jetMomentum.rho() > m_MinGoodJetTrackPtRatio || trMomentum.rho() > m_MinGoodJetTrackPt) {
211  pOut->push_back(*itJet); // fill it as signal jet
212  } else //else it is a PUjet
213  {
214  pOut_PUjets->push_back(*itJet); // fill it as PUjets
215  }
216  }
217  RefToBase<reco::Jet> jRef(generaljets, itJet - jets->begin());
218  (*pOut_jetTagCollection)[jRef] = trMomentum.rho(); // fill jetTagCollection
219  }
220  }
221  iEvent.put(std::move(pOut));
222  iEvent.put(std::move(pOut_PUjets), "PUjets");
223  iEvent.put(std::move(pOut_jetTagCollection));
224 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
double m_MinGoodJetTrackPt
Definition: PixelJetPuId.cc:82
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
double m_MaxTrackChi2
Definition: PixelJetPuId.cc:75
reco::TransientTrack build(const reco::Track *p) const
edm::EDGetTokenT< edm::View< reco::Jet > > generaljetsToken
Definition: PixelJetPuId.cc:71
edm::EDGetTokenT< edm::View< reco::CaloJet > > jetsToken
Definition: PixelJetPuId.cc:70
std::pair< double, Measurement1D > jetTrackDistance(const reco::TransientTrack &track, const GlobalVector &direction, const reco::Vertex &vertex)
Definition: IPTools.cc:206
U second(std::pair< T, U > const &p)
def pv(vc)
Definition: MetAnalyzer.py:7
edm::EDGetTokenT< reco::VertexCollection > primaryVertexToken
Definition: PixelJetPuId.cc:72
double m_MaxTrackDistanceToJet
Definition: PixelJetPuId.cc:76
double m_minet_fwjets
Definition: PixelJetPuId.cc:80
double m_mineta_fwjets
Definition: PixelJetPuId.cc:79
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
edm::EDGetTokenT< std::vector< reco::Track > > tracksToken
Definition: PixelJetPuId.cc:69
double m_MinTrackPt
Definition: PixelJetPuId.cc:74
T const * product() const
Definition: Handle.h:69
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
RefToBaseProd< T > makeRefToBaseProdFrom(RefToBase< T > const &iRef, Event const &iEvent)
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
T get() const
Definition: EventSetup.h:73
double m_MinGoodJetTrackPtRatio
Definition: PixelJetPuId.cc:83
primaryVertex
hltOfflineBeamSpot for HLTMON
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT<edm::View<reco::Jet> > PixelJetPuId::generaljetsToken
private

Definition at line 71 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

edm::EDGetTokenT<edm::View<reco::CaloJet> > PixelJetPuId::jetsToken
private

Definition at line 70 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

bool PixelJetPuId::m_fwjets
private

Definition at line 78 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

edm::InputTag PixelJetPuId::m_jets
private

Definition at line 68 of file PixelJetPuId.cc.

Referenced by PixelJetPuId().

double PixelJetPuId::m_MaxTrackChi2
private

Definition at line 75 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_MaxTrackDistanceToJet
private

Definition at line 76 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_minet_fwjets
private

Definition at line 80 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_mineta_fwjets
private

Definition at line 79 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_MinGoodJetTrackPt
private

Definition at line 82 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_MinGoodJetTrackPtRatio
private

Definition at line 83 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

double PixelJetPuId::m_MinTrackPt
private

Definition at line 74 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

edm::InputTag PixelJetPuId::m_primaryVertex
private

Definition at line 66 of file PixelJetPuId.cc.

Referenced by PixelJetPuId().

edm::InputTag PixelJetPuId::m_tracks
private

Definition at line 67 of file PixelJetPuId.cc.

Referenced by PixelJetPuId().

edm::EDGetTokenT<reco::VertexCollection> PixelJetPuId::primaryVertexToken
private

Definition at line 72 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().

edm::EDGetTokenT<std::vector<reco::Track> > PixelJetPuId::tracksToken
private

Definition at line 69 of file PixelJetPuId.cc.

Referenced by PixelJetPuId(), and produce().