Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:18:22

0001 /* Copyright 2013, Technische Universitaet Muenchen, Ludwig-Maximilians-Universität München
0002    Authors: Johannes Rauch & Tobias Schlüter
0003 
0004    This file is part of GENFIT.
0005 
0006    GENFIT is free software: you can redistribute it and/or modify
0007    it under the terms of the GNU Lesser General Public License as published
0008    by the Free Software Foundation, either version 3 of the License, or
0009    (at your option) any later version.
0010 
0011    GENFIT is distributed in the hope that it will be useful,
0012    but WITHOUT ANY WARRANTY; without even the implied warranty of
0013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014    GNU Lesser General Public License for more details.
0015 
0016    You should have received a copy of the GNU Lesser General Public License
0017    along with GENFIT.  If not, see <http://www.gnu.org/licenses/>.
0018 */
0019 
0020 
0021 #include "FitStatus.h"
0022 #include "IO.h"
0023 
0024 #include <TString.h>
0025 
0026 namespace genfit {
0027 
0028 PruneFlags::PruneFlags() {
0029   reset();
0030 }
0031 
0032 
0033 void PruneFlags::reset() {
0034   memset(this, 0, sizeof *this);
0035 }
0036 
0037 
0038 void PruneFlags::setFlags(Option_t* option) {
0039   TString opt = option;
0040   opt.ToUpper();
0041 
0042   value |= opt.Contains("C") ? C : 0;
0043   value |= opt.Contains("F") ? F : 0;
0044   value |= opt.Contains("L") ? L : 0;
0045   value |= opt.Contains("W") ? W : 0;
0046   value |= opt.Contains("R") ? R : 0;
0047   value |= opt.Contains("M") ? M : 0;
0048   value |= opt.Contains("I") ? I : 0;
0049   value |= opt.Contains("U") ? U : 0;
0050 }
0051 
0052 
0053 bool PruneFlags::hasFlags(Option_t* option) const {
0054   TString opt = option;
0055   opt.ToUpper();
0056 
0057   return !((!(value & C) && opt.Contains("C"))
0058        || (!(value & F) && opt.Contains("F"))
0059        || (!(value & L) && opt.Contains("L"))
0060        || (!(value & W) && opt.Contains("W"))
0061        || (!(value & R) && opt.Contains("R"))
0062        || (!(value & M) && opt.Contains("M"))
0063        || (!(value & I) && opt.Contains("I"))
0064        || (!(value & U) && opt.Contains("U")));
0065 }
0066 
0067 
0068 bool PruneFlags::isPruned() const {
0069   return !!value;
0070 }
0071 
0072 
0073 void PruneFlags::Print(const Option_t*) const {
0074   printOut << "PruneFlags: ";
0075   if (value & C) printOut << "C";
0076   if (value & F) printOut << "F";
0077   if (value & L) printOut << "L";
0078   if (value & W) printOut << "W";
0079   if (value & R) printOut << "R";
0080   if (value & M) printOut << "M";
0081   if (value & I) printOut << "I";
0082   if (value & U) printOut << "U";
0083   printOut << "\n";
0084 }
0085 
0086 
0087 
0088 void FitStatus::Print(const Option_t*) const
0089 {
0090   printOut << "fitStatus \n";
0091   if (isFitted_) {
0092     printOut << " track has been fitted,";
0093     if (isFitConvergedFully_) {
0094       printOut << " fit has converged fully,";
0095     } else if (isFitConvergedPartially_) {
0096       printOut << " fit has converged partially,";
0097     } else {
0098       printOut << " fit has NOT converged,";
0099     }
0100     printOut << " " << nFailedPoints_ << " TrackPoints could not be processed,";
0101     if (trackHasChanged_) {
0102       printOut << " track has changed since the fit,";
0103     }
0104     printOut << " fitted charge = " << charge_ << ", ";
0105     pruneFlags_.Print();
0106   }
0107   else {
0108     printOut << " track has NOT been fitted,";
0109   }
0110 }
0111 
0112 } /* End of namespace genfit */