• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

onlinemonitor/rocmonitor/TRocAnalysis.cxx (r4864/r3724)

Go to the documentation of this file.
00001 
00002 
00003 #include "TRocAnalysis.h"
00004 
00005 #include <cstdlib>
00006 #include <getopt.h>
00007 
00008 #include "Go4EventServer.h"
00009 #include "TGo4StepFactory.h"
00010 #include "TGo4AnalysisStep.h"
00011 #include "TGo4Version.h"
00012 #include "TGo4Log.h"
00013 
00014 
00015 
00016 //***********************************************************
00017 TRocAnalysis::TRocAnalysis()
00018 {
00019 }
00020 //***********************************************************
00021 
00022 // this constructor is called by go4analysis executable
00023 TRocAnalysis::TRocAnalysis(int argc, char** argv) :
00024    TGo4Analysis(argc, argv)
00025 {
00026    if (!TGo4Version::CheckVersion(__GO4BUILDVERSION__)) {
00027       TGo4Log::Error("Go4 version mismatch");
00028       exit(-1);
00029    }
00030 
00031    TGo4Log::Info("Create TRocAnalysis name: %s", argv[0]);
00032 
00033    // parsing user arguments
00034    // see http://www.gnu.org/software/libc/manual/html_node/Getopt-Long-Option-Example.html#Getopt-Long-Option-Example
00035    // for details about getpar and more examples
00036    int c;
00037    while (1)
00038    {
00039            static struct option long_options[] =
00040            {
00041                    /* These options don't set a flag.
00042                         *                  We distinguish them by their indices. */
00043                    {"par",  required_argument, 0, 'p'},
00044                    {"cond",  required_argument, 0, 'c'},
00045                    {0, 0, 0, 0}
00046            };
00047            /* getopt_long stores the option index here. */
00048            int option_index = 0;
00049            
00050            c = getopt_long (argc, argv, "c:p:",
00051                                                 long_options, &option_index);
00052            
00053            /* Detect the end of the options. */
00054            if (c == -1)
00055                    break;
00056            
00057            switch (c)
00058            {
00059                    case 'c':
00060                            userConds = optarg;
00061                            break;
00062                            
00063                    case 'p':
00064                            userPars = optarg;
00065                            break;
00066 
00067                    case '?':
00068                            /* getopt_long already printed an error message. */
00069                            break;
00070 
00071                    default:
00072                       TGo4Log::Error("No option %c. Check your arguments list. Aborting, sorry...", c);
00073                            abort();
00074            }
00075    }
00076 
00077    TGo4StepFactory* factory = new TGo4StepFactory("Factory");
00078    factory->DefEventProcessor("RocProc","TRocProc");// object name, class name
00079    factory->DefOutputEvent("ROC","TRocEvent"); // object name, class name
00080    factory->DefUserEventSource("TRocSource"); // object name, class name
00081 
00082    TGo4EventSourceParameter* sourcepar = new TGo4MbsFileParameter(Form("%s/data/test.lmd",getenv("GO4SYS")));
00083    TGo4FileStoreParameter* storepar = new TGo4FileStoreParameter(Form("%sOutput", argv[0]));
00084    storepar->SetOverwriteMode(kTRUE);
00085 
00086    TGo4AnalysisStep* step = new TGo4AnalysisStep("Roc", factory, sourcepar, storepar);
00087 
00088    step->SetSourceEnabled(kTRUE);
00089    step->SetStoreEnabled(kFALSE);
00090    step->SetProcessEnabled(kTRUE);
00091    step->SetErrorStopEnabled(kTRUE);
00092 
00093    // Now the first analysis step is set up.
00094    // Other steps could be created here
00095    AddAnalysisStep(step);
00096 
00097    // uncomment following line to define custom passwords for analysis server
00098    // DefineServerPasswords("CernOct11admin", "CernOct11ctrl", "CernOct11view");
00099 
00100 }
00101 
00102 //***********************************************************
00103 TRocAnalysis::~TRocAnalysis()
00104 {
00105    TGo4Log::Info("TRocAnalysis: Delete instance");
00106 }
00107 

Generated on Tue Dec 10 2013 04:52:23 for ROCsoft by  doxygen 1.7.1