File indexing completed on 2021-02-14 12:49:20
0001 #ifndef HeavyFlavorAnalysis_RecoDecay_BPHRecoCandidate_h
0002 #define HeavyFlavorAnalysis_RecoDecay_BPHRecoCandidate_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHKinematicFit.h"
0021
0022
0023
0024
0025 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoBuilder.h"
0026 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHGenericPtr.h"
0027 #include "DataFormats/PatCandidates/interface/CompositeCandidate.h"
0028
0029 namespace edm {
0030 class EventSetup;
0031 }
0032
0033 namespace reco {
0034 class Candidate;
0035 }
0036
0037
0038
0039
0040 #include <vector>
0041
0042
0043
0044
0045
0046 class BPHRecoCandidate : public virtual BPHKinematicFit {
0047 public:
0048
0049
0050
0051
0052 BPHRecoCandidate(const edm::EventSetup* es);
0053
0054 BPHRecoCandidate(const edm::EventSetup* es, const BPHRecoBuilder::ComponentSet& compSet);
0055
0056
0057 BPHRecoCandidate(const BPHRecoCandidate& x) = delete;
0058 BPHRecoCandidate& operator=(const BPHRecoCandidate& x) = delete;
0059
0060
0061
0062 ~BPHRecoCandidate() override;
0063
0064
0065
0066
0067
0068
0069 virtual void add(const std::string& name, const reco::Candidate* daug, double mass = -1.0, double sigma = -1.0) {
0070 addK(name, daug, "cfhpmig", mass, sigma);
0071 return;
0072 }
0073 virtual void add(const std::string& name,
0074 const reco::Candidate* daug,
0075 const std::string& searchList,
0076 double mass = -1.0,
0077 double sigma = -1.0) {
0078 addK(name, daug, searchList, mass, sigma);
0079 return;
0080 }
0081 virtual void add(const std::string& name, const BPHRecoConstCandPtr& comp) {
0082 addK(name, comp);
0083 return;
0084 }
0085
0086
0087
0088 static std::vector<BPHRecoConstCandPtr> build(const BPHRecoBuilder& builder, double mass = -1, double msig = -1);
0089
0090
0091
0092 virtual BPHRecoCandidate* clone(int level = -1) const;
0093
0094 protected:
0095
0096
0097 void fill(BPHRecoCandidate* ptr, int level) const override;
0098
0099
0100
0101 template <class T>
0102 static void fill(std::vector<typename BPHGenericPtr<const T>::type>& cList,
0103 const BPHRecoBuilder& builder,
0104 double mass = -1,
0105 double msig = -1);
0106 };
0107
0108 template <class T>
0109 void BPHRecoCandidate::fill(std::vector<typename BPHGenericPtr<const T>::type>& cList,
0110 const BPHRecoBuilder& builder,
0111 double mass,
0112 double msig) {
0113
0114 const std::vector<BPHRecoBuilder::ComponentSet> dll = builder.build();
0115
0116 int i;
0117 int n = dll.size();
0118 cList.reserve(n);
0119 T* rc = nullptr;
0120 for (i = 0; i < n; ++i) {
0121
0122 rc = new T(builder.eventSetup(), dll[i]);
0123
0124 if (mass > 0)
0125 rc->setConstraint(mass, msig);
0126
0127 if (builder.accept(*rc))
0128 cList.push_back(typename BPHGenericPtr<const T>::type(rc));
0129 else
0130 delete rc;
0131 }
0132 return;
0133 }
0134
0135 #endif