CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 83 of file IPProducer.h.

Constructor & Destructor Documentation

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

Definition at line 85 of file IPProducer.h.

86  token_cands(iC.consumes<edm::View<reco::Candidate> >(iConfig.getParameter<edm::InputTag>("candidates"))), maxDeltaR(iConfig.getParameter<double>("maxDeltaR")),
87  explicitJTA(iConfig.existsAs<bool>("explicitJTA") ? iConfig.getParameter<bool>("explicitJTA") : false) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
vector< PseudoJet > jets
edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
Definition: IPProducer.h:128
edm::EDGetTokenT< edm::View< reco::Candidate > > token_cands
Definition: IPProducer.h:129

Member Function Documentation

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

Definition at line 93 of file IPProducer.h.

References reco::deltaR2(), explicitJTA, edm::Event::getByToken(), i, j, fwrapper::jets, m_map, maxDeltaR, token_cands, and token_jets.

93  {
95  iEvent.getByToken(token_jets, jets);
96  std::vector<reco::JetTagInfo> bases;
97 
99  iEvent.getByToken(token_cands, cands);
100  m_map.clear();
101  m_map.resize(jets->size());
102  double maxDeltaR2 = maxDeltaR*maxDeltaR;
103  size_t i = 0;
104  for(edm::View<reco::Jet>::const_iterator it = jets->begin();
105  it != jets->end(); it++, i++) {
106  edm::RefToBase<reco::Jet> jRef(jets, i);
107  bases.push_back(reco::JetTagInfo(jRef));
108  if( explicitJTA )
109  {
110  for(size_t j=0;j<it->numberOfDaughters();++j) {
111  if( it->daughterPtr(j)->bestTrack()!=0 && it->daughterPtr(j)->charge() !=0 ){
112  m_map[i].push_back(it->daughterPtr(j));
113  }
114  }
115  }
116  else
117  {
118  for(size_t j=0;j<cands->size();++j) {
119  if( (*cands)[j].bestTrack()!=0 && (*cands)[j].charge() !=0 && (*cands)[j].pt() > 0 && Geom::deltaR2((*cands)[j],(*jets)[i]) < maxDeltaR2 ){
120  m_map[i].push_back(cands->ptrAt(j));
121  }
122  }
123  }
124  }
125  return bases;
126  }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
std::vector< std::vector< reco::CandidatePtr > > m_map
Definition: IPProducer.h:127
vector< PseudoJet > jets
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
Definition: IPProducer.h:128
T1 deltaR2(T1 eta1, T2 phi1, T3 eta2, T4 phi2)
Definition: deltaR.h:36
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
edm::EDGetTokenT< edm::View< reco::Candidate > > token_cands
Definition: IPProducer.h:129
const std::vector<reco::CandidatePtr>& IPProducerHelpers::FromJetAndCands::tracks ( const reco::JetTagInfo it)
inline

Definition at line 89 of file IPProducer.h.

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

90  {
91  return m_map[it.jet().key()];
92  }
virtual edm::RefToBase< Jet > jet(void) const
returns a polymorphic reference to the tagged jet
Definition: JetTagInfo.h:22
std::vector< std::vector< reco::CandidatePtr > > m_map
Definition: IPProducer.h:127
size_t key() const
Definition: RefToBase.h:250

Member Data Documentation

bool IPProducerHelpers::FromJetAndCands::explicitJTA

Definition at line 131 of file IPProducer.h.

Referenced by makeBaseVector().

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

Definition at line 127 of file IPProducer.h.

Referenced by makeBaseVector(), and tracks().

double IPProducerHelpers::FromJetAndCands::maxDeltaR

Definition at line 130 of file IPProducer.h.

Referenced by makeBaseVector().

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

Definition at line 129 of file IPProducer.h.

Referenced by makeBaseVector().

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

Definition at line 128 of file IPProducer.h.

Referenced by makeBaseVector().