Commit a4ed697f authored by Chad Lantz's avatar Chad Lantz
Browse files

Added verbosity flag for event and resource usage

parent a8c2ea4c
......@@ -22,7 +22,7 @@ namespace {
void PrintUsage() {
std::cout << " Usage: AnalysisExample2021 [-d /path/to/input/files/ ] [-f /list/of.root /files/here.root]" << std::endl
<< " [-o /output/directory/] [-c /config/file.xml] [-a /alignment/file.xml]" << std::endl
<< " [-t /timing/file.txt] [-n #events] [--help]" << std::endl;
<< " [-t /timing/file.txt] [-n #events] [-v (verbose)] [--help]" << std::endl;
}
}
......@@ -37,6 +37,7 @@ void PrintHelp(){
std::cout << " c Configuration file to be used" << std::endl;
std::cout << " a Alignment file to be used" << std::endl;
std::cout << " t Timing file to be used" << std::endl;
std::cout << " v Verbose. Currently prints event#, CPU/RAM usage if flag is used. Takes no argument" << std::endl;
}
......@@ -79,6 +80,7 @@ int main(int argc, char *argv[]){
std::string config_file = "";
std::string alignment_file = "";
std::string timing_file = (std::string)std::getenv("JZCaPA") + "/Utils/Timing_data/2021_PreliminaryTiming.txt";
int verbosity = 0;
std::vector<std::string> root_files;
......@@ -99,6 +101,7 @@ int main(int argc, char *argv[]){
else if(TString(argv[i]) == "-c") config_file = argv[i+1];
else if(TString(argv[i]) == "-a") alignment_file = argv[i+1];
else if(TString(argv[i]) == "-t") timing_file = argv[i+1];
else if(TString(argv[i]) == "-v") verbosity = 1;
else if(TString(argv[i]) == "--help") PrintHelp();
else{
PrintUsage();
......@@ -160,11 +163,13 @@ int main(int argc, char *argv[]){
std::cout << "~=~=~=~=~=~ Run Start" << std::endl;
r->EnablePlotLabel();
if( maxEvents != 0 )r->SetMaxEvents( maxEvents );
EventTimer timer(1000, r, kFALSE);
timer.TurnOn();
if(verbosity > 0) timer.TurnOn();
std::cout << "~=~=~=~=~=~ Run Start" << std::endl;
r->Run();
timer.TurnOff();
if(verbosity > 0) timer.TurnOff();
std::cout << std::endl << "~=~=~=~=~=~ Run Stop" << std::endl;
delete r;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment