83int main(
int argc,
char** argv) {
106 const string keysExplainer =
MAKE_STRING(
"Terminal output:" << endl << listOfKeys);
108 JParser<> zap(
"\nProgram to compare histograms in root files that have the same directory structure. See the link below this usage for further details.\n");
110 zap[
's'] =
make_field(steeringFile ,
"ASCII steering file with list of histograms and tests");
111 zap[
'a'] =
make_field(file1 ,
"input file 1");
112 zap[
'b'] =
make_field(file2 ,
"input file 2");
113 zap[
'o'] =
make_field(output ,
"output file root") =
"zebramantis.root";
114 zap[
't'] =
make_field(ascii ,
"output file txt" ) =
"zebramantis.txt";
116 zap[
'w'] =
make_field(onlyFailures ,
"write only failed tests" );
121 catch(
const exception &error) {
122 ERROR(error.what() << endl);
129 TFile* f1 = TFile::Open(file1.c_str());
130 TFile* f2 = TFile::Open(file2.c_str());
132 TFile out(output.c_str(),
"recreate");
135 results.open (ascii);
136 results <<
"# " << listOfKeys << endl;
140 std::ifstream infile(steeringFile);
147 for (
string line; getline(infile, line); ) {
149 istringstream iss(line);
154 if (!(iss >> name >> testID)) {
158 DEBUG(
"Input: " << name <<
' ' << testID << endl);
160 const TRegexp regexp(name);
162 for (vector<JRootObjectID>::const_iterator objectID = objectIDs.cbegin() ; objectID != objectIDs.cend() ; ++objectID) {
164 const TString& dirName = objectID->getDirectory();
165 const TString& fullName = objectID->getFullObjectName();
167 DEBUG(
"Key: " << fullName <<
" match = " << fullName.Contains(regexp) << endl);
169 if ((fullName.Index(regexp) != -1)) {
174 if (!obj1 || !obj2) {
175 DEBUG(
"Could not retrieve " << fullName << endl);
179 d[testID]->read(iss);
180 d[testID]->test(obj1,obj2);
182 if (dirName.Length() > 0 && !out.GetDirectory(dirName)) {
184 if (dirName[0] == JRootObjectID::PATHNAME_SEPARATOR) {
185 out.mkdir(TString(dirName(1, dirName.Length() - 1)));
195 if (onlyFailures && r->passed) {
199 print(cout, *r, keys.cbegin(), keys.cend(),
false);
200 print(results, *r, listOfKeys.cbegin(), listOfKeys.cend(),
true);
205 const size_t Npass = count_if(d[testID]->cbegin(), d[testID]->cend(),
206 make_predicate(&JTestResult::passed,
true));
209 nfailed += (d[testID]->size() - Npass);
218 results << WHITE <<
"# PASSED: " << npassed <<
" " <<
" FAILED: " << nfailed <<
" FAILURE FRACTION: " << float (nfailed)/(nfailed+npassed) << endl;
220 putObject(&out,
JMeta(argc, argv));
221 JMeta::copy(file1.c_str(), out);
222 JMeta::copy(file2.c_str(), out);