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 //------------------------------------
19 // Collaborating Class Declarations --
20 //------------------------------------
23 class BPHRecoBuilder;
24 
25 //---------------
26 // C++ Headers --
27 //---------------
28 #include <vector>
29 #include <map>
30 #include <string>
31 
32 // ---------------------
33 // -- Class Interface --
34 // ---------------------
35 
37 
38  friend class BPHRecoBuilder;
39 
40  public:
41 
48  virtual ~BPHDecayMomentum();
49 
53  virtual const pat::CompositeCandidate& composite() const;
55 
60  virtual const std::vector<std::string>& daugNames() const;
61 
66  virtual const std::vector<std::string>& compNames() const;
67 
73  virtual const std::vector<const reco::Candidate*>& daughters() const;
74 
81  virtual const std::vector<const reco::Candidate*>& daughFull() const;
82 
84  virtual const reco::Candidate* originalReco(
85  const reco::Candidate* daug ) const;
86 
91  virtual const std::vector<BPHRecoConstCandPtr>& daughComp() const;
92 
95  virtual const reco::Candidate* getDaug( const std::string& name ) const;
96 
99  virtual BPHRecoConstCandPtr getComp( const std::string& name ) const;
100 
101  protected:
102 
103  struct Component {
105  double mass;
106  double msig;
108  };
109 
110  // constructors
112  BPHDecayMomentum( const std::map<std::string,Component>& daugMap );
113  BPHDecayMomentum( const std::map<std::string,Component>& daugMap,
114  const std::map<std::string,BPHRecoConstCandPtr> compMap );
115 
116  // get an object filled in the constructor
117  // to be used in the creation of other bases of BPHRecoCandidate
118  const std::vector<Component>& componentList() const;
119 
122  virtual void addP( const std::string& name,
123  const reco::Candidate* daug, double mass = -1.0 );
125  virtual void addP( const std::string& name,
126  const BPHRecoConstCandPtr& comp );
127 
128  // utility function used to cash reconstruction results
129  virtual void setNotUpdated() const;
130 
131  private:
132 
133  // object filled in the constructor
134  // to be used in the creation of other bases of BPHRecoCandidate
135  std::vector<Component> compList;
136 
137  // names used for simple and previously reconstructed particles
138  std::vector<std::string> nList;
139  std::vector<std::string> nComp;
140 
141  // pointers to simple and previously reconstructed particles
142  // (clones stored for simple particles)
143  std::vector<const reco::Candidate*> dList;
144  std::vector<BPHRecoConstCandPtr > cList;
145 
146  // maps linking names to decay products
147  // (simple and previously reconstructed particles)
148  std::map<std::string,const reco::Candidate*> dMap;
149  std::map<std::string,BPHRecoConstCandPtr > cMap;
150 
151  // map linking cloned particles to original ones
152  std::map<const reco::Candidate*, const reco::Candidate*> clonesMap;
153 
154  // reconstruction results cache
155  mutable bool oldMom;
156  mutable std::vector<const reco::Candidate*> dFull;
158 
159  // create clones of simple particles, store them and their names
160  void clonesList( const std::map<std::string,Component>& daugMap );
161 
162  // fill lists of previously reconstructed particles and their names
163  // and retrieve cascade decay products
164  void dCompList();
165 
166  // compute the total momentum of simple particles, produced
167  // directly or in cascade decays
168  virtual void sumMomentum(
169  const std::vector<const reco::Candidate*> dl ) const;
170 
171  // recursively fill the list of simple particles, produced
172  // directly or in cascade decays
173  virtual void fillDaug( std::vector<const reco::Candidate*>& ad ) const;
174 
175  // compute the total momentum and cache it
176  virtual void computeMomentum() const;
177 
178 };
179 
180 
181 #endif
182 
Analysis-level particle class.
const reco::Candidate * cand
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()
virtual const std::vector< const reco::Candidate * > & daughters() const
std::vector< const reco::Candidate * > dList
std::vector< BPHRecoConstCandPtr > cList
std::map< std::string, BPHRecoConstCandPtr > cMap
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< std::string, const reco::Candidate * > dMap
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