CMS 3D CMS Logo

BPHRecoCandidate.h
Go to the documentation of this file.
1 #ifndef HeavyFlavorAnalysis_RecoDecay_BPHRecoCandidate_h
2 #define HeavyFlavorAnalysis_RecoDecay_BPHRecoCandidate_h
3 
17 //----------------------
18 // Base Class Headers --
19 //----------------------
21 
22 //------------------------------------
23 // Collaborating Class Declarations --
24 //------------------------------------
28 
29 namespace edm {
30  class EventSetup;
31 }
32 
33 namespace reco {
34  class Candidate;
35 }
36 
37 //---------------
38 // C++ Headers --
39 //---------------
40 #include <vector>
41 
42 // ---------------------
43 // -- Class Interface --
44 // ---------------------
45 
46 class BPHRecoCandidate : public virtual BPHKinematicFit {
47 public:
53  // create an object with daughters as specified in the ComponentSet
55 
56  // deleted copy constructor and assignment operator
57  BPHRecoCandidate(const BPHRecoCandidate& x) = delete;
58  BPHRecoCandidate& operator=(const BPHRecoCandidate& x) = delete;
59 
62  ~BPHRecoCandidate() override;
63 
66  virtual void add(const std::string& name, const reco::Candidate* daug, double mass = -1.0, double sigma = -1.0) {
70  addK(name, daug, "cfhpmig", mass, sigma);
71  return;
72  }
73  virtual void add(const std::string& name,
74  const reco::Candidate* daug,
75  const std::string& searchList,
76  double mass = -1.0,
77  double sigma = -1.0) {
78  addK(name, daug, searchList, mass, sigma);
79  return;
80  }
81  virtual void add(const std::string& name, const BPHRecoConstCandPtr& comp) {
82  addK(name, comp);
83  return;
84  }
85 
88  static std::vector<BPHRecoConstCandPtr> build(const BPHRecoBuilder& builder, double mass = -1, double msig = -1);
89 
92  virtual BPHRecoCandidate* clone(int level = -1) const;
93 
94 protected:
95  // function doing the job to clone reconstructed decays:
96  // copy stable particles and clone cascade decays up to chosen level
97  void fill(BPHRecoCandidate* ptr, int level) const override;
98 
99  // template function called by "build" to allow
100  // the creation of derived objects
101  template <class T>
102  static void fill(std::vector<typename BPHGenericPtr<const T>::type>& cList,
103  const BPHRecoBuilder& builder,
104  double mass = -1,
105  double msig = -1);
106 };
107 
108 template <class T>
110  const BPHRecoBuilder& builder,
111  double mass,
112  double msig) {
113  // create particle combinations
114  const std::vector<BPHRecoBuilder::ComponentSet> dll = builder.build();
115  // loop over combinations and create reconstructed particles
116  int i;
117  int n = dll.size();
118  cList.reserve(n);
119  T* rc = nullptr;
120  for (i = 0; i < n; ++i) {
121  // create reconstructed particle
122  rc = new T(builder.eventSetup(), dll[i]);
123  // apply mass constraint, if requested
124  if (mass > 0)
125  rc->setConstraint(mass, msig);
126  // apply post selection
127  if (builder.accept(*rc))
128  cList.push_back(typename BPHGenericPtr<const T>::type(rc));
129  else
130  delete rc;
131  }
132  return;
133 }
134 
135 #endif
personalPlayback.level
level
Definition: personalPlayback.py:22
CompositeCandidate.h
BPHGenericPtr.h
mps_fire.i
i
Definition: mps_fire.py:428
BPHGenericPtr::type
std::shared_ptr< T > type
Definition: BPHGenericPtr.h:8
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
configurableAnalysis::Candidate
char Candidate[]
Definition: modules.cc:20
BPHRecoCandidate::fill
void fill(BPHRecoCandidate *ptr, int level) const override
Definition: BPHRecoCandidate.cc:61
edm
HLT enums.
Definition: AlignableModifier.h:19
BPHRecoCandidate::add
virtual void add(const std::string &name, const BPHRecoConstCandPtr &comp)
Definition: BPHRecoCandidate.h:81
DDAxes::x
reco
fixed size matrix
Definition: AlignmentAlgorithmBase.h:45
BPHRecoCandidate::add
virtual void add(const std::string &name, const reco::Candidate *daug, const std::string &searchList, double mass=-1.0, double sigma=-1.0)
Definition: BPHRecoCandidate.h:73
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
BPHRecoBuilder::build
std::vector< ComponentSet > build() const
build a set of combinations of particles fulfilling the selections
Definition: BPHRecoBuilder.cc:177
BPHRecoBuilder
Definition: BPHRecoBuilder.h:50
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
BPHRecoBuilder::ComponentSet
Definition: BPHRecoBuilder.h:127
BPHRecoBuilder::eventSetup
const edm::EventSetup * eventSetup() const
get the EventSetup set in the constructor
Definition: BPHRecoBuilder.cc:186
newFWLiteAna.searchList
searchList
Definition: newFWLiteAna.py:119
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::EventSetup
Definition: EventSetup.h:58
BPHRecoCandidate::~BPHRecoCandidate
~BPHRecoCandidate() override
Definition: BPHRecoCandidate.cc:38
BPHRecoBuilder.h
BPHKinematicFit::mass
virtual ParticleMass mass() const
Definition: BPHKinematicFit.cc:297
reco::Candidate
Definition: Candidate.h:27
BPHRecoCandidate::BPHRecoCandidate
BPHRecoCandidate(const edm::EventSetup *es)
Definition: BPHRecoCandidate.cc:30
BPHKinematicFit::addK
virtual void addK(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
BPHKinematicFit.h
T
long double T
Definition: Basic3DVectorLD.h:48
BPHRecoCandidate::build
static std::vector< BPHRecoConstCandPtr > build(const BPHRecoBuilder &builder, double mass=-1, double msig=-1)
Definition: BPHRecoCandidate.cc:43
EgHLTOffHistBins_cfi.mass
mass
Definition: EgHLTOffHistBins_cfi.py:34
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BPHRecoCandidate::operator=
BPHRecoCandidate & operator=(const BPHRecoCandidate &x)=delete
BPHRecoCandidate::add
virtual void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
Definition: BPHRecoCandidate.h:69
BPHRecoCandidate::clone
virtual BPHRecoCandidate * clone(int level=-1) const
Definition: BPHRecoCandidate.cc:53
BPHKinematicFit
Definition: BPHKinematicFit.h:38
EventSetup
BPHRecoBuilder::accept
bool accept(const BPHRecoCandidate &cand) const
Definition: BPHRecoBuilder.cc:151
BPHRecoCandidate
Definition: BPHRecoCandidate.h:46
BPHDecayMomentum::cList
std::vector< BPHRecoConstCandPtr > cList
Definition: BPHDecayMomentum.h:143
BPHRecoConstCandPtr
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
Definition: BPHRecoCandidatePtr.h:9