GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4ComAddTreeHistogram.cxx
Go to the documentation of this file.
1 // $Id: TGo4ComAddTreeHistogram.cxx 2627 2019-10-01 08:02:45Z linev $
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 "TGo4Log.h"
17 #include "TGo4AnalysisClientImp.h"
18 #include "TGo4AnalysisImp.h"
19 #include "TGo4RemoteCommand.h"
20 
22  TGo4AnalysisCommand("ANAddTreeHis","Add a tree histogram to dynamic list")
23 {
24  GO4TRACE((12,"TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram() ctor",__LINE__, __FILE__));
26 }
27 
28 TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram(const char* histogramname, const char* treename,const char* varexp, const char* cut) :
29  TGo4AnalysisCommand("ANAddTreeHis","Add a tree histogram to dynamic list")
30 {
31  GO4TRACE((12,"TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram() ctor",__LINE__, __FILE__));
32  SetReceiverName("AnalysisClient"); // this command needs client as receiver
33  // to send back status message
35  SetHistogramName(histogramname);
36  SetTreeName(treename);
37  SetVarexp(varexp);
38  SetCut(cut);
39 }
40 
42 {
43  GO4TRACE((12,"TGo4ComAddTreeHistogram::~TGo4ComAddTreeHistogram() dtor",__LINE__, __FILE__));
44 }
45 
47 {
48  if(remcom==0) return;
49  SetHistogramName(remcom->GetString(0));
50  SetTreeName(remcom->GetString(1));
51  SetVarexp(remcom->GetString(2));
52  SetCut(remcom->GetString(3));
53 }
54 
56 {
57  GO4TRACE((12,"TGo4ComAddTreeHistogram::ExeCom()",__LINE__, __FILE__));
58 
60  if(cli)
61  {
63 // TGo4Log::Debug(" !!! %s executing: adding tree histogram entry %s ",
64 // GetName(),fxHistoName.GetName());
65  if(ana)
66  {
67  TString histo = fxHistoName;
68  if (histo.Length()==0) histo = "hTreeDraw";
69  Bool_t result= ana->AddTreeHistogram(histo.Data(),
70  fxTreeName.Data(),
71  fxVarexp.Data(),
72  fxCut.Data());
73  if(result)
74  {
75  cli->SendStatusMessage(1,kTRUE,TString::Format(
76  "Added Dynamic histogram %s for tree %s.",
77  fxHistoName.Data(),fxTreeName.Data()));
78  }
79  else
80  {
81  cli->SendStatusMessage(2,kTRUE,TString::Format(
82  "Could not add Dynamic histogram %s for tree %s !!!",
83  fxHistoName.Data(),fxTreeName.Data()));
84  }
85  }// if ana
86  else
87  {
88  cli->SendStatusMessage(3, kTRUE,TString::Format(
89  " %s ERROR no analysis ",GetName()));
90 
91  }
92  } // if cli
93  else
94  {
95  GO4TRACE((11,"TGo4ComAddTreeHistogram::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
96  TGo4Log::Debug(" !!! ComAddTreeHistogram ''%s'': NO RECEIVER ERROR!!!",GetName());
97 
98  return 1;
99  }
100 
101  return -1;
102 }
Bool_t AddTreeHistogram(const char *hisname, const char *treename, const char *varexp, const char *cutexp)
void SetReceiverName(const char *)
Definition: TGo4Command.cxx:93
virtual void SendStatusMessage(Int_t level, Bool_t printout, const TString &text)
TGo4CommandReceiver * fxReceiverBase
Definition: TGo4Command.h:116
void SetCut(const char *cut)
void SetVarexp(const char *exp)
void SetTreeName(const char *name)
virtual void Set(TGo4RemoteCommand *remcon)
void SetProtection(Go4CommandMode_t m)
Definition: TGo4Command.h:104
const char * GetString(Int_t i) const
#define GO4TRACE(X)
Definition: TGo4Log.h:26
static TGo4Analysis * Instance()
void SetHistogramName(const char *name)
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:274