Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/Go4CommandsAnalysis/TGo4ComCreateHistogram.cxx

Go to the documentation of this file.
00001 //---------------------------------------------------------------
00002 //        Go4 Release Package v2.10-5 (build 21005) 
00003 //                      03-Nov-2005
00004 //---------------------------------------------------------------
00005 //       The GSI Online Offline Object Oriented (Go4) Project
00006 //       Experiment Data Processing at DVEE 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 "TGo4ComCreateHistogram.h"
00017 
00018 #include "TROOT.h"
00019 #include "TH1.h"
00020 
00021 #include "Go4Log/TGo4Log.h"
00022 #include "Go4Analysis/TGo4AnalysisImp.h"
00023 #include "Go4AnalysisClient/TGo4AnalysisClientImp.h"
00024 
00025 TGo4ComCreateHistogram::TGo4ComCreateHistogram(const char* obname,  const char* classname)
00026 :TGo4ComCreateObject(obname,classname)
00027 {
00028    TRACE((12,"TGo4ComCreateHistogram::TGo4ComCreateHistogram(Text_t*,..) ctor",__LINE__, __FILE__));
00029    SetName("ANCreateHisto");
00030    fxHistoStatus.SetName(obname);
00031 }
00032 
00033 TGo4ComCreateHistogram::TGo4ComCreateHistogram() : TGo4ComCreateObject()
00034 {
00035    TRACE((12,"TGo4ComCreateHistogram::TGo4ComCreateHistogram() ctor",__LINE__, __FILE__));
00036    SetName("ANCreateHisto");
00037 }
00038 
00039 
00040 TGo4ComCreateHistogram::~TGo4ComCreateHistogram()
00041 {
00042    TRACE((12,"TGo4ComCreateHistogram::~TGo4ComCreateHistogram() dtor",__LINE__, __FILE__));
00043 }
00044 
00045 Int_t TGo4ComCreateHistogram::ExeCom()
00046 {
00047    TRACE((12,"TGo4ComCreateHistogram::ExeCom()",__LINE__, __FILE__));
00048 
00049    TGo4Analysis* ana=0;
00050    TGo4AnalysisClient* cli=dynamic_cast<TGo4AnalysisClient*> (fxReceiverBase);
00051    if(cli)
00052       {
00053          ana=TGo4Analysis::Instance();
00054          if(ana)
00055             {
00056                TObject* ob=0;
00057                TH1* his=dynamic_cast<TH1*> (CreateObject());
00058                if(his)
00059                   {
00060                   his->SetName(fxHistoStatus.GetName());
00061                   his->SetTitle(fxHistoStatus.GetTitle());
00062                   his->SetDirectory(gROOT);
00063                   //TAxis* xax=his->GetXaxis();
00064                   TAxis* yax=his->GetYaxis();
00065                   TAxis* zax=his->GetZaxis();
00066                   Int_t dimension=fxHistoStatus.GetDimension();
00067                   switch(dimension)
00068                      {
00069                          case 1:
00070                               yax->Set(1,0.,1.);
00071                               his->SetBins(fxHistoStatus.GetXbins(),
00072                                            fxHistoStatus.GetXmin(),
00073                                            fxHistoStatus.GetXmax());
00074                             break;
00075                          case 2:
00076 
00077                               yax->Set(1,0.,1.);
00078                               zax->Set(1,0.,1.);
00079                               his->SetBins(fxHistoStatus.GetXbins(),
00080                                            fxHistoStatus.GetXmin(),
00081                                            fxHistoStatus.GetXmax(),
00082                                            fxHistoStatus.GetYbins(),
00083                                            fxHistoStatus.GetYmin(),
00084                                            fxHistoStatus.GetYmax());
00085                             break;
00086 
00087                          case 3:
00088                               yax->Set(1,0.,1.);
00089                               zax->Set(1,0.,1.);
00090                               his->SetBins(fxHistoStatus.GetXbins(),
00091                                            fxHistoStatus.GetXmin(),
00092                                            fxHistoStatus.GetXmax(),
00093                                            fxHistoStatus.GetYbins(),
00094                                            fxHistoStatus.GetYmin(),
00095                                            fxHistoStatus.GetYmax(),
00096                                            fxHistoStatus.GetZbins(),
00097                                            fxHistoStatus.GetZmin(),
00098                                            fxHistoStatus.GetZmax());
00099                             break;
00100 
00101                         default:
00102                            cli->SendStatusMessage(3, kFALSE,"ERROR on creating new histogram %s: no dimension specified !!! ",
00103                                                     GetObjectName());
00104                            delete his;
00105                            return 1;
00106                            break;
00107 
00108                      }
00109 
00110                   Bool_t ok=ana->AddHistogram(his);
00111                   if(ok)
00112                      {
00113                        his->SetBit(TGo4Status::kGo4CanDelete); // dynamic objects may be deleted from gui
00114                        cli->SendStatusMessage(1, kFALSE,"Added new histogram %s to Go4 folders.",
00115                                                    GetObjectName());
00116                      }
00117                   else
00118                      {
00119                         cli->SendStatusMessage(3, kFALSE,"ERROR on adding new histogram %s ",
00120                                                     GetObjectName());
00121                         delete his;
00122                      } // if(ok)
00123 
00124                   } // if(his)
00125               else
00126                 {
00127                   cli->SendStatusMessage(3, kFALSE,"ERROR on creating new histogram %s ",
00128                                                     GetObjectName());
00129                   delete ob;
00130                 }
00131 
00132             }
00133          else
00134             {
00135                      cli->SendStatusMessage(3, kTRUE," %s ERROR no analysis",
00136                                                  GetName());
00137             } // if(ana)
00138 
00139 
00140 
00141       }
00142    else
00143       {
00144       TRACE((11,"TGo4ComCreateHistogram::ExeCom() - no receiver specified ERROR!",__LINE__, __FILE__));
00145          TGo4Log::Debug(" !!! ComInitAnalysis ''%s'': NO RECEIVER ERROR!!!",GetName());
00146          return 1;
00147       }
00148 
00149    return -1;
00150 }
00151 
00152 //----------------------------END OF GO4 SOURCE FILE ---------------------

Generated on Tue Nov 8 10:55:50 2005 for Go4-v2.10-5 by doxygen1.2.15