GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4EventProcessor.cxx
Go to the documentation of this file.
1 // $Id: TGo4EventProcessor.cxx 1798 2015-11-17 13:13:45Z adamczew $
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 f�r 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 <snprintf.h>
17 #include <string.h>
18 
19 #include "TH1.h"
20 #include "TH2.h"
21 #include "TCutG.h"
22 #include "TArrayD.h"
23 #include "TAxis.h"
24 #include "TROOT.h"
25 
26 #include "TGo4Log.h"
27 #include "TGo4WinCond.h"
28 #include "TGo4PolyCond.h"
29 #include "TGo4EventElement.h"
30 #include "TGo4EventCalibration.h"
31 #include "TGo4AnalysisImp.h"
32 
34  TGo4EventSource(name),
35  fxInputEvent(0),
36  fxCalibration(0),
37  fbKeepInputEvent(kFALSE),
38  fbKeepOutputEvent(kFALSE)
39 {
40 GO4TRACE((15,"TGo4EventProcessor::TGo4EventProcessor()",__LINE__, __FILE__));
41 }
42 
44 {
45 GO4TRACE((15,"TGo4EventProcessor::~TGo4EventProcessor()",__LINE__, __FILE__));
46 }
47 
48 Bool_t TGo4EventProcessor::CheckInputEvent(const char* classname)
49 {
50  GO4TRACE((12,"TGo4EventProcessor::CheckInputEvent()",__LINE__, __FILE__));
51  if(fxInputEvent==0) return kFALSE;
52 
53  return !strcmp(fxInputEvent->ClassName(),classname);
54 }
55 
56 Bool_t TGo4EventProcessor::CheckCalibration(const char* classname)
57 {
58  GO4TRACE((12,"TGo4EventProcessor::CheckCalibration()",__LINE__, __FILE__));
59  if(fxCalibration==0) return kFALSE;
60 
61  return !strcmp(fxCalibration->ClassName(),classname);
62 }
63 
64 Bool_t TGo4EventProcessor::AddObject(TNamed* any, const char* subfolder)
65 {
66  return TGo4Analysis::Instance()->AddObject(any,subfolder);
67 }
68 
69 Bool_t TGo4EventProcessor::AddHistogram(TH1* his, const char* subfolder, Bool_t replace)
70 {
71  return TGo4Analysis::Instance()->AddHistogram(his,subfolder,replace);
72 }
73 
74 Bool_t TGo4EventProcessor::AddParameter(TGo4Parameter* par,const char* subfolder)
75 {
76  return TGo4Analysis::Instance()->AddParameter(par,subfolder);
77 }
78 
79 Bool_t TGo4EventProcessor::AddPicture(TGo4Picture* pic,const char* subfolder)
80 {
81  return TGo4Analysis::Instance()->AddPicture(pic,subfolder);
82 }
83 
84 Bool_t TGo4EventProcessor::AddCanvas(TCanvas* can, const char* subfolder)
85 {
86  return TGo4Analysis::Instance()->AddCanvas(can,subfolder);
87 }
88 
89 Bool_t TGo4EventProcessor::AddAnalysisCondition(TGo4Condition* con,const char* subfolder)
90 {
91  return TGo4Analysis::Instance()->AddAnalysisCondition(con,subfolder);
92 }
93 
94 Bool_t TGo4EventProcessor::RemoveHistogram(const char* name)
95 {
97 }
98 
99 Bool_t TGo4EventProcessor::RemoveParameter(const char* name)
100 {
101  return TGo4Analysis::Instance()->RemoveParameter(name);
102 }
103 
104 Bool_t TGo4EventProcessor::RemovePicture(const char* name)
105 {
106  return TGo4Analysis::Instance()->RemovePicture(name);
107 }
108 
109 Bool_t TGo4EventProcessor::RemoveCanvas(const char* name)
110 {
111  return TGo4Analysis::Instance()->RemoveCanvas(name);
112 }
113 
115 {
117 }
118 
119 TNamed* TGo4EventProcessor::GetObject(const char* name, const char* folder)
120 {
121  return TGo4Analysis::Instance()->GetObject(name,folder);
122 }
123 
124 TH1* TGo4EventProcessor::GetHistogram(const char* name)
125 {
126  return TGo4Analysis::Instance()->GetHistogram(name);
127 }
128 
129 TGo4Parameter* TGo4EventProcessor::GetParameter(const char* name, const char* par_class)
130 {
131  return TGo4Analysis::Instance()->GetParameter(name, par_class);
132 }
133 
135 {
136  return TGo4Analysis::Instance()->GetPicture(name);
137 }
138 
139 TCanvas* TGo4EventProcessor::GetCanvas(const char* name)
140 {
141  return TGo4Analysis::Instance()->GetCanvas(name);
142 }
143 
144 TGo4Condition* TGo4EventProcessor::GetAnalysisCondition(const char* name, const char* cond_cl)
145 {
146  return TGo4Analysis::Instance()->GetAnalysisCondition(name, cond_cl);
147 }
148 
150 {
151  return TGo4Analysis::Instance()->GetInputEvent(stepname);
152 }
153 
155 {
156  return TGo4Analysis::Instance()->GetOutputEvent(stepname);
157 }
158 
159 void TGo4EventProcessor::Message(Int_t prio, const char* text,...)
160 {
161  char txtbuf[__MESSAGETEXTLENGTH__];
162  va_list args;
163  va_start(args, text);
164  vsnprintf(txtbuf, __MESSAGETEXTLENGTH__, text, args);
165  va_end(args);
166  TGo4Analysis::Instance()->Message(prio,txtbuf);
167 }
168 
170 {
171  return (TGo4Analysis::Instance()->SendObjectToGUI(ob ) );
172 }
173 
174 void TGo4EventProcessor::Clear(Option_t* opt)
175 {
176  TGo4Log::Info("Default Clear of event processor %s", GetName());
177  // dummy clear, may be implemented by user
178 }
179 
181 {
183 }
184 
186 {
187  return TGo4Analysis::Instance()->IsObjMade();
188 }
189 
190 
191 TH1* TGo4EventProcessor::MakeTH1(char type, const char* fullname, const char* title,
192  Int_t nbinsx, Double_t xlow, Double_t xup,
193  const char* xtitle, const char* ytitle)
194 {
195  return TGo4Analysis::Instance()->MakeTH1(type, fullname, title,
196  nbinsx, xlow, xup,
197  xtitle, ytitle);
198 }
199 
200 TH2* TGo4EventProcessor::MakeTH2(char type, const char* fullname, const char* title,
201  Int_t nbinsx, Double_t xlow, Double_t xup,
202  Int_t nbinsy, Double_t ylow, Double_t yup,
203  const char* xtitle, const char* ytitle, const char* ztitle)
204 {
205  return TGo4Analysis::Instance()->MakeTH2(type, fullname, title,
206  nbinsx, xlow, xup,
207  nbinsy, ylow, yup,
208  xtitle, ytitle, ztitle);
209 }
210 
212  Double_t xmin, Double_t xmax,
213  const char* HistoName)
214 {
215  return TGo4Analysis::Instance()->MakeWinCond(fullname, xmin, xmax, HistoName);
216 }
217 
219  Double_t xmin, Double_t xmax,
220  Double_t ymin, Double_t ymax,
221  const char* HistoName)
222 {
223  return TGo4Analysis::Instance()->MakeWinCond(fullname,
224  xmin, xmax,
225  ymin, ymax,
226  HistoName);
227 }
228 
230  Int_t npoints,
231  Double_t (*points) [2],
232  const char* HistoName)
233 {
234  return TGo4Analysis::Instance()->MakePolyCond(fullname, npoints, points, HistoName);
235 }
236 
237 
238 TGo4ShapedCond* TGo4EventProcessor::MakeEllipseCond(const char* fullname, Int_t npoints, Double_t cx, Double_t cy,
239  Double_t a1, Double_t a2, Double_t theta, const char* HistoName)
240 {
241  return TGo4Analysis::Instance()->MakeEllipseCond(fullname, npoints, cx, cy, a1, a2, theta, HistoName);
242 }
243 
244 TGo4ShapedCond* TGo4EventProcessor::MakeCircleCond(const char* fullname, Int_t npoints, Double_t cx, Double_t cy,
245  Double_t r, const char* HistoName)
246 {
247  return TGo4Analysis::Instance()->MakeCircleCond(fullname, npoints, cx, cy, r, HistoName);
248 }
249 
251  Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta,
252  const char* HistoName )
253 {
254  return TGo4Analysis::Instance()->MakeBoxCond(fullname, cx, cy, a1, a2, theta,HistoName);
255 }
256 
258  Int_t npoints,
259  Double_t (*points) [2],
260  const char* HistoName)
261 {
262  return TGo4Analysis::Instance()->MakeFreeShapeCond(fullname,npoints,points,HistoName);
263 }
264 
265 
267  const char* classname,
268  const char* newcmd)
269 {
270  return TGo4Analysis::Instance()->MakeParameter(fullname, classname, newcmd);
271 }
272 
273 Long_t TGo4EventProcessor::ExecuteScript(const char* macro_name)
274 {
275  return TGo4Analysis::Instance()->ExecuteScript(macro_name);
276 }
277 
278 Long_t TGo4EventProcessor::ExecutePython(const char* macro_name, Int_t* errcode)
279 {
280  return TGo4Analysis::Instance()->ExecutePython(macro_name, errcode);
281 }
282 
283 Long_t TGo4EventProcessor::ExecuteLine(const char* command, Int_t* errcode)
284 {
285  return TGo4Analysis::Instance()->ExecuteLine(command, errcode);
286 }
287 
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)
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)
virtual Bool_t CheckInputEvent(const char *classname)
TGo4WinCond * MakeWinCond(const char *fullname, Double_t xmin, Double_t xmax, 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)
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()
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)
static void Info(const char *text,...)
Definition: TGo4Log.cxx:283
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)