PandaRoot
MergedConstraint.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 // ******************************************************
14 // DecayTreeFitter Package
15 // We thank the original author Wouter Hulsbergen
16 // (BaBar, LHCb) for providing the sources.
17 // http://arxiv.org/abs/physics/0503191v1 (2005)
18 // Adaptation & Development for PANDA: Ralf Kliemt (2015)
19 // ******************************************************
20 #ifndef MERGEDCONSTRAINT_H
21 #define MERGEDCONSTRAINT_H 1
22 
23 #include <vector>
24 #include "Constraint.h"
25 #include "Rtypes.h"
26 
27 namespace DecayTreeFitter {
28 class MergedConstraint : public Constraint {
29  public:
30  typedef std::vector<Constraint *> constraintlist;
31 
33  virtual ~MergedConstraint() {}
34 
35  MergedConstraint(const constraintlist &list) : Constraint(Constraint::merged), m_list(list)
36  {
37  int d(0);
38  for (constraintlist::iterator it = m_list.begin(); it != m_list.end(); ++it)
39  d += (*it)->dim();
40  setDim(d);
41  }
42 
43  virtual ErrCode project(const FitParams *fitpar, Projection &p) const;
44 
46  {
47  m_list.push_back(c);
48  setDim(dim() + c->dim());
49  setNIter(std::max(nIter(), c->nIter()));
50  }
51 
52  virtual void print(std::ostream &os = std::cout) const;
53 
54  private:
55  constraintlist m_list;
56  ClassDef(MergedConstraint, 1)
57 };
58 
59 } // namespace DecayTreeFitter
60 
61 #endif
virtual ErrCode project(const FitParams *fitpar, Projection &p) const
void setDim(unsigned int d)
Definition: Constraint.h:70
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:37
unsigned int nIter() const
Definition: Constraint.h:48
virtual void print(std::ostream &os=std::cout) const
std::vector< Constraint * > constraintlist
MergedConstraint(const constraintlist &list)
unsigned int dim() const
Definition: Constraint.h:46
void setNIter(unsigned int d)
Definition: Constraint.h:71