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

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

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