#include "COMETSpectrumFactory.hh" #include "COMETVSpectrum.hh" #include #include #include #include #include #include using std::cout; using std::endl; void Usage(const char* prog){ cout<<"Usage: "< Name of the spectrum to sample. \n" <<" Should be one of: "< Specify the number of times to sample the spectrum \n" <<" -f Set the name of the output file \n" <<" -b Set the number of bins in the output histogram \n" <<" -u Set the upper limit of the output histogram \n" <<" -l Set the lower limit of the output histogram \n" <>max; break; } case 'l': { stream>>min; break; } case 'n': { stream>>n_samples; break; } case 'b': { stream>>n_bins; break; } case 'f': { outfilename=optarg; continue; } case 's': { requested_spectrum=optarg; continue; } case 'h':case '?': Usage(argv[0]); return 0; default: cout<<"Error: Unknown option: "<IsZombie()){ COMETError("Cannot open output file for spectrum histogram"); return 3; } std::string title="Sampling of spectrum: "; title+=spectrum->GetName(); TH1* hist=new TH1F(spectrum->GetName().c_str(),title.c_str(),n_bins,min,max); for(int i=0;iGenerateOne(); hist->Fill(energy); } out_file->Write(); out_file->Close(); return 0; }