CMS 3D CMS Logo

BPHParticleChargeSelect.h
Go to the documentation of this file.
1 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h
2 #define HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h
3 
12 //----------------------
13 // Base Class Headers --
14 //----------------------
16 
17 //------------------------------------
18 // Collaborating Class Declarations --
19 //------------------------------------
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 
26 
27 // ---------------------
28 // -- Class Interface --
29 // ---------------------
30 
32 
33  public:
34 
37  BPHParticleChargeSelect( int c ): charge( c ? ( c > 0 ? 1 : -1 ) : 0 ) {}
38 
42 
45  virtual bool accept( const reco::Candidate& cand ) const {
47  switch ( charge ) {
48  default:
49  case 0: return ( cand.charge() != 0 );
50  case 1: return ( cand.charge() > 0 );
51  case -1: return ( cand.charge() < 0 );
52  }
53  return true;
54  };
55 
57  void setCharge( int c ) { charge =( c ? ( c > 0 ? 1 : -1 ) : 0 ); return; }
58 
60  double getCharge() const { return charge; }
61 
62  private:
63 
64  // private copy and assigment constructors
67 
68  int charge;
69 
70 };
71 
72 
73 #endif
74 
BPHParticleChargeSelect & operator=(const BPHParticleChargeSelect &x)
virtual bool accept(const reco::Candidate &cand) const
select particle
double getCharge() const
get seelction charge
void setCharge(int c)
set seelction charge
virtual int charge() const =0
electric charge