-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add another script executable, add program options (#943)
This PR partly harmonizes the Executables in the Script/TrackingPerformance folder. Currently one can run: ActsExampleResidualAndPulls ActsExamplePerigeeParameters both steered by program options, the efficiency & fake-rate executable with also follow in a separate PR. The naming of the plots is slightly refined and a quite option to produce plots from shell scripts (e.g. automatically from test runs in the CI is added).
- Loading branch information
1 parent
c020c92
commit 60c824c
Showing
6 changed files
with
590 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
add_executable(ActsExampleResidualsAndPulls ResidualsAndPulls.cpp) | ||
target_link_libraries(ActsExampleResidualsAndPulls ROOT::Core ROOT::Hist ROOT::Tree ROOT::TreePlayer) | ||
target_link_libraries(ActsExampleResidualsAndPulls ROOT::Core ROOT::Hist ROOT::Tree ROOT::TreePlayer Boost::program_options) | ||
|
||
install( | ||
TARGETS | ||
ActsExampleResidualsAndPulls | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
|
||
|
||
add_executable(ActsExamplePerigeeParameters PerigeeParameters.cpp) | ||
target_link_libraries(ActsExamplePerigeeParameters ROOT::Core ROOT::Hist ROOT::Tree ROOT::TreePlayer Boost::program_options) | ||
|
||
install( | ||
TARGETS | ||
ActsExamplePerigeeParameters | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
Examples/Scripts/TrackingPerformance/PerigeeParameters.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2021 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#include <exception> | ||
#include <iostream> | ||
#include <string> | ||
|
||
#include <TApplication.h> | ||
#include <boost/program_options.hpp> | ||
|
||
#include "perigeeParamResolution.C" | ||
|
||
using namespace boost::program_options; | ||
|
||
int main(int argc, char** argv) { | ||
std::cout << "*** ACTS Perigee parameter plotting" << std::endl; | ||
|
||
try { | ||
options_description description("*** Usage:"); | ||
|
||
// Add the program options | ||
auto ao = description.add_options(); | ||
ao("help,h", "Display this help message"); | ||
ao("silent,s", bool_switch(), "Silent mode (without X-window/display)."); | ||
ao("input,i", value<std::string>()->default_value(""), | ||
"Input ROOT file containing the input TTree."); | ||
ao("fit", bool_switch(), "Fit the smoothed parameters."); | ||
ao("save", value<std::string>()->default_value("png"), | ||
"Output save format (to be interpreted by ROOT)."); | ||
|
||
// Set up the variables map | ||
variables_map vm; | ||
store(command_line_parser(argc, argv).options(description).run(), vm); | ||
notify(vm); | ||
|
||
if (vm.count("help")) { | ||
std::cout << description; | ||
} | ||
|
||
// Parse the parameters | ||
auto iFile = vm["input"].as<std::string>(); | ||
auto saveAs = vm["save"].as<std::string>(); | ||
|
||
TApplication* tApp = vm["silent"].as<bool>() | ||
? nullptr | ||
: new TApplication("ResidualAndPulls", 0, 0); | ||
|
||
// Run the actual resolution estimation | ||
switch (perigeeParamResolution(iFile, vm["fit"].as<bool>())) { | ||
case -1: { | ||
std::cout << "*** Input file could not be opened, check name/path." | ||
<< std::endl; | ||
} break; | ||
default: { | ||
std::cout << "*** Successful run." << std::endl; | ||
}; | ||
} | ||
|
||
if (tApp != nullptr) { | ||
tApp->Run(); | ||
} | ||
|
||
} catch (std::exception& e) { | ||
std::cerr << e.what() << "\n"; | ||
} | ||
|
||
std::cout << "*** Done." << std::endl; | ||
return 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.