Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "TGo4ComAddTreeHistogram.h"
00015
00016 #include "TGo4Log.h"
00017 #include "TGo4AnalysisClientImp.h"
00018 #include "TGo4AnalysisImp.h"
00019 #include "TGo4RemoteCommand.h"
00020
00021 TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram() :
00022 TGo4AnalysisCommand("ANAddTreeHis","Add a tree histogram to dynamic list")
00023 {
00024 GO4TRACE((12,"TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram() ctor",__LINE__, __FILE__));
00025 SetProtection(kGo4ComModeController);
00026 }
00027
00028 TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram(const char* histogramname, const char* treename,const char* varexp, const char* cut) :
00029 TGo4AnalysisCommand("ANAddTreeHis","Add a tree histogram to dynamic list")
00030 {
00031 GO4TRACE((12,"TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram() ctor",__LINE__, __FILE__));
00032 SetReceiverName("AnalysisClient");
00033
00034 SetProtection(kGo4ComModeController);
00035 SetHistogramName(histogramname);
00036 SetTreeName(treename);
00037 SetVarexp(varexp);
00038 SetCut(cut);
00039
00040 }
00041
00042 TGo4ComAddTreeHistogram::~TGo4ComAddTreeHistogram()
00043 {
00044 GO4TRACE((12,"TGo4ComAddTreeHistogram::~TGo4ComAddTreeHistogram() dtor",__LINE__, __FILE__));
00045 }
00046
00047 void TGo4ComAddTreeHistogram::Set(TGo4RemoteCommand* remcom)
00048 {
00049 if(remcom==0) return;
00050 SetHistogramName(remcom->GetString(0));
00051 SetTreeName(remcom->GetString(1));
00052 SetVarexp(remcom->GetString(2));
00053 SetCut(remcom->GetString(3));
00054 }
00055
00056 Int_t TGo4ComAddTreeHistogram::ExeCom()
00057 {
00058 GO4TRACE((12,"TGo4ComAddTreeHistogram::ExeCom()",__LINE__, __FILE__));
00059
00060 TGo4AnalysisClient* cli = dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00061 if(cli)
00062 {
00063 TGo4Analysis* ana = TGo4Analysis::Instance();
00064
00065
00066 if(ana)
00067 {
00068 TString histo = fxHistoName;
00069 if (histo.Length()==0) histo = "hTreeDraw";
00070 Bool_t result= ana->AddTreeHistogram(histo.Data(),
00071 fxTreeName.Data(),
00072 fxVarexp.Data(),
00073 fxCut.Data());
00074 if(result)
00075 {
00076 cli->SendStatusMessage(1,kTRUE,TString::Format(
00077 "Added Dynamic histogram %s for tree %s.",
00078 fxHistoName.Data(),fxTreeName.Data()));
00079 }
00080 else
00081 {
00082 cli->SendStatusMessage(2,kTRUE,TString::Format(
00083 "Could not add Dynamic histogram %s for tree %s !!!",
00084 fxHistoName.Data(),fxTreeName.Data()));
00085 }
00086 }
00087 else
00088 {
00089 cli->SendStatusMessage(3, kTRUE,TString::Format(
00090 " %s ERROR no analysis ",GetName()));
00091
00092 }
00093 }
00094 else
00095 {
00096 GO4TRACE((11,"TGo4ComAddTreeHistogram::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
00097 TGo4Log::Debug(" !!! ComAddTreeHistogram ''%s'': NO RECEIVER ERROR!!!",GetName());
00098
00099 return 1;
00100 }
00101
00102 return -1;
00103 }