CMS 3D CMS Logo

BPHDecayMomentum.h
Go to the documentation of this file.
1 #ifndef HeavyFlavorAnalysis_RecoDecay_BPHDecayMomentum_h
2 #define HeavyFlavorAnalysis_RecoDecay_BPHDecayMomentum_h
3 
13 //----------------------
14 // Base Class Headers --
15 //----------------------
16 
17 //------------------------------------
18 // Collaborating Class Declarations --
19 //------------------------------------
22 class BPHRecoBuilder;
23 
24 //---------------
25 // C++ Headers --
26 //---------------
27 #include <vector>
28 #include <map>
29 #include <string>
30 
31 // ---------------------
32 // -- Class Interface --
33 // ---------------------
34 
36  friend class BPHRecoBuilder;
37 
38 public:
45  virtual ~BPHDecayMomentum();
46 
50  virtual const pat::CompositeCandidate& composite() const;
52 
57  virtual const std::vector<std::string>& daugNames() const;
58 
63  virtual const std::vector<std::string>& compNames() const;
64 
70  virtual const std::vector<const reco::Candidate*>& daughters() const;
71 
78  virtual const std::vector<const reco::Candidate*>& daughFull() const;
79 
81  virtual const reco::Candidate* originalReco(const reco::Candidate* daug) const;
82 
87  virtual const std::vector<BPHRecoConstCandPtr>& daughComp() const;
88 
91  virtual const reco::Candidate* getDaug(const std::string& name) const;
92 
95  virtual BPHRecoConstCandPtr getComp(const std::string& name) const;
96 
97 protected:
98  struct Component {
100  double mass;
101  double msig;
103  };
104 
105  // constructors
107  BPHDecayMomentum(const std::map<std::string, Component>& daugMap);
108  BPHDecayMomentum(const std::map<std::string, Component>& daugMap,
109  const std::map<std::string, BPHRecoConstCandPtr> compMap);
110 
111  // get an object filled in the constructor
112  // to be used in the creation of other bases of BPHRecoCandidate
113  const std::vector<Component>& componentList() const;
114 
117  virtual void addP(const std::string& name, const reco::Candidate* daug, double mass = -1.0);
119  virtual void addP(const std::string& name, const BPHRecoConstCandPtr& comp);
120 
121  // utility function used to cash reconstruction results
122  virtual void setNotUpdated() const;
123 
124 private:
125  // object filled in the constructor
126  // to be used in the creation of other bases of BPHRecoCandidate
127  std::vector<Component> compList;
128 
129  // names used for simple and previously reconstructed particles
130  std::vector<std::string> nList;
131  std::vector<std::string> nComp;
132 
133  // pointers to simple and previously reconstructed particles
134  // (clones stored for simple particles)
135  std::vector<const reco::Candidate*> dList;
136  std::vector<BPHRecoConstCandPtr> cList;
137 
138  // maps linking names to decay products
139  // (simple and previously reconstructed particles)
140  std::map<std::string, const reco::Candidate*> dMap;
141  std::map<std::string, BPHRecoConstCandPtr> cMap;
142 
143  // map linking cloned particles to original ones
144  std::map<const reco::Candidate*, const reco::Candidate*> clonesMap;
145 
146  // reconstruction results cache
147  mutable bool oldMom;
148  mutable std::vector<const reco::Candidate*> dFull;
150 
151  // create clones of simple particles, store them and their names
152  void clonesList(const std::map<std::string, Component>& daugMap);
153 
154  // fill lists of previously reconstructed particles and their names
155  // and retrieve cascade decay products
156  void dCompList();
157 
158  // compute the total momentum of simple particles, produced
159  // directly or in cascade decays
160  virtual void sumMomentum(const std::vector<const reco::Candidate*> dl) const;
161 
162  // recursively fill the list of simple particles, produced
163  // directly or in cascade decays
164  virtual void fillDaug(std::vector<const reco::Candidate*>& ad) const;
165 
166  // compute the total momentum and cache it
167  virtual void computeMomentum() const;
168 };
169 
170 #endif
Analysis-level particle class.
const reco::Candidate * cand
std::vector< BPHRecoConstCandPtr > cList
virtual void sumMomentum(const std::vector< const reco::Candidate * > dl) const
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
virtual void setNotUpdated() const
virtual void computeMomentum() const
virtual ~BPHDecayMomentum()
std::map< std::string, const reco::Candidate * > dMap
virtual const std::vector< const reco::Candidate * > & daughters() const
std::vector< const reco::Candidate * > dList
const std::vector< Component > & componentList() const
std::vector< Component > compList
std::vector< const reco::Candidate * > dFull
virtual void addP(const std::string &name, const reco::Candidate *daug, double mass=-1.0)
virtual void fillDaug(std::vector< const reco::Candidate * > &ad) const
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
virtual const pat::CompositeCandidate & composite() const
get a composite by the simple sum of simple particles
void clonesList(const std::map< std::string, Component > &daugMap)
std::map< const reco::Candidate *, const reco::Candidate * > clonesMap
pat::CompositeCandidate compCand
virtual BPHRecoConstCandPtr getComp(const std::string &name) const
virtual const std::vector< BPHRecoConstCandPtr > & daughComp() const
virtual const std::vector< const reco::Candidate * > & daughFull() const
virtual const std::vector< std::string > & compNames() const
std::vector< std::string > nList
virtual const std::vector< std::string > & daugNames() const
virtual const reco::Candidate * getDaug(const std::string &name) const
std::vector< std::string > nComp
std::map< std::string, BPHRecoConstCandPtr > cMap