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