// $Id$ //----------------------------------------------------------------------- // The GSI Online Offline Object Oriented (Go4) Project // Experiment Data Processing at EE department, GSI //----------------------------------------------------------------------- // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH // Planckstr. 1, 64291 Darmstadt, Germany // Contact: http://go4.gsi.de //----------------------------------------------------------------------- // This software can be used under the license agreements as stated // in Go4License.txt file which is part of the distribution. //----------------------------------------------------------------------- #include "TGo4ComAddTreeHistogram.h" #include "TGo4Log.h" #include "TGo4AnalysisClientImp.h" #include "TGo4AnalysisImp.h" #include "TGo4RemoteCommand.h" TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram() : TGo4AnalysisCommand("ANAddTreeHis","Add a tree histogram to dynamic list") { GO4TRACE((12,"TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram() ctor",__LINE__, __FILE__)); SetProtection(kGo4ComModeController); } TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram(const char *histogramname, const char *treename, const char *varexp, const char *cut) : TGo4AnalysisCommand("ANAddTreeHis","Add a tree histogram to dynamic list") { GO4TRACE((12,"TGo4ComAddTreeHistogram::TGo4ComAddTreeHistogram() ctor",__LINE__, __FILE__)); SetReceiverName("AnalysisClient"); // this command needs client as receiver // to send back status message SetProtection(kGo4ComModeController); SetHistogramName(histogramname); SetTreeName(treename); SetVarexp(varexp); SetCut(cut); } void TGo4ComAddTreeHistogram::Set(TGo4RemoteCommand *remcom) { if (!remcom) return; SetHistogramName(remcom->GetString(0)); SetTreeName(remcom->GetString(1)); SetVarexp(remcom->GetString(2)); SetCut(remcom->GetString(3)); } Int_t TGo4ComAddTreeHistogram::ExeCom() { GO4TRACE((12,"TGo4ComAddTreeHistogram::ExeCom()",__LINE__, __FILE__)); TGo4AnalysisClient *cli = dynamic_cast (fxReceiverBase); if (cli) { auto ana = TGo4Analysis::Instance(); if (ana) { TString histo = fxHistoName; if (histo.IsNull()) histo = "hTreeDraw"; Bool_t result = ana->AddTreeHistogram(histo.Data(), fxTreeName.Data(), fxVarexp.Data(), fxCut.Data()); if (result) { cli->SendStatusMessage( 1, kTRUE, TString::Format("Added Dynamic histogram %s for tree %s.", fxHistoName.Data(), fxTreeName.Data())); } else { cli->SendStatusMessage(2, kTRUE, TString::Format("Could not add Dynamic histogram %s for tree %s !!!", fxHistoName.Data(), fxTreeName.Data())); } } else { cli->SendStatusMessage(3, kTRUE, TString::Format(" %s ERROR no analysis ", GetName())); } } else { GO4TRACE((11, "TGo4ComAddTreeHistogram::ExeCom() - no receiver specified ERROR!", __LINE__, __FILE__)); TGo4Log::Debug(" !!! ComAddTreeHistogram ''%s'': NO RECEIVER ERROR!!!", GetName()); return 1; } return -1; }