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_
 

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.

48 { bottom_ = nullptr; }

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

Member Function Documentation

◆ operator()()

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

Definition at line 52 of file TopProjector.h.

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

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

◆ setBottom()

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

Definition at line 50 of file TopProjector.h.

50 { bottom_ = &bottom; }

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

Member Data Documentation

◆ bottom_

template<class Top , class Bottom >
BottomFwdPtr const* TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_
protected
muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
TopProjectorFwdPtrOverlap::bottom_
BottomFwdPtr const * bottom_
Definition: TopProjector.h:97
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
edm::Ptr< Candidate >
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:229