1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#ifndef HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h
#define HeavyFlavorAnalysis_SpecificDecay_BPHParticleChargeSelect_h
/** \class BPHParticleChargeSelect
*
* Description:
* Class for particle selection by charge
*
* \author Paolo Ronchese INFN Padova
*
*/
//----------------------
// Base Class Headers --
//----------------------
#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoSelect.h"
//------------------------------------
// Collaborating Class Declarations --
//------------------------------------
#include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
//---------------
// C++ Headers --
//---------------
// ---------------------
// -- Class Interface --
// ---------------------
class BPHParticleChargeSelect : public BPHRecoSelect {
public:
/** Constructor
*/
BPHParticleChargeSelect(int c) : charge(c ? (c > 0 ? 1 : -1) : 0) {}
// deleted copy constructor and assignment operator
BPHParticleChargeSelect(const BPHParticleChargeSelect& x) = delete;
BPHParticleChargeSelect& operator=(const BPHParticleChargeSelect& x) = delete;
/** Destructor
*/
~BPHParticleChargeSelect() override = default;
/** Operations
*/
/// select particle
bool accept(const reco::Candidate& cand) const override {
switch (charge) {
default:
case 0:
return (cand.charge() != 0);
case 1:
return (cand.charge() > 0);
case -1:
return (cand.charge() < 0);
}
return true;
};
/// set selection charge
void setCharge(int c) {
charge = (c ? (c > 0 ? 1 : -1) : 0);
return;
}
/// get selection charge
double getCharge() const { return charge; }
private:
int charge;
};
#endif
|