CMS 3D CMS Logo

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 >:
unary_function

List of all members.

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 ( ) [inline, explicit]

Definition at line 49 of file TopProjector.h.

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

{bottom_ = 0;}
template<class Top , class Bottom >
TopProjectorFwdPtrOverlap< Top, Bottom >::TopProjectorFwdPtrOverlap ( edm::ParameterSet const &  iConfig) [inline, explicit]

Definition at line 51 of file TopProjector.h.

References TopProjectorFwdPtrOverlap< Top, Bottom >::bottom_.

{ bottom_ = 0;}

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().

                                                   {
      bool topFwdGood = top.ptr().isNonnull() && top.ptr().isAvailable();
      bool topBckGood = top.backPtr().isNonnull() && top.backPtr().isAvailable();
      bool bottomFwdGood = bottom_->ptr().isNonnull() && bottom_->ptr().isAvailable();
      bool bottomBckGood = bottom_->backPtr().isNonnull() && bottom_->backPtr().isAvailable();

      bool matched = 
        (topFwdGood && bottomFwdGood && top.ptr().refCore() == bottom_->ptr().refCore() && top.ptr().key() == bottom_->ptr().key()) ||
        (topFwdGood && bottomBckGood && top.ptr().refCore() == bottom_->backPtr().refCore() && top.ptr().key() == bottom_->backPtr().key()) ||
        (topBckGood && bottomFwdGood && top.backPtr().refCore() == bottom_->ptr().refCore() && top.backPtr().key() == bottom_->ptr().key()) ||
        (topBckGood && bottomBckGood && top.backPtr().refCore() == bottom_->backPtr().refCore() && top.backPtr().key() == bottom_->backPtr().key())
        ;
      if ( !matched ) {
        for ( unsigned isource = 0; isource < top->numberOfSourceCandidatePtrs(); ++isource ) {
          reco::CandidatePtr const & topSrcPtr = top->sourceCandidatePtr(isource);
          bool topSrcGood = topSrcPtr.isNonnull() && topSrcPtr.isAvailable();
          if ( (topSrcGood && bottomFwdGood && topSrcPtr.refCore() == bottom_->ptr().refCore() && topSrcPtr.key() == bottom_->ptr().key())|| 
               (topSrcGood && bottomBckGood && topSrcPtr.refCore() == bottom_->backPtr().refCore() && topSrcPtr.key() == bottom_->backPtr().key())
               ) {
            matched = true;
            break;
          }
        }
      }
      if ( !matched ) {
        for ( unsigned isource = 0; isource < (*bottom_)->numberOfSourceCandidatePtrs(); ++isource ) {
          reco::CandidatePtr const & bottomSrcPtr = (*bottom_)->sourceCandidatePtr(isource);
          bool bottomSrcGood = bottomSrcPtr.isNonnull() && bottomSrcPtr.isAvailable();
          if ( (topFwdGood && bottomSrcGood && bottomSrcPtr.refCore() == top.ptr().refCore() && bottomSrcPtr.key() == top.ptr().key() )|| 
               (topBckGood && bottomSrcGood && bottomSrcPtr.refCore() == top.backPtr().refCore() && bottomSrcPtr.key() == top.backPtr().key() )
               ) {
            matched = true;
            break;
          }
        }
      }

      return matched;
      
    }
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_.

{ bottom_ = &bottom; }

Member Data Documentation

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