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