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 //----------------
38 // Constructors --
39 //----------------
41  BPHDecayVertex( es ),
42  BPHPlusMinusVertex( es ),
43  BPHRecoCandidate( es ) {
44 }
45 
46 
49  BPHDecayMomentum( compList.daugMap, compList.compMap ),
50  BPHDecayVertex( this, es ),
51  BPHKinematicFit( this ),
52  BPHPlusMinusVertex( es ),
53  BPHRecoCandidate( es, compList ) {
54 }
55 
56 //--------------
57 // Destructor --
58 //--------------
60 }
61 
62 //--------------
63 // Operations --
64 //--------------
65 void BPHPlusMinusCandidate::add( const string& name,
66  const reco::Candidate* daug,
67  double mass, double sigma ) {
68  add( name, daug, "cfhpmig", mass, sigma );
69  return;
70 }
71 
72 
73 void BPHPlusMinusCandidate::add( const string& name,
74  const reco::Candidate* daug,
75  const string& searchList,
76  double mass, double sigma ) {
77  const vector<const reco::Candidate*>& dL = daughters();
78  switch ( dL.size() ) {
79  case 2:
80  edm::LogPrint( "TooManyParticles" )
81  << "BPHPlusMinusCandidate::add: "
82  << "complete, add rejected";
83  return;
84  case 1:
85  if ( ( daug->charge() * dL.front()->charge() ) > 0 ) {
86  edm::LogPrint( "TooManyParticles" )
87  << "BPHPlusMinusCandidate::add: "
88  << "already containing same sign particle, add rejected";
89  return;
90  }
91  case 0:
92  addK( name, daug, searchList, mass, sigma );
93  }
94  return;
95 }
96 
97 
98 vector<BPHPlusMinusConstCandPtr> BPHPlusMinusCandidate::build(
99  const BPHRecoBuilder& builder,
100  const string& nPos,
101  const string& nNeg,
102  double mass, double msig ) {
103  vector<BPHPlusMinusConstCandPtr> cList;
104  class ChargeSelect: public BPHRecoSelect {
105  public:
106  ChargeSelect( int c ): charge ( c ) {}
107  ~ChargeSelect() override {}
108  bool accept( const reco::Candidate& cand ) const override {
109  return ( ( charge * cand.charge() ) > 0 );
110  }
111  private:
112  int charge;
113  };
114  ChargeSelect tkPos( +1 );
115  ChargeSelect tkNeg( -1 );
116  builder.filter( nPos, tkPos );
117  builder.filter( nNeg, tkNeg );
118  fill<BPHPlusMinusCandidate>( cList, builder, mass, msig );
119  return cList;
120 }
121 
122 
124  static const pat::CompositeCandidate compCand;
125  static const string msg =
126  "BPHPlusMinusCandidate incomplete, no composite available";
127  if ( !chkSize( msg ) ) return compCand;
129 }
130 
131 
133  static const string msg =
134  "BPHPlusMinusCandidate incomplete, no cowboy/sailor classification";
135  return ( chkSize( msg ) && phiDiff() );
136 }
137 
138 
140  static const string msg =
141  "BPHPlusMinusCandidate incomplete, no cowboy/sailor classification";
142  return ( chkSize( msg ) && !phiDiff() );
143 }
144 
145 
147  const vector<const reco::Candidate*>& dL = daughters();
148  int idPos = ( dL.front()->charge() > 0 ? 0 : 1 );
149  return reco::deltaPhi( dL[ idPos]->phi(),
150  dL[1 - idPos]->phi() ) > 0;
151 }
152 
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)
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
std::vector< BPHRecoConstCandPtr > cList
bool isCowboy() const
get cowboy/sailor classification
std::vector< Component > compList
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:22
virtual const pat::CompositeCandidate & composite() const
get a composite by the simple sum of simple particles
tuple msg
Definition: mps_check.py:277
virtual int charge() const =0
electric charge
void filter(const std::string &name, const BPHRecoSelect &sel) const
pat::CompositeCandidate compCand