9#include <alignment/PedeResult.h>
41 ifstream file(filename);
46 int eigenPairIndex = -1;
48 for (
auto& pData :
data) {
49 pData.eigenweights.clear();
50 pData.eigenweights.reserve(20);
53 while (getline(file, line)) {
57 string tmp1, tmp2, tmp3;
60 ss >> tmp1 >> eigenPairNumber >> tmp2 >> tmp3 >> eigenvalue;
61 cout << tmp1 <<
" " << tmp2 <<
" " << tmp3 <<
" " << eigenPairNumber <<
" " << eigenvalue << endl;
62 if (tmp1 ==
"Eigenvector")
68 vector<pair<int, double>> elements;
69 while (getline(file, line) && line.length() > 2) {
76 triplet >> lab1 >> w1 >> lab2 >> w2 >> lab3 >> w3;
77 if (lab1) elements.push_back({lab1, w1});
78 if (lab2) elements.push_back({lab2, w2});
79 if (lab3) elements.push_back({lab3, w3});
82 for (
auto& pData :
data) {
83 pData.eigenweights.push_back(0.);
85 for (
auto el : elements) {
88 data[index].eigenweights[eigenPairIndex] = el.second;
98 ifstream res(filename);
107 while (getline(res, line)) {
111 double presigma = 0.;
116 ss >> label >> param >> presigma >> differ >> error;
134 return data[parameterIndex].label;
139 return data[parameterIndex].correction;
144 return data[parameterIndex].error;
149 return data[parameterIndex].presigma;
154 return data[parameterIndex].presigma < 0;
159 return !
isParameterFixed(parameterIndex) &&
data[parameterIndex].correction != 0. &&
data[parameterIndex].error != 0.;
171 if (eigenPairIndex >= element.eigenweights.size())
174 return data[parameterIndex].eigenweights[eigenPairIndex];
178 for (
auto pdata :
data) {
179 std::cout << pdata.index <<
" : " << pdata.label <<
" corr: " << pdata.correction <<
" err: " << pdata.error <<
" presigma: " <<
180 pdata.presigma << endl;
void readEigenFile(std::string filename="millepede.eve")
Reads file with eigen-vector/numbers.
bool valid
Flag to check if data wa loaded.
double getParameterCorrection(unsigned int parameterIndex)
Get determined correction of parameter at index.
bool isParameterDetermined(unsigned int parameterIndex)
Is parameter at given index determined?
int noDeterminedParams
Number of parameters actually determined.
PedeResult()
Default constructor, use read(...) to init the object.
double getEigenNumber(unsigned int eigenPairIndex)
Get eigennumber at given index.
int getParameterIndex(int parameterLabel)
Get index of parameter with given label.
void read(std::string filename="millepede.res")
Reads the result file and inits the object.
std::map< int, int > labelIndices
Map to link parameter labels and their indices in result.
bool outOfBounds(int iparam)
Is index out of valid range?
bool isParameterFixed(unsigned int parameterIndex)
Is parameter at given index fixed?
unsigned int getParameterLabel(unsigned int parameterIndex)
Get label of parameter at index.
double getParameterPresigma(unsigned int parameterIndex)
Get presigma of parameter at index.
std::vector< double > eigenNumbers
Vector of loaded eigennumbers.
double getParameterError(unsigned int parameterIndex)
Get correction error of parameter at index.
double getEigenVectorElement(unsigned int eigenPairIndex, unsigned int parameterIndex)
Get eigenvector at given index.
std::vector< parameterData > data
Vector with all the parameter data.
void dump()
Dump the content to std::cout.
Abstract base class for different kinds of events.
Struct to hold data for a parameter.