GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4AnalysisWebStatus.cxx
Go to the documentation of this file.
1 // $Id: TGo4AnalysisWebStatus.cxx 1396 2015-02-20 15:11:10Z 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 "TGo4AnalysisWebStatus.h"
15 
16 #include "TUrl.h"
17 #include "TClass.h"
18 
19 #include "TGo4AnalysisStepStatus.h"
20 
21 #include "TGo4Analysis.h"
22 #include "TGo4AnalysisClient.h"
23 //#include "TGo4LockGuard.h"
24 
26 TString TGo4AnalysisWebStatus::fgxURL_CLOSE = "close";
27 
28 TString TGo4AnalysisWebStatus::fgxURL_ENABLESTEP = "stepenabled";
29 TString TGo4AnalysisWebStatus::fgxURL_ENABLESOURCE = "sourceenabled";
30 TString TGo4AnalysisWebStatus::fgxURL_ENABLESTORE = "storeenabled";
31 
32 TString TGo4AnalysisWebStatus::fgxURL_SOURCE_TYPE = "sourcesel";
33 TString TGo4AnalysisWebStatus::fgxURL_SOURCE_NAME = "sourcename";
34 TString TGo4AnalysisWebStatus::fgxURL_SOURCE_PORT = "sourceport";
35 TString TGo4AnalysisWebStatus::fgxURL_SOURCE_TIMEOUT = "sourcetmout";
36 TString TGo4AnalysisWebStatus::fgxURL_SOURCE_RETRY = "sourceretry";
37 TString TGo4AnalysisWebStatus::fgxURL_SOURCE_FIRST = "sourcefirst";
38 TString TGo4AnalysisWebStatus::fgxURL_SOURCE_LAST = "sourcelast";
39 TString TGo4AnalysisWebStatus::fgxURL_SOURCE_SKIP = "sourceskip";
40 TString TGo4AnalysisWebStatus::fgxURL_STORE_TYPE = "storesel";
41 TString TGo4AnalysisWebStatus::fgxURL_STORE_NAME = "storename";
42 TString TGo4AnalysisWebStatus::fgxURL_STORE_SPLIT = "storesplit";
43 TString TGo4AnalysisWebStatus::fgxURL_STORE_BUF = "storebuf";
44 TString TGo4AnalysisWebStatus::fgxURL_STORE_COMP = "storecomp";
45 TString TGo4AnalysisWebStatus::fgxURL_STORE_ASF = "storeasf";
47 
48 TString TGo4AnalysisWebStatus::fgxURL_ASF_SAVE = "saveasf";
49 TString TGo4AnalysisWebStatus::fgxURL_ASF_ENABLED = "asfenabled";
50 TString TGo4AnalysisWebStatus::fgxURL_ASF_NAME = "asfname";
52 TString TGo4AnalysisWebStatus::fgxURL_ASF_COMP = "asfcomp";
53 TString TGo4AnalysisWebStatus::fgxURL_ASF_OVERWRITE = "asfoverwrite";
54 
55 TString TGo4AnalysisWebStatus::fgxURL_PREFS_NAME = "anaprefsname";
56 TString TGo4AnalysisWebStatus::fgxURL_PREFS_LOAD = "loadprefs";
57 TString TGo4AnalysisWebStatus::fgxURL_PREFS_SAVE = "saveprefs";
58 
59 
60 // Method TUrl::HasOption is not available for older ROOT versions, use workaround:
61 #if ROOT_VERSION_CODE < ROOT_VERSION(5,34,20)
62 #define HasOption(x) GetValueFromOptions(x)!=0
63 #endif
64 
65 
66 
67 Bool_t TGo4AnalysisWebStatus::UpdateFromUrl(const char* rest_url_opt)
68 {
69  std::cout << "\nTGo4AnalysisWebStatus Update From Url with " << rest_url_opt << std::endl;
70 // TGo4LockGuard gard; // test: can we avoid deadlock with monitoring sniffer here?
71 // std::cout << "\nTGo4AnalysisWebStatus AFTER lockguard." << std::endl;
72  TString message;
73  message.Form("TGo4AnalysisWebStatus::UpdateFromUrl ");
75  TUrl url;
76  url.SetOptions(rest_url_opt); // this time try to use ROOT default class
77  TString theKey;
78 
79  //handle first pseudo commands that should not initialize analysis:
80 
81  // close analysis:
83  if (url.HasOption(theKey.Data()))
84  {
85  ana->StopAnalysis();
86  ana->CloseAnalysis();
87  message.Append(TString::Format(", CLOSING analysis"));
88  TGo4Log::Message(1, message.Data());
89  return kTRUE;
90  }
91 
92  // save asf:
94  if (url.HasOption(theKey.Data()))
95  {
96  const char* filename = url.GetValueFromOptions(theKey.Data());
98  message.Append(TString::Format(", saving autosave file %s", filename));
99  TGo4Log::Message(1, message.Data());
100  return kTRUE;
101  }
102 
103  // save setup:
105  if (url.HasOption(theKey.Data()))
106  {
107  const char* filename = url.GetValueFromOptions(theKey.Data());
108  SaveStatus(filename);
109  message.Append(TString::Format(", saving configuration file %s", filename));
110  TGo4Log::Message(1, message.Data());
111  return kTRUE;
112  }
113 
114  // load setup and initialize:
116  if (url.HasOption(theKey.Data()))
117  {
118  const char* filename = url.GetValueFromOptions(theKey.Data());
119  ana->StopAnalysis();
120  if (LoadStatus(filename))
121  {
122  ana->InitEventClasses();
123  message.Append(TString::Format(", loaded configuration file %s", filename));
124  }
125  else
126  {
127  message.Append(TString::Format(", /!\\ FAILED to load configuration file %s !!!", filename));
128  }
129  TGo4Log::Message(1, message.Data());
130  return kTRUE;
131  }
132 
133  // first stepwise options here:
134 
136  TGo4AnalysisStepStatus* step = 0;
137  Int_t stepindex = 0;
138  while ((step = NextStepStatus()) != 0)
139  {
140  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_ENABLESTEP.Data(), stepindex);
141  if (url.HasOption(theKey.Data()))
142  {
143 
144  //std::cout <<"---- found stepenabled key:"<<theKey.Data()<< std::endl;
145  Bool_t enablestep = ((TString(url.GetValueFromOptions(theKey.Data())) == "true") ? kTRUE : kFALSE);
146  message.Append(TString::Format(", %s=%d", theKey.Data(), enablestep));
147  step->SetProcessEnabled(enablestep);
148  }
149  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_ENABLESOURCE.Data(), stepindex);
150  if (url.HasOption(theKey.Data()))
151  {
152  //std::cout <<"---- found sourceenabled key:"<<theKey.Data()<< std::endl;
153  Bool_t enablesource = ((TString(url.GetValueFromOptions(theKey.Data())) == "true") ? kTRUE : kFALSE);
154  message.Append(TString::Format(", %s=%d", theKey.Data(), enablesource));
155  step->SetSourceEnabled(enablesource);
156  }
157  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_ENABLESTORE.Data(), stepindex);
158  if (url.HasOption(theKey.Data()))
159  {
160  //std::cout <<"---- found storeenabled key:"<<theKey.Data()<< std::endl;
161  Bool_t enablestore = ((TString(url.GetValueFromOptions(theKey.Data())) == "true") ? kTRUE : kFALSE);
162  message.Append(TString::Format(", %s=%d", theKey.Data(), enablestore));
163  step->SetStoreEnabled(enablestore);
164  }
165 
166  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_SOURCE_TYPE.Data(), stepindex);
167  if (url.HasOption(theKey.Data()))
168  {
169  Int_t srctype = url.GetIntValueFromOptions(theKey.Data());
170  message.Append(TString::Format(", %s=%d", theKey.Data(), srctype));
171 
172  // extract values of old source parameter and save them into the new if matching:
173  TGo4EventSourceParameter* oldsrcpar = step->GetSourcePar();
174  TGo4MbsSourceParameter* oldmbspar = dynamic_cast<TGo4MbsSourceParameter*>(oldsrcpar);
175  TGo4UserSourceParameter* olduserpar = dynamic_cast<TGo4UserSourceParameter*>(oldsrcpar);
176  TString srcname = oldsrcpar->GetName();
177  Int_t port = oldmbspar ? oldmbspar->GetPort() : 0;
178  if (port == 0)
179  port = olduserpar ? olduserpar->GetPort() : 0;
180  // JAM: the above shows that event source hierarchy interface is still not optimized
181  // however, currently (March 2015) no manpower to improve or redesign Go4 if it is working...
182 
183  TGo4EventSourceParameter* newpar = 0;
184  switch (srctype)
185  {
186  case GO4EV_FILE:
187  newpar = new TGo4FileSourceParameter(srcname);
188  break;
189 
190  case GO4EV_MBS_FILE:
191  newpar = new TGo4MbsFileParameter(srcname);
192  break;
193 
194  case GO4EV_MBS_STREAM:
195  newpar = new TGo4MbsStreamParameter(srcname);
196  break;
197 
198  case GO4EV_MBS_TRANSPORT:
199  newpar = new TGo4MbsTransportParameter(srcname);
200  break;
201 
203  newpar = new TGo4MbsEventServerParameter(srcname);
204  break;
205 
206  case GO4EV_MBS_REVSERV:
207  newpar = new TGo4RevServParameter(srcname);
208  break;
209 
210  case GO4EV_MBS_RANDOM:
211  newpar = new TGo4MbsRandomParameter("random");
212  break;
213 
214  case GO4EV_USER:
215  newpar = new TGo4UserSourceParameter(srcname, "", port);
216  break;
217  };
218 
219  TGo4MbsSourceParameter* newmbspar = dynamic_cast<TGo4MbsSourceParameter*>(newpar);
220  if (newmbspar)
221  {
222  newmbspar->SetPort(port);
223  if (oldmbspar)
224  {
225  newmbspar->SetStartEvent(oldmbspar->GetStartEvent());
226  newmbspar->SetStopEvent(oldmbspar->GetStopEvent());
227  newmbspar->SetEventInterval(oldmbspar->GetEventInterval());
228  }
229  }
230  newpar->SetTimeout(oldsrcpar->GetTimeout());
231 
232  step->SetSourcePar(newpar);
233  delete newpar; // SetSourcePar does clone argument, we do not need it further
234  } // fgxURL_SOURCE_TYPE
235 
236  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_SOURCE_NAME.Data(), stepindex);
237  if (url.HasOption(theKey.Data()))
238  {
239  TString srcname = url.GetValueFromOptions(theKey.Data());
240  message.Append(TString::Format(", %s=%s", theKey.Data(), srcname.Data()));
241  TGo4EventSourceParameter* srcpar = step->GetSourcePar();
242  srcpar->SetName(srcname.Data());
243 
244  } // fgxURL_SOURCE_NAME;
245 
246  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_SOURCE_PORT.Data(), stepindex);
247  if (url.HasOption(theKey.Data()))
248  {
249  Int_t port = url.GetIntValueFromOptions(theKey.Data());
250  message.Append(TString::Format(", %s=%d", theKey.Data(), port));
251  TGo4EventSourceParameter* srcpar = step->GetSourcePar();
252  TGo4MbsSourceParameter* mbspar = dynamic_cast<TGo4MbsSourceParameter*>(srcpar);
253  TGo4UserSourceParameter* userpar = dynamic_cast<TGo4UserSourceParameter*>(srcpar);
254  if (mbspar)
255  mbspar->SetPort(port);
256  else if (userpar)
257  userpar->SetPort(port);
258  else
259  message.Append(
260  TString::Format(" - /!\\ NEVER COME HERE: Could not set port to type %s ", srcpar->ClassName()));
261  } //fgxURL_SOURCE_PORT;
262 
263  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_SOURCE_TIMEOUT.Data(), stepindex);
264  if (url.HasOption(theKey.Data()))
265  {
266  Int_t timeout = url.GetIntValueFromOptions(theKey.Data());
267  message.Append(TString::Format(", %s=%d", theKey.Data(), timeout));
268  TGo4EventSourceParameter* srcpar = step->GetSourcePar();
269  srcpar->SetTimeout(timeout);
270  } //fgxURL_SOURCE_TIMEOUT;
271 
272  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_SOURCE_RETRY.Data(), stepindex);
273  if (url.HasOption(theKey.Data()))
274  {
275  Int_t retry = url.GetIntValueFromOptions(theKey.Data());
276  message.Append(TString::Format(", %s=%d", theKey.Data(), retry));
277  TGo4EventSourceParameter* srcpar = step->GetSourcePar();
278  TGo4MbsSourceParameter* mbspar = dynamic_cast<TGo4MbsSourceParameter*>(srcpar);
279  if (mbspar)
280  mbspar->SetRetryCnt(retry);
281  else
282  message.Append(
283  TString::Format(" - /!\\ NEVER COME HERE: Could not set retry count to type %s ",
284  srcpar->ClassName()));
285  } //fgxURL_SOURCE_RETRY;
286 
287  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_SOURCE_FIRST.Data(), stepindex);
288  if (url.HasOption(theKey.Data()))
289  {
290  Int_t startevent = url.GetIntValueFromOptions(theKey.Data());
291  message.Append(TString::Format(", %s=%d", theKey.Data(), startevent));
292  TGo4EventSourceParameter* srcpar = step->GetSourcePar();
293  TGo4MbsSourceParameter* mbspar = dynamic_cast<TGo4MbsSourceParameter*>(srcpar);
294  if (mbspar)
295  mbspar->SetStartEvent(startevent);
296  else
297  message.Append(
298  TString::Format(" - /!\\ NEVER COME HERE: Could not set start event to type %s ",
299  srcpar->ClassName()));
300  } //fgxURL_SOURCE_FIRST;
301 
302  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_SOURCE_LAST.Data(), stepindex);
303  if (url.HasOption(theKey.Data()))
304  {
305  Int_t stopevent = url.GetIntValueFromOptions(theKey.Data());
306  message.Append(TString::Format(", %s=%d", theKey.Data(), stopevent));
307  TGo4EventSourceParameter* srcpar = step->GetSourcePar();
308  TGo4MbsSourceParameter* mbspar = dynamic_cast<TGo4MbsSourceParameter*>(srcpar);
309  if (mbspar)
310  mbspar->SetStopEvent(stopevent);
311  else
312  message.Append(
313  TString::Format(" - /!\\ NEVER COME HERE: Could not set stop event to type %s ",
314  srcpar->ClassName()));
315  } //fgxURL_SOURCE_LAST;
316 
317  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_SOURCE_SKIP.Data(), stepindex);
318  if (url.HasOption(theKey.Data()))
319  {
320  Int_t skipevents = url.GetIntValueFromOptions(theKey.Data());
321  message.Append(TString::Format(", %s=%d", theKey.Data(), skipevents));
322  TGo4EventSourceParameter* srcpar = step->GetSourcePar();
323  TGo4MbsSourceParameter* mbspar = dynamic_cast<TGo4MbsSourceParameter*>(srcpar);
324  if (mbspar)
325  mbspar->SetEventInterval(skipevents);
326  else
327  message.Append(
328  TString::Format(" - /!\\ NEVER COME HERE: Could not set event interval to type %s ",
329  srcpar->ClassName()));
330  } //fgxURL_SOURCE_SKIP;
331 
332  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_STORE_TYPE.Data(), stepindex);
333  if (url.HasOption(theKey.Data()))
334  {
335  Int_t storetype = url.GetIntValueFromOptions(theKey.Data());
336  message.Append(TString::Format(", %s=%d", theKey.Data(), storetype));
337 
338  // extract values of old store parameter and save them into the new if matching:
339  TGo4EventStoreParameter* oldstorepar = step->GetStorePar();
340  TString storename = oldstorepar->GetName();
341  TGo4FileStoreParameter* oldfilepar = dynamic_cast<TGo4FileStoreParameter*>(oldstorepar);
342  TGo4BackStoreParameter* oldbackpar = dynamic_cast<TGo4BackStoreParameter*>(oldstorepar);
343 
344  // JAM NOTE: what is missing here completely is support of user defined storages!
345  // this does not exist in Qt GUI either, because nobody has ever used this feature... ;-(
346  // shall we provide this in the future?
347 
348  Int_t oldsplit = -1, oldbuf = -1, oldcomp = -1, oldauto = -1, oldover = -1;
349  if (oldfilepar)
350  {
351  oldsplit = oldfilepar->GetSplitlevel();
352  oldbuf = oldfilepar->GetBufsize();
353  oldcomp = oldfilepar->GetCompression();
354  oldauto = oldfilepar->GetAutosaveSize();
355  oldover = oldfilepar->IsOverwriteMode();
356  }
357  else if (oldbackpar)
358  {
359  oldsplit = oldbackpar->GetSplitlevel();
360  oldbuf = oldbackpar->GetBufsize();
361  }
362  else
363  {
364  message.Append(
365  TString::Format(" - /!\\ NEVER COME HERE: old event store parameter is type %s ",
366  oldstorepar ? oldstorepar->ClassName() : "nullpointer"));
367  }
368 
369  TGo4EventStoreParameter* newpar = 0;
370  switch (storetype)
371  {
372  default:
373  case GO4EV_FILE:
374  {
375  TGo4FileStoreParameter* filestore = new TGo4FileStoreParameter(storename);
376  if (oldsplit >= 0)
377  filestore->SetSplitlevel(oldsplit); // restore my soul...
378  if (oldbuf >= 0)
379  filestore->SetBufsize(oldbuf);
380  if (oldcomp >= 0)
381  filestore->SetCompression(oldcomp);
382  if (oldauto >= 0)
383  filestore->SetAutosaveSize(oldauto);
384  if (oldover >= 0)
385  filestore->SetOverwriteMode(oldover);
386  newpar = filestore;
387  }
388  break;
389  case GO4EV_BACK:
390  {
391  TGo4BackStoreParameter* bckstore = new TGo4BackStoreParameter(storename);
392  if (oldsplit >= 0)
393  bckstore->SetSplitlevel(oldsplit);
394  if (oldbuf >= 0)
395  bckstore->SetBufsize(oldbuf);
396  newpar = bckstore;
397  }
398  break;
399  };
400  step->SetStorePar(newpar);
401  delete newpar; // SetStorePar does clone argument, we do not need it further
402 
403  } //fgxURL_STORE_TYPE;
404 
405  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_STORE_NAME.Data(), stepindex);
406  if (url.HasOption(theKey.Data()))
407  {
408  TString storename = url.GetValueFromOptions(theKey.Data());
409  message.Append(TString::Format(", %s=%s", theKey.Data(), storename.Data()));
410  TGo4EventStoreParameter* storepar = step->GetStorePar();
411  storepar->SetName(storename.Data());
412  } // fgxURL_STORE_NAME
413 
414  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_STORE_SPLIT.Data(), stepindex);
415  if (url.HasOption(theKey.Data()))
416  {
417  Int_t split = url.GetIntValueFromOptions(theKey.Data());
418  message.Append(TString::Format(", %s=%d", theKey.Data(), split));
419  TGo4EventStoreParameter* storepar = step->GetStorePar();
420  TGo4FileStoreParameter* filepar = dynamic_cast<TGo4FileStoreParameter*>(storepar);
421  TGo4BackStoreParameter* backpar = dynamic_cast<TGo4BackStoreParameter*>(storepar);
422  if (filepar)
423  filepar->SetSplitlevel(split);
424  else if (backpar)
425  backpar->SetSplitlevel(split);
426  else
427  message.Append(
428  TString::Format(" - /!\\ NEVER COME HERE: can not set split level to eventstore type %s ",
429  storepar ? storepar->ClassName() : "nullpointer"));
430 
431  } //ffgxURL_STORE_SPLIT
432 
433  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_STORE_BUF.Data(), stepindex);
434  if (url.HasOption(theKey.Data()))
435  {
436  Int_t bufsize = url.GetIntValueFromOptions(theKey.Data());
437  message.Append(TString::Format(", %s=%d", theKey.Data(), bufsize));
438  TGo4EventStoreParameter* storepar = step->GetStorePar();
439  TGo4FileStoreParameter* filepar = dynamic_cast<TGo4FileStoreParameter*>(storepar);
440  TGo4BackStoreParameter* backpar = dynamic_cast<TGo4BackStoreParameter*>(storepar);
441  if (filepar)
442  filepar->SetBufsize(bufsize);
443  else if (backpar)
444  backpar->SetBufsize(bufsize);
445  else
446  message.Append(
447  TString::Format(" - /!\\ NEVER COME HERE: can not set bufsize to eventstore type %s ",
448  storepar ? storepar->ClassName() : "nullpointer"));
449  } //fgxURL_STORE_BUF
450 
451  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_STORE_COMP.Data(), stepindex);
452  if (url.HasOption(theKey.Data()))
453  {
454  Int_t bufsize = url.GetIntValueFromOptions(theKey.Data());
455  message.Append(TString::Format(", %s=%d", theKey.Data(), bufsize));
456  TGo4EventStoreParameter* storepar = step->GetStorePar();
457  TGo4FileStoreParameter* filepar = dynamic_cast<TGo4FileStoreParameter*>(storepar);
458  if (filepar)
459  filepar->SetBufsize(bufsize);
460  else
461  message.Append(
462  TString::Format(" - /!\\ NEVER COME HERE: can not set compression to eventstore type %s ",
463  storepar ? storepar->ClassName() : "nullpointer"));
464  } //fgxURL_STORE_COMP
465 
466  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_STORE_ASF.Data(), stepindex);
467  if (url.HasOption(theKey.Data()))
468  {
469  Int_t treeautosave = url.GetIntValueFromOptions(theKey.Data());
470  message.Append(TString::Format(", %s=%d", theKey.Data(), treeautosave));
471  TGo4EventStoreParameter* storepar = step->GetStorePar();
472  TGo4FileStoreParameter* filepar = dynamic_cast<TGo4FileStoreParameter*>(storepar);
473  if (filepar)
474  filepar->SetAutosaveSize(treeautosave);
475  else
476  message.Append(
477  TString::Format(" - /!\\ NEVER COME HERE: can not set tree autosave interval to eventstore type %s ",
478  storepar ? storepar->ClassName() : "nullpointer"));
479  } //fgxURL_STORE_COMP
480 
481  theKey.Form("%s_%d", TGo4AnalysisWebStatus::fgxURL_STORE_OVERWRITE.Data(), stepindex);
482  if (url.HasOption(theKey.Data()))
483  {
484  Int_t overwrite = url.GetIntValueFromOptions(theKey.Data());
485  message.Append(TString::Format(", %s=%d", theKey.Data(), overwrite));
486  TGo4EventStoreParameter* storepar = step->GetStorePar();
487  TGo4FileStoreParameter* filepar = dynamic_cast<TGo4FileStoreParameter*>(storepar);
488  if (filepar)
489  filepar->SetOverwriteMode(overwrite);
490  else
491  message.Append(
492  TString::Format(" - /!\\ NEVER COME HERE: can not set overwrite mode to eventstore type %s ",
493  storepar ? storepar->ClassName() : "nullpointer"));
494  } //fgxURL_STORE_OVERWRITE
495 
496  step->PrintStatus();
497  stepindex++;
498  } // while step
499 
501  // step independent options:
502 
504  if (url.HasOption(theKey.Data()))
505  {
506  Int_t asfenabled = url.GetIntValueFromOptions(theKey.Data());
507  message.Append(TString::Format(", %s=%d", theKey.Data(), asfenabled));
508  SetAutoSaveOn(asfenabled);
509  } //fgxURL_ASF_ENABLED
510 
512  if (url.HasOption(theKey.Data()))
513  {
514  TString asfname = url.GetValueFromOptions(theKey.Data());
515  message.Append(TString::Format(", %s=%s", theKey.Data(), asfname.Data()));
516  SetAutoFileName(asfname.Data());
517  } //fgxURL_ASF_NAME
518 
520  if (url.HasOption(theKey.Data()))
521  {
522  Int_t asftime = url.GetIntValueFromOptions(theKey.Data());
523  message.Append(TString::Format(", %s=%d", theKey.Data(), asftime));
524  SetAutoSaveInterval(asftime);
525  } //fgxURL_ASF_INTERVAL
526 
528  if (url.HasOption(theKey.Data()))
529  {
530  Int_t asfcomp = url.GetIntValueFromOptions(theKey.Data());
531  message.Append(TString::Format(", %s=%d", theKey.Data(), asfcomp));
532  SetAutoSaveCompression(asfcomp);
533  } //fgxURL_ASF_COMP
534 
536  if (url.HasOption(theKey.Data()))
537  {
538  Int_t asfover = url.GetIntValueFromOptions(theKey.Data());
539  message.Append(TString::Format(", %s=%d", theKey.Data(), asfover));
540  SetAutoSaveOverwrite(asfover);
541  } //fgxURL_ASF_OVERWRITE
542 
544  if (url.HasOption(theKey.Data()))
545  {
546  TString prefsname = url.GetValueFromOptions(theKey.Data());
547  message.Append(TString::Format(", %s=%s", theKey.Data(), prefsname.Data()));
548  SetConfigFileName(prefsname.Data());
549  } //fgxURL_PREFS_NAME
550 
551  // apply this setup to analysis:
552  std::cout << "\nTGo4AnalysisWebStatus Update From Url :StopAnalysis..."<< std::endl;
553  ana->StopAnalysis(); // need this to correctly invoke UserPreLoop later!
554  std::cout << "\nTGo4AnalysisWebStatus Update From Url :SetStatus..."<< std::endl;
555  ana->SetStatus(this);
556 
557  // update status for ourself
558  ana->UpdateStatus(this);
559 
560  std::cout << "\nTGo4AnalysisWebStatus Update From Url :InitEventClasses..."<< std::endl;
561  ana->InitEventClasses();
562 
563  // if we find start key restart analysis for submit and start button:
564  if (url.HasOption(TGo4AnalysisWebStatus::fgxURL_STARTRUN.Data()))
565  {
566  std::cout << "\nTGo4AnalysisWebStatus Update From Url :StartAnalysis..."<< std::endl;
567  ana->StartAnalysis(); // this can cause deadlock ?!
568  std::cout << "\nTGo4AnalysisWebStatus Update From Url :After StartAnalysis"<< std::endl;
569  message.Append("\n Analysis was started!");
570  }
571 
572  TGo4Log::Message(1, message.Data());
573  return kTRUE;
574 }
575 
577 {
579  return an ? an->CreateStatus() : 0;
580 }
581 
582 
584 {
586  TGo4AnalysisClient* cli = an ? an->GetAnalysisClient() : 0;
587 
588  if ((an==0) || (status==0)) return kFALSE;
589 
590  if(cli) {
591  if (cli->MainIsRunning()) an->PostLoop(); // if submit is done on running analysis,
592  } else {
593  if (!an->IsStopWorking()) an->PostLoop();
594  }
595 
596  an->SetStatus(status);
597 
598  // also copy values to ourself
599  an->UpdateStatus(this);
600 
601  if (an->InitEventClasses()) {
602  if(cli) {
603  if (cli->MainIsRunning()) an->PreLoop(); // if submit is done on running analysis,
604  } else {
605  if (!an->IsStopWorking()) an->PreLoop();
606  }
607  }
608 
609  return kTRUE;
610 }
611 
612 
613 Bool_t TGo4AnalysisWebStatus::LoadStatus(const char* fname)
614 {
615  // make it here to be able use via http interface
616 
618 
619  return ana ? ana->LoadStatus(fname) : kFALSE;
620 
621 }
622 
623 Bool_t TGo4AnalysisWebStatus::SaveStatus(const char* fname)
624 {
625  // make it here to be able use via http interface
626 
628 
629  return ana ? ana->SaveStatus(fname) : kFALSE;
630 }
631 
632 
633 Bool_t TGo4AnalysisWebStatus::WriteAutoSave(const char* fname,
634  Bool_t overwrite,
635  Int_t complevel)
636 {
637  // make it here to be able use via http interface
638 
640  if (ana==0) return kFALSE;
641 
642  ana->SetAutoSaveFile(fname, overwrite, complevel);
643  ana->AutoSave();
644 
645  return kTRUE;
646 }
647 
648 Bool_t TGo4AnalysisWebStatus::ExecuteLine(const char* exeline)
649 {
650  if ((exeline==0) || (*exeline==0)) return kFALSE;
652  if(ana==0) return kFALSE;
653 
654  Int_t errcode=0;
655  ana->ExecuteLine(exeline, &errcode);
656  fflush(stdout);
657  return errcode!=0 ? kFALSE : kTRUE;
658 }
void SetAutoFileName(const char *name)
void SetStartEvent(UInt_t firstindex)
void SetProcessEnabled(Bool_t on=kTRUE)
static TString fgxURL_PREFS_SAVE
static TString fgxURL_SOURCE_TYPE
void SetStoreEnabled(Bool_t on=kTRUE)
TGo4EventStoreParameter * GetStorePar() const
void SetSplitlevel(Int_t split)
static TString fgxURL_SOURCE_PORT
Bool_t LoadStatus(const char *filename=0)
void SetSplitlevel(Int_t split)
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
Bool_t ExecuteLine(const char *cmd)
void SetStopEvent(UInt_t lastindex)
void UpdateStatus(TGo4AnalysisStatus *state)
virtual void CloseAnalysis()
static TString fgxURL_ENABLESTORE
static TString fgxURL_STORE_SPLIT
void SetAutoSaveOn(Bool_t on=kTRUE)
static TString fgxURL_SOURCE_NAME
static TString fgxURL_STORE_COMP
Bool_t MainIsRunning()
Definition: TGo4Slave.h:92
static TString fgxURL_ENABLESTEP
static TString fgxURL_STORE_OVERWRITE
TGo4AnalysisStepStatus * NextStepStatus()
static TString fgxURL_PREFS_LOAD
void SetSourceEnabled(Bool_t on=kTRUE)
static TString fgxURL_ENABLESOURCE
static TString fgxURL_SOURCE_FIRST
static TString fgxURL_SOURCE_LAST
TGo4AnalysisClient * GetAnalysisClient() const
static TString fgxURL_PREFS_NAME
Bool_t IsStopWorking() const
TGo4AnalysisStatus * CreateStatus()
void SetAutosaveSize(Int_t interval)
Bool_t ApplyStatus(TGo4AnalysisStatus *status)
static TString fgxURL_SOURCE_TIMEOUT
void SetStorePar(TGo4EventStoreParameter *kind)
Bool_t SaveStatus(const char *fname)
void SetSourcePar(TGo4EventSourceParameter *kind)
TGo4EventSourceParameter * GetSourcePar() const
void SetOverwriteMode(Bool_t over=kTRUE)
static TString fgxURL_SOURCE_SKIP
static TString fgxURL_SOURCE_RETRY
void SetEventInterval(UInt_t skipinterval)
void SetBufsize(Int_t bufsize)
static const char * Message(Int_t prio, const char *text,...)
Definition: TGo4Log.cxx:209
Bool_t UpdateFromUrl(const char *rest_url_opt)
static TString fgxURL_STORE_TYPE
static TString fgxURL_ASF_INTERVAL
virtual Bool_t InitEventClasses()
static TString fgxURL_ASF_OVERWRITE
static TString fgxURL_STORE_NAME
void SetAutoSaveOverwrite(Bool_t over=kTRUE)
Long_t ExecuteLine(const char *command, Int_t *errcode=0)
void SetAutoSaveFile(const char *filename=0, Bool_t overwrite=kFALSE, Int_t compression=5)
Bool_t LoadStatus(const char *fname)
Bool_t SaveStatus(const char *filename=0)
void SetConfigFileName(const char *name)
void SetBufsize(Int_t bufsize)
void SetAutoSaveInterval(Int_t i)
static TString fgxURL_ASF_ENABLED
TGo4AnalysisStatus * CreateStatus()
static TGo4Analysis * Instance()
void SetAutoSaveCompression(Int_t i=5)
Bool_t WriteAutoSave(const char *fname, Bool_t overwrite, Int_t complevel)
void SetStatus(TGo4AnalysisStatus *state)