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