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