GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4AnalysisObjectManager.h
Go to the documentation of this file.
1 // $Id$
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4ANALYSISOBJECTMANAGER_H
15 #define TGO4ANALYSISOBJECTMANAGER_H
16 
17 #include "TNamed.h"
18 
19 class TCanvas;
20 class TTree;
21 class TMutex;
22 class TFolder;
23 class TH1;
24 class TH2;
25 class TFile;
26 class TDirectory;
27 class TIterator;
28 
29 class TGo4EventElement;
30 class TGo4EventProcessor;
31 class TGo4EventSource;
32 class TGo4EventStore;
33 class TGo4ObjectStatus;
34 class TGo4TreeStructure;
35 class TGo4CompositeEvent;
36 class TObjArray;
37 class TGo4Condition;
38 class TGo4WinCond;
39 class TGo4PolyCond;
41 class TGo4DynamicEntry;
42 class TGo4MbsHist;
43 class TGo4Picture;
44 class TGo4Parameter;
46 
54 class TGo4AnalysisObjectManager : public TNamed {
55 
56  public:
57 
59 
60  TGo4AnalysisObjectManager(const char *name);
61 
63 
72  Bool_t AddObject(TNamed *anything, const char *subfolder = nullptr, Bool_t replace = kTRUE);
73 
81  TNamed *GetObject(const char *name, const char *folder = nullptr);
82 
90  TObject *GetAsTObject(const char *name, const char *folder = nullptr);
91 
92 
98  Bool_t RemoveObject(const char *name, Bool_t del=kTRUE);
99 
106  Bool_t DeleteObjects(const char *name);
107 
116  TObject *NextMatchingObject(const char *expr,
117  const char *folder,
118  Bool_t reset);
119 
127  TFolder *CreateBranchFolder(TObjArray *branchlist,
128  const char *name,
129  const char *title,
130  Bool_t istopbranch = kFALSE);
131 
139  TFolder *CreateCompositeBranchFolder(TObjArray *branchlist,
140  TGo4CompositeEvent *compevent,
141  Int_t startindex, Int_t *skip,
142  const char *name, const char *title);
143 
148  TGo4TreeStructure *CreateTreeStructure(TTree *thetree);
149 
151  TGo4TreeStructure *CreateTreeStructure(const char *treename);
152 
154  TFolder *CreateMembersFolder(TObject *obj, const char *membrfoldername, TClass *cl);
155 
160  Bool_t AddHistogram(TH1 *his, const char *subfolder = nullptr, Bool_t replace = kTRUE);
161 
165  TH1 *GetHistogram(const char *name);
166 
173  Bool_t RemoveHistogram(const char *name, Bool_t del = kTRUE);
174 
192  TH1 *MakeTH1(const char *histotype,
193  const char *foldername,
194  const char *histoname,
195  Int_t nbinsx,
196  Axis_t xlow,
197  Axis_t xup,
198  const char *title = nullptr,
199  const char *xtitle = nullptr,
200  const char *ytitle = nullptr);
201 
222  TH2 *MakeTH2(const char *histotype,
223  const char *foldername,
224  const char *histoname,
225  Int_t nbinsx,
226  Axis_t xlow,
227  Axis_t xup,
228  Int_t nbinsy,
229  Axis_t ylow,
230  Axis_t yup,
231  const char *title = nullptr,
232  const char *xtitle = nullptr,
233  const char *ytitle = nullptr);
234 
241  Bool_t AddTree(TTree *tree, const char *subfolder = nullptr);
242 
246  TTree *GetTree(const char *name);
247 
254  Bool_t RemoveTree(TTree *tree, const char *stepname = nullptr);
255 
261  Bool_t AddAnalysisCondition(TGo4Condition *con, const char *subfolder = nullptr);
262 
270  Bool_t SetAnalysisCondition(const char *name, TGo4Condition *con,
271  Bool_t counter = kTRUE, TFolder *parent = nullptr);
272 
277  TGo4Condition *GetAnalysisCondition(const char *name, const char *cond_cl = nullptr);
278 
283  Bool_t RemoveAnalysisCondition(const char *name);
284 
299  TGo4WinCond *MakeWindowCond(const char *foldername,
300  const char *conditionname,
301  Double_t xlow,
302  Double_t xup,
303  const char *bindhistogram = nullptr,
304  Bool_t invert = kFALSE);
305 
322  TGo4WinCond *MakeWindowCond(const char *foldername,
323  const char *conditionname,
324  Double_t xlow,
325  Double_t xup,
326  Double_t ylow,
327  Double_t yup,
328  const char *bindhistogram = nullptr,
329  Bool_t invert = kFALSE);
330 
354  TGo4PolyCond *MakePolyCond(const char *foldername,
355  const char *conditionname,
356  Int_t size,
357  Float_t (*points)[2],
358  const char *bindhistogram = nullptr,
359  Bool_t invert = kFALSE);
365  Bool_t AddParameter(TGo4Parameter *par, const char *subfolder = nullptr);
366 
374  Bool_t SetParameter(const char *name, TGo4Parameter *par, TFolder *parent = nullptr);
375 
383  Bool_t SetParameterStatus(const char *name, TGo4ParameterStatus *par, TFolder *parent = nullptr);
384 
388  TGo4Parameter *GetParameter(const char *name, const char *parameter_class = nullptr);
389 
394  Bool_t RemoveParameter(const char *name);
395 
401  Bool_t AddPicture(TGo4Picture *pic, const char *subfolder = nullptr);
402 
410  Bool_t SetPicture(const char *name, TGo4Picture *pic, TFolder *parent = nullptr);
411 
416  TGo4Picture *GetPicture(const char *name);
417 
422  Bool_t RemovePicture(const char *name);
423 
429  Bool_t AddCanvas(TCanvas *can, const char *subfolder = nullptr);
430 
435  TCanvas *GetCanvas(const char *name);
436 
441  Bool_t RemoveCanvas(const char *name);
442 
447  TGo4ObjectStatus *CreateObjectStatus(const char *name, const char *folder = nullptr);
448 
451  TGo4ObjectStatus *CreateObjectStatus(TObject *ob, Bool_t fullinfo = kTRUE);
452 
458 
464  TFolder *CreateNamesFolder(TFolder *objectfolder);
465 
469  TFolder *GetObjectFolder();
470 
474  Bool_t AddEventStore(TGo4EventStore *store);
475 
479  Bool_t RemoveEventStore(TGo4EventStore *store);
480 
484  Bool_t AddEventSource(TGo4EventSource *source);
485 
489  Bool_t RemoveEventSource(TGo4EventSource *source);
490 
495 
500 
505 
510 
514  TGo4EventElement *GetEventStructure(const char *name) const;
515 
519  Bool_t ResetBackStores(Bool_t clearflag=kFALSE);
520 
524  void CloseAnalysis();
525 
527  void SaveObjects(TFile *file);
528 
533  Bool_t LoadObjects(TFile *statusfile);
534 
536  Bool_t AddDynamicEntry(TGo4DynamicEntry *entry);
537 
539  void ResetCurrentDynList();
540 
543  void ProcessDynamicList();
544 
545  void SetDynListInterval(Int_t val) { fiDynListInterval = val; }
546 
547  Int_t GetDynListInterval() const { return fiDynListInterval; }
548 
561  Bool_t AddDynamicHistogram(const char *name,
562  const char *histo,
563  const char *hevx, const char *hmemx,
564  const char *hevy = nullptr, const char *hmemy = nullptr,
565  const char *hevz = nullptr, const char *hmemz = nullptr,
566  const char *condition = nullptr,
567  const char *cevx = nullptr, const char *cmemx = nullptr,
568  const char *cevy = nullptr, const char *cmemy = nullptr);
569 
577  Bool_t AddTreeHistogram(const char *hisname, const char *treename, const char *varexp, const char *cutexp);
578 
583  void PrintHistograms(const char *expression = nullptr);
584 
589  void PrintConditions(const char *expression = nullptr);
590 
595  void PrintParameters(const char *expression = nullptr);
596 
600  void PrintDynamicList();
601 
608  Bool_t ClearObjects(const char *name);
609 
618  Bool_t ProtectObjects(const char *name, const Option_t *flags);
619 
626  Bool_t RemoveDynamicEntry(const char *entryname);
627 
631  TFolder *FindSubFolder(TFolder *parent, const char *subfolder, Bool_t create = kTRUE);
632 
634  Bool_t FindObjectPathName(TObject *obj, TString &pathname, TFolder *fold = nullptr);
635 
636  Bool_t CreatedInMake() const { return fbCreatedinMake; }
637 
639  void SetSortedOrder(Bool_t on = kTRUE) { fbSortedOrder = on; }
640 
642  Bool_t IsSortedOrder() const { return fbSortedOrder; }
643 
645  void RecursiveRemove(TObject *obj) override;
646 
648  static const char *fgcTOPDYNAMICLIST;
649 
651  static const char *fgcTOPFOLDER;
652 
654  static const char *fgcHISTFOLDER;
655 
657  static const char *fgcDYNFOLDER;
658 
660  static const char *fgcCONDFOLDER;
661 
663  static const char *fgcPARAFOLDER;
664 
666  static const char *fgcTREEFOLDER;
667 
669  static const char *fgcPICTFOLDER;
670 
672  static const char *fgcCANVFOLDER;
673 
675  static const char *fgcANALYSISFOLDER;
676 
678  static const char *fgcEVENTFOLDER;
679 
681  static const char *fgcSRCFOLDER;
682 
684  static const char *fgcSTOREFOLDER;
685 
687  static const char *fgcPROCFOLDER;
688 
690  static const char *fgcUSRFOLDER;
691 
693  static const char *fgcTMPFOLDER;
694 
695  static const char *GetTOPDYNAMICLIST();
696  static const char *GetTOPFOLDER();
697  static const char *GetHISTFOLDER();
698  static const char *GetDYNFOLDER();
699  static const char *GetCONDFOLDER();
700  static const char *GetPARAFOLDER();
701  static const char *GetTREEFOLDER();
702  static const char *GetPICTFOLDER();
703  static const char *GetCANVFOLDER();
704  static const char *GetANALYSISFOLDER();
705  static const char *GetEVENTFOLDER();
706  static const char *GetSRCFOLDER();
707  static const char *GetSTOREFOLDER();
708  static const char *GetPROCFOLDER();
709  static const char *GetUSRFOLDER();
710  static const char *GetTMPFOLDER();
711 
712  private:
713 
717  TFolder *fxGo4Dir{nullptr};
718 
719 
724  TFolder *fxHistogramDir{nullptr};
725 
730  TFolder *fxConditionDir{nullptr};
731 
735  TFolder *fxParameterDir{nullptr};
736 
741  TFolder *fxDynListDir{nullptr};
742 
746  TFolder *fxUserDir{nullptr};
747 
751  TFolder *fxTreeDir{nullptr};
752 
756  TFolder *fxPictureDir{nullptr};
757 
761  TFolder *fxCanvasDir{nullptr};
762 
766  TFolder *fxStoreDir{nullptr};
767 
771  TFolder *fxSourceDir{nullptr};
772 
776  TFolder *fxProcessorDir{nullptr};
777 
781  TFolder *fxEventDir{nullptr};
782 
786  TFolder *fxAnalysisDir{nullptr};
787 
791  TFolder *fxTempFolder{nullptr};
792 
796  TMutex *fxDirMutex{nullptr};
797 
801  TList *fxMatchList{nullptr};
802 
804  TIterator *fxMatchIterator{nullptr};
805 
811  Int_t fiDynListCount{0};
812 
817 
822  Bool_t fbCreatedinMake{kFALSE};
823 
830  Bool_t fbSuppressLoadHistograms{kFALSE};
831 
835  Bool_t fbSortedOrder{kFALSE};
836 
845  Bool_t AddObjectToFolder(TObject *ob,
846  TFolder *fold,
847  const char *subfolder = nullptr,
848  Bool_t replace = kTRUE,
849  Bool_t uniquename = kFALSE,
850  Bool_t resetbits = kTRUE);
851 
858  Bool_t RemoveObjectFromFolder(const char *fullname, TFolder *fold, Bool_t isDel);
859 
865  Bool_t LoadFolder(TFolder *source, TFolder *destination, Bool_t replace = kFALSE);
866 
872  Bool_t LoadFolder(TDirectory *source, TFolder *destination, Bool_t replace = kFALSE);
873 
879  Bool_t PutToFolder(TObject *ob, TFolder *destination, Bool_t replace = kFALSE);
880 
886  Bool_t SaveFolder(TFolder *source);
887 
893  void RemoveFromDir(TFolder *fold, TDirectory *dir);
894 
899  void AppendToDir(TObject *ob, TDirectory *dir);
900 
906  Int_t PrintFolder(TFolder *fold, Option_t *opt, const char *expression = nullptr);
907 
912  Bool_t ClearFolder(TFolder *fold);
913 
918  Bool_t ClearObject(TObject *ob);
919 
924  Bool_t DeleteFolder(TFolder *fold);
925 
930  Bool_t DeleteObject(TObject *ob);
931 
940  Bool_t ProtectFolder(TFolder *fold, const Option_t *flags);
941 
950  Bool_t ProtectObject(TObject *ob, const Option_t *flags);
951 
955  void CleanupDynamicLists(TObject *oldobject);
956 
960  TList *CreateObjectList(const char *expr, const char *folder = nullptr);
961 
963  TList *CreateObjectList(const char *expr, TFolder *fold);
964 
966  Bool_t IsMatching(const char *string, const char *expression) const;
967 
971  TObject *FindObjectInFolder(TFolder *folder, const char *fullname) const;
972 
978  TObject *TestObject(TFolder *folder,
979  const char *&pathname,
980  const char *objectname,
981  const TClass *cl);
982 
983 };
984 
985 #endif //TGO4ANALYSISOBJECTMANAGER_H
TFolder * CreateCompositeBranchFolder(TObjArray *branchlist, TGo4CompositeEvent *compevent, Int_t startindex, Int_t *skip, const char *name, const char *title)
Bool_t ProtectObject(TObject *ob, const Option_t *flags)
Bool_t RemoveObjectFromFolder(const char *fullname, TFolder *fold, Bool_t isDel)
Bool_t RemoveEventProcessor(TGo4EventProcessor *pro)
Bool_t RemoveEventStructure(TGo4EventElement *ev)
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=nullptr)
TGo4PolyCond * MakePolyCond(const char *foldername, const char *conditionname, Int_t size, Float_t(*points)[2], const char *bindhistogram=nullptr, Bool_t invert=kFALSE)
Bool_t AddDynamicEntry(TGo4DynamicEntry *entry)
TObject * GetAsTObject(const char *name, const char *folder=nullptr)
TFolder * CreateBranchFolder(TObjArray *branchlist, const char *name, const char *title, Bool_t istopbranch=kFALSE)
Bool_t RemovePicture(const char *name)
Bool_t AddParameter(TGo4Parameter *par, const char *subfolder=nullptr)
static const char * GetTOPDYNAMICLIST()
void RemoveFromDir(TFolder *fold, TDirectory *dir)
TGo4ObjectStatus * CreateObjectStatus(const char *name, const char *folder=nullptr)
Bool_t IsMatching(const char *string, const char *expression) const
Bool_t ClearObjects(const char *name)
Bool_t DeleteObjects(const char *name)
void SetSortedOrder(Bool_t on=kTRUE)
Bool_t RemoveObject(const char *name, Bool_t del=kTRUE)
TGo4Picture * GetPicture(const char *name)
Bool_t AddPicture(TGo4Picture *pic, const char *subfolder=nullptr)
Bool_t RemoveDynamicEntry(const char *entryname)
TH1 * GetHistogram(const char *name)
Bool_t AddDynamicHistogram(const char *name, const char *histo, const char *hevx, const char *hmemx, const char *hevy=nullptr, const char *hmemy=nullptr, const char *hevz=nullptr, const char *hmemz=nullptr, const char *condition=nullptr, const char *cevx=nullptr, const char *cmemx=nullptr, const char *cevy=nullptr, const char *cmemy=nullptr)
Bool_t SetParameter(const char *name, TGo4Parameter *par, TFolder *parent=nullptr)
Bool_t AddCanvas(TCanvas *can, const char *subfolder=nullptr)
Bool_t ProtectFolder(TFolder *fold, const Option_t *flags)
TNamed * GetObject(const char *name, const char *folder=nullptr)
Bool_t RemoveEventStore(TGo4EventStore *store)
Bool_t AddTree(TTree *tree, const char *subfolder=nullptr)
Bool_t AddEventProcessor(TGo4EventProcessor *pro)
Bool_t AddEventSource(TGo4EventSource *source)
TObject * TestObject(TFolder *folder, const char *&pathname, const char *objectname, const TClass *cl)
Bool_t PutToFolder(TObject *ob, TFolder *destination, Bool_t replace=kFALSE)
void PrintConditions(const char *expression=nullptr)
TFolder * CreateNamesFolder(TFolder *objectfolder)
Bool_t SetAnalysisCondition(const char *name, TGo4Condition *con, Bool_t counter=kTRUE, TFolder *parent=nullptr)
Bool_t RemoveEventSource(TGo4EventSource *source)
Bool_t RemoveTree(TTree *tree, const char *stepname=nullptr)
Bool_t AddAnalysisCondition(TGo4Condition *con, const char *subfolder=nullptr)
void AppendToDir(TObject *ob, TDirectory *dir)
Bool_t RemoveCanvas(const char *name)
Bool_t AddEventStore(TGo4EventStore *store)
TFolder * FindSubFolder(TFolder *parent, const char *subfolder, Bool_t create=kTRUE)
Bool_t AddObjectToFolder(TObject *ob, TFolder *fold, const char *subfolder=nullptr, Bool_t replace=kTRUE, Bool_t uniquename=kFALSE, Bool_t resetbits=kTRUE)
TGo4Parameter * GetParameter(const char *name, const char *parameter_class=nullptr)
TH2 * MakeTH2(const char *histotype, const char *foldername, const char *histoname, Int_t nbinsx, Axis_t xlow, Axis_t xup, Int_t nbinsy, Axis_t ylow, Axis_t yup, const char *title=nullptr, const char *xtitle=nullptr, const char *ytitle=nullptr)
Bool_t ResetBackStores(Bool_t clearflag=kFALSE)
TGo4AnalysisObjectNames * CreateNamesList()
TObject * NextMatchingObject(const char *expr, const char *folder, Bool_t reset)
TGo4EventElement * GetEventStructure(const char *name) const
TList * CreateObjectList(const char *expr, const char *folder=nullptr)
Bool_t RemoveAnalysisCondition(const char *name)
void CleanupDynamicLists(TObject *oldobject)
TH1 * MakeTH1(const char *histotype, const char *foldername, const char *histoname, Int_t nbinsx, Axis_t xlow, Axis_t xup, const char *title=nullptr, const char *xtitle=nullptr, const char *ytitle=nullptr)
Bool_t AddHistogram(TH1 *his, const char *subfolder=nullptr, Bool_t replace=kTRUE)
Bool_t SetParameterStatus(const char *name, TGo4ParameterStatus *par, TFolder *parent=nullptr)
Bool_t RemoveHistogram(const char *name, Bool_t del=kTRUE)
TFolder * CreateMembersFolder(TObject *obj, const char *membrfoldername, TClass *cl)
Bool_t ProtectObjects(const char *name, const Option_t *flags)
TObject * FindObjectInFolder(TFolder *folder, const char *fullname) const
Bool_t AddTreeHistogram(const char *hisname, const char *treename, const char *varexp, const char *cutexp)
Bool_t AddObject(TNamed *anything, const char *subfolder=nullptr, Bool_t replace=kTRUE)
Bool_t RemoveParameter(const char *name)
void PrintHistograms(const char *expression=nullptr)
static const char * GetANALYSISFOLDER()
Bool_t AddEventStructure(TGo4EventElement *ev)
Bool_t LoadObjects(TFile *statusfile)
void PrintParameters(const char *expression=nullptr)
void RecursiveRemove(TObject *obj) override
TGo4WinCond * MakeWindowCond(const char *foldername, const char *conditionname, Double_t xlow, Double_t xup, const char *bindhistogram=nullptr, Bool_t invert=kFALSE)
TTree * GetTree(const char *name)
Bool_t SetPicture(const char *name, TGo4Picture *pic, TFolder *parent=nullptr)
TGo4TreeStructure * CreateTreeStructure(TTree *thetree)
Bool_t LoadFolder(TFolder *source, TFolder *destination, Bool_t replace=kFALSE)
TCanvas * GetCanvas(const char *name)
Bool_t FindObjectPathName(TObject *obj, TString &pathname, TFolder *fold=nullptr)
Int_t PrintFolder(TFolder *fold, Option_t *opt, const char *expression=nullptr)