GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4EventProcessor.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 TGO4EVENTPROCESSOR_H
15 #define TGO4EVENTPROCESSOR_H
16 
17 #include "TGo4EventSource.h"
18 
19 #include <cmath>
20 
21 class TH1;
22 class TH1D;
23 class TH1F;
24 class TH1S;
25 class TH1I;
26 class TH1C;
27 class TH2;
28 class TH2D;
29 class TH2C;
30 class TH2F;
31 class TH2S;
32 class TH2I;
33 class TGraph;
34 class TMultiGraph;
35 class TF1;
36 class TCanvas;
37 
38 class TGo4Condition;
39 class TGo4WinCond;
40 class TGo4PolyCond;
41 class TGo4ShapedCond;
42 class TGo4ListCond;
43 class TGo4RollingGraph;
44 
45 #ifndef TGo4EllipseCond
46 #define TGo4EllipseCond TGo4ShapedCond
47 #endif
48 
49 class TGo4CondArray;
50 class TGo4Picture;
51 class TGo4Parameter;
52 
53 class TGo4MbsEvent;
54 class TGo4EventElement;
56 
68  friend class TGo4EventElement;
69 
70  public:
71 
72  TGo4EventProcessor(const char *name);
73 
74  virtual ~TGo4EventProcessor();
75 
82 
87 
94  virtual Bool_t CheckInputEvent(const char *classname);
95 
102 
107 
114  virtual Bool_t CheckCalibration(const char *classname);
115 
116  /* implemented by subclass to assign correct event structures*/
117  virtual void InitEvent(TGo4EventElement *) {}
118 
119  /* implemented by subclass to do actual processing. For second step processors!*/
120  virtual void FinalizeEvent() {}
121 
123  Bool_t AddObject(TNamed *anything, const char *subfolder = nullptr);
124 
126  Bool_t AddHistogram(TH1 *his, const char *subfolder = nullptr, Bool_t replace = kTRUE);
127 
129  Bool_t AddParameter(TGo4Parameter *par, const char *subfolder = nullptr);
130 
132  Bool_t AddAnalysisCondition(TGo4Condition *con, const char *subfolder = nullptr);
133 
135  Bool_t AddPicture(TGo4Picture *pic, const char *subfolder = nullptr);
136 
138  Bool_t AddCanvas(TCanvas *can, const char *subfolder = nullptr);
139 
141  Bool_t RemoveHistogram(const char *name);
142 
144  Bool_t RemoveParameter(const char *name);
145 
147  Bool_t RemoveAnalysisCondition(const char *name);
148 
150  Bool_t RemovePicture(const char *name);
151 
153  Bool_t RemoveCanvas(const char *name);
154 
156  TNamed *GetObject(const char *name, const char *folder = nullptr);
157 
159  TH1 *GetHistogram(const char *name);
160 
162  TGo4Parameter *GetParameter(const char *name, const char *par_class = nullptr);
163 
165  TGo4Condition *GetAnalysisCondition(const char *name, const char *cond_cl = nullptr);
166 
168  TGo4Picture *GetPicture(const char *name);
169 
171  TCanvas *GetCanvas(const char *name);
172 
177  TGo4EventElement *GetInputEvent(const char *stepname);
178 
183  TGo4EventElement *GetOutputEvent(const char *stepname);
184 
193  void Message(Int_t prio, const char *text, ...)
194  #if defined(__GNUC__) && !defined(__CINT__)
195  __attribute__((format(printf, 3, 4)))
196  #endif
197  ;
198 
200  void SendObjectToGUI(TNamed *ob);
201 
202  /* We overwrite the default TNamed::Clear that would
203  * erase our name and title!
204  * Implement this method in your parameter class
205  * if you would like to reset any values with the
206  * eraser button in the gui remote browser*/
207  void Clear(Option_t *opt = "") override;
208 
210  void SetMakeWithAutosave(Bool_t on = kTRUE);
211 
214  Bool_t IsObjMade() const;
215 
229  TH1 *MakeTH1(char type, const char *fullname, const char *title,
230  Int_t nbinsx, Double_t xlow, Double_t xup,
231  const char *xtitle = nullptr, const char *ytitle = nullptr);
232 
247  TH2 *MakeTH2(char type, const char *fullname, const char *title,
248  Int_t nbinsx, Double_t xlow, Double_t xup,
249  Int_t nbinsy, Double_t ylow, Double_t yup,
250  const char *xtitle = nullptr, const char *ytitle = nullptr, const char *ztitle = nullptr);
251 
256  TGraph *MakeGraph(const char *fullname, const char *title, Int_t points = 0, Double_t *xvalues = nullptr,
257  Double_t *yvalues = nullptr);
258 
262  TGraph *MakeGraph(const char *fullname, const char *title, TF1 *function);
263 
268  TGo4RollingGraph *MakeRollingGraph(const char *fullname, const char *title, Int_t points = 0, Int_t average = 1);
269 
274  TGo4WinCond *MakeWinCond(const char *fullname,
275  Double_t xmin, Double_t xmax,
276  const char *HistoName = nullptr);
277 
283  TGo4WinCond *MakeWinCond(const char *fullname,
284  Double_t xmin, Double_t xmax,
285  Double_t ymin, Double_t ymax,
286  const char *HistoName = nullptr);
287 
297  TGo4PolyCond *MakePolyCond(const char *fullname,
298  Int_t npoints,
299  Double_t (*points) [2],
300  const char *HistoName = nullptr);
301 
310  TGo4ShapedCond *MakeEllipseCond(const char *fullname,
311  Int_t npoints,
312  Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta = 0,
313  const char *HistoName = nullptr);
314 
321  TGo4ShapedCond *MakeCircleCond(const char *fullname,
322  Int_t npoints, Double_t cx, Double_t cy, Double_t r,
323  const char *HistoName = nullptr);
324 
333  TGo4ShapedCond *MakeBoxCond(const char *fullname, Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta,
334  const char *HistoName = nullptr);
335 
347  TGo4ShapedCond *MakeFreeShapeCond(const char *fullname,
348  Int_t npoints,
349  Double_t (*points) [2],
350  const char *HistoName = nullptr);
351 
359  TGo4ListCond *MakeListCond(const char *fullname, const Int_t num, const Int_t * values, const char *HistoName = nullptr);
360 
368  TGo4ListCond *MakeListCond(const char *fullname, const Int_t start, const Int_t stop, const Int_t step = 1, const char *HistoName = nullptr);
369 
374  TGo4ListCond *MakeListCond(const char *fullname, const char *title, const char *HistoName = nullptr);
375 
388  TGo4Parameter *MakeParameter(const char *fullname,
389  const char *classname,
390  const char *newcmd = nullptr);
391 
394  Long64_t ExecuteScript(const char *script_name);
395 
399  Long64_t ExecutePython(const char *macro_name, Int_t *errcode = nullptr);
400 
405  Long64_t ExecuteLine(const char *command, Int_t *errcode = nullptr);
406 
407  /* if true, processor wants to continue with current content of input event
408  * event is not refilled from event source, and all previous analysis steps are suspended*/
409  Bool_t IsKeepInputEvent() const { return fbKeepInputEvent; }
410 
411  /* Mark current input event for reprocessing in next cycle
412  * In this case, all previous analysis steps are skipped until this is done*/
413  void SetKeepInputEvent(Bool_t val = kTRUE) { fbKeepInputEvent = val; }
414 
415  /* if true, processor wants to continue filling current output event
416  * Event is not stored, and all subsequent analysis steps are skipped*/
417  Bool_t IsKeepOutputEvent() const { return fbKeepOutputEvent; }
418 
419  /* Mark current input event for reprocessing in next cycle
420  * In this case, all previous analysis steps are skipped until this is done*/
421  void SetKeepOutputEvent(Bool_t val = kTRUE) { fbKeepOutputEvent = val; }
422 
424  virtual void UserPreLoop() {}
425 
427  virtual void UserPostLoop() {}
428 
429  protected:
430 
432 
433  private:
434 
437 
440 
442  Bool_t fbKeepInputEvent{kFALSE};
443 
445  Bool_t fbKeepOutputEvent{kFALSE};
446 
447  ClassDefOverride(TGo4EventProcessor,3)
448 };
449 
450 #endif //TGO4EVENTPROCESSOR_H
TH1 * MakeTH1(char type, const char *fullname, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, const char *xtitle=nullptr, const char *ytitle=nullptr)
TGo4ShapedCond * MakeFreeShapeCond(const char *fullname, Int_t npoints, Double_t(*points) [2], const char *HistoName=nullptr)
void SetKeepOutputEvent(Bool_t val=kTRUE)
Graphs that renew themselves iteratively to monitor a value.
Long64_t ExecuteScript(const char *script_name)
Bool_t RemoveParameter(const char *name)
Bool_t IsKeepInputEvent() const
TNamed * GetObject(const char *name, const char *folder=nullptr)
Bool_t RemovePicture(const char *name)
TGo4Picture * GetPicture(const char *name)
virtual void UserPreLoop()
TGo4RollingGraph * MakeRollingGraph(const char *fullname, const char *title, Int_t points=0, Int_t average=1)
virtual Bool_t CheckInputEvent(const char *classname)
Bool_t AddPicture(TGo4Picture *pic, const char *subfolder=nullptr)
Bool_t AddHistogram(TH1 *his, const char *subfolder=nullptr, Bool_t replace=kTRUE)
Bool_t AddParameter(TGo4Parameter *par, const char *subfolder=nullptr)
TH2 * MakeTH2(char type, const char *fullname, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup, const char *xtitle=nullptr, const char *ytitle=nullptr, const char *ztitle=nullptr)
TGo4EventCalibration * GetCalibration() const
TGo4EventCalibration * fxCalibration
Bool_t RemoveCanvas(const char *name)
virtual void UserPostLoop()
virtual void InitEvent(TGo4EventElement *)
TCanvas * GetCanvas(const char *name)
void Clear(Option_t *opt="") override
TGo4Parameter * MakeParameter(const char *fullname, const char *classname, const char *newcmd=nullptr)
Long64_t ExecuteLine(const char *command, Int_t *errcode=nullptr)
void SetKeepInputEvent(Bool_t val=kTRUE)
void SetInputEvent(TGo4EventElement *raw)
Bool_t IsKeepOutputEvent() const
TGo4ShapedCond * MakeBoxCond(const char *fullname, Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta, const char *HistoName=nullptr)
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=nullptr)
Long64_t ExecutePython(const char *macro_name, Int_t *errcode=nullptr)
virtual Bool_t CheckCalibration(const char *classname)
TGo4EventElement * GetInputEvent()
void SetCalibration(TGo4EventCalibration *cali)
TGo4Parameter * GetParameter(const char *name, const char *par_class=nullptr)
virtual void FinalizeEvent()
void Message(Int_t prio, const char *text,...)
Bool_t AddAnalysisCondition(TGo4Condition *con, const char *subfolder=nullptr)
Bool_t AddCanvas(TCanvas *can, const char *subfolder=nullptr)
TGo4EventElement * fxInputEvent
void SendObjectToGUI(TNamed *ob)
TGo4EventElement * GetOutputEvent(const char *stepname)
Bool_t RemoveAnalysisCondition(const char *name)
TGo4WinCond * MakeWinCond(const char *fullname, Double_t xmin, Double_t xmax, const char *HistoName=nullptr)
Bool_t AddObject(TNamed *anything, const char *subfolder=nullptr)
TGo4ShapedCond * MakeCircleCond(const char *fullname, Int_t npoints, Double_t cx, Double_t cy, Double_t r, const char *HistoName=nullptr)
TH1 * GetHistogram(const char *name)
void SetMakeWithAutosave(Bool_t on=kTRUE)
TGo4ListCond * MakeListCond(const char *fullname, const Int_t num, const Int_t *values, const char *HistoName=nullptr)
TGraph * MakeGraph(const char *fullname, const char *title, Int_t points=0, Double_t *xvalues=nullptr, Double_t *yvalues=nullptr)
TGo4ShapedCond * MakeEllipseCond(const char *fullname, Int_t npoints, Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta=0, const char *HistoName=nullptr)
TGo4PolyCond * MakePolyCond(const char *fullname, Int_t npoints, Double_t(*points) [2], const char *HistoName=nullptr)
Bool_t RemoveHistogram(const char *name)