File indexing completed on 2024-04-06 12:01:03
0001 #ifndef CommonTools_CandUtils_CandCombinerBase_h
0002 #define CommonTools_CandUtils_CandCombinerBase_h
0003
0004
0005
0006
0007
0008 #include "DataFormats/Candidate/interface/OverlapChecker.h"
0009 #include "DataFormats/Candidate/interface/NamedCompositeCandidate.h"
0010 #include <vector>
0011 #include <string>
0012
0013 class NamedCandCombinerBase {
0014 public:
0015 typedef std::vector<std::string> string_coll;
0016
0017 NamedCandCombinerBase(std::string name);
0018
0019 NamedCandCombinerBase(std::string name, int, int);
0020
0021 NamedCandCombinerBase(std::string name, int, int, int);
0022
0023 NamedCandCombinerBase(std::string name, int, int, int, int);
0024
0025 NamedCandCombinerBase(std::string name, bool checkCharge, bool checkOverlap, const std::vector<int> &);
0026
0027 virtual ~NamedCandCombinerBase();
0028
0029 std::unique_ptr<reco::NamedCompositeCandidateCollection> combine(const std::vector<reco::CandidatePtrVector> &,
0030 string_coll const &) const;
0031
0032 std::unique_ptr<reco::NamedCompositeCandidateCollection> combine(const reco::CandidatePtrVector &,
0033 string_coll const &) const;
0034
0035 std::unique_ptr<reco::NamedCompositeCandidateCollection> combine(const reco::CandidatePtrVector &,
0036 const reco::CandidatePtrVector &,
0037 string_coll const &) const;
0038
0039 std::unique_ptr<reco::NamedCompositeCandidateCollection> combine(const reco::CandidatePtrVector &,
0040 const reco::CandidatePtrVector &,
0041 const reco::CandidatePtrVector &,
0042 string_coll const &) const;
0043
0044 std::unique_ptr<reco::NamedCompositeCandidateCollection> combine(const reco::CandidatePtrVector &,
0045 const reco::CandidatePtrVector &,
0046 const reco::CandidatePtrVector &,
0047 const reco::CandidatePtrVector &,
0048 string_coll const &) const;
0049
0050 private:
0051
0052 bool preselect(const reco::Candidate &, const reco::Candidate &) const;
0053
0054 void combine(reco::NamedCompositeCandidate &,
0055 const reco::CandidatePtr &,
0056 const reco::CandidatePtr &,
0057 std::string,
0058 std::string) const;
0059
0060 typedef std::vector<
0061 std::pair<std::pair<reco::CandidatePtr, size_t>, std::vector<reco::CandidatePtrVector>::const_iterator> >
0062 CandStack;
0063 typedef std::vector<int> ChargeStack;
0064
0065 void combine(size_t collectionIndex,
0066 CandStack &,
0067 ChargeStack &,
0068 string_coll const &names,
0069 std::vector<reco::CandidatePtrVector>::const_iterator begin,
0070 std::vector<reco::CandidatePtrVector>::const_iterator end,
0071 std::unique_ptr<reco::NamedCompositeCandidateCollection> &comps) const;
0072
0073 virtual bool select(const reco::Candidate &) const = 0;
0074
0075 virtual bool selectPair(const reco::Candidate &c1, const reco::Candidate &c2) const = 0;
0076
0077 virtual void setup(reco::NamedCompositeCandidate &) const = 0;
0078
0079 virtual void addDaughter(reco::NamedCompositeCandidate &cmp, const reco::CandidatePtr &c, std::string name) const = 0;
0080
0081 bool checkCharge_;
0082
0083 bool checkOverlap_;
0084
0085 std::vector<int> dauCharge_;
0086
0087 OverlapChecker overlap_;
0088
0089 std::string name_;
0090 };
0091
0092 #endif