CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
reco::isodeposit::OtherJetConstituentsDeltaRVeto Class Reference

#include <EventDependentAbsVetos.h>

Inheritance diagram for reco::isodeposit::OtherJetConstituentsDeltaRVeto:
reco::isodeposit::EventDependentAbsVeto reco::isodeposit::AbsVeto

Public Member Functions

void centerOn (double eta, double phi) override
 Set axis for matching jets. More...
 
 OtherJetConstituentsDeltaRVeto (Direction dir, const edm::InputTag &jets, double dRjet, const edm::InputTag &pfCandAssocMap, double dRconstituent, edm::ConsumesCollector &iC)
 Create a veto specifying the input collection of the jets, the candidates, and the deltaR. More...
 
void setEvent (const edm::Event &evt, const edm::EventSetup &es) override
 Picks up the directions of the given candidates. More...
 
bool veto (double eta, double phi, float value) const override
 
 ~OtherJetConstituentsDeltaRVeto () override
 
- Public Member Functions inherited from reco::isodeposit::EventDependentAbsVeto
 ~EventDependentAbsVeto () override
 
- Public Member Functions inherited from reco::isodeposit::AbsVeto
virtual ~AbsVeto ()
 

Private Types

typedef edm::AssociationMap< edm::OneToMany< std::vector< reco::PFJet >, std::vector< reco::PFCandidate >, unsigned int > > JetToPFCandidateAssociation
 

Private Member Functions

void initialize ()
 

Private Attributes

double dR2constituent_
 
double dR2jet_
 
const edm::Eventevt_
 
std::vector< Directionitems_
 
edm::EDGetTokenT< reco::PFJetCollectionsrcJets_
 
edm::EDGetTokenT< JetToPFCandidateAssociationsrcPFCandAssocMap_
 
Direction vetoDir_
 

Detailed Description

Definition at line 64 of file EventDependentAbsVetos.h.

Member Typedef Documentation

Definition at line 97 of file EventDependentAbsVetos.h.

Constructor & Destructor Documentation

reco::isodeposit::OtherJetConstituentsDeltaRVeto::OtherJetConstituentsDeltaRVeto ( Direction  dir,
const edm::InputTag jets,
double  dRjet,
const edm::InputTag pfCandAssocMap,
double  dRconstituent,
edm::ConsumesCollector iC 
)
inline

Create a veto specifying the input collection of the jets, the candidates, and the deltaR.

Definition at line 67 of file EventDependentAbsVetos.h.

68  : evt_(nullptr),
69  vetoDir_(dir),
71  dR2jet_(dRjet*dRjet),
73  dR2constituent_(dRconstituent*dRconstituent)
74  {
75  //std::cout << "<OtherJetConstituentsDeltaRVeto::OtherJetConstituentsDeltaRVeto>:" << std::endl;
76  //std::cout << " vetoDir: eta = " << vetoDir_.eta() << ", phi = " << vetoDir_.phi() << std::endl;
77  //std::cout << " srcJets = " << srcJets_.label() << ":" << srcJets_.instance() << std::endl;
78  //std::cout << " dRjet = " << sqrt(dR2jet_) << std::endl;
79  //std::cout << " srcPFCandAssocMap = " << srcPFCandAssocMap_.label() << ":" << srcPFCandAssocMap_.instance() << std::endl;
80  //std::cout << " dRconstituent = " << sqrt(dR2constituent_) << std::endl;
81  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::AssociationMap< edm::OneToMany< std::vector< reco::PFJet >, std::vector< reco::PFCandidate >, unsigned int > > JetToPFCandidateAssociation
edm::EDGetTokenT< JetToPFCandidateAssociation > srcPFCandAssocMap_
edm::EDGetTokenT< reco::PFJetCollection > srcJets_
std::vector< PFJet > PFJetCollection
collection of PFJet objects
dbl *** dir
Definition: mlp_gen.cc:35
reco::isodeposit::OtherJetConstituentsDeltaRVeto::~OtherJetConstituentsDeltaRVeto ( )
inlineoverride

Member Function Documentation

void reco::isodeposit::OtherJetConstituentsDeltaRVeto::centerOn ( double  eta,
double  phi 
)
overridevirtual

Set axis for matching jets.

Reimplemented from reco::isodeposit::AbsVeto.

Definition at line 97 of file EventDependentAbsVetos.cc.

References initialize().

98 {
99  //std::cout << "<OtherJetConstituentsDeltaRVeto::centerOn>:" << std::endl;
100  //std::cout << " eta = " << eta << std::endl;
101  //std::cout << " phi = " << phi << std::endl;
102  vetoDir_ = Direction(eta,phi);
103  initialize();
104 }
void reco::isodeposit::OtherJetConstituentsDeltaRVeto::initialize ( void  )
private

Definition at line 62 of file EventDependentAbsVetos.cc.

References edm::RefVector< C, T, F >::begin(), reco::deltaR2(), edm::RefVector< C, T, F >::end(), training_settings::idx, edm::Ref< C, T, F >::isNonnull(), reco::isodeposit::OtherCandidatesDeltaRVeto::items_, metsig::jet, and fwrapper::jets.

63 {
64  //std::cout << "<OtherJetConstituentsDeltaRVeto::initialize>:" << std::endl;
65  //std::cout << " vetoDir: eta = " << vetoDir_.eta() << ", phi = " << vetoDir_.phi() << std::endl;
66  assert(evt_);
67  items_.clear();
69  evt_->getByToken(srcJets_, jets);
71  evt_->getByToken(srcPFCandAssocMap_, jetToPFCandMap);
72  double dR2min = dR2jet_;
73  reco::PFJetRef matchedJet;
74  size_t numJets = jets->size();
75  for ( size_t jetIndex = 0; jetIndex < numJets; ++jetIndex ) {
76  reco::PFJetRef jet(jets, jetIndex);
77  double dR2 = ::deltaR2(vetoDir_.eta(), vetoDir_.phi(), jet->eta(), jet->phi());
78  //std::cout << "jet #" << jetIndex << ": Pt = " << jet->pt() << ", eta = " << jet->eta() << ", phi = " << jet->phi() << " (dR = " << sqrt(dR2) << ")" << std::endl;
79  if ( dR2 < dR2min ) {
80  matchedJet = jet;
81  dR2min = dR2;
82  }
83  }
84  if ( matchedJet.isNonnull() ) {
85  edm::RefVector<reco::PFCandidateCollection> pfCandsMappedToJet = (*jetToPFCandMap)[matchedJet];
86  int idx = 0;
87  for ( edm::RefVector<reco::PFCandidateCollection>::const_iterator pfCand = pfCandsMappedToJet.begin();
88  pfCand != pfCandsMappedToJet.end(); ++pfCand ) {
89  //std::cout << "pfCand #" << idx << ": Pt = " << (*pfCand)->pt() << ", eta = " << (*pfCand)->eta() << ", phi = " << (*pfCand)->phi() << std::endl;
90  items_.push_back(Direction((*pfCand)->eta(), (*pfCand)->phi()));
91  ++idx;
92  }
93  }
94 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:251
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
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
vector< PseudoJet > jets
edm::EDGetTokenT< JetToPFCandidateAssociation > srcPFCandAssocMap_
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16
edm::EDGetTokenT< reco::PFJetCollection > srcJets_
void reco::isodeposit::OtherJetConstituentsDeltaRVeto::setEvent ( const edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Picks up the directions of the given candidates.

Implements reco::isodeposit::EventDependentAbsVeto.

Definition at line 56 of file EventDependentAbsVetos.cc.

57 {
58  //std::cout << "<OtherJetConstituentsDeltaRVeto::setEvent>:" << std::endl;
59  evt_ = &evt;
60 }
bool reco::isodeposit::OtherJetConstituentsDeltaRVeto::veto ( double  eta,
double  phi,
float  value 
) const
overridevirtual

Return "true" if a deposit at specific (eta,phi) with that value must be vetoed in the sum This is true if the deposit is within the stored AbsVeto of any item of the source collection

Implements reco::isodeposit::AbsVeto.

Definition at line 47 of file EventDependentAbsVetos.cc.

References reco::deltaR2(), PVValHelper::eta, and reco::isodeposit::OtherCandidatesDeltaRVeto::items_.

48 {
49  for (std::vector<Direction>::const_iterator it = items_.begin(), ed = items_.end(); it != ed; ++it) {
50  if (::deltaR2(it->eta(), it->phi(), eta, phi) < dR2constituent_) return true;
51  }
52  return false;
53 }
constexpr auto deltaR2(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
Definition: deltaR.h:16

Member Data Documentation

double reco::isodeposit::OtherJetConstituentsDeltaRVeto::dR2constituent_
private

Definition at line 107 of file EventDependentAbsVetos.h.

double reco::isodeposit::OtherJetConstituentsDeltaRVeto::dR2jet_
private

Definition at line 105 of file EventDependentAbsVetos.h.

const edm::Event* reco::isodeposit::OtherJetConstituentsDeltaRVeto::evt_
private

Definition at line 101 of file EventDependentAbsVetos.h.

std::vector<Direction> reco::isodeposit::OtherJetConstituentsDeltaRVeto::items_
private

Definition at line 108 of file EventDependentAbsVetos.h.

edm::EDGetTokenT<reco::PFJetCollection> reco::isodeposit::OtherJetConstituentsDeltaRVeto::srcJets_
private

Definition at line 104 of file EventDependentAbsVetos.h.

edm::EDGetTokenT<JetToPFCandidateAssociation> reco::isodeposit::OtherJetConstituentsDeltaRVeto::srcPFCandAssocMap_
private

Definition at line 106 of file EventDependentAbsVetos.h.

Direction reco::isodeposit::OtherJetConstituentsDeltaRVeto::vetoDir_
private

Definition at line 103 of file EventDependentAbsVetos.h.