Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4ComGetCurrentEvent.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE 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 "TGo4ComGetCurrentEvent.h"
00017 
00018 #include "TTree.h"
00019 
00020 #include "TGo4Log.h"
00021 #include "TGo4AnalysisClientImp.h"
00022 #include "TGo4AnalysisImp.h"
00023 #include "TGo4EventElement.h"
00024 #include "TGo4RemoteCommand.h"
00025 
00026 TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent(const char* obname)
00027 :TGo4AnalysisObjectCommand("ANGetEvent","Get current event from analysis",obname),
00028 fbOutputEvent(kTRUE), fbPrintoutOnly(kFALSE), fbTreeMode(kTRUE)
00029 {
00030    TRACE((12,"TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent(const Text_t*) ctor",__LINE__, __FILE__));
00031    SetReceiverName("AnalysisClient");  // this command needs client as receiver
00032                                        // override default receiver
00033 }
00034 
00035 TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent()
00036 :TGo4AnalysisObjectCommand("ANGetEvent","Get current event from analysis","his"),
00037 fbOutputEvent(kTRUE), fbPrintoutOnly(kFALSE), fbTreeMode(kTRUE)
00038  {
00039    TRACE((12,"TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent() ctor",__LINE__, __FILE__));
00040    SetReceiverName("AnalysisClient");  // this command needs client as receiver
00041                                        // override default receiver
00042 }
00043 
00044 TGo4ComGetCurrentEvent::~TGo4ComGetCurrentEvent()
00045 {
00046    TRACE((12,"TGo4ComGetCurrentEvent::~TGo4ComGetCurrentEvent() dtor",__LINE__, __FILE__));
00047 }
00048 
00049 
00050 Int_t TGo4ComGetCurrentEvent::ExeCom()
00051 {
00052    TRACE((12,"TGo4ComGetCurrentEvent::ExeCom()",__LINE__, __FILE__));
00053 
00054    TGo4Log::Debug(" Executing %s : Event %s requested, isoutput=%d, printoutonly=%d ",
00055          GetName(), GetObjectName(), IsOutputEvent(), IsPrintoutOnly() );
00056    TGo4AnalysisClient* cli=dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00057    if (cli!=0)
00058       {
00059          TGo4Analysis* ana=TGo4Analysis::Instance();
00060          if(ana==0)
00061              {
00062                     // never come here
00063                     cli->SendStatusMessage(3, kTRUE," %s ERROR no analysis ",GetName());
00064                     return -2;
00065              } else {}
00066          if(IsTreeMode())
00067             {
00068             // tree mode:
00069             if(IsPrintoutOnly())
00070                {
00071                    // only display event content on terminal
00072                    ana->ShowEvent(GetObjectName(), IsOutputEvent());
00073                }
00074             else
00075                {
00076                TTree* sampletree=ana->CreateSingleEventTree(GetObjectName(), IsOutputEvent());
00077                if(sampletree)
00078                   {
00079                      cli->SendObject(sampletree, GetTaskName());
00080                      delete sampletree;
00081                   }
00082                else
00083                   {
00084                      cli->SendStatusMessage(3, kTRUE,"GetCurrentEvent %s - ERROR:  no such event ",
00085                                                    GetObjectName());
00086                   }
00087                }// if(IsPrintoutOnly())
00088             }// if(IsTreeMode())
00089          else
00090             {
00091            // event mode:
00092            TGo4EventElement* event=0;
00093            if(IsOutputEvent())
00094              event=ana->GetOutputEvent(GetObjectName());
00095            else
00096              event=ana->GetInputEvent(GetObjectName());
00097           if(event==0)
00098                // event step of name does not exists, we search event in folder:
00099                event=ana->GetEventStructure(GetObjectName());
00100             if(event)
00101                {
00102                   if(IsPrintoutOnly())
00103                      event->PrintEvent();
00104                   else
00105                      cli->SendObject(event, GetTaskName());
00106                }
00107             else
00108                {
00109                   cli->SendStatusMessage(3, kTRUE,"GetCurrentEvent %s - ERROR:  no such event ",
00110                                                    GetObjectName());
00111                } // if(event)
00112             } // if(IsTreeMode())
00113       }
00114    else
00115        {
00116       TRACE((11,"TGo4ComGetCurrentEvent::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
00117          TGo4Log::Debug(" !!! %s : NO or WRONG RECEIVER ERROR!!!",GetName());
00118          return 1;
00119       }
00120    return -1;
00121 }
00122 
00123 void TGo4ComGetCurrentEvent::Set(TGo4RemoteCommand* remcom)
00124 {
00125 if(remcom==0) return;
00126 TGo4AnalysisObjectCommand::Set(remcom);
00127 fbOutputEvent=remcom->GetValue(0);
00128 fbPrintoutOnly=remcom->GetValue(1);
00129 fbTreeMode=remcom->GetValue(2);
00130 
00131 }
00132 
00133 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:05 2008 for Go4-v3.04-1 by  doxygen 1.4.2