Skip to content

Commit

Permalink
Merge pull request #1466 from VinzenzBildstein/main
Browse files Browse the repository at this point in the history
Bug fixes from S2388
  • Loading branch information
VinzenzBildstein authored Oct 19, 2024
2 parents 784d5ad + 564551b commit 4e97bb8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
5 changes: 3 additions & 2 deletions include/TSingleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ class TSingleton : public TObject { // NOLINT(cppcoreguidelines-virtual-class-
fDir = gDirectory; // in either case (read from file or created new), gDirectory is the current directory
break; // we will find the newest key first, so we want to break here and not try and read other instaces of the same class
}
}
} else if(verbose) { std::cout << "Not reading " << T::Class()->GetName() << " from file!" << std::endl; }
if(fSingleton == nullptr) {
fSingleton = new T;
fDir = gDirectory; // in either case (read from file or created new), gDirectory is the current directory
if(verbose) { std::cout << "Created new singleton of class " << T::Class()->GetName() << std::endl; }
}
}
} else if(verbose) { std::cout << "Re-using old singleton of class " << T::Class()->GetName() << std::endl; }
return fSingleton;
}

Expand Down
4 changes: 2 additions & 2 deletions libraries/TFormat/TGRSIFrame.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ TGRSIFrame::TGRSIFrame()
fPpg = new TPPG;

// loop over input files, add them to the chain, and read the runinfo and calibration from them
bool first = true;
bool first = true;
for(const auto& fileName : fOptions->RootInputFiles()) {
if(chain->Add(fileName.c_str(), 0) >= 1) { // setting nentries parameter to zero make TChain load the file header and return a 1 if the file was opened successfully
TFile* file = TFile::Open(fileName.c_str());
if(first) {
first = false;
TRunInfo::Get();
TRunInfo::ReadInfoFromFile(file);
} else {
TRunInfo::AddCurrent();
}
Expand Down
16 changes: 8 additions & 8 deletions libraries/TFormat/TRunInfo.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -556,14 +556,14 @@ std::string TRunInfo::ListOfMissingRuns(bool all) const
return {"none"};
}

// unless the "all" flag is set, we limit ourself to printing 140 characters (should be 20 runs?)
std::cout << " current string length is " << result.str().length() << " and all is set to " << (all?"true":"false") << std::endl;
if(!all && result.str().length() > 140) {
result.str(result.str().substr(0, 140));
result.seekp(0, std::ios_base::end);
result << " ... and more";
std::cout << " limited string length is " << result.str().length() << std::endl;
}
// unless the "all" flag is set, we limit ourself to printing 140 characters (should be 20 runs?)
std::cout << " current string length is " << result.str().length() << " and all is set to " << (all ? "true" : "false") << std::endl;
if(!all && result.str().length() > 140) {
result.str(result.str().substr(0, 140));
result.seekp(0, std::ios_base::end);
result << " ... and more";
std::cout << " limited string length is " << result.str().length() << std::endl;
}
return result.str();
}

Expand Down
2 changes: 1 addition & 1 deletion util/WriteCalToRoot.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main(int argc, char** argv)
std::transform(option.begin(), option.end(), option.begin(), ::tolower);
if(option == "update") {
update = true;
} else if(option == "replace") {
} else if(option != "replace") {
std::cout << R"(Wrong option ")" << option << R"(", should be either "update" or "replace")" << std::endl;
return 1;
}
Expand Down

0 comments on commit 4e97bb8

Please sign in to comment.