test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
48  public:
49 
52  BPHRecoCandidate( const edm::EventSetup* es );
55  // create an object with daughters as specified in the ComponentSet
57  const BPHRecoBuilder::ComponentSet& compSet );
58 
61  virtual ~BPHRecoCandidate();
62 
65  virtual void add( const std::string& name,
69  const reco::Candidate* daug,
70  double mass = -1.0, double sigma = -1.0 ) {
71  addK( name, daug, "cfhpmig", mass, sigma ); return; }
72  virtual void add( const std::string& name,
73  const reco::Candidate* daug,
74  const std::string& searchList,
75  double mass = -1.0, double sigma = -1.0 ) {
76  addK( name, daug, searchList, mass, sigma ); return; }
77  virtual void add( const std::string& name,
78  const BPHRecoConstCandPtr& comp ) {
79  addK( name, comp ); return; }
80 
83  static std::vector<BPHRecoConstCandPtr> build( const BPHRecoBuilder& builder,
84  double mass = -1,
85  double msig = -1 );
86 
87  protected:
88 
89  // template function called by "build" to allow
90  // the creation of derived objects
91  template <class T>
92  static void fill( std::vector< typename BPHGenericPtr<const T>::type >& cList,
93  const BPHRecoBuilder& builder,
94  double mass = -1, double msig = -1 );
95 
96  private:
97 
98 };
99 
100 
101 template <class T>
102 void BPHRecoCandidate::fill( std::vector<
103  typename BPHGenericPtr<const T>::type >& cList,
104  const BPHRecoBuilder& builder,
105  double mass, double msig ) {
106  // create paricle combinations
107  const std::vector<BPHRecoBuilder::ComponentSet> dll = builder.build();
108  // loop over combinations and create reconstructed particles
109  int i;
110  int n = dll.size();
111  cList.reserve( n );
112  T* rc = 0;
113  for ( i = 0; i < n; ++i ) {
114  // create reconstructed particle
115  rc = new T( builder.eventSetup(), dll[i] );
116  // apply mass constraint, if requested
117  if ( mass > 0 ) rc->setConstraint( mass, msig );
118  // apply post selection
119  if ( builder.accept( *rc ) ) cList.push_back( typename
121  ( rc ) );
122  else delete rc;
123  }
124  return;
125 }
126 
127 #endif
128 
int i
Definition: DBlmapReader.cc:9
virtual void addK(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
BPHRecoCandidate(const edm::EventSetup *es)
std::shared_ptr< T > type
Definition: BPHGenericPtr.h:8
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
std::vector< ComponentSet > build() const
build a set of combinations of particles fulfilling the selections
virtual ParticleMass mass() const
bool accept(const BPHRecoCandidate &cand) const
const edm::EventSetup * eventSetup() const
get the EventSetup set in the constructor
static void fill(std::vector< typename BPHGenericPtr< const T >::type > &cList, const BPHRecoBuilder &builder, double mass=-1, double msig=-1)
std::vector< BPHRecoConstCandPtr > cList
virtual ~BPHRecoCandidate()
virtual void add(const std::string &name, const reco::Candidate *daug, const std::string &searchList, double mass=-1.0, double sigma=-1.0)
static std::vector< BPHRecoConstCandPtr > build(const BPHRecoBuilder &builder, double mass=-1, double msig=-1)
virtual void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
virtual void add(const std::string &name, const BPHRecoConstCandPtr &comp)
long double T