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

/Go4GUI/TGo4EventInfoSlots.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 "TGo4EventInfoSlots.h"
00017 
00018 #include <iostream.h>
00019 
00020 #include "TTree.h"
00021 
00022 #include "Go4LockGuard/TGo4LockGuard.h"
00023 #include "Go4GUIRegistry/TGo4GUIRegistry.h"
00024 #include "Go4CommandsAnalysis/TGo4ComGetCurrentEvent.h"
00025 #include "Go4CommandsAnalysis/TGo4ComSetPrintEvent.h"
00026 #include "Go4Event/TGo4EventElement.h"
00027 #include "TGo4EventInfo.h"
00028 #include "TGo4EventInfoStatus.h"
00029 
00030 TGo4EventInfoSlots::TGo4EventInfoSlots(const char * name, const char * title,  TGo4EventInfo * p)
00031                        :TGo4SlotsBaseClass(name , title), fxTGo4EventInfo(p)
00032 {
00033    TGo4LockGuard Global;
00034       char StatusName[256];
00035     fxTGo4GUIRegistry=TGo4GUIRegistry::Instance();
00036       snprintf(StatusName,256,"%s%s",name,"_Status" );
00037    fxTGo4EventInfoStatus= new TGo4EventInfoStatus(StatusName, "DynEntryStatus");
00038    fxTGo4GUIRegistry->RegisterSlotClass(this, fxTGo4EventInfoStatus, p);
00039 
00040 }
00041 void TGo4EventInfoSlots::AddObject(TNamed *fxData)
00042 {
00043   if(fxData==0) return;
00044 //   cout <<"TGo4EventInfoSlots got object "<< fxData << endl;
00045 //   cout <<"Name:"<<fxData->GetName() << endl;
00046    if(fxData->InheritsFrom("TTree"))
00047       {
00048          // we have a tree containing one event
00049          TTree* sample=dynamic_cast<TTree*>(fxData);
00050          fxTGo4EventInfoStatus->SetEvent(sample);
00051          fxTGo4EventInfo->RefreshInfo();
00052       }
00053    else if(fxData->InheritsFrom("TGo4EventElement"))
00054       {
00055          // we have one sample event
00056          TGo4EventElement* esample=dynamic_cast<TGo4EventElement*>(fxData);
00057          fxTGo4EventInfoStatus->SetEvent(esample);
00058          fxTGo4EventInfo->RefreshInfo();
00059       }
00060    else
00061       {
00062          cerr <<"ERROR in TGo4EventInfoSlots: AddObject got unknown type" << endl;
00063       }
00064 }
00065 
00066 void TGo4EventInfoSlots::SetGUI(TGo4EventInfo *GUI)
00067 {
00068    fxTGo4EventInfo=GUI;
00069 }
00070 
00071 void TGo4EventInfoSlots::StatusChanged(TGo4Status *status)
00072 {
00073 }
00074 
00075 TGo4EventInfoSlots::~TGo4EventInfoSlots()
00076 {
00077    delete fxTGo4EventInfoStatus;
00078 
00079 }
00080 
00081 TGo4Status * TGo4EventInfoSlots::GetStatus()
00082 {
00083    return fxTGo4EventInfoStatus;
00084 }
00085 
00086 
00087 void TGo4EventInfoSlots::SendGetCurrentEventCommand()
00088 {
00089  TGo4ComGetCurrentEvent *com = new TGo4ComGetCurrentEvent(fxTGo4EventInfoStatus->GetEventName());
00090  com->SetPrintoutOnly(fxTGo4EventInfoStatus->IsRemoteMode());
00091  com->SetOutputEvent(kFALSE);
00092  com->SetTreeMode(fxTGo4EventInfoStatus->IsTreeMode());
00093  if(fxTGo4EventInfoStatus->IsRemoteMode())
00094     fxTGo4GUIRegistry->SubmitCommand(com);
00095  else
00096     fxTGo4GUIRegistry->SubmitCommand(com,fxTGo4EventInfoStatus->GetEventName(), this);
00097  // note that sample tree send by analysis will have same name as event!
00098 }
00099 
00100 void TGo4EventInfoSlots::SendSetPrintEventCommand()
00101 {
00102 TGo4ComSetPrintEvent *com = new TGo4ComSetPrintEvent(fxTGo4EventInfoStatus->GetEventName());
00103 com->SetEventNum(fxTGo4EventInfoStatus->GetEventNum());
00104 com->SetSubId(fxTGo4EventInfoStatus->GetSubId());
00105 com->SetHex(fxTGo4EventInfoStatus->IsHex());
00106 com->SetLong(fxTGo4EventInfoStatus->IsLong());
00107 com->SetData(fxTGo4EventInfoStatus->IsData());
00108 
00109 fxTGo4GUIRegistry->SubmitCommand(com);
00110 }
00111 
00112 void TGo4EventInfoSlots::PrintToLog()
00113 {
00114    TGo4Log::Message(1,fxTGo4EventInfoStatus->GetEventPrintout());
00115 }
00116 
00117 
00118 void TGo4EventInfoSlots::EventDisplay()
00119 {
00120    TGo4EventElement* samev=fxTGo4EventInfoStatus->GetSampleEvent();
00121    TTree* samtre=fxTGo4EventInfoStatus->GetSampleTree();
00122    if(samev)
00123       {
00124          samev->Inspect();
00125       }
00126    else if(samtre)
00127       {
00128          samtre->StartViewer();
00129       }
00130 }
00131 
00132 
00133 
00134 //----------------------------END OF GO4 SOURCE FILE ---------------------

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