Belle II Software development
PedeApplication Class Reference

Class interfacing Millepede solver (Pede) More...

#include <PedeApplication.h>

Public Member Functions

 PedeApplication ()
 Constructor.
 
bool run (PedeSteering &steering)
 Run Pede with given steering.
 
PedeResult calibrate (PedeSteering &steering)
 Run Pede and return full result with parameter corrections.
 
bool success ()
 Was Pede successfull (can the result be used)?
 
int warnings () const
 Level of warnings converted to int.
 
bool aborted () const
 True if Pede was aborted (parameters not calculated)
 
int getExitCode () const
 Returns the Pede exit code (from millepede.end file)
 
std::string getExitMessage () const
 Returns the Pede exit message (from millepede.end file)
 
void readEndFile (std::string filename="millepede.end")
 Reads the millepede.end file and sets this object retrieved state.
 
int revision ()
 Return Pede revision number.
 

Private Attributes

int exitCode
 Pede exit code.
 
std::string exitMessage
 Pede exit message.
 

Detailed Description

Class interfacing Millepede solver (Pede)

Definition at line 23 of file PedeApplication.h.

Constructor & Destructor Documentation

◆ PedeApplication()

PedeApplication ( )
inline

Constructor.

Definition at line 26 of file PedeApplication.h.

26: exitCode(-1), exitMessage("") {}
std::string exitMessage
Pede exit message.

Member Function Documentation

◆ aborted()

bool aborted ( ) const
inline

True if Pede was aborted (parameters not calculated)

Definition at line 38 of file PedeApplication.h.

38{return exitCode >= 10 || exitCode == -1;}

◆ calibrate()

PedeResult calibrate ( PedeSteering steering)

Run Pede and return full result with parameter corrections.

Parameters
steeringPede steering object with commands

Definition at line 51 of file PedeApplication.cc.

52 {
53 PedeResult result;
54 if (run(steering)) {
55 result.read("millepede.res");
56 result.readEigenFile("millepede.eve");
57 }
58 return result;
59 }
bool run(PedeSteering &steering)
Run Pede with given steering.

◆ getExitCode()

int getExitCode ( ) const
inline

Returns the Pede exit code (from millepede.end file)

Definition at line 40 of file PedeApplication.h.

40{return exitCode;}

◆ getExitMessage()

std::string getExitMessage ( ) const
inline

Returns the Pede exit message (from millepede.end file)

Definition at line 42 of file PedeApplication.h.

42{return exitMessage;}

◆ readEndFile()

void readEndFile ( std::string  filename = "millepede.end")

Reads the millepede.end file and sets this object retrieved state.

Definition at line 43 of file PedeApplication.cc.

44 {
45 stringstream ss;
46 ifstream result(filename);
47 result >> exitCode;
48 ss << result.rdbuf();
49 exitMessage = ss.str();
50 }

◆ revision()

int revision ( )

Return Pede revision number.

Definition at line 25 of file PedeApplication.cc.

26 {
27 int ver(-1);
28 string tmpfile("pede_test.tmp.txt");
29
30 string cmd("pede > " + tmpfile);
31 system(cmd.c_str());
32
33 ifstream file(tmpfile);
34 string line; string verText;
35
36 getline(file, line);
37 stringstream ss(line);
38 ss >> verText >> ver;
39
40 remove(tmpfile.c_str());
41 return ver;
42 }

◆ run()

bool run ( PedeSteering steering)

Run Pede with given steering.

Parameters
steeringPede steering object with commands

Definition at line 60 of file PedeApplication.cc.

61 {
62 string cmd("export OMP_THREAD_LIMIT=1000 && pede " + steering.make());
63 int retval = system(cmd.c_str());
64 if (retval != 0)
65 return false;
67 return !aborted();
68 }
void readEndFile(std::string filename="millepede.end")
Reads the millepede.end file and sets this object retrieved state.
bool aborted() const
True if Pede was aborted (parameters not calculated)

◆ success()

bool success ( )
inline

Was Pede successfull (can the result be used)?

Definition at line 34 of file PedeApplication.h.

34{return warnings() <= 1;}
int warnings() const
Level of warnings converted to int.

◆ warnings()

int warnings ( ) const

Level of warnings converted to int.

Definition at line 70 of file PedeApplication.cc.

71 {
72 switch (exitCode) {
73 // No warnings
74 case 0:
75 return 0;
76 // Mild warnings (result can be used)
77 case 1:
78 return 1;
79 // Severe warnings (result should not be used - add more data)
80 case 2:
81 return 2;
82 // Extreme warnings (result must not be used - problem not well defined)
83 case 3:
84 return 3;
85 // crashed or aborted:
86 default:
87 return 101;
88 }
89 }

Member Data Documentation

◆ exitCode

int exitCode
private

Pede exit code.

Definition at line 50 of file PedeApplication.h.

◆ exitMessage

std::string exitMessage
private

Pede exit message.

Definition at line 52 of file PedeApplication.h.


The documentation for this class was generated from the following files: