105 const string& keysExplainer =
MAKE_STRING(
"Terminal output:" << endl << listOfKeys);
107 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");
109 zap[
's'] =
make_field(steeringFile ,
"ASCII steering file with list of histograms and tests");
110 zap[
'a'] =
make_field(file1 ,
"input file 1");
111 zap[
'b'] =
make_field(file2 ,
"input file 2");
112 zap[
'o'] =
make_field(output ,
"output file root") =
"zebramantis.root";
113 zap[
't'] =
make_field(ascii ,
"output file txt" ) =
"zebramantis.txt";
115 zap[
'w'] =
make_field(onlyFailures ,
"write only failed tests" );
120 catch(
const exception &error) {
121 ERROR(error.what() << endl);
128 TFile*
f1 = TFile::Open(file1.c_str());
129 TFile* f2 = TFile::Open(file2.c_str());
131 TFile out(output.c_str(),
"recreate");
134 results.open (ascii);
135 results <<
"# " << listOfKeys << endl;
139 std::ifstream infile(steeringFile);
146 for (
string line;
getline(infile, line); ) {
148 istringstream iss(line);
153 if (!(iss >> name >> testID)) {
157 DEBUG(
"Input: " << name <<
' ' << testID << endl);
159 const TRegexp regexp(name);
163 const TString& dirName = objectID->getDirectory();
164 const TString& fullName = objectID->getFullObjectName();
166 DEBUG(
"Key: " << fullName <<
" match = " << fullName.Contains(regexp) << endl);
168 if ((fullName.Index(regexp) != -1)) {
173 if (!obj1 || !obj2) {
174 DEBUG(
"Could not retrieve " << fullName << endl);
178 d[testID]->read(iss);
179 d[testID]->test(obj1,obj2);
181 if (dirName.Length() > 0 && !out.GetDirectory(dirName)) {
184 out.mkdir(TString(dirName(1, dirName.Length() - 1)));
194 if (onlyFailures &&
r->passed) {
198 print(cout, *
r, keys.cbegin(), keys.cend(),
' ',
false);
199 print(results, *
r, listOfKeys.cbegin(), listOfKeys.cend(),
' ',
true);
204 const size_t Npass = count_if(d[testID]->cbegin(), d[testID]->cend(),
208 nfailed += (d[testID]->size() - Npass);
217 results <<
WHITE <<
"# PASSED: " << npassed <<
" " <<
" FAILED: " << nfailed <<
" FAILURE FRACTION: " << float (nfailed)/(nfailed+npassed) << endl;
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void readDir(TDirectory *dir, std::vector< TString > &v)
#define MAKE_STRING(A)
Make string.
Dictionary to map different tests to unique integer indices.
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
static const char PATHNAME_SEPARATOR
path name separator
Utility class to parse command line options.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
JProperties & getProperties(T &object, const JEquationParameters ¶meters=JEquationParameters(), const int debug=1)
Get properties of a given object.
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
Auxiliary data structure for return type of make methods.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...