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

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

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