// Author: Edward Brash February 15, 2005 // // // hd_root.cc // #include #include #include "MyProcessor.h" #include "DANA/DApplication.h" using namespace std; typedef void SetTFilePtrAddress_t(TFile **); TFile* tfilePtr = NULL; string OUTPUT_FILENAME = "hd_root.root"; string COMMAND_LINE_OUTPUT_FILENAME = ""; bool filename_from_command_line = false; void ParseCommandLineArguments(int &narg, char *argv[]); void DecideOutputFilename(void); void Usage(void); //----------- // main //----------- int main(int narg, char *argv[]) { // Parse the command line ParseCommandLineArguments(narg, argv); // Instantiate our event processor MyProcessor myproc; // Instantiate an event loop object DApplication app(narg, argv); // Decide on the output filename DecideOutputFilename(); // Run though all events, calling our event processor's methods app.monitor_heartbeat = 0; app.Run(&myproc); return 0; } //----------- // ParseCommandLineArguments //----------- void ParseCommandLineArguments(int &narg, char *argv[]) { if(narg==1)Usage(); for(int i=1;i=narg-1){ cerr<<"\"-o\" requires a filename!"<SetDefaultParameter("OUTPUT_FILENAME", OUTPUT_FILENAME,"Output filename used by hd_root"); // If the user specified an output filename on the command line, // use it to overwrite the config. parameter/default one if(filename_from_command_line){ OUTPUT_FILENAME = COMMAND_LINE_OUTPUT_FILENAME; // Set the actual output filename in config. param. gPARMS->SetParameter("OUTPUT_FILENAME", OUTPUT_FILENAME); } jout<<"OUTPUT_FILENAME: "<