Belle II Software  release-08-01-10
FitStatus.cc
1 /* Copyright 2013, Technische Universitaet Muenchen, Ludwig-Maximilians-Universität München
2  Authors: Johannes Rauch & Tobias Schlüter
3 
4  This file is part of GENFIT.
5 
6  GENFIT is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  GENFIT is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 
21 #include "FitStatus.h"
22 #include "IO.h"
23 
24 #include <TString.h>
25 
26 namespace genfit {
27 
28 PruneFlags::PruneFlags() {
29  reset();
30 }
31 
32 
33 void PruneFlags::reset() {
34  memset(this, 0, sizeof *this);
35 }
36 
37 
38 void PruneFlags::setFlags(Option_t* option) {
39  TString opt = option;
40  opt.ToUpper();
41 
42  value |= opt.Contains("C") ? C : 0;
43  value |= opt.Contains("F") ? F : 0;
44  value |= opt.Contains("L") ? L : 0;
45  value |= opt.Contains("W") ? W : 0;
46  value |= opt.Contains("R") ? R : 0;
47  value |= opt.Contains("M") ? M : 0;
48  value |= opt.Contains("I") ? I : 0;
49  value |= opt.Contains("U") ? U : 0;
50 }
51 
52 
53 bool PruneFlags::hasFlags(Option_t* option) const {
54  TString opt = option;
55  opt.ToUpper();
56 
57  return !((!(value & C) && opt.Contains("C"))
58  || (!(value & F) && opt.Contains("F"))
59  || (!(value & L) && opt.Contains("L"))
60  || (!(value & W) && opt.Contains("W"))
61  || (!(value & R) && opt.Contains("R"))
62  || (!(value & M) && opt.Contains("M"))
63  || (!(value & I) && opt.Contains("I"))
64  || (!(value & U) && opt.Contains("U")));
65 }
66 
67 
68 bool PruneFlags::isPruned() const {
69  return !!value;
70 }
71 
72 
73 void PruneFlags::Print(const Option_t*) const {
74  printOut << "PruneFlags: ";
75  if (value & C) printOut << "C";
76  if (value & F) printOut << "F";
77  if (value & L) printOut << "L";
78  if (value & W) printOut << "W";
79  if (value & R) printOut << "R";
80  if (value & M) printOut << "M";
81  if (value & I) printOut << "I";
82  if (value & U) printOut << "U";
83  printOut << "\n";
84 }
85 
86 
87 
88 void FitStatus::Print(const Option_t*) const
89 {
90  printOut << "fitStatus \n";
91  if (isFitted_) {
92  printOut << " track has been fitted,";
94  printOut << " fit has converged fully,";
95  } else if (isFitConvergedPartially_) {
96  printOut << " fit has converged partially,";
97  } else {
98  printOut << " fit has NOT converged,";
99  }
100  printOut << " " << nFailedPoints_ << " TrackPoints could not be processed,";
101  if (trackHasChanged_) {
102  printOut << " track has changed since the fit,";
103  }
104  printOut << " fitted charge = " << charge_ << ", ";
105  pruneFlags_.Print();
106  }
107  else {
108  printOut << " track has NOT been fitted,";
109  }
110 }
111 
112 } /* End of namespace genfit */
double R
typedef autogenerated by FFTW
PruneFlags pruneFlags_
Prune flags.
Definition: FitStatus.h:157
bool trackHasChanged_
has anything in the Track been changed since the fit? -> fit isn't valid anymore
Definition: FitStatus.h:155
bool isFitConvergedPartially_
did the fit converge with a subset of all TrackPoints?
Definition: FitStatus.h:151
bool isFitted_
has the track been fitted?
Definition: FitStatus.h:147
double charge_
fitted charge
Definition: FitStatus.h:159
bool isFitConvergedFully_
did the fit converge with all TrackPoints?
Definition: FitStatus.h:149
int nFailedPoints_
Number of failed TrackPoints.
Definition: FitStatus.h:153
Defines for I/O streams used for error and debug printing.
std::ostream printOut
Default stream for output of Print calls.
bool isPruned() const
check if any of the flags is set
Definition: FitStatus.cc:68
void setFlags(Option_t *option="")
does not reset! If a flag is already true and is not in opt, it will stay true.
Definition: FitStatus.cc:38
bool hasFlags(Option_t *option="CFLWRMIU") const
check if all the given flags are set
Definition: FitStatus.cc:53