Fix: data file options; Feat: output file path
This commit is contained in:
parent
0684422d0f
commit
fc40af7463
@ -143,7 +143,7 @@ public:
|
||||
void readTreeData(vector<string> files);
|
||||
void FillHistograms();
|
||||
void postOperations();
|
||||
void saveHistograms();
|
||||
void saveHistograms(TString);
|
||||
void drawHistograms();
|
||||
|
||||
private:
|
||||
|
25
main.cc
25
main.cc
@ -4,6 +4,7 @@
|
||||
|
||||
#include "iostream"
|
||||
|
||||
using namespace clipp;
|
||||
using namespace std;
|
||||
|
||||
const string datapath = "/home/liuyihui/BluetAnalyzer/data";
|
||||
@ -11,18 +12,26 @@ const string datapath = "/home/liuyihui/BluetAnalyzer/data";
|
||||
int main(int argc, char **argv) {
|
||||
string cfgfile;
|
||||
string datafile;
|
||||
string outputfile = "bluetAnalyzer.root";
|
||||
vector<string> ranges;
|
||||
vector<string> runfiles;
|
||||
Long_t rl, rr;
|
||||
|
||||
auto cfg = clipp::value("config file", cfgfile);
|
||||
auto data =
|
||||
(clipp::option("-f", "--file") & clipp::value("data file", datafile),
|
||||
clipp::option("-r", "--range") &
|
||||
clipp::values("number1 number2", ranges));
|
||||
auto cfg = value("config file", cfgfile);
|
||||
auto data = (((required("-f", "--file").doc("data file path") &
|
||||
value("data file", datafile)) |
|
||||
(required("-r", "--range").doc("data file number range") &
|
||||
values("number1 number2", ranges))),
|
||||
option("-o", "--output")
|
||||
.doc("output file path, default: bluetAnalyzer.root") &
|
||||
value("output file", outputfile));
|
||||
|
||||
if (!clipp::parse(argc, const_cast<char **>(argv), cfg & data)) {
|
||||
cerr << clipp::make_man_page(cfg & data, argv[0]) << endl;
|
||||
auto fmt = doc_formatting{}.first_column(4);
|
||||
if (!parse(argc, const_cast<char **>(argv), cfg & data)) {
|
||||
cerr << make_man_page(cfg & data, "BluetAnalyzer", fmt)
|
||||
.prepend_section("DESCRIPTION",
|
||||
" Program for MTPC Data Analysis.")
|
||||
<< endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -50,7 +59,7 @@ int main(int argc, char **argv) {
|
||||
bluet->readTreeData(runfiles);
|
||||
bluet->FillHistograms();
|
||||
bluet->postOperations();
|
||||
bluet->saveHistograms();
|
||||
bluet->saveHistograms(outputfile);
|
||||
bluet->drawHistograms();
|
||||
|
||||
return 0;
|
||||
|
@ -996,8 +996,8 @@ void BluetAnalyzer::drawPadFeatures() {
|
||||
// c0->Update();
|
||||
// }
|
||||
|
||||
void BluetAnalyzer::saveHistograms() {
|
||||
TFile *fout = new TFile("bluetAnalyzer.root", "RECREATE");
|
||||
void BluetAnalyzer::saveHistograms(TString filename) {
|
||||
TFile *fout = new TFile(filename, "RECREATE");
|
||||
fout->cd();
|
||||
hprofile->Write();
|
||||
hslicex->Write();
|
||||
|
Loading…
Reference in New Issue
Block a user