7 #include "TObjString.h"
33 TIter iter(dir->GetListOfKeys());
35 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
39 dir->cd(key->GetName());
41 TDirectory *subdir = gDirectory;
50 buffer.push_back(objectID);
73 int main(
int argc,
char** argv) {
96 const string& keysExplainer =
MAKE_STRING(
"Terminal output:" << endl << listOfKeys);
98 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");
100 zap[
's'] =
make_field(steeringFile ,
"ASCII steering file with list of histograms and tests");
101 zap[
'a'] =
make_field(file1 ,
"input file 1");
102 zap[
'b'] =
make_field(file2 ,
"input file 2");
103 zap[
'o'] =
make_field(output ,
"output file root") =
"zebramantis.root";
104 zap[
't'] =
make_field(ascii ,
"output file txt" ) =
"zebramantis.txt";
106 zap[
'w'] =
make_field(onlyFailures ,
"write only failed tests" );
111 catch(
const exception &error) {
112 ERROR(error.what() << endl);
119 TFile* f1 = TFile::Open(file1.c_str());
120 TFile* f2 = TFile::Open(file2.c_str());
122 TFile out(output.c_str(),
"recreate");
125 results.open (ascii);
126 results <<
"# " << listOfKeys << endl;
131 std::ifstream infile(steeringFile);
138 for (
string line;
getline(infile, line); ) {
140 istringstream iss(line);
145 if (!(iss >> name >> testID)) {
149 const TRegexp regexp(name);
153 const TString& objectDir = objectID->getDirectory();
154 const TString& objectName = objectID->getFullObjectName();
156 if ((objectName.Index(regexp) != -1) && (f2->Get(objectName))) {
161 d[testID]->read(iss);
162 d[testID]->test(obj1,obj2);
164 if (out.GetDirectory(objectDir)==0) {
165 out.mkdir(objectDir);
172 if (onlyFailures &&
r->passed) {
176 print(cout, *
r, keys.cbegin(), keys.cend(),
' ',
false);
177 print(results, *
r, listOfKeys.cbegin(), listOfKeys.cend(),
' ',
true);
182 const size_t Npass = count_if(
d[testID]->results.cbegin(),
d[testID]->results.cend(),
186 nfailed += (
d[testID]->results.size() - Npass);
195 results <<
WHITE <<
"# PASSED: " << npassed <<
" " <<
" FAILED: " << nfailed <<
" FAILURE FRACTION: " << float (nfailed)/(nfailed+npassed) << endl;
Utility class to parse command line options.
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
int main(int argc, char *argv[])
JProperties & getProperties(T &object, const JEquationParameters ¶meters=JEquationParameters(), const int debug=1)
Get properties of a given object.
then echo Enter input within $TIMEOUT_S seconds echo n User name
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class to handle file name, ROOT directory and object name.
#define MAKE_STRING(A)
Make string.
#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.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Utility class to parse command line options.
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.
void readDir(TDirectory *dir, std::vector< TString > &v)