CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
IPProducerHelpers::FromJetAndCands Class Reference

#include <IPProducer.h>

Public Member Functions

 FromJetAndCands (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC, const std::string &jets="jets")
 
std::vector< reco::JetTagInfomakeBaseVector (const edm::Event &iEvent)
 
const std::vector< reco::CandidatePtr > & tracks (const reco::JetTagInfo &it)
 

Public Attributes

bool explicitJTA
 
std::vector< std::vector< reco::CandidatePtr > > m_map
 
double maxDeltaR
 
edm::EDGetTokenT< edm::View< reco::Candidate > > token_cands
 
edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
 

Detailed Description

Definition at line 81 of file IPProducer.h.

Constructor & Destructor Documentation

◆ FromJetAndCands()

IPProducerHelpers::FromJetAndCands::FromJetAndCands ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC,
const std::string &  jets = "jets" 
)
inline

Definition at line 83 of file IPProducer.h.

86  maxDeltaR(iConfig.getParameter<double>("maxDeltaR")),
87  explicitJTA(iConfig.existsAs<bool>("explicitJTA") ? iConfig.getParameter<bool>("explicitJTA") : false) {}

Member Function Documentation

◆ makeBaseVector()

std::vector<reco::JetTagInfo> IPProducerHelpers::FromJetAndCands::makeBaseVector ( const edm::Event iEvent)
inline

Definition at line 90 of file IPProducer.h.

90  {
92  iEvent.getByToken(token_jets, jets);
93  std::vector<reco::JetTagInfo> bases;
94 
96  iEvent.getByToken(token_cands, cands);
97  m_map.clear();
98  m_map.resize(jets->size());
99  double maxDeltaR2 = maxDeltaR * maxDeltaR;
100  size_t i = 0;
101  for (edm::View<reco::Jet>::const_iterator it = jets->begin(); it != jets->end(); it++, i++) {
103  bases.push_back(reco::JetTagInfo(jRef));
104  if (explicitJTA) {
105  for (size_t j = 0; j < it->numberOfDaughters(); ++j) {
106  if (it->daughterPtr(j)->bestTrack() != nullptr && it->daughterPtr(j)->charge() != 0) {
107  m_map[i].push_back(it->daughterPtr(j));
108  }
109  }
110  } else {
111  for (size_t j = 0; j < cands->size(); ++j) {
112  if ((*cands)[j].bestTrack() != nullptr && (*cands)[j].charge() != 0 && (*cands)[j].pt() > 0 &&
113  Geom::deltaR2((*cands)[j], (*jets)[i]) < maxDeltaR2) {
114  m_map[i].push_back(cands->ptrAt(j));
115  }
116  }
117  }
118  }
119  return bases;
120  }

References HLT_2018_cff::cands, HLTMuonOfflineAnalyzer_cfi::deltaR2, explicitJTA, mps_fire::i, iEvent, dqmiolumiharvest::j, singleTopDQM_cfi::jets, m_map, maxDeltaR, token_cands, and token_jets.

◆ tracks()

const std::vector<reco::CandidatePtr>& IPProducerHelpers::FromJetAndCands::tracks ( const reco::JetTagInfo it)
inline

Definition at line 89 of file IPProducer.h.

89 { return m_map[it.jet().key()]; }

References reco::JetTagInfo::jet(), edm::RefToBase< T >::key(), and m_map.

Member Data Documentation

◆ explicitJTA

bool IPProducerHelpers::FromJetAndCands::explicitJTA

Definition at line 125 of file IPProducer.h.

Referenced by makeBaseVector().

◆ m_map

std::vector<std::vector<reco::CandidatePtr> > IPProducerHelpers::FromJetAndCands::m_map

Definition at line 121 of file IPProducer.h.

Referenced by makeBaseVector(), and tracks().

◆ maxDeltaR

double IPProducerHelpers::FromJetAndCands::maxDeltaR

Definition at line 124 of file IPProducer.h.

Referenced by makeBaseVector().

◆ token_cands

edm::EDGetTokenT<edm::View<reco::Candidate> > IPProducerHelpers::FromJetAndCands::token_cands

Definition at line 123 of file IPProducer.h.

Referenced by makeBaseVector().

◆ token_jets

edm::EDGetTokenT<edm::View<reco::Jet> > IPProducerHelpers::FromJetAndCands::token_jets

Definition at line 122 of file IPProducer.h.

Referenced by makeBaseVector().

mps_fire.i
i
Definition: mps_fire.py:355
edm::RefToBase::key
size_t key() const
Definition: RefToBase.h:219
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
IPProducerHelpers::FromJetAndCands::maxDeltaR
double maxDeltaR
Definition: IPProducer.h:124
edm::Handle
Definition: AssociativeIterator.h:50
reco::JetTagInfo::jet
edm::RefToBase< Jet > jet(void) const override
returns a polymorphic reference to the tagged jet
Definition: JetTagInfo.h:22
IPProducerHelpers::FromJetAndCands::m_map
std::vector< std::vector< reco::CandidatePtr > > m_map
Definition: IPProducer.h:121
reco::JetTagInfo
Definition: JetTagInfo.h:9
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:49
edm::View
Definition: CaloClusterFwd.h:14
IPProducerHelpers::FromJetAndCands::token_cands
edm::EDGetTokenT< edm::View< reco::Candidate > > token_cands
Definition: IPProducer.h:123
iEvent
int iEvent
Definition: GenABIO.cc:224
IPProducerHelpers::FromJetAndCands::token_jets
edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
Definition: IPProducer.h:122
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
HLT_2018_cff.cands
cands
Definition: HLT_2018_cff.py:13762
edm::RefToBase< reco::Jet >
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
IPProducerHelpers::FromJetAndCands::explicitJTA
bool explicitJTA
Definition: IPProducer.h:125
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::InputTag
Definition: InputTag.h:15