#include "Riostream.h" #include #include "TROOT.h" #include "TRint.h" #include "TApplication.h" #include "TGo4Log.h" #include "TYYYAnalysis.h" #include "TGo4AnalysisClient.h" void usage(); // print announcement TROOT go4application("The GO4","This is the Go4"); #define kGUI 2 #define kBatch 1 //================== YYY analysis main program ============================ int main(int argc, char **argv) { // argv[0] program // argv[1] "-gui" when started by GUI. // In this case the following args are: // argv[2] analysis name as specified in GUI // argv[3] hostname of GUI // argv[4] connector port of GUI // if not GUI the args are: // argv[1] LMD filename // argv[2] optional number of events // define here the standard suffix of your data: const char* inputsuffix=".scf"; printf("\n%s started with args:\n",argv[0]); for(int i=1;i4) ? atoi(argv[4]) : 5000; // port of GUI server } else{ len = strlen(argv[1]); strncpy(input,argv[1],110); // input file name if(argc > 2) maxevents=atoi(argv[2]); } if(maxevents == -1) maxevents = 99999999; // we construct filenames char lmd[1024]; // input GSI listmode char asf[1024]; // root autosave file char raw[1024]; // root unpacked events char anl[1024]; // root analyzed events char *pc; if((pc=strstr(input,".lmd")) != 0)*pc=0; // strip any path information from input file name: // outname is name without path char* lastname = input; char* outname = lastname; lastname = strstr(outname,"/"); while(lastname!=0) { outname=lastname+1; lastname=strstr(outname,"/"); } strncpy(lmd,input,len+4); // input file with full path strncpy(asf,outname,len+4); strncpy(raw,outname,len+4); strncpy(anl,outname,len+4); strcat(lmd,inputsuffix); // input with user suffix strcat(asf,"_ASF"); // root autosave file strcat(raw,"_UPA"); // root unpacked events strcat(anl,"_ANL"); // root analyzed events printf("Files used: \nFile input: %s\nAutosave: %s\nUnpacked: %s\nAnalyzed: %s\n", lmd,asf,raw,anl); // Now setup the YYY analysis itself TYYYAnalysis* analysis = new TYYYAnalysis(lmd,raw,anl); // Enable autosave. Autosave is done when analysis loop is stopped // or intervall os over. //analysis->SetAutoSave(kFALSE); // no autosave analysis->SetAutoSaveFile(asf); // optional analysis->SetAutoSaveInterval(0); // events , 0 = termination of event loop // ===================== End YYY analysis ================================ // At this point the analysis is set up //TBenchmark bench; // optional if(runningMode == kBatch) { cout << "* starting analysis in batch mode ... " << endl; if (analysis->InitEventClasses() ) { // bench.Start("Go4EventServer"); // optional // prtimer.Start(); // optional analysis->RunImplicitLoop(maxevents); // prtimer.Stop(); // optional // prtimer.Resume(); // optional // bench.Show("Go4EventServer"); // optional delete analysis; cout << "\t Done!"<Terminate(); } else { cout << "Init event classes failed, aborting!"<Terminate(); } } if(runningMode == kGUI) { cout << "* starting analysis in client mode ..." << endl; TGo4AnalysisClient* client = new TGo4AnalysisClient(argc,argv,analysis, kTRUE,"YYY","demo"); cout << "Created AnalysisClient Instance: "<GetName()<