GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
TGo4EventProcessor.cxx
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 #include "TGo4EventProcessor.h"
15 
16 #include <cstring>
17 #include <stdarg.h>
18 
19 #include "TGo4Log.h"
20 #include "TGo4EventElement.h"
21 #include "TGo4EventCalibration.h"
22 #include "TGo4AnalysisImp.h"
23 
25 {
26 GO4TRACE((15,"TGo4EventProcessor::TGo4EventProcessor()",__LINE__, __FILE__));
27 }
28 
30 {
31 GO4TRACE((15,"TGo4EventProcessor::~TGo4EventProcessor()",__LINE__, __FILE__));
32 }
33 
34 Bool_t TGo4EventProcessor::CheckInputEvent(const char *classname)
35 {
36  GO4TRACE((12,"TGo4EventProcessor::CheckInputEvent()",__LINE__, __FILE__));
37  if(!fxInputEvent) return kFALSE;
38 
39  return !strcmp(fxInputEvent->ClassName(),classname);
40 }
41 
42 Bool_t TGo4EventProcessor::CheckCalibration(const char *classname)
43 {
44  GO4TRACE((12,"TGo4EventProcessor::CheckCalibration()",__LINE__, __FILE__));
45  if(!fxCalibration) return kFALSE;
46 
47  return !strcmp(fxCalibration->ClassName(),classname);
48 }
49 
50 Bool_t TGo4EventProcessor::AddObject(TNamed *any, const char *subfolder)
51 {
52  return TGo4Analysis::Instance()->AddObject(any,subfolder);
53 }
54 
55 Bool_t TGo4EventProcessor::AddHistogram(TH1 *his, const char *subfolder, Bool_t replace)
56 {
57  return TGo4Analysis::Instance()->AddHistogram(his,subfolder,replace);
58 }
59 
60 Bool_t TGo4EventProcessor::AddParameter(TGo4Parameter *par,const char *subfolder)
61 {
62  return TGo4Analysis::Instance()->AddParameter(par,subfolder);
63 }
64 
65 Bool_t TGo4EventProcessor::AddPicture(TGo4Picture *pic,const char *subfolder)
66 {
67  return TGo4Analysis::Instance()->AddPicture(pic,subfolder);
68 }
69 
70 Bool_t TGo4EventProcessor::AddCanvas(TCanvas *can, const char *subfolder)
71 {
72  return TGo4Analysis::Instance()->AddCanvas(can,subfolder);
73 }
74 
75 Bool_t TGo4EventProcessor::AddAnalysisCondition(TGo4Condition *con,const char *subfolder)
76 {
77  return TGo4Analysis::Instance()->AddAnalysisCondition(con,subfolder);
78 }
79 
80 Bool_t TGo4EventProcessor::RemoveHistogram(const char *name)
81 {
83 }
84 
85 Bool_t TGo4EventProcessor::RemoveParameter(const char *name)
86 {
88 }
89 
90 Bool_t TGo4EventProcessor::RemovePicture(const char *name)
91 {
92  return TGo4Analysis::Instance()->RemovePicture(name);
93 }
94 
95 Bool_t TGo4EventProcessor::RemoveCanvas(const char *name)
96 {
97  return TGo4Analysis::Instance()->RemoveCanvas(name);
98 }
99 
101 {
103 }
104 
105 TNamed *TGo4EventProcessor::GetObject(const char *name, const char *folder)
106 {
107  return TGo4Analysis::Instance()->GetObject(name,folder);
108 }
109 
110 TH1 *TGo4EventProcessor::GetHistogram(const char *name)
111 {
112  return TGo4Analysis::Instance()->GetHistogram(name);
113 }
114 
115 TGo4Parameter *TGo4EventProcessor::GetParameter(const char *name, const char *par_class)
116 {
117  return TGo4Analysis::Instance()->GetParameter(name, par_class);
118 }
119 
121 {
122  return TGo4Analysis::Instance()->GetPicture(name);
123 }
124 
125 TCanvas *TGo4EventProcessor::GetCanvas(const char *name)
126 {
127  return TGo4Analysis::Instance()->GetCanvas(name);
128 }
129 
130 TGo4Condition *TGo4EventProcessor::GetAnalysisCondition(const char *name, const char *cond_cl)
131 {
132  return TGo4Analysis::Instance()->GetAnalysisCondition(name, cond_cl);
133 }
134 
136 {
137  return TGo4Analysis::Instance()->GetInputEvent(stepname);
138 }
139 
141 {
142  return TGo4Analysis::Instance()->GetOutputEvent(stepname);
143 }
144 
145 void TGo4EventProcessor::Message(Int_t prio, const char *text,...)
146 {
147  char txtbuf[__MESSAGETEXTLENGTH__];
148  va_list args;
149  va_start(args, text);
150  vsnprintf(txtbuf, __MESSAGETEXTLENGTH__, text, args);
151  va_end(args);
152  TGo4Analysis::Instance()->Message(prio, "%s", txtbuf);
153 }
154 
156 {
158 }
159 
161 {
162  TGo4Log::Info("Default Clear of event processor %s", GetName());
163  // dummy clear, may be implemented by user
164 }
165 
167 {
169 }
170 
172 {
173  return TGo4Analysis::Instance()->IsObjMade();
174 }
175 
176 TH1 *TGo4EventProcessor::MakeTH1(char type, const char *fullname, const char *title,
177  Int_t nbinsx, Double_t xlow, Double_t xup,
178  const char *xtitle, const char *ytitle)
179 {
180  return TGo4Analysis::Instance()->MakeTH1(type, fullname, title,
181  nbinsx, xlow, xup,
182  xtitle, ytitle);
183 }
184 
185 TH2 *TGo4EventProcessor::MakeTH2(char type, const char *fullname, const char *title,
186  Int_t nbinsx, Double_t xlow, Double_t xup,
187  Int_t nbinsy, Double_t ylow, Double_t yup,
188  const char *xtitle, const char *ytitle, const char *ztitle)
189 {
190  return TGo4Analysis::Instance()->MakeTH2(type, fullname, title,
191  nbinsx, xlow, xup,
192  nbinsy, ylow, yup,
193  xtitle, ytitle, ztitle);
194 }
195 
196 TGraph *TGo4EventProcessor::MakeGraph(const char *fullname, const char *title, Int_t points, Double_t *xvalues,
197  Double_t *yvalues)
198 {
199  return TGo4Analysis::Instance()->MakeGraph(fullname, title, points, xvalues, yvalues);
200 }
201 
202 TGraph *TGo4EventProcessor::MakeGraph(const char *fullname, const char *title, TF1 *function)
203 {
204  return TGo4Analysis::Instance()->MakeGraph(fullname, title, function);
205 }
206 
207 TGo4RollingGraph *TGo4EventProcessor::MakeRollingGraph(const char *fullname, const char *title, Int_t points, Int_t average)
208 {
209  return TGo4Analysis::Instance()->MakeRollingGraph(fullname, title, points, average);
210 }
211 
212 
214  Double_t xmin, Double_t xmax,
215  const char *HistoName)
216 {
217  return TGo4Analysis::Instance()->MakeWinCond(fullname, xmin, xmax, HistoName);
218 }
219 
221  Double_t xmin, Double_t xmax,
222  Double_t ymin, Double_t ymax,
223  const char *HistoName)
224 {
225  return TGo4Analysis::Instance()->MakeWinCond(fullname,
226  xmin, xmax,
227  ymin, ymax,
228  HistoName);
229 }
230 
232  Int_t npoints,
233  Double_t (*points) [2],
234  const char *HistoName)
235 {
236  return TGo4Analysis::Instance()->MakePolyCond(fullname, npoints, points, HistoName);
237 }
238 
239 
240 TGo4ShapedCond *TGo4EventProcessor::MakeEllipseCond(const char *fullname, Int_t npoints, Double_t cx, Double_t cy,
241  Double_t a1, Double_t a2, Double_t theta, const char *HistoName)
242 {
243  return TGo4Analysis::Instance()->MakeEllipseCond(fullname, npoints, cx, cy, a1, a2, theta, HistoName);
244 }
245 
246 TGo4ShapedCond *TGo4EventProcessor::MakeCircleCond(const char *fullname, Int_t npoints, Double_t cx, Double_t cy,
247  Double_t r, const char *HistoName)
248 {
249  return TGo4Analysis::Instance()->MakeCircleCond(fullname, npoints, cx, cy, r, HistoName);
250 }
251 
253  Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta,
254  const char *HistoName )
255 {
256  return TGo4Analysis::Instance()->MakeBoxCond(fullname, cx, cy, a1, a2, theta,HistoName);
257 }
258 
260  Int_t npoints,
261  Double_t (*points) [2],
262  const char *HistoName)
263 {
264  return TGo4Analysis::Instance()->MakeFreeShapeCond(fullname,npoints,points,HistoName);
265 }
266 
267 
268 TGo4ListCond *TGo4EventProcessor::MakeListCond(const char *fullname, const Int_t num, const Int_t * values, const char *HistoName)
269 {
270  return TGo4Analysis::Instance()->MakeListCond(fullname, num, values, HistoName);
271 }
272 
273 
274 TGo4ListCond *TGo4EventProcessor::MakeListCond(const char *fullname, const Int_t start, const Int_t stop, const Int_t step, const char *HistoName)
275 {
276  return TGo4Analysis::Instance()->MakeListCond(fullname, start, stop, step,HistoName);
277 }
278 
279 
280 TGo4ListCond *TGo4EventProcessor::MakeListCond(const char *fullname, const char *title, const char *HistoName)
281 {
282  return TGo4Analysis::Instance()->MakeListCond(fullname, title, HistoName);
283 }
284 
285 
287  const char *classname,
288  const char *newcmd)
289 {
290  return TGo4Analysis::Instance()->MakeParameter(fullname, classname, newcmd);
291 }
292 
293 Long64_t TGo4EventProcessor::ExecuteScript(const char *macro_name)
294 {
295  return TGo4Analysis::Instance()->ExecuteScript(macro_name);
296 }
297 
298 Long64_t TGo4EventProcessor::ExecutePython(const char *macro_name, Int_t *errcode)
299 {
300  return TGo4Analysis::Instance()->ExecutePython(macro_name, errcode);
301 }
302 
303 Long64_t TGo4EventProcessor::ExecuteLine(const char *command, Int_t *errcode)
304 {
305  return TGo4Analysis::Instance()->ExecuteLine(command, errcode);
306 }
TGraph * MakeGraph(const char *fullname, const char *title, Int_t points=0, Double_t *xvalues=nullptr, Double_t *yvalues=nullptr)
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)
TGo4PolyCond * MakePolyCond(const char *fullname, Int_t npoints, Double_t(*points) [2], const char *HistoName=nullptr, Bool_t shapedcond=kFALSE)
Graphs that renew themselves iteratively to monitor a value.
void SetMakeWithAutosave(Bool_t on=kTRUE)
Long64_t ExecuteScript(const char *script_name)
Bool_t RemoveParameter(const char *name)
TNamed * GetObject(const char *name, const char *folder=nullptr)
Bool_t AddPicture(TGo4Picture *pic, const char *subfolder=nullptr)
Bool_t RemovePicture(const char *name)
TGo4ShapedCond * MakeBoxCond(const char *fullname, Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta, const char *HistoName=nullptr)
Bool_t RemoveParameter(const char *name)
TGo4Picture * GetPicture(const char *name)
Long64_t ExecutePython(const char *script_name, Int_t *errcode=nullptr)
static void Info(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:294
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)
Bool_t RemoveAnalysisCondition(const char *name)
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)
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)
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=nullptr)
TGo4ListCond * MakeListCond(const char *fullname, const Int_t num, const Int_t *values, const char *HistoName=nullptr)
TGo4EventCalibration * fxCalibration
Bool_t RemoveCanvas(const char *name)
Long64_t ExecuteScript(const char *script_name)
TH1 * GetHistogram(const char *name)
TCanvas * GetCanvas(const char *name)
void Clear(Option_t *opt="") override
TCanvas * GetCanvas(const char *name)
void SendObjectToGUI(TObject *ob)
Long64_t ExecuteLine(const char *command, Int_t *errcode=nullptr)
TGo4Parameter * MakeParameter(const char *fullname, const char *classname, const char *newcmd=nullptr)
void Message(Int_t prio, const char *text,...)
Long64_t ExecuteLine(const char *command, Int_t *errcode=nullptr)
TGo4Parameter * GetParameter(const char *name, const char *parameter_class=nullptr)
Bool_t AddAnalysisCondition(TGo4Condition *con, const char *subfolder=nullptr)
Bool_t RemoveCanvas(const char *name)
TGo4ShapedCond * MakeBoxCond(const char *fullname, Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta, const char *HistoName=nullptr)
TGo4Parameter * MakeParameter(const char *fullname, const char *classname, const char *cmd=nullptr)
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=nullptr)
TGo4EventElement * GetInputEvent(const char *stepname) const
TGo4Picture * GetPicture(const char *name)
TGo4WinCond * MakeWinCond(const char *fullname, Double_t xmin, Double_t xmax, const char *HistoName=nullptr)
Bool_t AddHistogram(TH1 *his, const char *subfolder=nullptr, Bool_t replace=kTRUE)
Long64_t ExecutePython(const char *macro_name, Int_t *errcode=nullptr)
Bool_t AddCanvas(TCanvas *can, const char *subfolder=nullptr)
virtual Bool_t CheckCalibration(const char *classname)
TGo4ShapedCond * MakeFreeShapeCond(const char *fullname, Int_t npoints, Double_t(*points)[2], const char *HistoName=nullptr)
TNamed * GetObject(const char *name, const char *folder=nullptr)
Bool_t AddObject(TNamed *anything, const char *subfolder=nullptr, Bool_t replace=kTRUE)
TGo4EventElement * GetInputEvent()
TGo4RollingGraph * MakeRollingGraph(const char *fullname, const char *title, Int_t points=0, Int_t average=1)
TGo4ShapedCond * MakeCircleCond(const char *fullname, Int_t npoints, Double_t cx, Double_t cy, Double_t r, const char *HistoName=nullptr)
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)
TGo4Parameter * GetParameter(const char *name, const char *par_class=nullptr)
#define GO4TRACE(X)
Definition: TGo4Log.h:25
Bool_t IsObjMade() const
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 * GetOutputEvent(const char *stepname) const
TGo4EventElement * fxInputEvent
Bool_t AddParameter(TGo4Parameter *par, const char *subfolder=nullptr)
void SendObjectToGUI(TNamed *ob)
TGo4EventElement * GetOutputEvent(const char *stepname)
Bool_t RemoveAnalysisCondition(const char *name)
Bool_t RemoveHistogram(const char *name, Bool_t del=kTRUE)
TGo4WinCond * MakeWinCond(const char *fullname, Double_t xmin, Double_t xmax, const char *HistoName=nullptr)
#define __MESSAGETEXTLENGTH__
Definition: TGo4Log.h:22
static TGo4Analysis * Instance()
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)
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)
Bool_t RemovePicture(const char *name)
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)