GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4ComGetCurrentEvent.cxx
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
15
16#include "TTree.h"
17
18#include "TGo4Log.h"
20#include "TGo4AnalysisImp.h"
21#include "TGo4EventElement.h"
22#include "TGo4RemoteCommand.h"
23
25 TGo4AnalysisObjectCommand("ANGetEvent","Get current event from analysis",obname),
26 fbOutputEvent(kTRUE),
27 fbPrintoutOnly(kFALSE),
28 fbTreeMode(kTRUE)
29{
30 GO4TRACE((12,"TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent(const char *) ctor",__LINE__, __FILE__));
31 SetReceiverName("AnalysisClient"); // this command needs client as receiver
32 // override default receiver
33}
34
36 TGo4AnalysisObjectCommand("ANGetEvent","Get current event from analysis","his"),
37 fbOutputEvent(kTRUE),
38 fbPrintoutOnly(kFALSE),
39 fbTreeMode(kTRUE)
40 {
41 GO4TRACE((12,"TGo4ComGetCurrentEvent::TGo4ComGetCurrentEvent() ctor",__LINE__, __FILE__));
42 SetReceiverName("AnalysisClient"); // this command needs client as receiver
43 // override default receiver
44}
45
47{
48 GO4TRACE((12,"TGo4ComGetCurrentEvent::ExeCom()",__LINE__, __FILE__));
49
50 TGo4Log::Debug(" Executing %s : Event %s requested, isoutput=%d, printoutonly=%d ",
51 GetName(), GetObjectName(), IsOutputEvent(), IsPrintoutOnly() );
52
54
55 if (!cli) {
56 GO4TRACE((11,"TGo4ComGetCurrentEvent::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
57 TGo4Log::Debug(" !!! %s : NO or WRONG RECEIVER ERROR!!!",GetName());
58 return 1;
59 }
60
62 if (!ana) {
63 // never come here
64 cli->SendStatusMessage(3, kTRUE,TString::Format(" %s ERROR no analysis ",GetName()));
65 return -2;
66 }
67
68 if(IsTreeMode()) {
69 // tree mode:
70 if(IsPrintoutOnly()) {
71 // only display event content on terminal
73 } else {
74 TTree *sampletree = ana->CreateSingleEventTree(GetObjectName(), IsOutputEvent());
75 if(sampletree) {
76 cli->SendObject(sampletree, GetTaskName());
77 delete sampletree;
78 } else {
79 cli->SendStatusMessage(3, kTRUE,TString::Format(
80 "GetCurrentEvent %s - ERROR: no such event ", GetObjectName()));
81 }
82 }// if(IsPrintoutOnly())
83 }// if(IsTreeMode())
84 else
85 {
86 // event mode:
87 TGo4EventElement *event = nullptr;
88 if (IsOutputEvent())
89 event = ana->GetOutputEvent(GetObjectName());
90 else
91 event = ana->GetInputEvent(GetObjectName());
92 if (!event)
93 // event step of name does not exists, we search event in folder:
94 event = ana->GetEventStructure(GetObjectName());
95 if (event) {
96 if (IsPrintoutOnly())
97 event->PrintEvent();
98 else
99 cli->SendObject(event, GetTaskName());
100 } else {
101 cli->SendStatusMessage(3, kTRUE,
102 TString::Format("GetCurrentEvent %s - ERROR: no such event ", GetObjectName()));
103 } // if(event)
104 } // if(IsTreeMode())
105
106 if (IsPrintoutOnly()) {
107 fflush(stderr);
108 fflush(stdout);
109 }
110
111 return -1;
112}
113
115{
116 if(!remcom) return;
118 fbOutputEvent = remcom->GetValue(0);
119 fbPrintoutOnly = remcom->GetValue(1);
120 fbTreeMode = remcom->GetValue(2);
121}
#define GO4TRACE(X)
Definition TGo4Log.h:25
void SendStatusMessage(Int_t level, Bool_t printout, const TString &text) override
Send message to gui.
const char * GetObjectName() const
access to the object name under command.
void Set(TGo4RemoteCommand *remcon) override
Set internals of this command from specification of external remote command (command container).
The mother of all go4 analysis.
TGo4EventElement * GetInputEvent(const char *stepname) const
Returns the input event structure of analysis step.
static TGo4Analysis * Instance()
return analysis instance
TGo4EventElement * GetEventStructure(const char *name) const
Search reference to event structure in folder.
void ShowEvent(const char *stepname, Bool_t isoutput=kTRUE)
Printout event content of single current event to analysis terminal (using ROOT TTree::Show method).
TGo4EventElement * GetOutputEvent(const char *stepname) const
Returns the output event (detector) structure of analysis step.
TTree * CreateSingleEventTree(const char *name, Bool_t isoutput=kTRUE)
Create a tree that is filled with one single event sample.
Bool_t fbTreeMode
If true, event will be put into tree before showing; otherwise use PrintEvent method or send event di...
void Set(TGo4RemoteCommand *remcon) override
Set internals of this command from specification of external remote command (command container).
Bool_t fbOutputEvent
If true output event is searched, otherwise input event of step.
Int_t ExeCom() override
Do the command action.
Bool_t fbPrintoutOnly
If true, the event will not be sent but content is shown on analysis terminal.
TGo4CommandReceiver * fxReceiverBase
void SetReceiverName(const char *)
const char * GetTaskName() const
The abstract base class for the data elements of which the unpacked events (or detector structure dat...
static void Debug(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 0.
Definition TGo4Log.cxx:281
This command is a container for commands to be send from master to slave via inter-process transport.
Int_t GetValue(Int_t i) const
void SendObject(TObject *obj, const char *receiver=nullptr)
Send object via data channel to the server.