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 // -- Class Interface --
28 // ---------------------
29 
31 public:
34  BPHParticleChargeSelect(int c) : charge(c ? (c > 0 ? 1 : -1) : 0) {}
35 
36  // deleted copy constructor and assignment operator
39 
43 
46  bool accept(const reco::Candidate& cand) const override {
48  switch (charge) {
49  default:
50  case 0:
51  return (cand.charge() != 0);
52  case 1:
53  return (cand.charge() > 0);
54  case -1:
55  return (cand.charge() < 0);
56  }
57  return true;
58  };
59 
61  void setCharge(int c) {
62  charge = (c ? (c > 0 ? 1 : -1) : 0);
63  return;
64  }
65 
67  double getCharge() const { return charge; }
68 
69 private:
70  int charge;
71 };
72 
73 #endif
BPHParticleChargeSelect::charge
int charge
Definition: BPHParticleChargeSelect.h:70
BPHRecoSelect
Definition: BPHRecoSelect.h:35
BPHRecoSelect.h
DDAxes::x
RecoCandidate.h
BPHParticleChargeSelect::accept
bool accept(const reco::Candidate &cand) const override
select particle
Definition: BPHParticleChargeSelect.h:47
BPHParticleChargeSelect::getCharge
double getCharge() const
get selection charge
Definition: BPHParticleChargeSelect.h:67
BPHParticleChargeSelect::~BPHParticleChargeSelect
~BPHParticleChargeSelect() override
Definition: BPHParticleChargeSelect.h:42
cand
Definition: decayParser.h:32
BPHParticleChargeSelect::setCharge
void setCharge(int c)
set selection charge
Definition: BPHParticleChargeSelect.h:61
reco::Candidate
Definition: Candidate.h:27
BPHParticleChargeSelect
Definition: BPHParticleChargeSelect.h:30
BPHParticleChargeSelect::operator=
BPHParticleChargeSelect & operator=(const BPHParticleChargeSelect &x)=delete
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
BPHParticleChargeSelect::BPHParticleChargeSelect
BPHParticleChargeSelect(int c)
Definition: BPHParticleChargeSelect.h:34