Wile is right about the includes.
I’d like to add:
void analyze(void)
is C style, in C++ void analyze()
is sufficient / identical.
Some more comments:
ifstream inFile;
inFile.open("slight.out");
cout << "slight.out open" << endl;
You aren’t checking the result - but you are printing that the file is open. So why not:
auto inFileName = "slight.out";
ifstream inFile(inFileName);
if (inFile.is_open()) {
cout << inFileName << " opened\n";
} else {
cout << "couldn't open " << inFileName << "\n";
// insert code to handle error
}
And a real bug: you are using assert with side effects!
Assert is for asserting internal program logic only, not for checking some input results! Asserts can be removed from code completely in release builds. Try assert(0)
in a interactive ROOT6 command line - it does nothing.
So do NOT write assert(lineStream >> label);
!
instead call some other (own) function taking a boolean.