Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:48

0001 #ifndef Candidate_CandAssociation_h
0002 #define Candidate_CandAssociation_h
0003 //
0004 // \author Luca Lista, INFN
0005 //
0006 #include "DataFormats/Common/interface/AssociationVector.h"
0007 #include "DataFormats/Common/interface/ValueMap.h"
0008 #include "DataFormats/Candidate/interface/Candidate.h"
0009 #include <vector>
0010 
0011 namespace edm {
0012   namespace helper {
0013     struct CandMasterKeyReference {
0014       template <typename CandRef>
0015       static const CandRef& get(const CandRef& t, edm::ProductID id) {
0016         if (id == t.id())
0017           return t;
0018         else
0019           return t->masterClone().template castTo<CandRef>();
0020       }
0021     };
0022 
0023     template <>
0024     struct AssociationKeyReferenceTrait<reco::CandidateCollection> {
0025       typedef CandMasterKeyReference type;
0026     };
0027   }  // namespace helper
0028 }  // namespace edm
0029 
0030 namespace reco {
0031   typedef edm::AssociationVector<CandidateRefProd, std::vector<float> > CandFloatAssociations;
0032   typedef edm::AssociationVector<CandidateRefProd, std::vector<double> > CandDoubleAssociations;
0033   typedef edm::AssociationVector<CandidateRefProd, std::vector<int> > CandIntAssociations;
0034   typedef edm::AssociationVector<CandidateRefProd, std::vector<unsigned int> > CandUIntAssociations;
0035   typedef edm::AssociationVector<CandidateBaseRefProd, std::vector<float> > CandViewFloatAssociations;
0036   typedef edm::AssociationVector<CandidateBaseRefProd, std::vector<double> > CandViewDoubleAssociations;
0037   typedef edm::AssociationVector<CandidateBaseRefProd, std::vector<int> > CandViewIntAssociations;
0038   typedef edm::AssociationVector<CandidateBaseRefProd, std::vector<unsigned int> > CandViewUIntAssociations;
0039   typedef edm::ValueMap<CandidateBaseRef> CandRefValueMap;
0040 }  // namespace reco
0041 
0042 #endif