Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FitStatus.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 
29  reset();
30 }
31 
32 
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 */