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 "Go4CommandsBase/TGo4CommandReceiver.h"
00020 #include "TObject.h"
00021 #include "TString.h"
00022 #include "TCut.h"
00023
00024 class TH1;
00025 class TTree;
00026 class TCanvas;
00027 class TFolder;
00028 class TNamed;
00029 class TMutex;
00030 class TStopwatch;
00031 class TFile;
00032
00033 class TGo4AnalysisStepManager;
00034 class TGo4AnalysisObjectManager;
00035 class TGo4AnalysisObjectNames;
00036 class TGo4AnalysisStatus;
00037 class TGo4AnalysisStep;
00038 class TGo4AnalysisClient;
00039 class TGo4HistogramStatus;
00040 class TGo4HistogramEntryStatus;
00041 class TGo4DynamicList;
00042 class TGo4DynamicListStatus;
00043 class TGo4DynamicEntryStatus;
00044 class TGo4Condition;
00045 class TGo4Parameter;
00046 class TGo4Picture;
00047 class TGo4Fitter;
00048 class TGo4CanvasStatus;
00049 class TGo4ObjectStatus;
00050 class TGo4EventStoreParameter;
00051 class TGo4EventSourceParameter;
00052 class TGo4EventProcessorParameter;
00053 class TGo4EventElement;
00054 class TGo4EventStore;
00055 class TGo4EventSource;
00056 class TGo4EventProcessor;
00057 class TGo4TreeStructure;
00058
00069 class TGo4Analysis : public TGo4CommandReceiver, public TObject {
00070
00071 friend class TGo4AnalysisStep;
00072 friend class TGo4AnalysisClient;
00073 friend class TGo4ComGetCurrentEvent;
00074 friend class TGo4ComHisGetDir;
00075 friend class TGo4ComGetNamesList;
00076 friend class TGo4ComGetDynamicEntryStatus;
00077 friend class TGo4HisConnectorRunnable;
00078 friend class TGo4HistogramServer;
00079
00080 public:
00081
00083 static const Int_t fgiAUTOSAVECOUNTS;
00084
00087 static const Int_t fgiGO4VERSION;
00088
00090 static const Int_t fgiDYNLISTINTERVAL;
00091
00093 static const Int_t fgiMACROSTARTPOLL;
00094
00096 static const Text_t fgcDEFAULTFILENAME[];
00097
00099 static const Text_t fgcDEFAULTSTATUSFILENAME[];
00100
00102 static const Text_t fgcDEFAULTFILESUF[];
00103
00105 static const Text_t fgcTOPDYNAMICLIST[];
00106
00107 static TGo4Analysis* Instance();
00108
00109 static Bool_t Exists();
00110
00111 virtual ~TGo4Analysis();
00112
00116 Int_t MainCycle();
00117
00120 Int_t PreLoop();
00121
00124 Int_t PostLoop();
00125
00130 Int_t Process();
00131
00132
00138 virtual Int_t UserEventFunc();
00139
00142 virtual Int_t UserPreLoop();
00143
00146 virtual Int_t UserPostLoop();
00147
00150 Int_t RunImplicitLoop(Int_t times);
00151
00154 virtual void CloseAnalysis();
00155
00159 virtual Bool_t InitEventClasses();
00160
00170 TGo4AnalysisObjectManager* ObjectManager() const { return fxObjectManager; }
00171
00172 Bool_t AddDynamicHistogram(const Text_t* name,
00173 const Text_t* histo,
00174 const Text_t* hevx, const Text_t* hmemx,
00175 const Text_t* hevy=0, const Text_t* hmemy=0,
00176 const Text_t* hevz=0, const Text_t* hmemz=0,
00177 const Text_t* condition=0,
00178 const Text_t* cevx=0, const Text_t* cmemx=0,
00179 const Text_t* cevy=0, const Text_t* cmemy=0);
00180
00181
00182 Bool_t AddDynamicHistogram(TGo4HistogramEntryStatus* settings);
00183
00188 Bool_t SetDynamicEntryStatus(const Text_t* name, TGo4DynamicEntryStatus* state, const Text_t* listname);
00189
00193 Bool_t RemoveDynamicEntry(const Text_t* entryname, const Text_t* listname=0);
00194
00201 Bool_t AddObject(TNamed * anything, const Text_t* subfolder=0, Bool_t replace=kTRUE);
00202
00207 TNamed * GetObject(const Text_t* name, const Text_t* folder=0);
00208
00212 Bool_t RemoveObject(const Text_t* name, Bool_t del=kTRUE);
00213
00218 Bool_t DeleteObjects(const Text_t * name);
00219
00224 Bool_t ClearObjects(const Text_t* name);
00225
00233 Bool_t ProtectObjects(const Text_t* name, const Option_t* flags);
00234
00236 Bool_t ResetBackStores();
00237
00244 TObject* NextMatchingObject(const Text_t* expr=0,
00245 const Text_t* folder=0,
00246 Bool_t reset=kFALSE);
00247
00249 TGo4TreeStructure* CreateTreeStructure(const Text_t* treename);
00250
00253 Bool_t AddHistogram(TH1* his , const Text_t* subfolder=0, Bool_t replace=kTRUE);
00254
00260 Bool_t AddTree(TTree* tree, const Text_t* subfolder=0);
00261
00266 Bool_t RemoveTree(TTree * tree, const Text_t* stepname=0);
00267
00272 Bool_t AddTreeHistogram(const Text_t * hisname, const Text_t* treename, const Text_t* varexp, TCut selection);
00273
00275 TH1* GetHistogram(const Text_t* name);
00276
00278 TTree * GetTree(const Text_t* name);
00279
00283 Bool_t RemoveHistogram(const Text_t* name, Bool_t del=kTRUE);
00284
00288 Bool_t AddAnalysisCondition(TGo4Condition * con, const Text_t* subfolder=0);
00289
00294 Bool_t SetAnalysisCondition(const Text_t* name, TGo4Condition* con, Bool_t counter=kTRUE);
00295
00298 TGo4Condition * GetAnalysisCondition(const Text_t* name);
00299
00302 Bool_t RemoveAnalysisCondition(const Text_t* name);
00303
00307 Bool_t AddParameter(TGo4Parameter * par, const Text_t* subfolder=0);
00308
00313 Bool_t SetParameter(const Text_t* name, TGo4Parameter * par);
00314
00317 TGo4Parameter * GetParameter(const Text_t* name);
00318
00321 Bool_t RemoveParameter(const Text_t* name);
00322
00326 Bool_t AddPicture(TGo4Picture * pic, const Text_t* subfolder=0);
00327
00332 Bool_t SetPicture(const Text_t* name, TGo4Picture * pic);
00333
00336 TGo4Picture * GetPicture(const Text_t* name);
00337
00340 Bool_t RemovePicture(const Text_t * name);
00341
00345 Bool_t AddCanvas(TCanvas * can, const Text_t* subfolder=0);
00346
00351 Bool_t SetCanvas(const Text_t* name, TGo4CanvasStatus * stat);
00352
00355 TCanvas * GetCanvas(const Text_t* name);
00356
00359 Bool_t RemoveCanvas(const Text_t * name);
00360
00363 TGo4AnalysisStatus* CreateStatus();
00364
00368 TGo4ObjectStatus* CreateObjectStatus(const Text_t * name, const Text_t* folder=0);
00369
00371 TGo4AnalysisObjectNames * CreateNamesList();
00372
00374 TFolder * GetObjectFolder();
00375
00377 void UpdateStatus(TGo4AnalysisStatus* state);
00378
00387 void SetStatus(TGo4AnalysisStatus * state);
00388
00391 Bool_t LoadStatus(const Text_t* filename=0);
00392
00395 Bool_t LoadObjects(const Text_t* filename=0);
00396
00398 Bool_t SaveStatus(const Text_t* filename=0);
00399
00403 void SetStepChecking(Bool_t on=kTRUE);
00404
00408 Bool_t SetFirstStep(const Text_t* name);
00409
00414 Bool_t SetLastStep(const Text_t* name);
00415
00426 Bool_t SetStepStorage(const Text_t* name, Bool_t on);
00427
00431 Bool_t NewStepStore(const Text_t* name, TGo4EventStoreParameter* par);
00432
00436 Bool_t NewStepSource(const Text_t* name, TGo4EventSourceParameter * par);
00437
00441 Bool_t NewStepProcessor(const Text_t* name, TGo4EventProcessorParameter * par);
00442
00444 void SetAutoSaveInterval(Int_t interval=0) { fiAutoSaveInterval=interval; }
00445
00447 void SetAutoSaveFile(const Text_t* filename=0,
00448 Bool_t overwrite=kFALSE,
00449 Int_t compression=5);
00450
00452 Int_t LockAutoSave();
00453
00455 Int_t UnLockAutoSave();
00456
00458 void SetAutoSave(Bool_t on=kTRUE) {fbAutoSaveOn=on;}
00459
00461 Bool_t IsAutoSaveOn() const { return fbAutoSaveOn; }
00462
00464 void SetAutoSaveFileChange(Bool_t on=kTRUE) {fbAutoSaveFileChange=on;}
00465
00468 Bool_t IsAutoSaveFileChange() const { return fbAutoSaveFileChange; }
00469
00471 Bool_t IsInitDone() const { return fbInitIsDone; }
00472
00477 Bool_t& IsRunning();
00478
00479
00483 void SetRunning(Bool_t on=kTRUE);
00484
00488 Int_t WaitForStart();
00489
00491 void StopWaiting();
00492
00493
00494
00495
00496
00497
00498
00499
00500
00501
00502
00503
00504
00506 Int_t IsErrorStopEnabled();
00507
00509 void SetNewInputFile(Bool_t on=kTRUE) {fbNewInputFile=on;}
00510
00512 Bool_t IsNewInputFile() const { return fbNewInputFile; }
00513
00514 void SetDynListInterval(Int_t val);
00515
00516 Int_t GetDynListInterval();
00517
00518
00519 Bool_t CheckDynListInterval();
00520
00524 TGo4EventElement* GetInputEvent(const char* stepname);
00525
00530 TGo4EventElement* GetInputEvent(Int_t stepindex);
00531
00536 TGo4EventElement* GetOutputEvent(const char* stepname);
00537
00544 TGo4EventElement* GetOutputEvent(Int_t stepindex);
00545
00549 TGo4EventElement* GetOutputEvent();
00550
00552 TGo4EventElement * GetEventStructure(const Text_t * name);
00553
00560 void Message(Int_t prio, const Text_t* text,...);
00561
00564 void SendObjectToGUI(TNamed* ob);
00565
00568 void StartObjectServer(const Text_t* basename, const Text_t* passwd);
00569
00571 void StopObjectServer();
00572
00573
00576 void SetAdministratorPassword(const char* passwd);
00577
00580 void SetControllerPassword(const char* passwd);
00581
00584 void SetObserverPassword(const char* passwd);
00585
00586
00588 virtual void Print(Option_t* opt="") const;
00589
00591 void PrintHistograms(const Text_t* expression=0);
00592
00594 void PrintConditions(const Text_t* expression=0);
00595
00597 void PrintDynamicList();
00598
00604 void ShowEvent(const Text_t* stepname, Bool_t isoutput=kTRUE);
00605
00610 Int_t StoreParameter(const Text_t * name, TGo4Parameter* par);
00611
00616 Int_t StoreCondition(const Text_t * name, TGo4Condition* con);
00617
00622 Int_t StoreFitter(const Text_t * name, TGo4Fitter* fit);
00623
00628 Int_t StoreFolder(const Text_t * stepname, TFolder* folder);
00629
00633 Int_t StoreFolder(const Text_t * stepname, const Text_t* foldername);
00634
00637 void AutoSave();
00638
00646 Bool_t AddAnalysisStep(TGo4AnalysisStep* next);
00647
00649 TGo4AnalysisStep* GetAnalysisStep(const Text_t* name);
00650
00651 protected:
00652
00655 Bool_t fbInitIsDone;
00656
00659 Bool_t fbAutoSaveOn;
00660
00662 TGo4Analysis();
00663
00669 Int_t ProcessAnalysisSteps();
00670
00671 private:
00672
00679 TTree* CreateSingleEventTree(const Text_t* name, Bool_t isoutput=kTRUE);
00680
00682 TTree* CreateSingleEventTree(TGo4EventElement* event);
00683
00685 void UpdateNamesList();
00686
00687 TGo4DynamicList* GetDynamicList(const Text_t* listname);
00688
00691 TGo4AnalysisObjectNames * GetNamesList() const { return fxObjectNames; }
00692
00696 void SetOutputEvent(TGo4EventElement * event);
00697
00700 Bool_t AddEventStore(TGo4EventStore * store);
00701
00703 Bool_t RemoveEventStore(TGo4EventStore * store);
00704
00707 Bool_t AddEventSource(TGo4EventSource * source);
00708
00710 Bool_t RemoveEventSource(TGo4EventSource* source);
00711
00714 Bool_t AddEventProcessor(TGo4EventProcessor * pro);
00715
00717 Bool_t RemoveEventProcessor(TGo4EventProcessor * pro);
00718
00721 Bool_t AddEventStructure(TGo4EventElement * ev);
00722
00724 Bool_t RemoveEventStructure(TGo4EventElement * ev);
00725
00727 void SetAnalysisClient(TGo4AnalysisClient* cli) { fxAnalysisSlave=cli; }
00728
00733 void SendMessageToGUI(Int_t level, Bool_t printout, const char* text);
00734
00736 void OpenAutoSaveFile();
00737
00739 void CloseAutoSaveFile();
00740
00742 static TGo4Analysis* fxInstance;
00743
00747 static Bool_t fbExists;
00748
00750 TGo4AnalysisClient* fxAnalysisSlave;
00751
00754 TGo4AnalysisStepManager* fxStepManager;
00755
00758 TGo4AnalysisObjectManager* fxObjectManager;
00759
00764 TGo4DynamicListStatus * fxDynamicListStatus;
00765
00767 Int_t fiAutoSaveCount;
00768
00770 TStopwatch* fxAutoSaveClock;
00771
00775 Int_t fiAutoSaveInterval;
00776
00778 Int_t fiAutoSaveCompression;
00779
00783 TMutex* fxAutoSaveMutex;
00784
00786 TFile* fxAutoFile;
00787
00789 TString fxAutoFileName;
00790
00792 Bool_t fbAutoSaveOverwrite;
00793
00795 TString fxConfigFilename;
00796
00799 Bool_t fbNewInputFile;
00800
00803 Bool_t fbAutoSaveFileChange;
00804
00807 TGo4EventElement* fxSampleEvent;
00808
00811 TGo4AnalysisObjectNames * fxObjectNames;
00812
00814 Bool_t fbStopWatingFlag;
00815
00816 ClassDef(TGo4Analysis,3)
00817 };
00818
00819 #endif
00820
00821