00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TGO4ANALYSISIMP_H
00017 #define TGO4ANALYSISIMP_H
00018
00019 #include "TGo4CommandReceiver.h"
00020 #include "TObject.h"
00021 #include "TString.h"
00022
00023 class TH1;
00024 class TTree;
00025 class TCanvas;
00026 class TFolder;
00027 class TNamed;
00028 class TMutex;
00029 class TStopwatch;
00030 class TFile;
00031
00032 class TGo4AnalysisStepManager;
00033 class TGo4AnalysisObjectManager;
00034 class TGo4AnalysisObjectNames;
00035 class TGo4AnalysisStatus;
00036 class TGo4AnalysisStep;
00037 class TGo4AnalysisClient;
00038 class TGo4HistogramStatus;
00039 class TGo4DynamicEntry;
00040 class TGo4Condition;
00041 class TGo4Parameter;
00042 class TGo4ParameterStatus;
00043 class TGo4Picture;
00044 class TGo4Fitter;
00045 class TGo4ObjectStatus;
00046 class TGo4EventStoreParameter;
00047 class TGo4EventSourceParameter;
00048 class TGo4EventProcessorParameter;
00049 class TGo4EventElement;
00050 class TGo4EventStore;
00051 class TGo4EventSource;
00052 class TGo4EventProcessor;
00053 class TGo4TreeStructure;
00054
00065 class TGo4Analysis : public TGo4CommandReceiver, public TObject {
00066
00067 friend class TGo4AnalysisStep;
00068 friend class TGo4AnalysisClient;
00069 friend class TGo4ComGetCurrentEvent;
00070 friend class TGo4ComGetNamesList;
00071 friend class TGo4ComGetEnvelope;
00072 friend class TGo4ComSetObject;
00073 friend class TGo4HisConnectorRunnable;
00074 friend class TGo4HistogramServer;
00075
00076 public:
00077
00079 static const Int_t fgiAUTOSAVECOUNTS;
00080
00083 static const Int_t fgiGO4VERSION;
00084
00086 static const Int_t fgiDYNLISTINTERVAL;
00087
00089 static const Int_t fgiMACROSTARTPOLL;
00090
00092 static const Text_t fgcDEFAULTFILENAME[];
00093
00095 static const Text_t fgcDEFAULTSTATUSFILENAME[];
00096
00098 static const Text_t fgcDEFAULTFILESUF[];
00099
00101 static const Text_t fgcTOPDYNAMICLIST[];
00102
00103 static TGo4Analysis* Instance();
00104
00105 static Bool_t Exists();
00106
00107 virtual ~TGo4Analysis();
00108
00112 Int_t MainCycle();
00113
00116 Int_t PreLoop();
00117
00120 Int_t PostLoop();
00121
00126 Int_t Process();
00127
00128
00134 virtual Int_t UserEventFunc();
00135
00138 virtual Int_t UserPreLoop();
00139
00142 virtual Int_t UserPostLoop();
00143
00146 Int_t RunImplicitLoop(Int_t times);
00147
00150 virtual void CloseAnalysis();
00151
00155 virtual Bool_t InitEventClasses();
00156
00166 TGo4AnalysisObjectManager* ObjectManager() const { return fxObjectManager; }
00167
00168 Bool_t AddDynamicHistogram(const Text_t* name,
00169 const Text_t* histo,
00170 const Text_t* hevx, const Text_t* hmemx,
00171 const Text_t* hevy=0, const Text_t* hmemy=0,
00172 const Text_t* hevz=0, const Text_t* hmemz=0,
00173 const Text_t* condition=0,
00174 const Text_t* cevx=0, const Text_t* cmemx=0,
00175 const Text_t* cevy=0, const Text_t* cmemy=0);
00176
00177
00182 Bool_t AddDynamicEntry(TGo4DynamicEntry* entry);
00183
00187 Bool_t RemoveDynamicEntry(const Text_t* entryname, const Text_t* listname=0);
00188
00195 Bool_t AddObject(TNamed * anything, const Text_t* subfolder=0, Bool_t replace=kTRUE);
00196
00201 TNamed * GetObject(const Text_t* name, const Text_t* folder=0);
00202
00206 Bool_t RemoveObject(const Text_t* name, Bool_t del=kTRUE);
00207
00212 Bool_t DeleteObjects(const Text_t * name);
00213
00218 Bool_t ClearObjects(const Text_t* name);
00219
00227 Bool_t ProtectObjects(const Text_t* name, const Option_t* flags);
00228
00232 Bool_t ResetBackStores(Bool_t clearflag=kFALSE);
00233
00240 TObject* NextMatchingObject(const Text_t* expr=0,
00241 const Text_t* folder=0,
00242 Bool_t reset=kFALSE);
00243
00245 TGo4TreeStructure* CreateTreeStructure(const Text_t* treename);
00246
00249 Bool_t AddHistogram(TH1* his , const Text_t* subfolder=0, Bool_t replace=kTRUE);
00250
00256 Bool_t AddTree(TTree* tree, const Text_t* subfolder=0);
00257
00262 Bool_t RemoveTree(TTree * tree, const Text_t* stepname=0);
00263
00268 Bool_t AddTreeHistogram(const char* hisname, const char* treename, const char* varexp, const char* cutexp);
00269
00271 TH1* GetHistogram(const Text_t* name);
00272
00274 TTree * GetTree(const Text_t* name);
00275
00279 Bool_t RemoveHistogram(const Text_t* name, Bool_t del=kTRUE);
00280
00284 Bool_t AddAnalysisCondition(TGo4Condition * con, const Text_t* subfolder=0);
00285
00290 Bool_t SetAnalysisCondition(const Text_t* name, TGo4Condition* con, Bool_t counter=kTRUE);
00291
00294 TGo4Condition * GetAnalysisCondition(const Text_t* name);
00295
00298 Bool_t RemoveAnalysisCondition(const Text_t* name);
00299
00303 Bool_t AddParameter(TGo4Parameter * par, const Text_t* subfolder=0);
00304
00309 Bool_t SetParameter(const char* name, TGo4Parameter * par);
00310
00315 Bool_t SetParameterStatus(const char* name, TGo4ParameterStatus* par);
00316
00319 TGo4Parameter * GetParameter(const Text_t* name);
00320
00323 Bool_t RemoveParameter(const Text_t* name);
00324
00328 Bool_t AddPicture(TGo4Picture * pic, const Text_t* subfolder=0);
00329
00334 Bool_t SetPicture(const Text_t* name, TGo4Picture * pic);
00335
00338 TGo4Picture * GetPicture(const Text_t* name);
00339
00342 Bool_t RemovePicture(const Text_t * name);
00343
00347 Bool_t AddCanvas(TCanvas * can, const Text_t* subfolder=0);
00348
00351 TCanvas * GetCanvas(const Text_t* name);
00352
00355 Bool_t RemoveCanvas(const Text_t * name);
00356
00359 TGo4AnalysisStatus* CreateStatus();
00360
00364 TGo4ObjectStatus* CreateObjectStatus(const Text_t * name, const Text_t* folder=0);
00365
00367 TGo4AnalysisObjectNames * CreateNamesList();
00368
00370 TFolder * GetObjectFolder();
00371
00373 void UpdateStatus(TGo4AnalysisStatus* state);
00374
00383 void SetStatus(TGo4AnalysisStatus * state);
00384
00387 Bool_t LoadStatus(const Text_t* filename=0);
00388
00391 Bool_t LoadObjects(const Text_t* filename=0);
00392
00394 Bool_t SaveStatus(const Text_t* filename=0);
00395
00399 void SetStepChecking(Bool_t on=kTRUE);
00400
00404 Bool_t SetFirstStep(const Text_t* name);
00405
00410 Bool_t SetLastStep(const Text_t* name);
00411
00422 Bool_t SetStepStorage(const Text_t* name, Bool_t on);
00423
00427 Bool_t NewStepStore(const Text_t* name, TGo4EventStoreParameter* par);
00428
00432 Bool_t NewStepSource(const Text_t* name, TGo4EventSourceParameter * par);
00433
00437 Bool_t NewStepProcessor(const Text_t* name, TGo4EventProcessorParameter * par);
00438
00440 void SetAutoSaveInterval(Int_t interval=0) { fiAutoSaveInterval=interval; }
00441
00443 void SetAutoSaveFile(const Text_t* filename=0,
00444 Bool_t overwrite=kFALSE,
00445 Int_t compression=5);
00446
00448 Int_t LockAutoSave();
00449
00451 Int_t UnLockAutoSave();
00452
00454 void SetAutoSave(Bool_t on=kTRUE) {fbAutoSaveOn=on;}
00455
00457 Bool_t IsAutoSaveOn() const { return fbAutoSaveOn; }
00458
00460 void SetAutoSaveFileChange(Bool_t on=kTRUE) {fbAutoSaveFileChange=on;}
00461
00464 Bool_t IsAutoSaveFileChange() const { return fbAutoSaveFileChange; }
00465
00467 Bool_t IsInitDone() const { return fbInitIsDone; }
00468
00473 Bool_t& IsRunning();
00474
00475
00479 void SetRunning(Bool_t on=kTRUE);
00480
00484 Int_t WaitForStart();
00485
00487 void StopWaiting();
00488
00490 Int_t IsErrorStopEnabled();
00491
00493 void SetNewInputFile(Bool_t on=kTRUE) {fbNewInputFile=on;}
00494
00496 Bool_t IsNewInputFile() const { return fbNewInputFile; }
00497
00498 void SetDynListInterval(Int_t val);
00499
00500 Int_t GetDynListInterval();
00501
00505 TGo4EventElement* GetInputEvent(const char* stepname);
00506
00511 TGo4EventElement* GetInputEvent(Int_t stepindex);
00512
00517 TGo4EventElement* GetOutputEvent(const char* stepname);
00518
00525 TGo4EventElement* GetOutputEvent(Int_t stepindex);
00526
00530 TGo4EventElement* GetOutputEvent();
00531
00533 TGo4EventElement * GetEventStructure(const Text_t * name);
00534
00541 void Message(Int_t prio, const Text_t* text,...);
00542
00545 void SendObjectToGUI(TNamed* ob);
00546
00549 void StartObjectServer(const Text_t* basename, const Text_t* passwd);
00550
00552 void StopObjectServer();
00553
00554
00557 void SetAdministratorPassword(const char* passwd);
00558
00561 void SetControllerPassword(const char* passwd);
00562
00565 void SetObserverPassword(const char* passwd);
00566
00567
00569 virtual void Print(Option_t* opt="") const;
00570
00572 void PrintHistograms(const Text_t* expression=0);
00573
00575 void PrintConditions(const Text_t* expression=0);
00576
00578 void PrintDynamicList();
00579
00585 void ShowEvent(const Text_t* stepname, Bool_t isoutput=kTRUE);
00586
00591 Int_t StoreParameter(const Text_t * name, TGo4Parameter* par);
00592
00597 Int_t StoreCondition(const Text_t * name, TGo4Condition* con);
00598
00603 Int_t StoreFitter(const Text_t * name, TGo4Fitter* fit);
00604
00609 Int_t StoreFolder(const Text_t * stepname, TFolder* folder);
00610
00614 Int_t StoreFolder(const Text_t * stepname, const Text_t* foldername);
00615
00618 void AutoSave();
00619
00627 Bool_t AddAnalysisStep(TGo4AnalysisStep* next);
00628
00631 TGo4AnalysisStep* GetAnalysisStep(const Text_t* name);
00632
00633 protected:
00634
00637 Bool_t fbInitIsDone;
00638
00641 Bool_t fbAutoSaveOn;
00642
00644 TGo4Analysis();
00645
00651 Int_t ProcessAnalysisSteps();
00652
00653 private:
00654
00661 TTree* CreateSingleEventTree(const Text_t* name, Bool_t isoutput=kTRUE);
00662
00664 TTree* CreateSingleEventTree(TGo4EventElement* event);
00665
00667 void UpdateNamesList();
00668
00671 TGo4AnalysisObjectNames * GetNamesList() const { return fxObjectNames; }
00672
00676 void SetOutputEvent(TGo4EventElement * event);
00677
00680 Bool_t AddEventStore(TGo4EventStore * store);
00681
00683 Bool_t RemoveEventStore(TGo4EventStore * store);
00684
00687 Bool_t AddEventSource(TGo4EventSource * source);
00688
00690 Bool_t RemoveEventSource(TGo4EventSource* source);
00691
00694 Bool_t AddEventProcessor(TGo4EventProcessor * pro);
00695
00697 Bool_t RemoveEventProcessor(TGo4EventProcessor * pro);
00698
00701 Bool_t AddEventStructure(TGo4EventElement * ev);
00702
00704 Bool_t RemoveEventStructure(TGo4EventElement * ev);
00705
00707 void SetAnalysisClient(TGo4AnalysisClient* cli) { fxAnalysisSlave=cli; }
00708
00713 void SendMessageToGUI(Int_t level, Bool_t printout, const char* text);
00714
00716 void OpenAutoSaveFile();
00717
00719 void CloseAutoSaveFile();
00720
00722 static TGo4Analysis* fxInstance;
00723
00727 static Bool_t fbExists;
00728
00730 TGo4AnalysisClient* fxAnalysisSlave;
00731
00734 TGo4AnalysisStepManager* fxStepManager;
00735
00738 TGo4AnalysisObjectManager* fxObjectManager;
00739
00741 Int_t fiAutoSaveCount;
00742
00744 TStopwatch* fxAutoSaveClock;
00745
00749 Int_t fiAutoSaveInterval;
00750
00752 Int_t fiAutoSaveCompression;
00753
00757 TMutex* fxAutoSaveMutex;
00758
00760 TFile* fxAutoFile;
00761
00763 TString fxAutoFileName;
00764
00766 Bool_t fbAutoSaveOverwrite;
00767
00769 TString fxConfigFilename;
00770
00773 Bool_t fbNewInputFile;
00774
00777 Bool_t fbAutoSaveFileChange;
00778
00781 TGo4EventElement* fxSampleEvent;
00782
00785 TGo4AnalysisObjectNames * fxObjectNames;
00786
00788 Bool_t fbStopWatingFlag;
00789
00790 ClassDef(TGo4Analysis,3)
00791 };
00792
00793 #endif
00794
00795