CandMapTrait

CandMapTrait

CandMapTrait

CandMapTrait

CandRefTrait

CandRefTrait

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#ifndef CommonTools_CandUtils_CandMapTrait_h
#define CommonTools_CandUtils_CandMapTrait_h

#include "DataFormats/Common/interface/AssociationMap.h"
#include "DataFormats/Candidate/interface/CandidateFwd.h"

/* \class reco::helper::CandMapTrait<T>
 *
 * \author Luca Lista, INFN 
 *
 * \version $Id: CandMapTrait.h,v 1.2 2007/10/20 16:00:52 llista Exp $
 *
 */
namespace reco {
  namespace helper {
    template <typename C1, typename C2 = C1>
    struct CandMapTrait {
      typedef edm::AssociationMap<edm::OneToOne<C1, C2> > type;
    };

    template <typename C1>
    struct CandMapTrait<C1, CandidateView> {
      typedef edm::AssociationMap<edm::OneToOneGeneric<C1, CandidateView> > type;
    };

    template <typename C2>
    struct CandMapTrait<CandidateView, C2> {
      typedef edm::AssociationMap<edm::OneToOneGeneric<CandidateView, C2> > type;
    };

    template <>
    struct CandMapTrait<CandidateView, CandidateView> {
      typedef edm::AssociationMap<edm::OneToOneGeneric<CandidateView, CandidateView> > type;
    };

    template <typename C>
    struct CandRefTrait {
      typedef edm::Ref<C> ref_type;
      typedef edm::RefProd<C> refProd_type;
    };

    template <typename T>
    struct CandRefTrait<edm::View<T> > {
      typedef edm::RefToBase<T> ref_type;
      typedef edm::RefToBaseProd<T> refProd_type;
    };
  }  // namespace helper
}  // namespace reco

#endif