Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4CommandsAnalysis/TGo4ComSetSource.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
00015 //----------------------------------------------------------------
00016 #include "TGo4ComSetSource.h"
00017 
00018 #include "Go4Log/TGo4Log.h"
00019 #include "Go4AnalysisClient/TGo4AnalysisClientImp.h"
00020 #include "Go4Analysis/TGo4AnalysisImp.h"
00021 
00022 TGo4ComSetSource::TGo4ComSetSource(const char* stepname, TGo4EventSourceParameter* newsource)
00023 :TGo4AnalysisStepCommand("ANSetSource","Set eventsource of analysis step",stepname)
00024 {
00025    TRACE((12,"TGo4ComSetSource::TGo4ComSetSource(const Text_t*) ctor",__LINE__, __FILE__));
00026    SetReceiverName("AnalysisClient");  // this command needs client as receiver
00027                                                  // to send back status message
00028 
00029    fxSourcePar=newsource;
00030 
00031 
00032 }
00033 TGo4ComSetSource::TGo4ComSetSource()
00034 :TGo4AnalysisStepCommand("ANSetSource","Set eventsource of analysis step",0)
00035 {
00036    TRACE((12,"TGo4ComSetSource::TGo4ComSetSource() ctor",__LINE__, __FILE__));
00037    SetReceiverName("AnalysisClient");  // this command needs client as receiver
00038                                                  // to send back status message
00039 
00040 
00041    fxSourcePar=0;
00042 }
00043 
00044 TGo4ComSetSource::~TGo4ComSetSource()
00045 {
00046    TRACE((12,"TGo4ComSetSource::~TGo4ComSetSource() dtor",__LINE__, __FILE__));
00047 }
00048 
00049 Int_t TGo4ComSetSource::ExeCom()
00050 {
00051    TRACE((12,"TGo4ComSetSource::ExeCom()",__LINE__, __FILE__));
00052 
00053    if (fxReceiverBase!=0)
00054       {
00055       TRACE((11,"TGo4ComSetSource::ExeCom() - found valid receiver",__LINE__, __FILE__));
00056          TGo4Log::Debug(" Executing %s : Step %s resets event source ",
00057             GetName(), GetStepName());
00058          TGo4Analysis* anna=0;
00059          TGo4AnalysisClient* cli=dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00060          if(cli)
00061             {
00062                anna=TGo4Analysis::Instance();
00063                const char* stepname = GetStepName();
00064                if(!strcmp(stepname,TGo4AnalysisStepCommand::fgcDEFAULTSTEP))
00065                      stepname=0;
00066 
00067                // execute action and look for result
00068                const char* parname = "default";
00069                TGo4EventSourceParameter* par=GetSourcePar();
00070                if(par) parname = par->GetName();
00071 
00072                if(anna && anna->NewStepSource(stepname , par ))
00073                   {
00074                      // true, command succeeds
00075                      cli->SendStatusMessage(1,kTRUE,"New source %s was set to step %s.",
00076                                                 parname, GetStepName());
00077                   }
00078                else
00079                   {
00080                     // result false, send error message through status
00081                      cli->SendStatusMessage(3,kTRUE,"%s - ERROR at setting source %s to step %s !!!",
00082                                                 GetName(),parname, GetStepName());
00083                   }
00084 
00085 
00086 
00087             }
00088 
00089          else
00090             {
00091                TGo4Log::Debug(" !!! %s : WRONG RECEIVER ERROR, never come here!!!",GetName());
00092             }
00093       }
00094 
00095    else
00096 
00097        {
00098       TRACE((11,"TGo4ComSetSource::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
00099          TGo4Log::Debug(" !!! %s : NO RECEIVER ERROR!!!",GetName());
00100          return 1;
00101       }
00102 
00103    return -1;
00104 }
00105 
00106 
00107 ClassImp(TGo4ComSetSource)
00108 
00109 
00110 
00111 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:55:51 2005 for Go4-v2.10-5 by doxygen1.2.15