CMS 3D CMS Logo

Public Member Functions | 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

List of all members.

Public Member Functions

virtual void centerOn (double eta, double phi)
 Set axis for matching jets.
 OtherJetConstituentsDeltaRVeto (Direction dir, const edm::InputTag &jets, double dRjet, const edm::InputTag &pfCandAssocMap, double dRconstituent)
 Create a veto specifying the input collection of the jets, the candidates, and the deltaR.
virtual void setEvent (const edm::Event &evt, const edm::EventSetup &es)
 Picks up the directions of the given candidates.
virtual bool veto (double eta, double phi, float value) const
virtual ~OtherJetConstituentsDeltaRVeto ()

Private Member Functions

void initialize ()

Private Attributes

double dR2constituent_
double dR2jet_
const edm::Eventevt_
std::vector< Directionitems_
edm::InputTag srcJets_
edm::InputTag srcPFCandAssocMap_
Direction vetoDir_

Detailed Description

Definition at line 59 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 
) [inline]

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

Definition at line 62 of file EventDependentAbsVetos.h.

            : evt_(0),
              vetoDir_(dir), 
              srcJets_(jets), 
              dR2jet_(dRjet*dRjet), 
              srcPFCandAssocMap_(pfCandAssocMap), 
              dR2constituent_(dRconstituent*dRconstituent) 
          { 
            //std::cout << "<OtherJetConstituentsDeltaRVeto::OtherJetConstituentsDeltaRVeto>:" << std::endl;
            //std::cout << " vetoDir: eta = " << vetoDir_.eta() << ", phi = " << vetoDir_.phi() << std::endl;
            //std::cout << " srcJets = " << srcJets_.label() << ":" << srcJets_.instance() << std::endl;
            //std::cout << " dRjet = " << sqrt(dR2jet_) << std::endl;
            //std::cout << " srcPFCandAssocMap = " << srcPFCandAssocMap_.label() << ":" << srcPFCandAssocMap_.instance() << std::endl;
            //std::cout << " dRconstituent = " << sqrt(dR2constituent_) << std::endl;
          }
virtual reco::isodeposit::OtherJetConstituentsDeltaRVeto::~OtherJetConstituentsDeltaRVeto ( ) [inline, virtual]

Definition at line 79 of file EventDependentAbsVetos.h.

{} 

Member Function Documentation

void reco::isodeposit::OtherJetConstituentsDeltaRVeto::centerOn ( double  eta,
double  phi 
) [virtual]

Set axis for matching jets.

Reimplemented from reco::isodeposit::AbsVeto.

Definition at line 102 of file EventDependentAbsVetos.cc.

{ 
    //std::cout << "<OtherJetConstituentsDeltaRVeto::centerOn>:" << std::endl;
    //std::cout << " eta = " << eta << std::endl;
    //std::cout << " phi = " << phi << std::endl;
    vetoDir_ = Direction(eta,phi); 
    initialize();
}
void reco::isodeposit::OtherJetConstituentsDeltaRVeto::initialize ( ) [private]

Definition at line 66 of file EventDependentAbsVetos.cc.

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

{
    //std::cout << "<OtherJetConstituentsDeltaRVeto::initialize>:" << std::endl;
    //std::cout << " vetoDir: eta = " << vetoDir_.eta() << ", phi = " << vetoDir_.phi() << std::endl;
    assert(evt_);
    items_.clear();
    edm::Handle<reco::PFJetCollection> jets;
    evt_->getByLabel(srcJets_, jets);
    typedef edm::AssociationMap<edm::OneToMany<std::vector<reco::PFJet>, std::vector<reco::PFCandidate>, unsigned int> > JetToPFCandidateAssociation;
    edm::Handle<JetToPFCandidateAssociation> jetToPFCandMap;
    evt_->getByLabel(srcPFCandAssocMap_, jetToPFCandMap);
    double dR2min = dR2jet_;
    reco::PFJetRef matchedJet;
    size_t numJets = jets->size();
    for ( size_t jetIndex = 0; jetIndex < numJets; ++jetIndex ) {
      reco::PFJetRef jet(jets, jetIndex);
      double dR2 = ::deltaR2(vetoDir_.eta(), vetoDir_.phi(), jet->eta(), jet->phi());
      //std::cout << "jet #" << jetIndex << ": Pt = " << jet->pt() << ", eta = " << jet->eta() << ", phi = " << jet->phi() << " (dR = " << sqrt(dR2) << ")" << std::endl;
      if ( dR2 < dR2min ) {
        matchedJet = jet;
        dR2min = dR2;
      }
    }
    if ( matchedJet.isNonnull() ) {
      edm::RefVector<reco::PFCandidateCollection> pfCandsMappedToJet = (*jetToPFCandMap)[matchedJet];
      int idx = 0;
      for ( edm::RefVector<reco::PFCandidateCollection>::const_iterator pfCand = pfCandsMappedToJet.begin();
            pfCand != pfCandsMappedToJet.end(); ++pfCand ) {
        //std::cout << "pfCand #" << idx << ": Pt = " << (*pfCand)->pt() << ", eta = " << (*pfCand)->eta() << ", phi = " << (*pfCand)->phi() << std::endl;
        items_.push_back(Direction((*pfCand)->eta(), (*pfCand)->phi()));
        ++idx;
      }
    }
}
void reco::isodeposit::OtherJetConstituentsDeltaRVeto::setEvent ( const edm::Event evt,
const edm::EventSetup es 
) [virtual]

Picks up the directions of the given candidates.

Implements reco::isodeposit::EventDependentAbsVeto.

Definition at line 60 of file EventDependentAbsVetos.cc.

{
    //std::cout << "<OtherJetConstituentsDeltaRVeto::setEvent>:" << std::endl;
    evt_ = &evt;
}
bool reco::isodeposit::OtherJetConstituentsDeltaRVeto::veto ( double  eta,
double  phi,
float  value 
) const [virtual]

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 51 of file EventDependentAbsVetos.cc.

References reco::deltaR2(), eta(), and phi.

{
    for (std::vector<Direction>::const_iterator it = items_.begin(), ed = items_.end(); it != ed; ++it) {
        if (::deltaR2(it->eta(), it->phi(), eta, phi) < dR2constituent_) return true;
    }
    return false;
}

Member Data Documentation

Definition at line 100 of file EventDependentAbsVetos.h.

Definition at line 98 of file EventDependentAbsVetos.h.

Definition at line 94 of file EventDependentAbsVetos.h.

Definition at line 101 of file EventDependentAbsVetos.h.

Definition at line 97 of file EventDependentAbsVetos.h.

Definition at line 99 of file EventDependentAbsVetos.h.

Definition at line 96 of file EventDependentAbsVetos.h.