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

TGo4AnalysisImp.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 "TGo4AnalysisImp.h"
00017 
00018 #include <stdexcept>
00019 #include "stdio.h"
00020 #include "Riostream.h"
00021 
00022 #include "TSystem.h"
00023 #include "TInterpreter.h"
00024 #include "TNamed.h"
00025 #include "TApplication.h"
00026 #include "TH1.h"
00027 #include "TTree.h"
00028 #include "TCanvas.h"
00029 #include "TFolder.h"
00030 #include "TFile.h"
00031 #include "TMutex.h"
00032 #include "TROOT.h"
00033 #include "TStopwatch.h"
00034 #include "snprintf.h"
00035 
00036 #include "TGo4Log.h"
00037 #include "TGo4LockGuard.h"
00038 #include "TGo4Thread.h"
00039 #include "TGo4CommandInvoker.h"
00040 #include "TGo4AnalysisCommandList.h"
00041 #include "TGo4UserException.h"
00042 #include "TGo4TaskHandler.h"
00043 
00044 #include "TGo4Version.h"
00045 #include "TGo4AnalysisStepManager.h"
00046 #include "TGo4AnalysisObjectManager.h"
00047 #include "TGo4AnalysisObjectNames.h"
00048 #include "TGo4AnalysisStatus.h"
00049 #include "TGo4AnalysisStep.h"
00050 #include "TGo4AnalysisClientImp.h"
00051 #include "TGo4HistogramStatus.h"
00052 #include "TGo4DynamicListException.h"
00053 #include "TGo4Condition.h"
00054 #include "TGo4Parameter.h"
00055 #include "TGo4Picture.h"
00056 #include "TGo4Fitter.h"
00057 #include "TGo4ObjectStatus.h"
00058 #include "TGo4EventStoreParameter.h"
00059 #include "TGo4EventSourceParameter.h"
00060 #include "TGo4EventProcessorParameter.h"
00061 #include "TGo4EventElement.h"
00062 #include "TGo4EventStore.h"
00063 #include "TGo4EventSource.h"
00064 #include "TGo4EventProcessor.h"
00065 #include "TGo4EventErrorException.h"
00066 #include "TGo4EventTimeoutException.h"
00067 #include "TGo4EventEndException.h"
00068 #include "TGo4CompositeEvent.h"
00069 #include "TGo4AnalysisStepException.h"
00070 #include "TGo4TreeStructure.h"
00071 
00072 #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
00073 #include "TCint.h"
00074 #endif
00075 const Int_t TGo4Analysis::fgiGO4VERSION = __GO4BUILDVERSION__;
00076 
00077 TGo4Analysis* TGo4Analysis::fxInstance = 0;
00078 Bool_t TGo4Analysis::fbExists=kFALSE;
00079 const Int_t TGo4Analysis::fgiAUTOSAVECOUNTS= 500;
00080 const Int_t TGo4Analysis::fgiDYNLISTINTERVAL= 1000;
00081 const Int_t TGo4Analysis::fgiMACROSTARTPOLL= 1000; //polling time for macro in WaitForStart
00082 const Text_t TGo4Analysis::fgcDEFAULTFILENAME[]="Go4AutoSave.root";
00083 const Text_t TGo4Analysis::fgcDEFAULTSTATUSFILENAME[]="Go4AnalysisPrefs.root";
00084 const Text_t TGo4Analysis::fgcDEFAULTFILESUF[]=".root";
00085 const Text_t TGo4Analysis::fgcTOPDYNAMICLIST[]="Go4DynamicList";
00086 
00087 TGo4Analysis* TGo4Analysis::Instance()
00088 {
00089 TRACE((14,"TGo4Analysis::Instance()",__LINE__, __FILE__));
00090    if(fxInstance==0)
00091       {
00092          fxInstance=new TGo4Analysis;
00093          fbExists=kTRUE;
00094       }
00095    else
00096       {
00097          // instance already there
00098       }
00099    return fxInstance;
00100 }
00101 
00102 Bool_t TGo4Analysis::Exists()
00103 {
00104    return fbExists;
00105 }
00106 
00107 
00108 TGo4Analysis::TGo4Analysis()
00109    :    TGo4CommandReceiver(), TObject(),
00110       fbInitIsDone(kFALSE),fbAutoSaveOn(kTRUE),fxAnalysisSlave(0),
00111       fxStepManager(0), fxObjectManager(0),
00112       fiAutoSaveCount(0), fiAutoSaveInterval(TGo4Analysis::fgiAUTOSAVECOUNTS), fiAutoSaveCompression(5),
00113       fxAutoFile(0), fbAutoSaveOverwrite(kFALSE), fbNewInputFile(kFALSE), fbAutoSaveFileChange(kFALSE), fxSampleEvent(0), fxObjectNames(0)
00114 {
00115 TRACE((15,"TGo4Analysis::TGo4Analysis()",__LINE__, __FILE__));
00116    //
00117    if(! ( TGo4Version::Instance()->CheckVersion(TGo4Analysis::fgiGO4VERSION) ) )
00118       {
00119          // wrong version number between framework and user executable
00120          Message(-1,"!!!! Analysis Base class:\n\t User Analysis was built with wrong \t\tGo4 Buildversion %d !!!!!",
00121                TGo4Version::Instance()->GetBuildVersion());
00122          Message(-1,"\t Please rebuild your analysis with current \tGo4 Buildversion %d ",
00123                      fgiGO4VERSION);
00124          Message(-1,"\t >>make clean all<<");
00125          Message(-1,"Aborting in 20 s...");
00126          gSystem->Sleep(20000);
00127          gApplication->Terminate();
00128       }
00129    else
00130       {
00131           // may not disable output of version number:
00132         Message(-1,"Welcome to Go4 Analysis Framework Release %s (build %d) !",
00133                      __GO4RELEASE__ , fgiGO4VERSION);
00134       }
00135    if(fxInstance==0)
00136       {
00137          gROOT->SetBatch(kTRUE);
00138          fxStepManager=new TGo4AnalysisStepManager("Go4 Analysis Step Manager");
00139          fxObjectManager=new TGo4AnalysisObjectManager("Go4 Central Object Manager");
00140          SetDynListInterval(TGo4Analysis::fgiDYNLISTINTERVAL);
00141          fxAutoSaveMutex =   new TMutex(kTRUE);
00142          fxAutoSaveClock=new TStopwatch;
00143          fxAutoSaveClock->Stop();
00144          fxAutoFileName=fgcDEFAULTFILENAME;
00145          fxConfigFilename=fgcDEFAULTSTATUSFILENAME;
00146          TGo4CommandInvoker::Instance(); // make sure we have an invoker instance!
00147          TGo4CommandInvoker::SetCommandList(new TGo4AnalysisCommandList);
00148          TGo4CommandInvoker::Register("Analysis",this); // register as command receiver at the global invoker
00149          fxInstance=this; // for ctor usage from derived user subclass
00150          fbExists=kTRUE;
00151       }
00152    else
00153       {
00154          // instance already there
00155          Message(2,"Analysis BaseClass ctor -- analysis singleton already exists !!!");
00156       }
00157       // settings for macro execution
00158       gROOT->ProcessLine("TGo4Analysis *go4 = TGo4Analysis::Instance();");
00159       gROOT->ProcessLine(".x $GO4SYS/Go4Analysis/anamacroinit.C");
00160 }
00161 
00162 TGo4Analysis::~TGo4Analysis()
00163 {
00164 TRACE((15,"TGo4Analysis::~TGo4Analysis()",__LINE__, __FILE__));
00165 CloseAnalysis();
00166 //cout <<"after close analysis." << endl;
00167 CloseAutoSaveFile();
00168 delete fxStepManager;
00169 delete fxObjectManager;
00170 if(fxObjectNames)
00171    {
00172       delete fxObjectNames;
00173       //cout <<"deleted namesobject" << endl;
00174    }
00175 delete fxAutoSaveClock;
00176 delete fxSampleEvent;
00177 TGo4CommandInvoker::UnRegister(this);
00178 fxInstance=0; // reset static singleton instance pointer
00179 //gROOT->ProcessLine(".x $GO4SYS/Go4Analysis/anamacroclose.C");
00180 //cout <<"end of dtor" << endl;
00181 }
00182 
00184 // Initialization and analysis defining methods:
00185 
00186 Bool_t TGo4Analysis::InitEventClasses()
00187 {
00188 TRACE((14,"TGo4Analysis::InitEventClasses()",__LINE__, __FILE__));
00189    //
00190    Bool_t rev=kTRUE;
00191    if(!fbInitIsDone)
00192       {
00193          Message(0,"Analysis BaseClass --  Initializing EventClasses...");
00194          LoadObjects(); // always use autosave file to get last objects list
00195          rev=fxStepManager->InitEventClasses();
00196          UpdateNamesList();
00197          Message(-1,"Analysis BaseClass --  Initializing EventClasses done.");
00198          fbInitIsDone=kTRUE;
00199       }
00200       else
00201          {
00202             Message(-1,"Analysis BaseClass --  EventClasses were already initialized.");
00203             rev=kTRUE;
00204          }
00205       return rev;
00206 }
00207 
00209 // main event cycle methods:
00210 
00211 Int_t TGo4Analysis::MainCycle()
00212 {
00213 TRACE((11,"TGo4Analysis::MainCycle()",__LINE__, __FILE__));
00214    if(fbInitIsDone)
00215       {
00216          {
00217          TGo4LockGuard mainlock; // protect analysis, but not status buffer
00218             fiAutoSaveCount++;
00219             ProcessAnalysisSteps();
00220             UserEventFunc();
00221             fxObjectManager->ProcessDynamicList();
00222             Double_t rt=fxAutoSaveClock->RealTime();
00223 
00224    //         if( (fiAutoSaveInterval!=0) && (fiAutoSaveCount > fiAutoSaveInterval) )
00225             if( (fiAutoSaveInterval!=0) && (rt > (Double_t) fiAutoSaveInterval) )
00226                   {
00227                   if(fbAutoSaveOn)
00228                      Message(0,"Analysis: Main Cycle Autosaving after %.2f s (%d events).",rt,fiAutoSaveCount);
00229                   AutoSave();
00230                   fiAutoSaveCount=0;
00231                   fxAutoSaveClock->Start(kTRUE);
00232                }
00233             else
00234                {
00235                   fxAutoSaveClock->Continue();
00236                }
00237          } //TGo4LockGuard main;
00238           if(fxAnalysisSlave)
00239              {
00240                   fxAnalysisSlave->UpdateRate();
00241                   if(fxAnalysisSlave->TestBufferUpdateConditions())
00242                     {
00243                        fxAnalysisSlave->UpdateStatusBuffer();
00244                        // note: creation of status buffer uses mainlock internally now
00245                        // status mutex required to be outside main mutex always JA
00246                     }
00247              }
00248       }
00249    else
00250       {
00251          throw TGo4UserException(3,"Analysis not yet initialized");
00252       }
00253    return 0;
00254 }
00255 
00256 Int_t TGo4Analysis::UserEventFunc()
00257 {
00258    TRACE((11,"TGo4Analysis::UserEventFunc()",__LINE__, __FILE__));
00259    return 0;
00260 }
00261 
00262 
00263 Int_t TGo4Analysis::Process()
00264 {
00265 TRACE((11,"TGo4Analysis::Process()",__LINE__, __FILE__));
00266 Int_t rev=0;
00267 #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
00268 Bool_t unlockedcint=kFALSE;
00269 if(gCINTMutex)
00270     {
00271         gCINTMutex->UnLock();
00272         unlockedcint=kTRUE;
00273         //cout <<"Process() Unlocked cint mutex..." << endl;
00274     }
00275 #endif
00276 
00277 try
00278 {
00279 if(fxAnalysisSlave)
00280    {
00281        gSystem->ProcessEvents(); // ensure cintlocktimer to give mainlock back
00282        //if(!IsRunning()) TGo4Thread::Sleep(200);
00283        //TGo4Thread::Sleep(50);   // give  other threads time to operate
00284    }
00285 {
00286    //TGo4LockGuard mainlock; // moved to MainCycle
00287    if(!IsRunning())
00288    {
00289         rev=-1;
00290    }
00291    //return -1;
00292    else
00293    {
00294        TDirectory* savdir=gDirectory;
00295        gROOT->cd(); // necessary for dynamic list scope
00296        MainCycle();
00297        savdir->cd();
00298    }
00299 }
00300 
00301 }
00303 // begin catch block
00304 catch(TGo4EventTimeoutException& ex)
00305 {
00306    {
00307    TGo4LockGuard global;
00308       ex.Handle(); // display exception on terminal in case of debug
00309    }
00310    if(TGo4Log::GetIgnoreLevel()<1)
00311       {
00312          // only display message if debug output enabled
00313          Message(2,"Analysis %s TIMEOUT for eventsource %s:%s.",
00314                   GetName(), ex.GetSourceClass(), ex.GetSourceName());
00315       } else{}
00316     //return 0;
00317 }
00318 catch(TGo4EventEndException& ex)
00319 {
00320 Message(2,"End Of Eventsource %s:%s - %s",
00321                                  ex.GetSourceClass(),
00322                                  ex.GetSourceName(),ex.GetErrMess());
00323 if(IsErrorStopEnabled())
00324    {
00325       if(fxAnalysisSlave) fxAnalysisSlave->Stop();
00326       //return -1;
00327       rev=-1;
00328    }
00329 //return 0;
00330 }
00331 catch(TGo4EventErrorException& ex)
00332 {
00333    //ex.Handle();
00334    Int_t prio=ex.GetPriority();
00335    if(prio==0)
00336       {
00337          // only display message without stop
00338          Message(1,"Eventsource %s:%s - %s",
00339                                  ex.GetSourceClass(),
00340                                  ex.GetSourceName(),ex.GetErrMess());
00341       }
00342    else
00343       {
00344          Message(3,"Analysis %s ERROR: %s from eventsource %s:%s",
00345                            GetName(),ex.GetErrMess(),
00346                            ex.GetSourceClass(), ex.GetSourceName());
00347       if(IsErrorStopEnabled())
00348          {
00349             if(fxAnalysisSlave) fxAnalysisSlave->Stop();
00350             //return -1;
00351             rev=-1;
00352          }
00353       }
00354    //return 0;
00355 }
00356 
00357 catch(TGo4DynamicListException& ex)
00358 {
00359    {
00360    TGo4LockGuard global;
00361       ex.Handle();
00362    }
00363    Message(3,"Analysis %s ERROR: %s from dynamic list entry %s:%s",
00364                            GetName(),ex.GetStatusMessage(),
00365                            ex.GetEntryName(), ex.GetEntryClass());
00366    if(IsErrorStopEnabled())
00367       {
00368          if(fxAnalysisSlave) fxAnalysisSlave->Stop();
00369          //return -1;
00370          rev=-1;
00371       }
00372    //return 0;
00373 }
00374 
00375 catch(TGo4AnalysisStepException& ex)
00376 {
00377    TGo4LockGuard global;
00378    ex.Handle();
00379    Message(3,"Analysis %s ERROR: %s in Analysis Step %s",
00380                            GetName(), ex.GetStatusMessage(), ex.GetStepName());
00381    if(IsErrorStopEnabled())
00382       {
00383          if(fxAnalysisSlave) fxAnalysisSlave->Stop();
00384          //return -1;
00385          rev=-1;
00386       }
00387    //return 0;
00388 }
00389 
00390 catch(TGo4UserException& ex)
00391 {
00392    //{TGo4LockGuard global;
00393    //ex.Handle();}
00394    Message(ex.GetPriority(), ex.GetMessage() );
00395    if(IsErrorStopEnabled() && ex.GetPriority()>2)
00396          {
00397             if(fxAnalysisSlave) fxAnalysisSlave->Stop(); // only stop for errors, warnings and infos continue loop!
00398             //return -1;
00399             rev=-1;
00400 
00401          }
00402    //return 0;
00403 }
00404 
00405 catch(std::exception& ex) // treat standard library exceptions
00406 {
00407    Message(3,"Analysis %s got standard exception %s",
00408                            GetName(), ex.what());
00409    if(IsErrorStopEnabled())
00410       {
00411          if(fxAnalysisSlave) fxAnalysisSlave->Stop();
00412          //return -1;
00413          rev=-1;
00414       }
00415    //return 0;
00416 }
00417 // end catch block
00419 #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
00420 
00421 if(gCINTMutex && unlockedcint)
00422 {
00423     gCINTMutex->Lock();
00424     //cout <<"PPPProcess() locked cint mutex..." << endl;
00425 }
00426 
00427 #endif
00428 return rev;
00429 }
00430 
00431 
00432 
00433 Int_t TGo4Analysis::RunImplicitLoop(Int_t times)
00434 {
00435 TRACE((11,"TGo4Analysis::RunImplicitLoop(Int_t)",__LINE__, __FILE__));
00436    Int_t i=0; // number of actually processed events
00437 try
00438 {
00439    PreLoop();
00440    Message(-1,"Analysis Implicit Loop for %d cycles is starting...",
00441             times);
00442    for(i=0; i<times; ++i)
00443       {
00444             try
00445                {
00446                   MainCycle();
00447                }
00448             catch(TGo4UserException& ex)
00449                {
00450                   if(ex.GetPriority()>2)
00451                      {
00452                         PostLoop();
00453                         throw;   // errors: stop event loop
00454                      }
00455                   else
00456                      {
00457                         ex.Handle(); // warnings and infos: continue loop after display message
00458                      }
00459                }
00460              catch(TGo4EventErrorException& ex)
00461                {
00462                   if(ex.GetPriority()>0)
00463                      {
00464                         Message(ex.GetPriority(),"%s",ex.GetErrMess());
00465                         PostLoop();
00466                         throw;   // errors: stop event loop
00467                      }
00468                   else
00469                      {
00470                         Message(1,"Eventsource %s:%s %s",ex.GetSourceClass(),
00471                                  ex.GetSourceName(),ex.GetErrMess());
00472                         ex.Handle(); // infos: continue loop after display message
00473                      }
00474                }
00475 
00476             catch(...)
00477                {
00478                   PostLoop(); // make sure that postloop is executed for all exceptions
00479                   throw;
00480                }
00482       }// for
00483 
00484    Message(-1,"Analysis Implicit Loop has finished after %d cycles.",
00485             i);
00486    PostLoop();
00487 } //  try
00488 
00489 catch(TGo4Exception& ex)
00490 {
00491   Message(-1,"%s appeared after %d cycles.",
00492             ex.What(),i);
00493   ex.Handle();
00494 }
00495 catch(std::exception& ex) // treat standard library exceptions
00496 {
00497   Message(-1,"standard exception %s appeared after %d cycles.",
00498             ex.what(),i);
00499 }
00500 catch(...)
00501 {
00502   Message(-1,"!!! Unexpected exception after %d cycles !!!",i);
00503 }
00505    return i;
00506 }
00507 
00509 // dynamic list stuff:
00510 
00511 
00512 Bool_t TGo4Analysis::RemoveDynamicEntry(const Text_t * entryname, const Text_t* listname)
00513 {
00514    TRACE((11,"TGo4Analysis::RemoveDynamicEntry(const Text_t *, const Text_t* )",__LINE__, __FILE__));
00515    Bool_t rev=fxObjectManager->RemoveDynamicEntry(entryname);
00516    if(rev) UpdateNamesList();
00517    return rev;
00518 }
00519 
00520 
00521 
00523 // status related methods:
00524 
00525 void TGo4Analysis::UpdateStatus(TGo4AnalysisStatus* state)
00526 {
00527 TRACE((11,"TGo4Analysis::UpdateStatus(TGo4AnalysisStatus*)",__LINE__, __FILE__));
00528    fxStepManager->UpdateStatus(state);
00529    if(state!=0)
00530       {
00531          state->SetAutoSaveInterval(fiAutoSaveInterval);
00532          state->SetAutoFileName(fxAutoFileName);
00533          state->SetAutoSaveCompression(fiAutoSaveCompression);
00534          state->SetAutoSaveOverwrite(fbAutoSaveOverwrite);
00535          state->SetAutoSaveOn(fbAutoSaveOn);
00536          state->SetConfigFileName(fxConfigFilename.Data());
00537       } // if(state!=0)
00538    else
00539       { }
00540 }
00541 
00542 void TGo4Analysis::SetStatus(TGo4AnalysisStatus * state)
00543 {
00544    TRACE((11,"TGo4Analysis::SetStatus(TGo4AnalysisStatus*)",__LINE__, __FILE__));
00545    if(state!=0)
00546       {
00547          // first we close down exisiting  analysis:
00548          CloseAnalysis();
00549          SetAutoSaveInterval(state->GetAutoSaveInterval());
00550          SetAutoSave(state->IsAutoSaveOn());
00551          SetAutoSaveFile(state->GetAutoFileName(),
00552                          state->IsAutoSaveOverwrite(),
00553                          state->GetAutoSaveCompression()
00554                                                             );
00555          fxStepManager->SetStatus(state);
00556       } // if(state!=0)
00557    else
00558       {
00559          // no state to set
00560       }
00561 }
00562 
00563 
00564 Bool_t TGo4Analysis::LoadStatus(const Text_t * filename)
00565 {
00566    TRACE((11,"TGo4Analysis::LoadStatus(const Text_t*)",__LINE__, __FILE__));
00567    //
00568    Bool_t rev=kFALSE;
00569    Int_t buflen=1024;
00570    Text_t buffer[1024];
00571    if(filename)
00572       {
00573           strncpy(buffer,filename,buflen-100);
00574       }
00575    else
00576       {
00577          strncpy(buffer,fgcDEFAULTSTATUSFILENAME,buflen-100);
00578       }
00579 
00580    if(!strstr(buffer,fgcDEFAULTFILESUF))
00581       {
00582          strcat(buffer,fgcDEFAULTFILESUF); // file suffix if not given by user
00583       }
00584    else {}
00585 
00586    TFile* statusfile = new TFile(buffer,"READ");
00587    if(statusfile && statusfile->IsOpen())
00588       {
00589          TGo4AnalysisStatus* state=
00590             dynamic_cast<TGo4AnalysisStatus*>( statusfile->Get( GetName() ) );
00591                // name of status object is name of analysis itself
00592          if(state)
00593             {
00594                Message(1,"Analysis: Found status object in file %s: %s",
00595                   buffer,GetName());
00596                SetStatus(state);
00597                fxConfigFilename=buffer; // remember last configuration file name
00598                Message(0,"Analysis: New analysis state is set.");
00599                rev=kTRUE;
00600             }
00601          else
00602             {
00603                Message(3,"Analysis LoadStatus: Could not find status %s in file %s",
00604                     GetName(),buffer);
00605                rev=kFALSE;
00606             }   // if(state)
00607          delete statusfile;
00608 
00609       }
00610    else
00611       {
00612          Message(3,"Analysis LoadStatus: Failed to open file %s",
00613                     buffer);
00614                rev=kFALSE;
00615          delete statusfile;
00616       }  //  if(statusfile && statusfile->IsOpen())
00617 
00618    return rev;
00619 }
00620 
00621 Bool_t TGo4Analysis::SaveStatus(const Text_t* filename)
00622 {
00623    TRACE((11,"TGo4Analysis::SaveStatus(const Text_t*)",__LINE__, __FILE__));
00624    Bool_t rev=kFALSE;
00625    Int_t buflen=1024;
00626    Text_t buffer[1024];
00627    if(filename)
00628       {
00629          strncpy(buffer,filename,buflen-100);
00630       }
00631    else
00632       {
00633          strncpy(buffer,fgcDEFAULTSTATUSFILENAME,buflen-100);
00634       }
00635    if(!strstr(buffer,fgcDEFAULTFILESUF))
00636       {
00637          strcat(buffer,fgcDEFAULTFILESUF); // file suffix if not given by user
00638       }
00639    else {}
00640    TFile* statusfile = new TFile(buffer,"RECREATE");
00641    if(statusfile && statusfile->IsOpen())
00642       {
00643          fxConfigFilename=buffer; // remember name of status
00644          statusfile->cd();
00645          TGo4AnalysisStatus* state= CreateStatus();
00646          if(state)
00647             {
00648                state->Write();
00649                delete state;
00650                delete statusfile;
00651                rev=kTRUE;
00652                Message(-1,"Analysis SaveStatus: Saved Analysis settings to file %s",
00653                            buffer);
00654             }
00655          else
00656             {
00657                Message(3,"Analysis SaveStatus: FAILED to create status object !!!");
00658                rev=kFALSE;
00659             }
00660       }
00661    else
00662       {
00663          Message(3,"Analysis SaveStatus: Failed to open file %s ",
00664                     buffer);
00665                rev=kFALSE;
00666       }  // if(statusfile && statusfile->IsOpen())
00667    return rev;
00668 }
00669 
00670 TGo4AnalysisStatus* TGo4Analysis::CreateStatus()
00671 {
00672    TRACE((11,"TGo4Analysis::CreateStatus()",__LINE__, __FILE__));
00673    TDirectory* filsav=gDirectory;
00674    gROOT->cd();
00675    TGo4AnalysisStatus* state= new TGo4AnalysisStatus(GetName());
00676    UpdateStatus(state);
00677    filsav->cd();
00678    return state;
00679 }
00680 
00681 void TGo4Analysis::Print(Option_t*) const
00682 {
00683    TGo4Analysis* localthis=const_cast<TGo4Analysis*>(this);
00684    TGo4AnalysisStatus* state=localthis->CreateStatus();
00685    state->PrintStatus();
00686    delete state;
00687 }
00688 
00689 TTree* TGo4Analysis::CreateSingleEventTree(TGo4EventElement* event)
00690 {
00691 TRACE((11,"TGo4Analysis::CreateSingleEventTree(TGo4EventElement*)",__LINE__, __FILE__));
00692    //
00693    if(event==0) return 0;
00694    TDirectory* filsav=gDirectory;
00695    gROOT->cd();
00696    delete fxSampleEvent;
00697    fxSampleEvent=(TGo4EventElement*) event->Clone();
00698    TTree* thetree= new TTree(fxSampleEvent->GetName(), "Single Event Tree");
00699    thetree->SetDirectory(0);
00700    TBranch *topbranch=
00701       thetree->Branch("Go4EventSample", fxSampleEvent->ClassName(), &fxSampleEvent, 64000, 99);
00702    if (fxSampleEvent->InheritsFrom("TGo4CompositeEvent"))
00703        dynamic_cast<TGo4CompositeEvent*>  (fxSampleEvent)->makeBranch(topbranch);
00704    thetree->Fill();
00705    filsav->cd();
00706    return thetree;
00707 
00708 }
00709 
00710 TTree* TGo4Analysis::CreateSingleEventTree(const Text_t* name, Bool_t isoutput)
00711 {
00712    TRACE((11,"TGo4Analysis::CreateSingleEventTree(const Text_t*, Bool_t)",__LINE__, __FILE__));
00713    //
00714    TGo4EventElement* event=0;
00715    if(isoutput) event=GetOutputEvent(name);
00716            else event=GetInputEvent(name);
00717    if(event==0)
00718       {
00719          // event step of name does not exists, we search event in folder:
00720          event=GetEventStructure(name);
00721       }
00722    return CreateSingleEventTree(event);
00723 }
00724 
00725 
00726 
00727 
00728 
00729 void TGo4Analysis::CloseAnalysis()
00730 {
00731 TRACE((14,"TGo4Analysis::CloseAnalysis()",__LINE__, __FILE__));
00732    //
00733    if(fbInitIsDone)
00734       {
00735          AutoSave();
00736          fxStepManager->CloseAnalysis();
00737          fxObjectManager->CloseAnalysis();
00738          fbInitIsDone=kFALSE;
00739       }
00740    else {}
00741 }
00742 
00743 Int_t TGo4Analysis::PreLoop()
00744 {
00745 TRACE((11,"TGo4Analysis:PreLoop()",__LINE__, __FILE__));
00746    TGo4LockGuard  autoguard(fxAutoSaveMutex);
00747       // avoid conflict with possible user object modifications during startup autosave!
00748    Int_t rev=0;
00749    fiAutoSaveCount=0;
00750    rev=UserPreLoop();
00751    fxAutoSaveClock->Start(kTRUE);
00752    return rev;
00753 }
00754 
00755 Int_t TGo4Analysis::PostLoop()
00756 {
00757 TRACE((11,"TGo4Analysis::PostLoop()",__LINE__, __FILE__));
00758    TGo4LockGuard  autoguard(fxAutoSaveMutex);
00759    Int_t rev=0;
00761 //   TTree* mytree=CreateSingleEventTree("Unpack");
00762 //   TFile* myfile=new TFile("eventsample.root","RECREATE");
00763 //   mytree->SetDirectory(myfile);
00764 //   mytree->Write();
00765 //   delete myfile;
00766 //   cout <<"___________Wrote eventsample to file eventsample.root" << endl;
00768    if(fbInitIsDone)   rev=UserPostLoop(); // do not call userpostloop after error in initialization
00769    return rev;
00770 }
00771 
00772 Int_t TGo4Analysis::UserPreLoop()
00773 {
00774 TRACE((11,"TGo4Analysis::UserPreLoop()",__LINE__, __FILE__));
00775    //
00776    Message(0,"Analysis BaseClass --  executing default User Preloop");
00777    return 0;
00778 }
00779 
00780 Int_t TGo4Analysis::UserPostLoop()
00781 {
00782 TRACE((11,"TGo4Analysis::UserPostLoop()",__LINE__, __FILE__));
00783    //
00784    Message(0,"Analysis BaseClass --  executing default User Postloop");
00785    return 0;
00786 }
00787 
00788 void TGo4Analysis::SetAutoSaveFile(const Text_t * filename, Bool_t overwrite, Int_t compression)
00789 {
00790 //   if(!fbAutoSaveOn) return; // do not set autosave file if disabled!
00791    //TGo4LockGuard  autoguard(fxAutoSaveMutex);
00792    Int_t buflen=1024;
00793    Text_t buffer[1024];
00794    if(filename)
00795       {
00796          strncpy(buffer,filename,buflen);
00797       }
00798    else
00799       {
00800          strncpy(buffer,fgcDEFAULTFILENAME,buflen);
00801       }
00802    if(!strstr(buffer,fgcDEFAULTFILESUF))
00803       {
00804          strncat(buffer,fgcDEFAULTFILESUF,buflen-1); // file suffix if not given by user
00805       }
00806    else {}
00807    // new: just set parameters, do not open file here:
00808    fxAutoFileName=buffer;
00809    fiAutoSaveCompression=compression;
00810    fbAutoSaveOverwrite=overwrite;
00811 }
00812 
00813 
00814 Int_t TGo4Analysis::LockAutoSave()
00815 {
00816 TRACE((12,"TGo4Analysis::LockAutoSave()",__LINE__, __FILE__));
00817    Int_t rev;
00818    if(TThread::Exists()>0 && fxAutoSaveMutex)
00819       {
00820          rev=fxAutoSaveMutex->Lock();
00821       }
00822    else
00823       {
00824          rev=-1;
00825       }
00826 
00827    return rev;
00828 }
00829 
00830 Int_t TGo4Analysis::UnLockAutoSave()
00831 {
00832 TRACE((12,"TGo4Analysis::UnLockAutoSave()",__LINE__, __FILE__));
00833    Int_t rev;
00834    if(TThread::Exists()>0 && fxAutoSaveMutex)
00835       {
00836          rev=fxAutoSaveMutex->UnLock();
00837       }
00838    else
00839       {
00840          rev=-1;
00841       }
00842 
00843    return rev;
00844 }
00845 
00846 
00847 
00848 void TGo4Analysis::AutoSave()
00849 {
00850 TRACE((12,"TGo4Analysis::AutoSave()",__LINE__, __FILE__));
00851    //
00852    if(!fbAutoSaveOn) return;
00853    TGo4LockGuard  autoguard(fxAutoSaveMutex);
00854    Message(0,"Analysis  --  AutoSaving....");
00855    //UpdateNamesList();
00856    fxStepManager->AutoSave();
00857    Bool_t oldmode=fbAutoSaveOverwrite;
00858    fbAutoSaveOverwrite=kTRUE; // force overwriting old file when saving
00859    OpenAutoSaveFile();
00860    fxObjectManager->SaveObjects(fxAutoFile);
00861    CloseAutoSaveFile();
00862    fbAutoSaveOverwrite=oldmode;
00863    Message(0,"Analysis  --  AutoSave done.");
00864 }
00865 
00866 void TGo4Analysis::OpenAutoSaveFile()
00867 {
00868 if(!fbAutoSaveOn) return;
00869 TGo4LockGuard  autoguard(fxAutoSaveMutex);
00870 gROOT->cd();
00871 if(fbAutoSaveOverwrite)
00872    {
00873       delete fxAutoFile;
00874       fxAutoFile = new TFile(fxAutoFileName.Data() ,"RECREATE");
00875       Message(-1,"Opening AutoSave file %s , RECREATE mode",fxAutoFileName.Data());
00876    }
00877 else
00878    {
00879       if(fxAutoFile==0)
00880          {
00881          fxAutoFile = new TFile(fxAutoFileName.Data(),"UPDATE");
00882          Message(-1,"Opening AutoSave file %s , UPDATE mode",fxAutoFileName.Data());
00883          }
00884       else
00885          {
00886              Message(-1,"Reusing AutoSave file %s , UPDATE mode",fxAutoFileName.Data());
00887          }
00888   } // if(fbAutoSaveOverwrite)
00889 fxAutoFile->SetCompressionLevel(fiAutoSaveCompression);
00890 gROOT->cd();
00891 }
00892 
00893 
00894 void TGo4Analysis::CloseAutoSaveFile()
00895 {
00896 if(fxAutoFile)
00897       {
00898          TGo4LockGuard  autoguard(fxAutoSaveMutex);
00899          delete fxAutoFile;
00900          fxAutoFile=0;
00901          Message(-1,"AutoSave file %s was closed.",fxAutoFileName.Data());
00902       }
00903 else {}
00904 
00905 }
00906 
00907 
00908 
00909 void TGo4Analysis::UpdateNamesList()
00910 {
00911 TRACE((11,"TGo4Analysis::UpdateNamesList()",__LINE__, __FILE__));
00912    //
00913 //cout <<"UpdateNamesList: current dir:"<< gDirectory->GetName() << endl;
00914 // first try: update all
00915 delete fxObjectNames;
00916 fxObjectNames = CreateNamesList();
00917 Message(0,"Analysis BaseClass --  Nameslist updated.");
00918 // debug:
00919 //   fxObjectNames->PrintStatus();
00920 }
00921 
00922 
00923 
00924 Bool_t TGo4Analysis::LoadObjects(const Text_t * filename)
00925 {
00926 TGo4LockGuard  autoguard(fxAutoSaveMutex);
00927 Bool_t rev=kTRUE;
00928 if(filename) fxAutoFileName=filename;
00929 OpenAutoSaveFile();
00930 if(fxAutoFile && fxAutoFile->IsOpen())
00931    {
00932      Message(-1,"Analysis LoadObjects: Loading from autosave file %s ",
00933            fxAutoFile->GetName());
00934      rev=fxObjectManager->LoadObjects(fxAutoFile);
00935    }
00936 else
00937    {
00938       Message(-1,"Analysis LoadObjects: Failed to load from file %s",
00939         fxAutoFileName.Data());
00940       rev=kFALSE;
00941    }
00942 CloseAutoSaveFile();
00943 gROOT->cd();
00944 return rev;
00945 }
00946 
00947 void TGo4Analysis::Message(Int_t prio, const Text_t* text,...)
00948 {
00949    Text_t txtbuf[TGo4Log::fguMESLEN];
00950    va_list args;
00951    va_start(args, text);
00952    vsnprintf(txtbuf, TGo4Log::fguMESLEN, text, args);
00953    va_end(args);
00954    SendMessageToGUI(prio,kTRUE, txtbuf);
00955 }
00956 
00957 void TGo4Analysis::SendMessageToGUI(Int_t level, Bool_t printout, const char* text)
00958 {
00959    if(fxAnalysisSlave)
00960       {
00961          // gui mode: send Text via status channel
00962          fxAnalysisSlave->SendStatusMessage(level,printout,text);
00963       }
00964    else
00965       {
00966          // batch mode: no gui connection, handle local printout
00967          Bool_t previousmode=TGo4Log::IsOutputEnabled();
00968          TGo4Log::OutputEnable(printout); // override the messaging state
00969          TGo4Log::Message(level,text);
00970          TGo4Log::OutputEnable(previousmode);
00971       } // if (fxAnalysisSlave)
00972 }
00973 
00974 void TGo4Analysis::SendObjectToGUI(TNamed * ob)
00975 {
00976    if(fxAnalysisSlave)
00977       {
00978          fxAnalysisSlave->SendObject(ob);
00979       }
00980    else
00981       {
00982          if(ob) Message(2,"Could not send object %s to GUI in batch mode.",ob->GetName());
00983       }
00984 }
00985 
00986 Bool_t& TGo4Analysis::IsRunning()
00987 {
00988 if(fxAnalysisSlave)
00989    return fxAnalysisSlave->MainIsRunning();
00990 else
00991    return TGo4Analysis::fbExists; // should be kTRUE
00992 
00993 }
00994 
00995 void TGo4Analysis::SetRunning(Bool_t on)
00996 {
00997 if(fxAnalysisSlave==0) return;
00998 if(on)
00999    fxAnalysisSlave->Start();
01000 else
01001    fxAnalysisSlave->Stop();
01002 
01003 }
01004 
01005 
01006 Int_t TGo4Analysis::WaitForStart()
01007 {
01008    #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
01009 
01010    Bool_t unlockedcint=kFALSE;
01011    if(gCINTMutex)
01012     {
01013         gCINTMutex->UnLock();
01014         unlockedcint=kTRUE;
01015         //cout <<"WWWWWWWait for Start Unlocked cint mutex..." << endl;
01016     }
01017    #endif
01018 
01019    Int_t cycles=0;
01020    fbStopWatingFlag = kFALSE;
01021    while(!IsRunning())
01022    {
01023       //cout <<"WWWWWWWait for Start before Sleep..." << endl;
01024       gSystem->Sleep(fgiMACROSTARTPOLL);
01025       cycles++;
01026       Bool_t sysret=gSystem->ProcessEvents();
01027 //      cout <<"  after process events with ret="<<sysret << endl;
01028 //      cout <<"  stopwatingflag is="<<fbStopWatingFlag << endl;
01029       if (sysret || fbStopWatingFlag)
01030          {
01031             //cout <<"wait sees root IsInterrupted..." << endl;
01032             cycles=-1;
01033             break;
01034          // allows cint canvas menu "Interrupt" to get us out of here!
01035          // additionally, without ProcessEvents no connect/disconnect of Go4
01036          // would be possible from this wait loop
01037          }
01038    }
01039    //if (fbStopWatingFlag) return -1;
01040    #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
01041 
01042    if(gCINTMutex && unlockedcint)
01043     {
01044         gCINTMutex->Lock();
01045         //cout <<"WWWWWWWait for Start locked cint mutex..." << endl;
01046 
01047     }
01049    #endif
01050    return cycles;
01051 }
01052 
01053 void TGo4Analysis::StopWaiting()
01054 {
01055    fbStopWatingFlag = kTRUE;
01056 }
01057 
01058 void TGo4Analysis::StartObjectServer(const Text_t* basename,  const Text_t* passwd)
01059    {
01060      if(fxAnalysisSlave)
01061       {
01062          Message(1,"Start object server not yet enabled.");
01063          //fxAnalysisSlave->StartObjectServer(basename,passwd);
01064       }
01065      else
01066       {
01067          Message(2,"Could not start object server in batch mode.");
01068       }
01069    }
01070 
01071 void TGo4Analysis::StopObjectServer()
01072    {
01073     if(fxAnalysisSlave)
01074       {
01075          //fxAnalysisSlave->StopObjectServer();
01076          Message(1,"Start object server not yet enabled.");
01077       }
01078      else
01079       {
01080          Message(2,"Could not stop object server in batch mode.");
01081       }
01082    }
01083 
01084 
01085 
01086 void TGo4Analysis::ShowEvent(const Text_t* stepname, Bool_t isoutput)
01087 {
01088 TTree* sevtree=CreateSingleEventTree(stepname,isoutput);
01089 if(sevtree)
01090    {
01091        if(isoutput)
01092           Message(1,"Showing Output Event %s of step %s",sevtree->GetName(),stepname);
01093        else
01094           Message(1,"Showing Input  Event %s of step %s",sevtree->GetName(),stepname);
01095        sevtree->Show(0);
01096        cout << endl;
01097        delete sevtree;
01098    }
01099 
01100 }
01101 
01102 
01103 
01105 // Methods that forward to object manager:
01106 
01107 
01108 Bool_t TGo4Analysis::AddDynamicHistogram(const Text_t* name,
01109                                   const Text_t* histo,
01110                                   const Text_t* hevx, const Text_t* hmemx,
01111                                   const Text_t* hevy, const Text_t* hmemy,
01112                                   const Text_t* hevz, const Text_t* hmemz,
01113                                   const Text_t* condition,
01114                                   const Text_t* cevx, const Text_t* cmemx,
01115                                   const Text_t* cevy, const Text_t* cmemy)
01116 {
01117 return (fxObjectManager->AddDynamicHistogram(name,
01118                                   histo, hevx, hmemx, hevy, hmemy, hevz, hmemz,
01119                                   condition, cevx, cmemx, cevy, cmemy));
01120 }
01121 
01122 Bool_t TGo4Analysis::AddTreeHistogram(const char* hisname, const char* treename, const char* varexp, const char* cutexp)
01123 {
01124    Bool_t rev=fxObjectManager->AddTreeHistogram(hisname,treename,varexp,cutexp);
01125    if(rev) UpdateNamesList();
01126    return rev;
01127 }
01128 
01129 Bool_t TGo4Analysis::AddEventProcessor(TGo4EventProcessor * pro)
01130 {
01131    return (fxObjectManager->AddEventProcessor(pro));
01132 }
01133 
01134 Bool_t TGo4Analysis::AddEventSource(TGo4EventSource * source)
01135 {
01136    return (fxObjectManager->AddEventSource(source));
01137 }
01138 
01139 Bool_t TGo4Analysis::AddEventStore(TGo4EventStore * store)
01140 {
01141    return (fxObjectManager->AddEventStore(store));
01142 }
01143 
01144 Bool_t TGo4Analysis::AddEventStructure(TGo4EventElement * ev)
01145 {
01146    return (fxObjectManager->AddEventStructure(ev));
01147 }
01148 
01149 Bool_t TGo4Analysis::AddHistogram(TH1 * his , const Text_t* subfolder, Bool_t replace)
01150 {
01151    return (fxObjectManager->AddHistogram(his,subfolder, replace));
01152 }
01153 
01154 Bool_t TGo4Analysis::AddObject(TNamed * anything, const Text_t* subfolder, Bool_t replace)
01155 {
01156    return (fxObjectManager->AddObject(anything,subfolder,replace));
01157 }
01158 
01159 Bool_t TGo4Analysis::AddParameter(TGo4Parameter * par, const Text_t* subfolder)
01160 {
01161    return (fxObjectManager->AddParameter(par,subfolder));
01162 }
01163 
01164 Bool_t TGo4Analysis::AddPicture(TGo4Picture * pic, const Text_t* subfolder)
01165 {
01166    return (fxObjectManager->AddPicture(pic,subfolder));
01167 }
01168 
01169 Bool_t TGo4Analysis::AddCanvas(TCanvas * can, const Text_t* subfolder)
01170 {
01171    return (fxObjectManager->AddCanvas(can,subfolder));
01172 }
01173 
01174 
01175 
01176 Bool_t TGo4Analysis::AddTree(TTree* tree, const Text_t* subfolder)
01177 {
01178   if(tree) tree->ResetBit(TGo4Status::kGo4BackStoreReset);
01179   return (fxObjectManager->AddTree(tree, subfolder));
01180 }
01181 
01182 
01183 
01184 Bool_t TGo4Analysis::AddAnalysisCondition(TGo4Condition * con, const Text_t* subfolder)
01185 {
01186   return (fxObjectManager->AddAnalysisCondition(con,subfolder));
01187 }
01188 
01189 TGo4Condition * TGo4Analysis::GetAnalysisCondition(const Text_t * name)
01190 {
01191   return (fxObjectManager->GetAnalysisCondition(name));
01192 }
01193 
01194 TGo4AnalysisStep* TGo4Analysis::GetAnalysisStep(const Text_t* name)
01195 {
01196   return fxStepManager->GetAnalysisStep(name);
01197 }
01198 
01199 Int_t TGo4Analysis::GetDynListInterval()
01200 {
01201    return fxObjectManager->GetDynListInterval();
01202 }
01203 
01204 TGo4EventElement * TGo4Analysis::GetEventStructure(const Text_t * name)
01205 {
01206   return (fxObjectManager->GetEventStructure(name));
01207 }
01208 
01209 TH1* TGo4Analysis::GetHistogram(const Text_t * name)
01210 {
01211   return (fxObjectManager->GetHistogram(name));
01212 }
01213 
01214 TNamed * TGo4Analysis::GetObject(const Text_t * name, const Text_t* folder)
01215 {
01216   return (fxObjectManager->GetObject(name,folder));
01217 }
01218 
01219 TGo4Parameter * TGo4Analysis::GetParameter(const Text_t * name)
01220 {
01221   return (fxObjectManager->GetParameter(name));
01222 }
01223 
01224 TGo4Picture * TGo4Analysis::GetPicture(const Text_t * name)
01225 {
01226   return (fxObjectManager->GetPicture(name));
01227 }
01228 
01229 TCanvas * TGo4Analysis::GetCanvas(const Text_t * name)
01230 {
01231   return (fxObjectManager->GetCanvas(name));
01232 }
01233 
01234 
01235 TTree * TGo4Analysis::GetTree(const Text_t * name)
01236 {
01237   return (fxObjectManager->GetTree(name));
01238 }
01239 
01240 TGo4AnalysisObjectNames * TGo4Analysis::CreateNamesList()
01241 {
01242   return (fxObjectManager->CreateNamesList());
01243 }
01244 
01245 TFolder * TGo4Analysis::GetObjectFolder()
01246 {
01247   return (fxObjectManager->GetObjectFolder());
01248 }
01249 
01250 
01251 TGo4ObjectStatus * TGo4Analysis::CreateObjectStatus(const Text_t * name, const Text_t* folder)
01252 {
01253   return (fxObjectManager->CreateObjectStatus(name,folder));
01254 }
01255 
01256 TGo4TreeStructure * TGo4Analysis::CreateTreeStructure(const Text_t* treename)
01257 {
01258   return (fxObjectManager->CreateTreeStructure(treename));
01259 }
01260 
01261 Bool_t TGo4Analysis::RemoveEventSource(TGo4EventSource* source)
01262 {
01263   return (fxObjectManager->RemoveEventSource(source));
01264 }
01265 
01266 Bool_t TGo4Analysis::RemoveEventStore(TGo4EventStore * store)
01267 {
01268   return (fxObjectManager->RemoveEventStore(store));
01269 }
01270 
01271 Bool_t TGo4Analysis::RemoveEventStructure(TGo4EventElement * ev)
01272 {
01273   return (fxObjectManager->RemoveEventStructure(ev));
01274 }
01275 
01276 Bool_t TGo4Analysis::RemoveHistogram(const Text_t * name, Bool_t del)
01277 {
01278   return (fxObjectManager->RemoveHistogram(name,del));
01279 }
01280 
01281 Bool_t TGo4Analysis::RemoveObject(const Text_t * name, Bool_t del)
01282 {
01283   return (fxObjectManager->RemoveObject(name,del));
01284 }
01285 
01286 
01287 
01288 Bool_t TGo4Analysis::RemoveParameter(const Text_t * name)
01289 {
01290   return (fxObjectManager->RemoveParameter(name));
01291 }
01292 
01293 Bool_t TGo4Analysis::RemovePicture(const Text_t * name)
01294 {
01295   return (fxObjectManager->RemovePicture(name));
01296 }
01297 
01298 Bool_t TGo4Analysis::RemoveCanvas(const Text_t * name)
01299 {
01300   return fxObjectManager->RemoveCanvas(name);
01301 }
01302 
01303 Bool_t TGo4Analysis::RemoveTree(TTree * tree, const Text_t* stepname)
01304 {
01305   return fxObjectManager->RemoveTree(tree, stepname);
01306 }
01307 
01308 Bool_t TGo4Analysis::RemoveAnalysisCondition(const Text_t* name)
01309 {
01310   return fxObjectManager->RemoveAnalysisCondition(name);
01311 }
01312 
01313 Bool_t TGo4Analysis::RemoveEventProcessor(TGo4EventProcessor * pro)
01314 {
01315   return (fxObjectManager->RemoveEventProcessor(pro));
01316 }
01317 
01318 Bool_t TGo4Analysis::DeleteObjects(const Text_t * name)
01319 {
01320   return (fxObjectManager->DeleteObjects(name));
01321 }
01322 
01323 Bool_t TGo4Analysis::ClearObjects(const Text_t * name)
01324 {
01325   return (fxObjectManager->ClearObjects(name));
01326 }
01327 
01328 Bool_t TGo4Analysis::ProtectObjects(const Text_t * name, const Option_t* flags)
01329 {
01330   return (fxObjectManager->ProtectObjects(name, flags));
01331 }
01332 
01333 Bool_t  TGo4Analysis::ResetBackStores(Bool_t clearflag)
01334 {
01335  return (fxObjectManager->ResetBackStores(clearflag));
01336 }
01337 
01338 Bool_t TGo4Analysis::SetAnalysisCondition(const Text_t * name, TGo4Condition* con,
01339                                    Bool_t counter)
01340 {
01341   return (fxObjectManager->SetAnalysisCondition(name, con, counter));
01342 }
01343 
01344 Bool_t TGo4Analysis::SetParameter(const char* name, TGo4Parameter* par)
01345 {
01346   return (fxObjectManager->SetParameter(name, par));
01347 }
01348 
01349 Bool_t TGo4Analysis::SetParameterStatus(const char* name, TGo4ParameterStatus* par)
01350 {
01351   return (fxObjectManager->SetParameterStatus(name, par));
01352 }
01353 
01354 Bool_t TGo4Analysis::SetPicture(const Text_t * name, TGo4Picture * pic)
01355 {
01356   return (fxObjectManager->SetPicture(name, pic));
01357 }
01358 
01359 
01360 void TGo4Analysis::SetDynListInterval(Int_t val)
01361 {
01362    fxObjectManager->SetDynListInterval(val);
01363 }
01364 
01365 void TGo4Analysis::PrintConditions(const Text_t* expression)
01366 {
01367    fxObjectManager->PrintConditions(expression);
01368 }
01369 
01370 void TGo4Analysis::PrintHistograms(const Text_t* expression)
01371 {
01372    fxObjectManager->PrintHistograms(expression);
01373 }
01374 
01375 void TGo4Analysis::PrintDynamicList()
01376 {
01377    fxObjectManager->PrintDynamicList();
01378 }
01379 
01380 TObject* TGo4Analysis::NextMatchingObject(const Text_t* expr,
01381                         const Text_t* folder,
01382                         Bool_t reset)
01383 {
01384 return (fxObjectManager->NextMatchingObject(expr,folder,reset));
01385 }
01386 
01387 
01388 
01389 
01391 // Methods that forward to stepmanager:
01392 
01393 TGo4EventElement* TGo4Analysis::GetInputEvent(Int_t stepindex)
01394 {
01395    return (fxStepManager->GetInputEvent(stepindex));
01396 }
01397 
01398 TGo4EventElement* TGo4Analysis::GetInputEvent(const char* stepname)
01399 {
01400      return (fxStepManager->GetInputEvent(stepname));
01401 }
01402 
01403 TGo4EventElement* TGo4Analysis::GetOutputEvent()
01404 {
01405    return fxStepManager->GetOutputEvent();
01406 }
01407 
01408 TGo4EventElement* TGo4Analysis::GetOutputEvent(Int_t stepindex)
01409 {
01410   return (fxStepManager->GetOutputEvent(stepindex));
01411 }
01412 
01413 TGo4EventElement* TGo4Analysis::GetOutputEvent(const char* stepname)
01414 {
01415      return (fxStepManager->GetOutputEvent(stepname));
01416 }
01417 
01418 Bool_t TGo4Analysis::NewStepProcessor(const Text_t* name, TGo4EventProcessorParameter * par)
01419 {
01420      return (fxStepManager->NewStepProcessor(name,par));
01421 }
01422 
01423 Bool_t TGo4Analysis::NewStepSource(const Text_t* name, TGo4EventSourceParameter * par)
01424 {
01425      return (fxStepManager->NewStepSource(name,par));
01426 }
01427 
01428 Bool_t TGo4Analysis::NewStepStore(const Text_t* name, TGo4EventStoreParameter* par)
01429 {
01430      return (fxStepManager->NewStepStore(name,par));
01431 }
01432 
01433 Bool_t TGo4Analysis::AddDynamicEntry(TGo4DynamicEntry* entry)
01434 {
01435   return fxObjectManager->AddDynamicEntry(entry);
01436 }
01437 
01438 void TGo4Analysis::SetStepChecking(Bool_t on)
01439 {
01440    fxStepManager->SetStepChecking(on);
01441 }
01442 
01443 
01444 Bool_t TGo4Analysis::SetFirstStep(const Text_t* name)
01445 {
01446   return (fxStepManager->SetFirstStep(name));
01447 }
01448 
01449 Bool_t TGo4Analysis::SetLastStep(const Text_t * name)
01450 {
01451   return (fxStepManager->SetLastStep(name));
01452 }
01453 
01454 Bool_t TGo4Analysis::SetStepStorage(const Text_t * name, Bool_t on)
01455 {
01456    return (fxStepManager->SetStepStorage(name,on));
01457 }
01458 
01459 Int_t TGo4Analysis::IsErrorStopEnabled()
01460 {
01461    return fxStepManager->IsErrorStopEnabled();
01462 }
01463 
01464 Bool_t TGo4Analysis::AddAnalysisStep(TGo4AnalysisStep* next)
01465 {
01466    return ( fxStepManager->AddAnalysisStep(next) );
01467 }
01468 
01469 Int_t TGo4Analysis::ProcessAnalysisSteps()
01470 {
01471    return (fxStepManager->ProcessAnalysisSteps());
01472 }
01473 
01474 void TGo4Analysis::SetOutputEvent(TGo4EventElement * event)
01475 {
01476    fxStepManager->SetOutputEvent(event);
01477 }
01478 
01479 Int_t TGo4Analysis::StoreParameter(const Text_t * name, TGo4Parameter* par)
01480 {
01481 return (fxStepManager->Store(name, par));
01482 }
01483 
01484 Int_t TGo4Analysis::StoreCondition(const Text_t * name, TGo4Condition* con)
01485 {
01486 return (fxStepManager->Store(name, con));
01487 }
01488 
01489 Int_t TGo4Analysis::StoreFitter(const Text_t * name, TGo4Fitter* fit)
01490 {
01491 return (fxStepManager->Store(name, fit));
01492 }
01493 
01494 Int_t TGo4Analysis::StoreFolder(const Text_t * name, TFolder* folder)
01495 {
01496 return (fxStepManager->Store(name, folder));
01497 }
01498 
01499 Int_t TGo4Analysis::StoreFolder(const Text_t * stepname, const Text_t * foldername)
01500 {
01501 TFolder* myfolder=fxObjectManager->FindSubFolder(GetObjectFolder(), foldername, kFALSE);
01502 if(myfolder)
01503    return (fxStepManager->Store(stepname, myfolder));
01504 else
01505    return 2;
01506 }
01507 
01508 
01509 void TGo4Analysis::SetObserverPassword(const char* passwd)
01510 {
01511    TGo4TaskHandler::SetObservAccount(0,passwd);
01512 }
01513 
01514 void TGo4Analysis::SetControllerPassword(const char* passwd)
01515 {
01516    TGo4TaskHandler::SetCtrlAccount(0,passwd);
01517 }
01518 
01519 void TGo4Analysis::SetAdministratorPassword(const char* passwd)
01520 {
01521    TGo4TaskHandler::SetAdminAccount(0,passwd);
01522 }
01523 
01524 
01525 
01526 
01527 
01528 //----------------------------END OF GO4 SOURCE FILE ---------------------

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