Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TGo4ComAddTreeHistogram.cxx

Go to the documentation of this file.
00001 //-------------------------------------------------------------
00002 //        Go4 Release Package v3.04-01 (build 30401)
00003 //                      28-November-2008
00004 //---------------------------------------------------------------
00005 //   The GSI Online Offline Object Oriented (Go4) Project
00006 //   Experiment Data Processing at EE department, GSI
00007 //---------------------------------------------------------------
00008 //
00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI
00010 //                    Planckstr. 1, 64291 Darmstadt, Germany
00011 //Contact:            http://go4.gsi.de
00012 //----------------------------------------------------------------
00013 //This software can be used under the license agreements as stated
00014 //in Go4License.txt file which is part of the distribution.
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");  // this command needs client as receiver
00035                                                  // to send back status message
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 //         TGo4Log::Debug(" !!! %s executing: adding tree histogram entry %s ",
00069 //            GetName(),fxHistoName.GetName());
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             }// if ana
00091          else
00092             {
00093                  cli->SendStatusMessage(3, kTRUE," %s ERROR no analysis ",
00094                                                  GetName());
00095 
00096             }
00097       } // if cli
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 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Fri Nov 28 12:59:04 2008 for Go4-v3.04-1 by  doxygen 1.4.2