#include #include #include #include "fcal11view.h" #include "MyProcessor.h" int GO = 0; // 1=continuously display events 0=wait for user TCanvas *maincanvas=NULL; extern JApplication *japp; JEventLoop *eventloop =NULL; MyProcessor *myproc = NULL; void ParseCommandLineArguments(int &narg, char *argv[], JApplication *japp); void Usage(JApplication *japp); //------------------- // main //------------------- int main(int narg, char *argv[]) { // Parse the command line arguments ParseCommandLineArguments(narg, argv, japp); // Instantiate a JApplication object. This has to be done BEFORE // creating the TApplication object since that modifies the argument list. japp = new JApplication(narg, argv); // Create a ROOT TApplication object TApplication app("FCAL 2011 Beam Test Data Viewier", &narg, argv); // This is done AFTER creating the TApplication object so when the // init routine is called, the window will be mapped and it can // draw the detectors. myproc = new MyProcessor(); japp->AddProcessor(myproc); // Call the JApplication's Init() routine to attach any plugins japp->Init(); // Create the JEventLoop object explicitly. eventloop = new JEventLoop(japp); eventloop->SetAutoFree(0); // prevent auto-freeing of event after OneEvent is called // We need to re-call myproc->init here (it was already called from the japp->Init() // call above). This is because the previous call was done before the JEventLoop // object existed and so the hdv_mainframe object wasn't created etc... We have // to call japp->Init() before instantiated the JEventLoop so that the plugins // are attached and the JEventLoop can capture the full list of factories and // processors. myproc->init(); // Process the first event jerror_t err =eventloop->OneEvent(); // Hand control to the ROOT "event" loop japp->GetJParameterManager()->PrintParameters(); app.SetReturnFromRun(true); if(err==NOERROR)app.Run(); // Clean-up the app (call erun and fini methods, delete sources) //japp->Fini(); // This now actually done in hdv_mainframe::DoQuit() if(japp)delete japp; return 0; } //----------- // ParseCommandLineArguments //----------- void ParseCommandLineArguments(int &narg, char *argv[], JApplication *japp) { if(narg==1)Usage(japp); for(int i=1;iUsage(); cout<