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)
 
std::vector< reco::JetTagInfomakeBaseVector (edm::Event &iEvent)
 
std::vector< reco::CandidatePtrtracks (edm::Event &, 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 84 of file IPProducer.h.

Constructor & Destructor Documentation

IPProducerHelpers::FromJetAndCands::FromJetAndCands ( const edm::ParameterSet iConfig,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 86 of file IPProducer.h.

87  token_cands(iC.consumes<edm::View<reco::Candidate> >(iConfig.getParameter<edm::InputTag>("candidates"))), maxDeltaR(iConfig.getParameter<double>("maxDeltaR")),
88  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:184
edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
Definition: IPProducer.h:129
edm::EDGetTokenT< edm::View< reco::Candidate > > token_cands
Definition: IPProducer.h:130

Member Function Documentation

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

Definition at line 94 of file IPProducer.h.

References reco::deltaR2(), edm::Event::getByToken(), i, j, fwrapper::jets, and p4.

94  {
96  iEvent.getByToken(token_jets, jets);
97  std::vector<reco::JetTagInfo> bases;
98 
100  iEvent.getByToken(token_cands, cands);
101  m_map.clear();
102  m_map.resize(jets->size());
103  double maxDeltaR2 = maxDeltaR*maxDeltaR;
104  size_t i = 0;
105  for(edm::View<reco::Jet>::const_iterator it = jets->begin();
106  it != jets->end(); it++, i++) {
107  edm::RefToBase<reco::Jet> jRef(jets, i);
108  bases.push_back(reco::JetTagInfo(jRef));
109  if( explicitJTA )
110  {
111  for(size_t j=0;j<it->numberOfDaughters();++j) {
112  if( it->daughterPtr(j)->bestTrack()!=0 && it->daughterPtr(j)->charge() !=0 ){
113  m_map[i].push_back(it->daughterPtr(j));
114  }
115  }
116  }
117  else
118  {
119  for(size_t j=0;j<cands->size();++j) {
120  if( (*cands)[j].bestTrack()!=0 && Geom::deltaR2((*cands)[j].p4(),(*jets)[i].p4()) < maxDeltaR2 && (*cands)[j].charge() !=0 ){
121  m_map[i].push_back(cands->ptrAt(j));
122  }
123  }
124  }
125  }
126  return bases;
127  }
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::vector< std::vector< reco::CandidatePtr > > m_map
Definition: IPProducer.h:128
double p4[4]
Definition: TauolaWrapper.h:92
vector< PseudoJet > jets
int j
Definition: DBlmapReader.cc:9
double deltaR2(const T1 &t1, const T2 &t2)
Definition: deltaR.h:36
edm::EDGetTokenT< edm::View< reco::Jet > > token_jets
Definition: IPProducer.h:129
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:130
std::vector<reco::CandidatePtr> IPProducerHelpers::FromJetAndCands::tracks ( edm::Event ,
const reco::JetTagInfo it 
)
inline

Definition at line 90 of file IPProducer.h.

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

91  {
92  return m_map[it.jet().key()];
93  }
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:128
size_t key() const
Definition: RefToBase.h:229

Member Data Documentation

bool IPProducerHelpers::FromJetAndCands::explicitJTA

Definition at line 132 of file IPProducer.h.

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

Definition at line 128 of file IPProducer.h.

double IPProducerHelpers::FromJetAndCands::maxDeltaR

Definition at line 131 of file IPProducer.h.

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

Definition at line 130 of file IPProducer.h.

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

Definition at line 129 of file IPProducer.h.