#include #include #include #include #include "TROOT.h" #include "TFile.h" #include "TH1D.h" #include "TError.h" #include "JPhysics/JPDFTypes.hh" #include "Jeep/JPrint.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Auxiliary program to print JSirene.cc job statistics. * \author mdejong */ int main(int argc, char **argv) { using namespace std; string inputFile; int debug; try { JParser<> zap("Auxiliary program to print JSirene job statistics."); zap['f'] = make_field(inputFile); zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } gErrorIgnoreLevel = kError; TFile* in = TFile::Open(inputFile.c_str(), "exist"); if (in == NULL || !in->IsOpen()) { FATAL("File: " << inputFile << " not opened." << endl); } TH1D* job = dynamic_cast(in->Get("job")); if (job == NULL) { FATAL("No job statistics."); } using namespace JPP; const int hit_types[] = { DIRECT_LIGHT_FROM_MUON, // muon SCATTERED_LIGHT_FROM_MUON, // DIRECT_LIGHT_FROM_DELTARAYS, // SCATTERED_LIGHT_FROM_DELTARAYS, // DIRECT_LIGHT_FROM_EMSHOWER, // SCATTERED_LIGHT_FROM_EMSHOWER, // DIRECT_LIGHT_FROM_MUON + 20, // tau SCATTERED_LIGHT_FROM_MUON + 20, // DIRECT_LIGHT_FROM_DELTARAYS + 20, // SCATTERED_LIGHT_FROM_DELTARAYS + 20, // DIRECT_LIGHT_FROM_EMSHOWER + 40, // electrons/hadrons SCATTERED_LIGHT_FROM_EMSHOWER + 40, // -1 // end marker }; typedef map map_type; map_type zmap; zmap[100] = "Number of photons"; zmap[200] = "Number of errors"; zmap[300] = "Number of misses"; NOTICE("Job summary" << endl); NOTICE(LEFT(40) << "Number of events input " << RIGHT(10) << (int) job->GetBinContent( 1) << endl); NOTICE(LEFT(40) << "Number of muons " << RIGHT(10) << (int) job->GetBinContent( 2) << endl); NOTICE(LEFT(40) << "Number of muons in can " << RIGHT(10) << (int) job->GetBinContent( 3) << endl); NOTICE(LEFT(40) << "Number of muons within road " << RIGHT(10) << (int) job->GetBinContent( 4) << endl); NOTICE(LEFT(40) << "Number of decayed particles (i.e. tau) " << RIGHT(10) << (int) job->GetBinContent( 6) << endl); NOTICE(LEFT(40) << "Number of detectable decayed particles " << RIGHT(10) << (int) job->GetBinContent( 7) << endl); NOTICE(LEFT(40) << "Number of electrons/hadrons " << RIGHT(10) << (int) job->GetBinContent( 8) << endl); NOTICE(LEFT(40) << "Number of detectable electrons/hadrons " << RIGHT(10) << (int) job->GetBinContent( 9) << endl); NOTICE(LEFT(40) << "Number of events output " << RIGHT(10) << (int) job->GetBinContent( 10) << endl); NOTICE(LEFT(40) << "Number of unknown particles " << RIGHT(10) << (int) job->GetBinContent( 21) << endl); for (map_type::const_iterator entry = zmap.begin(); entry != zmap.end(); ++entry) { NOTICE(endl); for (const int* i = hit_types; *i != -1; ++i) { NOTICE("" << LEFT (19) << entry->second << FILL(1) << RIGHT( 2) << *i << FILL(8) << FILL (10) << RIGHT(10) << (int) job->GetBinContent(entry->first + *i) << endl); } } in->Close(); }