Belle II Software development
PedeResult.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <map>
12#include <string>
13#include <vector>
14
15namespace Belle2 {
20 namespace alignment {
22 class PedeResult {
23 public:
28 explicit PedeResult(const std::string& filename);
30 void read(std::string filename = "millepede.res");
32 void readEigenFile(std::string filename = "millepede.eve");
34 bool isValid() {return valid;}
36 void dump();
38 int getNoParameters() const {return data.size();}
42 int getParameterIndex(int parameterLabel);
44 unsigned int getParameterLabel(unsigned int parameterIndex);
46 double getParameterCorrection(unsigned int parameterIndex);
48 double getParameterError(unsigned int parameterIndex);
50 double getParameterPresigma(unsigned int parameterIndex);
52 bool isParameterFixed(unsigned int parameterIndex);
54 bool isParameterDetermined(unsigned int parameterIndex);
56 int getNoEigenPairs() const {return eigenNumbers.size();}
58 double getEigenNumber(unsigned int eigenPairIndex);
60 double getEigenVectorElement(unsigned int eigenPairIndex, unsigned int parameterIndex);
61
62 private:
64 bool outOfBounds(int iparam) {if (iparam < 0) return true; if ((unsigned int)iparam >= data.size()) return true; return false;}
66 public:
77 parameterData(int index_, int label_, double correction_, double error_, double presigma_)
78 {
79 index = index_;
80 label = label_;
81 correction = correction_;
82 error = error_;
83 presigma = presigma_;
84 eigenweights.clear();
85 }
87 int index;
89 int label;
91 double correction;
93 double error;
95 double presigma;
97 std::vector<double> eigenweights;
98 };
99 private:
101 std::vector<parameterData> data;
103 std::vector<double> eigenNumbers;
105 bool valid;
107 std::map<int, int> labelIndices;
110 };
111 }
113}
Class to process Pede result file(s)
Definition: PedeResult.h:22
void readEigenFile(std::string filename="millepede.eve")
Reads file with eigen-vector/numbers.
Definition: PedeResult.cc:35
bool valid
Flag to check if data wa loaded.
Definition: PedeResult.h:105
double getParameterCorrection(unsigned int parameterIndex)
Get determined correction of parameter at index.
Definition: PedeResult.cc:136
int getNoDeterminedParameters() const
Get number of determined parameters (with correction)
Definition: PedeResult.h:40
bool isParameterDetermined(unsigned int parameterIndex)
Is parameter at given index determined?
Definition: PedeResult.cc:156
int getNoEigenPairs() const
Get the number of eigenvectors(numbers) in eigen file.
Definition: PedeResult.h:56
int noDeterminedParams
Number of parameters actually determined.
Definition: PedeResult.h:109
PedeResult()
Default constructor, use read(...) to init the object.
Definition: PedeResult.h:25
double getEigenNumber(unsigned int eigenPairIndex)
Get eigennumber at given index.
Definition: PedeResult.cc:161
int getParameterIndex(int parameterLabel)
Get index of parameter with given label.
Definition: PedeResult.cc:27
int getNoParameters() const
Get number of parameters in result (for looping over)
Definition: PedeResult.h:38
void read(std::string filename="millepede.res")
Reads the result file and inits the object.
Definition: PedeResult.cc:95
std::map< int, int > labelIndices
Map to link parameter labels and their indices in result.
Definition: PedeResult.h:107
bool outOfBounds(int iparam)
Is index out of valid range?
Definition: PedeResult.h:64
bool isParameterFixed(unsigned int parameterIndex)
Is parameter at given index fixed?
Definition: PedeResult.cc:151
unsigned int getParameterLabel(unsigned int parameterIndex)
Get label of parameter at index.
Definition: PedeResult.cc:131
double getParameterPresigma(unsigned int parameterIndex)
Get presigma of parameter at index.
Definition: PedeResult.cc:146
std::vector< double > eigenNumbers
Vector of loaded eigennumbers.
Definition: PedeResult.h:103
double getParameterError(unsigned int parameterIndex)
Get correction error of parameter at index.
Definition: PedeResult.cc:141
double getEigenVectorElement(unsigned int eigenPairIndex, unsigned int parameterIndex)
Get eigenvector at given index.
Definition: PedeResult.cc:166
std::vector< parameterData > data
Vector with all the parameter data.
Definition: PedeResult.h:101
void dump()
Dump the content to std::cout.
Definition: PedeResult.cc:176
bool isValid()
Was the object initialized properly from a result file?
Definition: PedeResult.h:34
Abstract base class for different kinds of events.
Struct to hold data for a parameter.
Definition: PedeResult.h:68
parameterData(int index_, int label_, double correction_, double error_, double presigma_)
Constructor from parameter data.
Definition: PedeResult.h:77
std::vector< double > eigenweights
Weights of this param in eigenvectors.
Definition: PedeResult.h:97