00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef TGO4ANALYSISOBJECTMANAGER_H
00015 #define TGO4ANALYSISOBJECTMANAGER_H
00016
00017 #include "TNamed.h"
00018 #include "Htypes.h"
00019
00020 class TCanvas;
00021 class TTree;
00022 class TMutex;
00023 class TFolder;
00024 class TH1;
00025 class TH2;
00026 class TFile;
00027 class TDirectory;
00028 class TIterator;
00029
00030 class TGo4EventElement;
00031 class TGo4EventProcessor;
00032 class TGo4EventSource;
00033 class TGo4EventStore;
00034 class TGo4ObjectStatus;
00035 class TGo4TreeStructure;
00036 class TGo4CompositeEvent;
00037 class TObjArray;
00038 class TGo4Condition;
00039 class TGo4WinCond;
00040 class TGo4PolyCond;
00041 class TGo4AnalysisObjectNames;
00042 class TGo4DynamicEntry;
00043 class TGo4MbsHist;
00044 class TGo4Picture;
00045 class TGo4Parameter;
00046 class TGo4ParameterStatus;
00047
00054 class TGo4AnalysisObjectManager : public TNamed {
00055 public:
00056
00057 TGo4AnalysisObjectManager();
00058
00059 TGo4AnalysisObjectManager(const char* name);
00060
00061 ~TGo4AnalysisObjectManager();
00062
00071 Bool_t AddObject(TNamed * anything, const char* subfolder=0, Bool_t replace=kTRUE);
00072
00080 TNamed * GetObject(const char * name, const char* folder=0);
00081
00089 TObject* GetAsTObject(const char * name, const char* folder=0);
00090
00091
00097 Bool_t RemoveObject(const char * name, Bool_t del=kTRUE);
00098
00099
00100
00107 Bool_t DeleteObjects(const char * name);
00108
00117 TObject* NextMatchingObject(const char* expr,
00118 const char* folder,
00119 Bool_t reset);
00120
00128 TFolder * CreateBranchFolder(TObjArray* branchlist,
00129 const char* name,
00130 const char* title,
00131 Bool_t istopbranch=kFALSE);
00132
00140 TFolder * CreateCompositeBranchFolder(TObjArray* branchlist,
00141 TGo4CompositeEvent* compevent,
00142 Int_t startindex, Int_t* skip,
00143 const char* name, const char* title);
00144
00149 TGo4TreeStructure * CreateTreeStructure(TTree * thetree);
00150
00152 TGo4TreeStructure * CreateTreeStructure(const char* treename);
00153
00155 TFolder* CreateMembersFolder(TObject* obj, const char* membrfoldername, TClass* cl);
00156
00157
00162 Bool_t AddHistogram(TH1 * his, const char* subfolder=0, Bool_t replace=kTRUE);
00163
00167 TH1* GetHistogram(const char * name);
00168
00175 Bool_t RemoveHistogram(const char * name, Bool_t del=kTRUE);
00176
00194 TH1* MakeTH1(const char* histotype,
00195 const char* foldername,
00196 const char* histoname,
00197 Int_t nbinsx,
00198 Axis_t xlow,
00199 Axis_t xup,
00200 const char* title = 0,
00201 const char* xtitle = 0,
00202 const char* ytitle = 0);
00203
00224 TH2* MakeTH2(const char* histotype,
00225 const char* foldername,
00226 const char* histoname,
00227 Int_t nbinsx,
00228 Axis_t xlow,
00229 Axis_t xup,
00230 Int_t nbinsy,
00231 Axis_t ylow,
00232 Axis_t yup,
00233 const char* title = 0,
00234 const char* xtitle = 0,
00235 const char* ytitle = 0);
00236
00243 Bool_t AddTree(TTree* tree, const char* subfolder=0);
00244
00248 TTree * GetTree(const char * name);
00249
00256 Bool_t RemoveTree(TTree * tree, const char* stepname=0);
00257
00263 Bool_t AddAnalysisCondition(TGo4Condition * con, const char* subfolder=0);
00264
00272 Bool_t SetAnalysisCondition(const char * name, TGo4Condition* con,
00273 Bool_t counter=kTRUE, TFolder* parent=0);
00274
00279 TGo4Condition * GetAnalysisCondition(const char * name, const char* cond_cl = 0);
00280
00285 Bool_t RemoveAnalysisCondition(const char * name);
00286
00301 TGo4WinCond* MakeWindowCond(const char* foldername,
00302 const char* conditionname,
00303 Double_t xlow,
00304 Double_t xup,
00305 const char* bindhistogram = 0,
00306 Bool_t invert = kFALSE);
00307
00324 TGo4WinCond* MakeWindowCond(const char* foldername,
00325 const char* conditionname,
00326 Double_t xlow,
00327 Double_t xup,
00328 Double_t ylow,
00329 Double_t yup,
00330 const char* bindhistogram = 0,
00331 Bool_t invert = kFALSE);
00332
00356 TGo4PolyCond* MakePolyCond(const char* foldername,
00357 const char* conditionname,
00358 Int_t size,
00359 Float_t (*points)[2],
00360 const char* bindhistogram = 0,
00361 Bool_t invert = kFALSE);
00367 Bool_t AddParameter(TGo4Parameter * par, const char* subfolder=0);
00368
00376 Bool_t SetParameter(const char * name, TGo4Parameter * par, TFolder* parent=0);
00377
00385 Bool_t SetParameterStatus(const char* name, TGo4ParameterStatus* par, TFolder* parent=0);
00386
00390 TGo4Parameter * GetParameter(const char* name, const char* parameter_class = 0);
00391
00396 Bool_t RemoveParameter(const char * name);
00397
00403 Bool_t AddPicture(TGo4Picture * pic, const char* subfolder=0);
00404
00412 Bool_t SetPicture(const char* name, TGo4Picture * pic, TFolder* parent=0);
00413
00418 TGo4Picture * GetPicture(const char * name);
00419
00424 Bool_t RemovePicture(const char * name);
00425
00426
00432 Bool_t AddCanvas(TCanvas * can, const char* subfolder=0);
00433
00438 TCanvas * GetCanvas(const char * name);
00439
00444 Bool_t RemoveCanvas(const char * name);
00445
00450 TGo4ObjectStatus * CreateObjectStatus(const char * name, const char* folder=0);
00451
00454 TGo4ObjectStatus * CreateObjectStatus(TObject* ob, Bool_t fullinfo=kTRUE);
00455
00456
00461 TGo4AnalysisObjectNames * CreateNamesList();
00462
00468 TFolder * CreateNamesFolder(TFolder * objectfolder);
00469
00473 TFolder * GetObjectFolder();
00474
00478 Bool_t AddEventStore(TGo4EventStore * store);
00479
00483 Bool_t RemoveEventStore(TGo4EventStore * store);
00484
00488 Bool_t AddEventSource(TGo4EventSource * source);
00489
00493 Bool_t RemoveEventSource(TGo4EventSource* source);
00494
00498 Bool_t AddEventProcessor(TGo4EventProcessor * pro);
00499
00503 Bool_t RemoveEventProcessor(TGo4EventProcessor * pro);
00504
00508 Bool_t AddEventStructure(TGo4EventElement * ev);
00509
00513 Bool_t RemoveEventStructure(TGo4EventElement * ev);
00514
00518 TGo4EventElement * GetEventStructure(const char * name);
00519
00523 Bool_t ResetBackStores(Bool_t clearflag=kFALSE);
00524
00528 void CloseAnalysis();
00529
00531 void SaveObjects(TFile* file);
00532
00537 Bool_t LoadObjects(TFile* statusfile);
00538
00540 Bool_t AddDynamicEntry(TGo4DynamicEntry* entry);
00541
00543 void ResetCurrentDynList();
00544
00547 void ProcessDynamicList();
00548
00549 void SetDynListInterval(Int_t val) { fiDynListInterval=val; }
00550
00551 Int_t GetDynListInterval() const { return fiDynListInterval; }
00552
00565 Bool_t AddDynamicHistogram(const char* name,
00566 const char* histo,
00567 const char* hevx, const char* hmemx,
00568 const char* hevy=0, const char* hmemy=0,
00569 const char* hevz=0, const char* hmemz=0,
00570 const char* condition=0,
00571 const char* cevx=0, const char* cmemx=0,
00572 const char* cevy=0, const char* cmemy=0);
00573
00574
00575
00583 Bool_t AddTreeHistogram(const char* hisname, const char* treename, const char* varexp, const char* cutexp);
00584
00589 void PrintHistograms(const char* expression=0);
00590
00595 void PrintConditions(const char* expression=0);
00596
00601 void PrintParameters(const char* expression=0);
00602
00606 void PrintDynamicList();
00607
00614 Bool_t ClearObjects(const char* name);
00615
00616
00625 Bool_t ProtectObjects(const char* name, const Option_t* flags);
00626
00633 Bool_t RemoveDynamicEntry(const char* entryname);
00634
00638 TFolder* FindSubFolder(TFolder* parent, const char* subfolder, Bool_t create=kTRUE);
00639
00641 Bool_t FindObjectPathName(TObject* obj, TString& pathname, TFolder* fold = 0);
00642
00643 Bool_t CreatedInMake() const { return fbCreatedinMake; }
00644
00646 virtual void RecursiveRemove(TObject* obj);
00647
00649 static const char* fgcTOPDYNAMICLIST;
00650
00652 static const char* fgcTOPFOLDER;
00653
00655 static const char* fgcHISTFOLDER;
00656
00658 static const char* fgcDYNFOLDER;
00659
00661 static const char* fgcCONDFOLDER;
00662
00664 static const char* fgcPARAFOLDER;
00665
00667 static const char* fgcTREEFOLDER;
00668
00670 static const char* fgcPICTFOLDER;
00671
00673 static const char* fgcCANVFOLDER;
00674
00676 static const char* fgcANALYSISFOLDER;
00677
00679 static const char* fgcEVENTFOLDER;
00680
00682 static const char* fgcSRCFOLDER;
00683
00685 static const char* fgcSTOREFOLDER;
00686
00688 static const char* fgcPROCFOLDER;
00689
00691 static const char* fgcUSRFOLDER;
00692
00694 static const char* fgcTMPFOLDER;
00695
00696 private:
00697
00701 TFolder * fxGo4Dir;
00702
00703
00708 TFolder * fxHistogramDir;
00709
00714 TFolder * fxConditionDir;
00715
00719 TFolder * fxParameterDir;
00720
00725 TFolder * fxDynListDir;
00726
00730 TFolder * fxUserDir;
00731
00735 TFolder * fxTreeDir;
00736
00740 TFolder * fxPictureDir;
00741
00745 TFolder * fxCanvasDir;
00746
00750 TFolder * fxStoreDir;
00751
00755 TFolder * fxSourceDir;
00756
00760 TFolder * fxProcessorDir;
00761
00765 TFolder * fxEventDir;
00766
00770 TFolder * fxAnalysisDir;
00771
00775 TFolder * fxTempFolder;
00776
00780 TMutex * fxDirMutex;
00781
00782
00786 TList * fxMatchList;
00787
00789 TIterator * fxMatchIterator;
00790
00791
00797 Int_t fiDynListCount;
00798
00802 Int_t fiDynListInterval;
00803
00808 Bool_t fbCreatedinMake;
00809
00816 Bool_t fbSuppressLoadHistograms;
00817
00826 Bool_t AddObjectToFolder(TObject * ob,
00827 TFolder* fold,
00828 const char* subfolder=0,
00829 Bool_t replace=kTRUE,
00830 Bool_t uniquename=kFALSE,
00831 Bool_t resetbits=kTRUE);
00832
00839 Bool_t RemoveObjectFromFolder(const char* fullname, TFolder* fold, Bool_t isDel);
00840
00846 Bool_t LoadFolder(TFolder* source, TFolder* destination, Bool_t replace=kFALSE);
00847
00853 Bool_t LoadFolder(TDirectory* source, TFolder* destination, Bool_t replace=kFALSE);
00854
00860 Bool_t PutToFolder(TObject* ob, TFolder* destination, Bool_t replace=kFALSE);
00861
00862
00868 Bool_t SaveFolder(TFolder* source);
00869
00875 void RemoveFromDir(TFolder* fold, TDirectory* dir);
00876
00881 void AppendToDir(TObject* ob, TDirectory* dir);
00882
00883
00889 Int_t PrintFolder(TFolder* fold, Option_t* opt, const char* expression=0);
00890
00895 Bool_t ClearFolder(TFolder* fold);
00896
00901 Bool_t ClearObject(TObject* ob);
00902
00903
00908 Bool_t DeleteFolder(TFolder* fold);
00909
00914 Bool_t DeleteObject(TObject* ob);
00915
00916
00925 Bool_t ProtectFolder(TFolder* fold, const Option_t* flags);
00926
00927
00936 Bool_t ProtectObject(TObject* ob, const Option_t* flags);
00937
00938
00942 void CleanupDynamicLists(TObject* oldobject);
00943
00947 TList* CreateObjectList(const char* expr, const char* folder=0);
00948
00950 TList* CreateObjectList(const char* expr, TFolder* fold);
00951
00953 Bool_t IsMatching(const char* string, const char* expression);
00954
00958 TObject* FindObjectInFolder(TFolder* folder, const char* fullname);
00959
00966 TObject* TestObject(TFolder* folder,
00967 const char* &pathname,
00968 const char* objectname,
00969 const TClass* cl);
00970
00971 };
00972
00973 #endif //TGO4ANALYSISOBJECTMANAGER_H