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 
28 using namespace std;
29 
30 //-------------------
31 // Initializations --
32 //-------------------
33 
34 //----------------
35 // Constructors --
36 //----------------
39 
41  const BPHRecoBuilder::ComponentSet& compList)
42  : BPHDecayMomentum(compList.daugMap, compList.compMap),
43  BPHDecayVertex(this, es),
44  BPHKinematicFit(this),
46  BPHRecoCandidate(es, compList) {}
47 
48 //--------------
49 // Operations --
50 //--------------
51 void BPHPlusMinusCandidate::add(const string& name, const reco::Candidate* daug, double mass, double sigma) {
52  add(name, daug, "cfhpmig", mass, sigma);
53  return;
54 }
55 
57  const string& name, const reco::Candidate* daug, const string& searchList, double mass, double sigma) {
58  const vector<const reco::Candidate*>& dL = daughters();
59  bool accept = false;
60  switch (dL.size()) {
61  case 0:
62  accept = true;
63  break;
64  case 1:
65  if ((daug->charge() * dL.front()->charge()) > 0) {
66  edm::LogPrint("TooManyParticles") << "BPHPlusMinusCandidate::add: "
67  << "already containing same sign particle, add rejected";
68  return;
69  }
70  accept = true;
71  break;
72  default:
73  edm::LogPrint("TooManyParticles") << "BPHPlusMinusCandidate::add: "
74  << "complete, add rejected";
75  return;
76  }
77  if (accept)
78  addK(name, daug, searchList, mass, sigma);
79  return;
80 }
81 
82 vector<BPHPlusMinusConstCandPtr> BPHPlusMinusCandidate::build(
83  const BPHRecoBuilder& builder, const string& nPos, const string& nNeg, double mass, double msig) {
84  vector<BPHPlusMinusConstCandPtr> cList;
85  class ChargeSelect : public BPHRecoSelect {
86  public:
87  ChargeSelect(int c) : charge(c) {}
88  ~ChargeSelect() override = default;
89  bool accept(const reco::Candidate& cand) const override { return ((charge * cand.charge()) > 0); }
90 
91  private:
92  int charge;
93  };
94  ChargeSelect tkPos(+1);
95  ChargeSelect tkNeg(-1);
96  builder.filter(nPos, tkPos);
97  builder.filter(nNeg, tkNeg);
98  fill<BPHPlusMinusCandidate>(cList, builder, mass, msig);
99  return cList;
100 }
101 
106  fill(ptr, level);
107  return ptr;
108 }
109 
111  static const pat::CompositeCandidate compCand;
112  static const string msg = "BPHPlusMinusCandidate incomplete, no composite available";
113  if (!chkSize(msg))
114  return compCand;
116 }
117 
119  static const string msg = "BPHPlusMinusCandidate incomplete, no cowboy/sailor classification";
120  return (chkSize(msg) && phiDiff());
121 }
122 
124  static const string msg = "BPHPlusMinusCandidate incomplete, no cowboy/sailor classification";
125  return (chkSize(msg) && !phiDiff());
126 }
127 
129  const vector<const reco::Candidate*>& dL = daughters();
130  int idPos = (dL.front()->charge() > 0 ? 0 : 1);
131  return reco::deltaPhi(dL[idPos]->phi(), dL[1 - idPos]->phi()) > 0;
132 }
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
Analysis-level particle class.
std::vector< BPHRecoConstCandPtr > cList
const BPHEventSetupWrapper * getEventSetup() const
retrieve EventSetup
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)
static std::vector< BPHPlusMinusConstCandPtr > build(const BPHRecoBuilder &builder, const BuilderParameters &par)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
const pat::CompositeCandidate & composite() const override
get a composite by the simple sum of simple particles
bool isCowboy() const
get cowboy/sailor classification
void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0) override
void fill(BPHRecoCandidate *ptr, int level) const override
void filter(const std::string &name, const BPHRecoSelect &sel) const
virtual int charge() const =0
electric charge
BPHRecoCandidate * clone(int level=-1) const override
Log< level::Warning, true > LogPrint
tuple msg
Definition: mps_check.py:285
BPHPlusMinusCandidate(const BPHEventSetupWrapper *es)
pat::CompositeCandidate compCand
virtual const std::vector< const reco::Candidate * > & daughters() const
virtual ParticleMass mass() const
virtual const pat::CompositeCandidate & composite() const
get a composite by the simple sum of simple particles