10 #include "TGraph2DErrors.h"
33 int main(
int argc,
char **argv)
43 JParser<> zap(
"Auxiliary program to create TGraph2D from input file with ASCII data.");
51 catch(
const exception &error) {
52 FATAL(error.what() << endl);
64 ifstream
in(file_name->c_str());
66 while (
in.peek() ==
'#') {
67 in.ignore(numeric_limits<streamsize>::max(),
'\n');
70 Double_t x, y, z, ex, ey, ez;
79 for (
string buffer;
getline(
in,buffer); ) {
81 istringstream
is(buffer);
83 if (is >> x) X .push_back(x);
84 if (is >> y) Y .push_back(y);
85 if (is >> z) Z .push_back(z);
86 if (is >> ex) EX.push_back(ex);
87 if (is >> ey) EY.push_back(ey);
88 if (is >> ez) EZ.push_back(ez);
91 if (X.size() != Y.size() || X.size() != Z.size()) {
92 FATAL(
"Number of points " << X.size() <<
' ' << Y.size() <<
' ' << Z.size() << endl);
95 TGraph2D* graph = NULL;
99 graph =
new TGraph2D(X.size(), X.data(), Y.data(), Z.data());
103 if (X.size() != EX.size()) {
104 FATAL(
"Number of x points " << X.size() <<
' ' << EX.size() << endl);
109 EX.resize(X.size(), 0.0);
110 EY.resize(Y.size(), 0.0);
113 if (Y.size() != EY.size()) {
114 FATAL(
"Number of y points " << Y.size() <<
' ' << EY.size() << endl);
117 if (Z.size() != EZ.size()) {
118 FATAL(
"Number of z points " << Z.size() <<
' ' << EZ.size() << endl);
121 graph =
new TGraph2DErrors(X.size(), X.data(), Y.data(), Z.data(), EX.data(), EY.data(), EZ.data());
126 graph->SetName(title.c_str());
130 DEBUG(
"TGraph " << graph->GetName() << endl);
Utility class to parse command line options.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
void setLimits(TGraph &g1)
Set limits of TGraph.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
General purpose messaging.
Utility class to parse command line options.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])