#include #include #include #include #include "TROOT.h" #include "TFile.h" #include "TH1D.h" #include "JAAnet/JAAnetToolkit.hh" #include "JAAnet/JPDB.hh" #include "Jeep/JeepToolkit.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to print JDomino.cc statistics. * \author mdejong */ int main(int argc, char **argv) { using namespace std; vector inputFile; bool combine; int debug; try { JParser<> zap("Auxiliary program to print JDomino statistics."); zap['f'] = make_field(inputFile); zap['c'] = make_field(combine); zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } using namespace JPP; vector buffer; for (vector::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) { TFile* in = TFile::Open(file_name->c_str(), "exist"); if (in == NULL || !in->IsOpen()) { FATAL("File: " << *file_name << " not opened." << endl); } TH1D* job = dynamic_cast(in->Get("job")); if (job == NULL) { FATAL("No job statistics."); } buffer.push_back(job); } if (!buffer.empty()) { const int WIDTH = 32; DEBUG(setw(6) << ' ' << ' ' << FILL(WIDTH, ' ')); for (vector::const_iterator file_name = inputFile.begin(); file_name != inputFile.end(); ++file_name) { DEBUG(' ' << setw(12) << getFilename(*file_name)); } DEBUG(endl); TH1D* h0 = buffer[0]; for (int i0 = 1; i0 <= h0->GetNbinsX(); ++i0) { const Double_t x = h0->GetBinCenter(i0); const int type = (int) x; const Int_t i1 = h0->FindBin(-x); if (combine) { if (type > 0) { break; } } double W = 0.0; for (vector::iterator h1 = buffer.begin(); h1 != buffer.end(); ++h1) { W += (combine ? (*h1)->GetBinContent(i0) + (*h1)->GetBinContent(i1) : (*h1)->GetBinContent(i0)); } if (W > 0.0 || JPDB::getInstance().hasPDG(combine ? abs(type) : type)) { NOTICE(setw(6) << right << (combine ? abs(type) : type)); try { JParticle particle = JPDB::getInstance().getPDG(combine ? abs(type) : type); NOTICE(' ' << setw(WIDTH) << left << particle.name); } catch(const exception& error) { NOTICE(' ' << setw(WIDTH) << left << "unknown"); } for (vector::iterator h1 = buffer.begin(); h1 != buffer.end(); ++h1) { NOTICE(noshowpos << ' ' << FIXED(12,6) << (combine ? (*h1)->GetBinContent(i0) + (*h1)->GetBinContent(i1) : (*h1)->GetBinContent(i0))); } NOTICE(endl); } } } }