7 #include "TObjString.h"
28 TIter iter(dir->GetListOfKeys());
30 for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
34 dir->cd(key->GetName());
35 TDirectory *subdir = gDirectory;
40 const TString fullPath(dir->GetPath());
41 TObjArray* t = fullPath.Tokenize(
":");
42 v.push_back(TString(((TObjString *)(t->At(1)))->String() +
"/" + (TString)key->GetName()));
63 int main(
int argc,
char** argv) {
74 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");
75 zap[
's'] =
make_field(steeringFile ,
"ASCII steering file with list of histograms and tests");
78 zap[
'o'] =
make_field(output ,
"output file root") =
"zebramantis.root";
79 zap[
't'] =
make_field(ascii ,
"output file txt" ) =
"zebramantis.txt";
80 zap[
'w'] =
make_field(onlyFailures ,
"write only failed tests" );
83 catch(
const exception &error) {
84 ERROR(error.what() << endl);
87 TFile* f1 = TFile::Open(file1.c_str());
88 TFile* f2 = TFile::Open(file2.c_str());
90 TFile out(output.c_str(),
"recreate");
99 std::ifstream infile(steeringFile);
113 while (
getline(infile, line)) {
114 while (line.length()==0)
117 istringstream iss(line);
118 iss >> name >> testID;
120 const TRegexp regexp(name);
122 if (((*key).Index(regexp) != -1) && (f2->Get(*key))) {
127 d[testID]->read(iss);
128 d[testID]->test(obj1,obj2);
131 (
r->passed ? npassed++ : nfailed++);
135 string path =
MAKE_STRING(Key.substr (Key.find (
'/') + 1 , Key.rfind (
'/')));
137 d[testID]->write(cout);
138 d[testID]->write(results,
";", onlyFailures);
139 d[testID]->save (&out, path, onlyFailures);
144 infile.seekg(0, ios::beg);
147 results <<
WHITE <<
"PASSED: " << npassed <<
" " <<
" FAILED: " << nfailed <<
" FAILURE FRACTION: " << float (nfailed)/(nfailed+npassed) << endl;
Utility class to parse command line options.
#define MAKE_STRING(A)
Make string.
do cat driver txt<< EOFevent ev_configure{RC_EVT%< ev_configure.txt > RC_DWRT path
#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.
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Utility class to parse command line options.
void readDir(TDirectory *dir, vector< TString > &v)
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.
int main(int argc, char *argv[])