CMS 3D CMS Logo

BPHPlusMinusCandidate.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //-----------------------
9 // This Class' Header --
10 //-----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
23 
24 //---------------
25 // C++ Headers --
26 //---------------
27 #include <iostream>
28 #include <cmath>
29 
30 using namespace std;
31 
32 //-------------------
33 // Initializations --
34 //-------------------
35 
36 //----------------
37 // Constructors --
38 //----------------
41 
43  : BPHDecayMomentum(compList.daugMap, compList.compMap),
44  BPHDecayVertex(this, es),
45  BPHKinematicFit(this),
47  BPHRecoCandidate(es, compList) {}
48 
49 //--------------
50 // Destructor --
51 //--------------
53 
54 //--------------
55 // Operations --
56 //--------------
57 void BPHPlusMinusCandidate::add(const string& name, const reco::Candidate* daug, double mass, double sigma) {
58  add(name, daug, "cfhpmig", mass, sigma);
59  return;
60 }
61 
63  const string& name, const reco::Candidate* daug, const string& searchList, double mass, double sigma) {
64  const vector<const reco::Candidate*>& dL = daughters();
65  switch (dL.size()) {
66  case 2:
67  edm::LogPrint("TooManyParticles") << "BPHPlusMinusCandidate::add: "
68  << "complete, add rejected";
69  return;
70  case 1:
71  if ((daug->charge() * dL.front()->charge()) > 0) {
72  edm::LogPrint("TooManyParticles") << "BPHPlusMinusCandidate::add: "
73  << "already containing same sign particle, add rejected";
74  return;
75  }
76  [[fallthrough]];
77  case 0:
78  addK(name, daug, searchList, mass, sigma);
79  }
80  return;
81 }
82 
83 vector<BPHPlusMinusConstCandPtr> BPHPlusMinusCandidate::build(
84  const BPHRecoBuilder& builder, const string& nPos, const string& nNeg, double mass, double msig) {
85  vector<BPHPlusMinusConstCandPtr> cList;
86  class ChargeSelect : public BPHRecoSelect {
87  public:
88  ChargeSelect(int c) : charge(c) {}
89  ~ChargeSelect() override {}
90  bool accept(const reco::Candidate& cand) const override { return ((charge * cand.charge()) > 0); }
91 
92  private:
93  int charge;
94  };
95  ChargeSelect tkPos(+1);
96  ChargeSelect tkNeg(-1);
97  builder.filter(nPos, tkPos);
98  builder.filter(nNeg, tkNeg);
99  fill<BPHPlusMinusCandidate>(cList, builder, mass, msig);
100  return cList;
101 }
102 
104  static const pat::CompositeCandidate compCand;
105  static const string msg = "BPHPlusMinusCandidate incomplete, no composite available";
106  if (!chkSize(msg))
107  return compCand;
109 }
110 
112  static const string msg = "BPHPlusMinusCandidate incomplete, no cowboy/sailor classification";
113  return (chkSize(msg) && phiDiff());
114 }
115 
117  static const string msg = "BPHPlusMinusCandidate incomplete, no cowboy/sailor classification";
118  return (chkSize(msg) && !phiDiff());
119 }
120 
122  const vector<const reco::Candidate*>& dL = daughters();
123  int idPos = (dL.front()->charge() > 0 ? 0 : 1);
124  return reco::deltaPhi(dL[idPos]->phi(), dL[1 - idPos]->phi()) > 0;
125 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
Analysis-level particle class.
static std::vector< BPHPlusMinusConstCandPtr > build(const BPHRecoBuilder &builder, const std::string &nPos, const std::string &nNeg, double mass=-1, double msig=-1)
BPHPlusMinusCandidate(const edm::EventSetup *es)
std::vector< BPHRecoConstCandPtr > cList
virtual void addK(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
static bool chkSize(const T &cont, const std::string &msg)
virtual ParticleMass mass() const
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
virtual const std::vector< const reco::Candidate * > & daughters() const
const pat::CompositeCandidate & composite() const override
get a composite by the simple sum of simple particles
void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0) override
bool isCowboy() const
get cowboy/sailor classification
std::vector< Component > compList
virtual const pat::CompositeCandidate & composite() const
get a composite by the simple sum of simple particles
tuple msg
Definition: mps_check.py:285
virtual int charge() const =0
electric charge
void filter(const std::string &name, const BPHRecoSelect &sel) const
pat::CompositeCandidate compCand