#include #include #include "TROOT.h" #include "TFile.h" #include "TH1D.h" #include "TH2D.h" #include "JPhysics/JGeane.hh" #include "Jeep/JParser.hh" #include "Jeep/JMessage.hh" /** * \file * * Example program to histogram muon energy loss. * \author mdejong */ int main(int argc, char* argv[]) { using namespace std; using namespace JPP; string outputFile; int debug; try { JParser<> zap("Example program to histogram muon energy loss."); zap['o'] = make_field(outputFile) = "geane.root"; zap['d'] = make_field(debug) = 2; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } TFile out(outputFile.c_str(), "recreate"); TH1D h1("h1", NULL, 900, -1.0, +8.0); TH2D h2("h2", NULL, 90, -1.0, +8.0, 100, 0.0, 5.0); for(int i = 1; i <= h1.GetNbinsX(); ++i) { const double x = h1.GetBinCenter(i); const double E = pow(10.0, x); h1.Fill(x, gWater(E)); } for(int ix = 1; ix <= h2.GetXaxis()->GetNbins(); ++ix) { for(int iy = 1; iy <= h2.GetYaxis()->GetNbins(); ++iy) { const double x = h2.GetXaxis()->GetBinCenter(ix); const double y = h2.GetYaxis()->GetBinCenter(iy); const double E = pow(10.0, x); const double dx = pow(10.0, y); h2.Fill(x, y, gWater(E, dx)); } } out.Write(); out.Close(); }