CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Protected Attributes
TopProjectorFwdPtrOverlap< Top, Bottom > Class Template Reference

This checks a slew of possible overlaps for FwdPtr<Candidate> and derivatives. More...

#include <TopProjector.h>

Public Types

typedef edm::FwdPtr< Bottom > BottomFwdPtr
 
typedef edm::FwdPtr< Top > TopFwdPtr
 

Public Member Functions

bool operator() (TopFwdPtr const &top) const
 
void setBottom (BottomFwdPtr const &bottom)
 
 TopProjectorFwdPtrOverlap ()
 
 TopProjectorFwdPtrOverlap (edm::ParameterSet const &iConfig)
 

Protected Attributes

BottomFwdPtr const * bottom_
 
const bool matchByPtrDirect_ = false
 

Detailed Description

template<class Top, class Bottom>
class TopProjectorFwdPtrOverlap< Top, Bottom >

This checks a slew of possible overlaps for FwdPtr<Candidate> and derivatives.

Definition at line 41 of file TopProjector.h.

Member Typedef Documentation

◆ BottomFwdPtr

template<class Top , class Bottom >
typedef edm::FwdPtr<Bottom> TopProjectorFwdPtrOverlap< Top, Bottom >::BottomFwdPtr

Definition at line 44 of file TopProjector.h.

◆ TopFwdPtr

template<class Top , class Bottom >
typedef edm::FwdPtr<Top> TopProjectorFwdPtrOverlap< Top, Bottom >::TopFwdPtr

Definition at line 43 of file TopProjector.h.

Constructor & Destructor Documentation

◆ TopProjectorFwdPtrOverlap() [1/2]

template<class Top , class Bottom >
TopProjectorFwdPtrOverlap< Top, Bottom >::TopProjectorFwdPtrOverlap ( )
inlineexplicit

Definition at line 46 of file TopProjector.h.

46 { bottom_ = 0; }

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

◆ TopProjectorFwdPtrOverlap() [2/2]

template<class Top , class Bottom >
TopProjectorFwdPtrOverlap< Top, Bottom >::TopProjectorFwdPtrOverlap ( edm::ParameterSet const &  iConfig)
inlineexplicit

Definition at line 48 of file TopProjector.h.

49  : bottom_(nullptr), matchByPtrDirect_(iConfig.getParameter<bool>("matchByPtrDirect")) {}

Member Function Documentation

◆ operator()()

template<class Top , class Bottom >
bool TopProjectorFwdPtrOverlap< Top, Bottom >::operator() ( TopFwdPtr const &  top) const
inline

Definition at line 53 of file TopProjector.h.

53  {
55  return top.ptr().refCore() == bottom_->ptr().refCore() && top.ptr().key() == bottom_->ptr().key();
56  bool topFwdGood = top.ptr().isNonnull() && top.ptr().isAvailable();
57  bool topBckGood = top.backPtr().isNonnull() && top.backPtr().isAvailable();
58  bool bottomFwdGood = bottom_->ptr().isNonnull() && bottom_->ptr().isAvailable();
59  bool bottomBckGood = bottom_->backPtr().isNonnull() && bottom_->backPtr().isAvailable();
60 
61  bool matched = (topFwdGood && bottomFwdGood && top.ptr().refCore() == bottom_->ptr().refCore() &&
62  top.ptr().key() == bottom_->ptr().key()) ||
63  (topFwdGood && bottomBckGood && top.ptr().refCore() == bottom_->backPtr().refCore() &&
64  top.ptr().key() == bottom_->backPtr().key()) ||
65  (topBckGood && bottomFwdGood && top.backPtr().refCore() == bottom_->ptr().refCore() &&
66  top.backPtr().key() == bottom_->ptr().key()) ||
67  (topBckGood && bottomBckGood && top.backPtr().refCore() == bottom_->backPtr().refCore() &&
68  top.backPtr().key() == bottom_->backPtr().key());
69  if (!matched) {
70  for (unsigned isource = 0; isource < top->numberOfSourceCandidatePtrs(); ++isource) {
71  reco::CandidatePtr const& topSrcPtr = top->sourceCandidatePtr(isource);
72  bool topSrcGood = topSrcPtr.isNonnull() && topSrcPtr.isAvailable();
73  if ((topSrcGood && bottomFwdGood && topSrcPtr.refCore() == bottom_->ptr().refCore() &&
74  topSrcPtr.key() == bottom_->ptr().key()) ||
75  (topSrcGood && bottomBckGood && topSrcPtr.refCore() == bottom_->backPtr().refCore() &&
76  topSrcPtr.key() == bottom_->backPtr().key())) {
77  matched = true;
78  break;
79  }
80  }
81  }
82  if (!matched) {
83  for (unsigned isource = 0; isource < (*bottom_)->numberOfSourceCandidatePtrs(); ++isource) {
84  reco::CandidatePtr const& bottomSrcPtr = (*bottom_)->sourceCandidatePtr(isource);
85  bool bottomSrcGood = bottomSrcPtr.isNonnull() && bottomSrcPtr.isAvailable();
86  if ((topFwdGood && bottomSrcGood && bottomSrcPtr.refCore() == top.ptr().refCore() &&
87  bottomSrcPtr.key() == top.ptr().key()) ||
88  (topBckGood && bottomSrcGood && bottomSrcPtr.refCore() == top.backPtr().refCore() &&
89  bottomSrcPtr.key() == top.backPtr().key())) {
90  matched = true;
91  break;
92  }
93  }
94  }
95 
96  return matched;
97  }

References edm::FwdPtr< T >::backPtr(), TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_, edm::Ptr< T >::isAvailable(), edm::Ptr< T >::isNonnull(), edm::Ptr< T >::key(), TopProjectorFwdPtrOverlap< Top, Bottom >::matchByPtrDirect_, muonTagProbeFilters_cff::matched, edm::FwdPtr< T >::ptr(), edm::Ptr< T >::refCore(), and relativeConstraints::value.

◆ setBottom()

template<class Top , class Bottom >
void TopProjectorFwdPtrOverlap< Top, Bottom >::setBottom ( BottomFwdPtr const &  bottom)
inline

Definition at line 51 of file TopProjector.h.

51 { bottom_ = &bottom; }

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

Member Data Documentation

◆ bottom_

template<class Top , class Bottom >
BottomFwdPtr const* TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_
protected

◆ matchByPtrDirect_

template<class Top , class Bottom >
const bool TopProjectorFwdPtrOverlap< Top, Bottom >::matchByPtrDirect_ = false
protected
muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
TopProjectorFwdPtrOverlap::bottom_
BottomFwdPtr const * bottom_
Definition: TopProjector.h:100
edm::Ptr::refCore
RefCore const & refCore() const
Definition: Ptr.h:167
edm::Ptr::key
key_type key() const
Definition: Ptr.h:163
edm::FwdPtr::ptr
Ptr< value_type > const & ptr() const
Definition: FwdPtr.h:116
TopProjectorFwdPtrOverlap::matchByPtrDirect_
const bool matchByPtrDirect_
Definition: TopProjector.h:101
edm::Ptr< Candidate >
relativeConstraints.value
value
Definition: relativeConstraints.py:53
edm::Ptr::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:146
edm::FwdPtr::backPtr
Ptr< value_type > const & backPtr() const
Definition: FwdPtr.h:117
edm::Ptr::isAvailable
bool isAvailable() const
Definition: Ptr.h:230