CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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>

Inheritance diagram for TopProjectorFwdPtrOverlap< Top, Bottom >:

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 42 of file TopProjector.h.

Member Typedef Documentation

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

Definition at line 46 of file TopProjector.h.

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

Definition at line 45 of file TopProjector.h.

Constructor & Destructor Documentation

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

Definition at line 49 of file TopProjector.h.

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

49 {bottom_ = 0;}
BottomFwdPtr const * bottom_
Definition: TopProjector.h:97
template<class Top , class Bottom >
TopProjectorFwdPtrOverlap< Top, Bottom >::TopProjectorFwdPtrOverlap ( edm::ParameterSet const &  iConfig)
inlineexplicit

Definition at line 51 of file TopProjector.h.

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

51 { bottom_ = 0;}
BottomFwdPtr const * bottom_
Definition: TopProjector.h:97

Member Function Documentation

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

Definition at line 55 of file TopProjector.h.

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

55  {
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 =
62  (topFwdGood && bottomFwdGood && top.ptr().refCore() == bottom_->ptr().refCore() && top.ptr().key() == bottom_->ptr().key()) ||
63  (topFwdGood && bottomBckGood && top.ptr().refCore() == bottom_->backPtr().refCore() && top.ptr().key() == bottom_->backPtr().key()) ||
64  (topBckGood && bottomFwdGood && top.backPtr().refCore() == bottom_->ptr().refCore() && top.backPtr().key() == bottom_->ptr().key()) ||
65  (topBckGood && bottomBckGood && top.backPtr().refCore() == bottom_->backPtr().refCore() && top.backPtr().key() == bottom_->backPtr().key())
66  ;
67  if ( !matched ) {
68  for ( unsigned isource = 0; isource < top->numberOfSourceCandidatePtrs(); ++isource ) {
69  reco::CandidatePtr const & topSrcPtr = top->sourceCandidatePtr(isource);
70  bool topSrcGood = topSrcPtr.isNonnull() && topSrcPtr.isAvailable();
71  if ( (topSrcGood && bottomFwdGood && topSrcPtr.refCore() == bottom_->ptr().refCore() && topSrcPtr.key() == bottom_->ptr().key())||
72  (topSrcGood && bottomBckGood && topSrcPtr.refCore() == bottom_->backPtr().refCore() && topSrcPtr.key() == bottom_->backPtr().key())
73  ) {
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() && bottomSrcPtr.key() == top.ptr().key() )||
84  (topBckGood && bottomSrcGood && bottomSrcPtr.refCore() == top.backPtr().refCore() && bottomSrcPtr.key() == top.backPtr().key() )
85  ) {
86  matched = true;
87  break;
88  }
89  }
90  }
91 
92  return matched;
93 
94  }
Ptr< value_type > const & ptr() const
Definition: FwdPtr.h:120
BottomFwdPtr const * bottom_
Definition: TopProjector.h:97
Ptr< value_type > const & backPtr() const
Definition: FwdPtr.h:121
bool isNonnull() const
Checks for non-null.
Definition: Ptr.h:152
RefCore const & refCore() const
Definition: Ptr.h:173
key_type key() const
Definition: Ptr.h:169
string top
Definition: fff_deleter.py:272
bool isAvailable() const
Definition: Ptr.h:158
template<class Top , class Bottom >
void TopProjectorFwdPtrOverlap< Top, Bottom >::setBottom ( BottomFwdPtr const &  bottom)
inline

Definition at line 53 of file TopProjector.h.

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

53 { bottom_ = &bottom; }
BottomFwdPtr const * bottom_
Definition: TopProjector.h:97

Member Data Documentation

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