GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4AnalysisImp.cxx
Go to the documentation of this file.
1 // $Id: TGo4AnalysisImp.cxx 2162 2018-10-10 14:16:24Z 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 "TGo4AnalysisImp.h"
15 
16 #include <stdexcept>
17 #include <stdio.h>
18 #include <stdlib.h>
19 
20 #include "Riostream.h"
21 #include "TSystem.h"
22 #include "TInterpreter.h"
23 #include "TNamed.h"
24 #include "TApplication.h"
25 #include "TH1.h"
26 #include "TH2.h"
27 #include "TTree.h"
28 #include "TCanvas.h"
29 #include "TFolder.h"
30 #include "TFile.h"
31 #include "TKey.h"
32 #include "TThread.h"
33 #include "TMutex.h"
34 #include "TROOT.h"
35 #include "TCutG.h"
36 #include "TStopwatch.h"
37 #include "TTimeStamp.h"
38 #include "snprintf.h"
39 
40 #include "TGo4Log.h"
41 #include "TGo4LockGuard.h"
42 #include "TGo4Thread.h"
43 #include "TGo4CommandInvoker.h"
44 #include "TGo4Ratemeter.h"
46 #include "TGo4UserException.h"
47 #include "TGo4TaskHandler.h"
48 #include "TGo4WinCond.h"
49 #include "TGo4PolyCond.h"
50 #include "TGo4ShapedCond.h"
51 
52 #include "TGo4Version.h"
56 #include "TGo4AnalysisStatus.h"
57 #include "TGo4AnalysisWebStatus.h"
58 #include "TGo4AnalysisStep.h"
59 #include "TGo4AnalysisClientImp.h"
60 #include "TGo4AnalysisSniffer.h"
62 #include "TGo4Condition.h"
63 #include "TGo4Parameter.h"
64 #include "TGo4Picture.h"
65 #include "TGo4Fitter.h"
66 #include "TGo4ObjectStatus.h"
67 #include "TGo4ObjEnvelope.h"
71 #include "TGo4EventElement.h"
72 #include "TGo4EventStore.h"
73 #include "TGo4EventSource.h"
74 #include "TGo4EventProcessor.h"
77 #include "TGo4EventEndException.h"
79 #include "TGo4TreeStructure.h"
80 
81 
82 
83 #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
84 #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
85 #include "TCint.h"
86 #endif
87 #endif
88 
89 
90 class TGo4InterruptHandler : public TSignalHandler {
91  public:
93  TSignalHandler(kSigInterrupt, kFALSE)
94  {
95  }
96 
97  virtual Bool_t Notify()
98  {
101 
102  return kTRUE;
103  }
104 };
105 
106 
107 #ifdef WIN32
108 
109 namespace {
110  void InstallGo4CtrlCHandler(bool on);
111 }
112 
113 #endif
114 
115 
116 // _________________________________________________________________________________
117 
118 
120 Bool_t TGo4Analysis::fbExists = kFALSE;
122 const Int_t TGo4Analysis::fgiAUTOSAVECOUNTS= 500;
123 const Int_t TGo4Analysis::fgiDYNLISTINTERVAL= 1000;
124 const Int_t TGo4Analysis::fgiMACROSTARTPOLL= 1000; //polling time for macro in WaitForStart
125 const char* TGo4Analysis::fgcDEFAULTFILENAME="Go4AutoSave.root";
126 const char* TGo4Analysis::fgcDEFAULTSTATUSFILENAME="Go4AnalysisPrefs.root";
127 const char* TGo4Analysis::fgcDEFAULTFILESUF=".root";
128 const char* TGo4Analysis::fgcTOPDYNAMICLIST="Go4DynamicList";
129 
130 const char TGo4Analysis::fgcPYPROMPT = '$';
131 const char* TGo4Analysis::fgcPYINIT = "python/go4init.py";
132 
134 {
135  GO4TRACE((14,"TGo4Analysis::Instance()",__LINE__, __FILE__));
136  if(fxInstance==0) {
138  fbExists=kTRUE;
139  }
140  return fxInstance;
141 }
142 
144 {
145  return fbExists;
146 }
147 
149 {
150  return fiRunningMode == 0;
151 }
152 
154 {
155  return fiRunningMode == 1;
156 }
157 
159 {
160  return fiRunningMode == 2;
161 }
162 
164 {
165  fiRunningMode = mode;
166 }
167 
168 
169 
170 TGo4Analysis::TGo4Analysis(const char* name) :
171  TObject(),TGo4CommandReceiver(),
172  fbInitIsDone(kFALSE),
173  fbAutoSaveOn(kTRUE),
174  fxAnalysisSlave(0),
175  fxStepManager(0),
176  fxObjectManager(0),
177  fiAutoSaveCount(0),
178  fiAutoSaveInterval(TGo4Analysis::fgiAUTOSAVECOUNTS),
179  fiAutoSaveCompression(5),
180  fxAutoFile(0),
181  fbAutoSaveOverwrite(kFALSE),
182  fbNewInputFile(kFALSE),
183  fxCurrentInputFileName(),
184  fbAutoSaveFileChange(kFALSE),
185  fxSampleEvent(0),
186  fxObjectNames(0),
187  fxDoWorkingFlag(flagInit),
188  fxInterruptHandler(0),
189  fAnalysisName(),
190  fBatchLoopCount(-1),
191  fServerAdminPass(),
192  fServerCtrlPass(),
193  fServerObserverPass(),
194  fbMakeWithAutosave(kTRUE),
195  fbObjMade(kFALSE),
196  fbPythonBound(kFALSE),
197  fNumCtrlC(0),
198  fSniffer(0),
199  fxRate(0)
200 {
201  GO4TRACE((15,"TGo4Analysis::TGo4Analysis(const char*)",__LINE__, __FILE__));
202 
203  if (name!=0) SetAnalysisName(name);
204 
205  Constructor();
206 }
207 
208 
209 TGo4Analysis::TGo4Analysis(int argc, char** argv) :
210  TObject(),TGo4CommandReceiver(),
211  fbInitIsDone(kFALSE),
212  fbAutoSaveOn(kTRUE),
213  fxAnalysisSlave(0),
214  fxStepManager(0),
215  fxObjectManager(0),
216  fiAutoSaveCount(0),
217  fiAutoSaveInterval(TGo4Analysis::fgiAUTOSAVECOUNTS),
218  fiAutoSaveCompression(5),
219  fxAutoFile(0),
220  fbAutoSaveOverwrite(kFALSE),
221  fbNewInputFile(kFALSE),
222  fxCurrentInputFileName(),
223  fbAutoSaveFileChange(kFALSE),
224  fxSampleEvent(0),
225  fxObjectNames(0),
226  fxDoWorkingFlag(flagInit),
227  fxInterruptHandler(0),
228  fAnalysisName(),
229  fBatchLoopCount(-1),
230  fServerAdminPass(),
231  fServerCtrlPass(),
232  fServerObserverPass(),
233  fbMakeWithAutosave(kTRUE),
234  fbObjMade(kFALSE),
235  fbPythonBound(kFALSE),
236  fNumCtrlC(0),
237  fSniffer(0),
238  fxRate(0)
239 {
240  GO4TRACE((15,"TGo4Analysis::TGo4Analysis(const char*)",__LINE__, __FILE__));
241 
242  if ((argc>0) && (argv[0]!=0)) SetAnalysisName(argv[0]);
243 
244  Constructor();
245 }
246 
248 {
250  // wrong version number between framework and user executable
251  Message(-1,"!!!! Analysis Base class:\n\t User Analysis was built with wrong \t\tGo4 Buildversion %d !!!!!",
252  TGo4Version::Instance()->GetBuildVersion());
253  Message(-1,"\t Please rebuild your analysis with current \tGo4 Buildversion %d ", __GO4BUILDVERSION__);
254  Message(-1,"\t >>make clean all<<");
255  Message(-1,"Aborting in 20 s...");
256  gSystem->Sleep(20000);
257  exit(-1);
258  } else {
259  // may not disable output of version number:
260  Message(-1,"Welcome to Go4 Analysis Framework Release %s (build %d) !",
262  }
263 
264  if(fxInstance==0) {
265  gROOT->SetBatch(kTRUE);
266  fxStepManager = new TGo4AnalysisStepManager("Go4 Analysis Step Manager");
267  fxObjectManager = new TGo4AnalysisObjectManager("Go4 Central Object Manager");
269  fxAutoSaveMutex = new TMutex(kTRUE);
270  fxAutoSaveClock = new TStopwatch;
271  fxAutoSaveClock->Stop();
273  if (fAnalysisName.Length()>0) fxAutoFileName = TString::Format("%sASF.root", fAnalysisName.Data());
275  fxDefaultTestFileName=TString::Format("%s/data/test.lmd",getenv("GO4SYS"));
276 
277  TGo4CommandInvoker::Instance(); // make sure we have an invoker instance!
279  TGo4CommandInvoker::Register("Analysis",this); // register as command receiver at the global invoker
280  fxInstance = this; // for ctor usage from derived user subclass
281  fbExists = kTRUE;
282 
284  fxInterruptHandler->Add();
285 
286 #ifdef WIN32
287  InstallGo4CtrlCHandler(true);
288 #endif
289 
290  } else {
291  // instance already there
292  Message(2,"Analysis BaseClass ctor -- analysis singleton already exists !!!");
293  }
294  // settings for macro execution
295 #if ROOT_VERSION_CODE > ROOT_VERSION(6,12,0)
296  TInterpreter* theI = gROOT->GetInterpreter();
297  theI->SetProcessLineLock(kTRUE); // mandatory for ROOT > 6.12
298 #endif
299  gROOT->ProcessLineSync("TGo4Analysis *go4 = TGo4Analysis::Instance();");
300  gROOT->ProcessLineSync(Form(".x %s", TGo4Log::subGO4SYS("macros/anamacroinit.C").Data()));
301 }
302 
303 
305 {
306 
307 #ifdef WIN32
308  InstallGo4CtrlCHandler(false);
309 #endif
310 
311  if (fxInterruptHandler!=0) {
312  delete fxInterruptHandler;
313  fxInterruptHandler = 0;
314  }
315 
316  GO4TRACE((15,"TGo4Analysis::~TGo4Analysis()",__LINE__, __FILE__));
317  CloseAnalysis();
319  delete fxStepManager;
320  delete fxObjectManager;
321  delete fxObjectNames;
322  delete fxAutoSaveClock;
323  delete fxSampleEvent;
325  fxInstance = 0; // reset static singleton instance pointer
326  gROOT->ProcessLineSync(Form(".x %s", TGo4Log::subGO4SYS("macros/anamacroclose.C").Data()));
327  //std::cout <<"end of dtor" << std::endl;
328 }
329 
330 
332 {
333  switch(fNumCtrlC++) {
334  case 0:
335  StopWorking(); // for batch mode and server mode
336  ShutdownServer(); // only for server mode
337  break;
338  case 1:
339  // if shutdown should hang, we do second try closing the files directly
340  CloseAnalysis();
343  if (gApplication) gApplication->Terminate();
344  break;
345  case 2:
346  default:
347  exit(1); // the hard way if nothing helps
348  break;
349  }
350 }
351 
352 
354 // Initialization and analysis defining methods:
355 
357 {
358  GO4TRACE((14,"TGo4Analysis::InitEventClasses()",__LINE__, __FILE__));
359  //
360  Bool_t rev = kTRUE;
361  if(!fbInitIsDone) {
362  try {
363  TGo4Log::Debug("Analysis -- Initializing EventClasses...");
364  LoadObjects(); // always use autosave file to get last objects list
366  UpdateNamesList();
367  TGo4Log::Info("Analysis -- Initializing EventClasses done.");
368  fbInitIsDone = kTRUE;
369  if (!fxAnalysisSlave) {
372  }
373 
374  } catch(TGo4EventErrorException& ex) {
375  Message(ex.GetPriority(), ex.GetErrMess());
376  rev = kFALSE;
377  }
378  } else
379  TGo4Log::Info("Analysis BaseClass -- EventClasses were already initialized.");
380  return rev;
381 }
382 
384 // main event cycle methods:
385 
387 {
388  GO4TRACE((11,"TGo4Analysis::MainCycle()",__LINE__, __FILE__));
389  if(!fbInitIsDone)
390  throw TGo4UserException(3,"Analysis not yet initialized");
391 
392  {
393  TGo4LockGuard mainlock; // protect analysis, but not status buffer
394 
396 
397  UserEventFunc();
398 
400 
401  if (fbAutoSaveOn && (fiAutoSaveInterval!=0)) {
402  fiAutoSaveCount++;
403  Double_t rt = fxAutoSaveClock->RealTime();
404  if (rt > (Double_t) fiAutoSaveInterval) {
405  Message(0,"Analysis: Main Cycle Autosaving after %.2f s (%d events).",rt,fiAutoSaveCount);
406  AutoSave();
407  fiAutoSaveCount = 0;
408  fxAutoSaveClock->Start(kTRUE);
409  } else
410  fxAutoSaveClock->Continue();
411  }
412 
413  SetNewInputFile(kFALSE); // reset flag of new input file
414 
415  } //TGo4LockGuard main;
416 
417  if(fxAnalysisSlave) {
419  // note: creation of status buffer uses mainlock internally now
420  // status mutex required to be outside main mutex always JA
423  }
424 
425  return 0;
426 }
427 
429 {
430  GO4TRACE((11,"TGo4Analysis::UserEventFunc()",__LINE__, __FILE__));
431  return 0;
432 }
433 
435 {
437 }
438 
440 {
441  GO4TRACE((11,"TGo4Analysis::Process()",__LINE__, __FILE__));
442  Int_t rev=0;
443 #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
444 #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
445  Bool_t unlockedcint=kFALSE;
446  if(gCINTMutex) {
447  gCINTMutex->UnLock();
448  unlockedcint=kTRUE;
449  //std::cout <<"Process() Unlocked cint mutex..." << std::endl;
450  }
451 #endif
452 #endif
453 
454  try
455  {
456  ProcessEvents();
457 
458  if(fxAnalysisSlave)
459  {
460  gSystem->ProcessEvents(); // ensure cintlocktimer to give mainlock back
461  //if(!IsRunning()) TGo4Thread::Sleep(200);
462  //TGo4Thread::Sleep(50); // give other threads time to operate
463  }
464  {
465  //TGo4LockGuard mainlock; // moved to MainCycle
466  if(!IsRunning())
467  {
468  rev=-1;
469  }
470  //return -1;
471  else
472  {
473  TDirectory* savdir = gDirectory;
474  gROOT->cd(); // necessary for dynamic list scope
475  MainCycle();
476  savdir->cd();
477  }
478  }
479 
480  }
482  // begin catch block
483  catch(TGo4EventTimeoutException& ex)
484  {
485  {
486  TGo4LockGuard global;
487  ex.Handle(); // display exception on terminal in case of debug
488  }
490  {
491  // only display message if debug output enabled
492  Message(2,"Analysis %s TIMEOUT for eventsource %s:%s.",
493  GetName(), ex.GetSourceClass(), ex.GetSourceName());
494  } else{}
495  //return 0;
496  }
497  catch(TGo4EventEndException& ex)
498  {
499  Message(2,"End of event source %s: name:%s - msg:%s",
500  ex.GetSourceClass(), ex.GetSourceName(), ex.GetErrMess());
501  if(IsErrorStopEnabled()) {
503  //return -1;
504  rev=-1;
505  }
506  //return 0;
507  }
508  catch(TGo4EventErrorException& ex)
509  {
510  //ex.Handle();
511  Int_t prio=ex.GetPriority();
512  if(prio==0)
513  {
514  // SL:12.2011 even erre display can be skipped, continue without stop
515  // Message(1,"Event source %s: %s - %s",
516  // ex.GetSourceClass(), ex.GetSourceName(),ex.GetErrMess());
517  }
518  else
519  {
520  Message(3,"Analysis %s ERROR: %s from event source %s:\n %s",
521  GetName(),ex.GetErrMess(),
522  ex.GetSourceClass(), ex.GetSourceName());
523  if(IsErrorStopEnabled())
524  {
526  //return -1;
527  rev=-1;
528  }
529  }
530  //return 0;
531  }
532 
533  catch(TGo4DynamicListException& ex)
534  {
535  {
536  TGo4LockGuard global;
537  ex.Handle();
538  }
539  Message(3,"Analysis %s ERROR: %s from dynamic list entry %s:%s",
540  GetName(),ex.GetStatusMessage(),
541  ex.GetEntryName(), ex.GetEntryClass());
542  if(IsErrorStopEnabled())
543  {
545  //return -1;
546  rev=-1;
547  }
548  //return 0;
549  }
550 
551  catch(TGo4AnalysisStepException& ex)
552  {
553  TGo4LockGuard global;
554  ex.Handle();
555  Message(3,"Analysis %s ERROR: %s in Analysis Step %s",
556  GetName(), ex.GetStatusMessage(), ex.GetStepName());
557  if(IsErrorStopEnabled())
558  {
560  //return -1;
561  rev=-1;
562  }
563  //return 0;
564  }
565 
566  catch(TGo4UserException& ex)
567  {
568  // { TGo4LockGuard global; ex.Handle(); }
569 
570  if(strlen(ex.GetMessage())!=0)
571  Message(ex.GetPriority(), ex.GetMessage());
572  if(IsErrorStopEnabled() && (ex.GetPriority() > 2)) {
573  if(fxAnalysisSlave) fxAnalysisSlave->Stop(); // only stop for errors, warnings and infos continue loop!
574  //return -1;
575  rev=-1;
576 
577  }
578  //return 0;
579  }
580 
581  catch(std::exception& ex) // treat standard library exceptions
582  {
583  Message(3,"Analysis %s got standard exception %s",
584  GetName(), ex.what());
585  if(IsErrorStopEnabled())
586  {
588  //return -1;
589  rev=-1;
590  }
591  //return 0;
592  }
593  // end catch block
595 #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
596 #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
597  if(gCINTMutex && unlockedcint) {
599  gCINTMutex->Lock();
600  //std::cout <<"PPPProcess() locked cint mutex..." << std::endl;
601  }
602 #endif
603 #endif
604  return rev;
605 }
606 
607 
608 
609 Int_t TGo4Analysis::RunImplicitLoop(Int_t times, Bool_t showrate, Double_t process_event_interval, Bool_t iswebserver)
610 {
611  GO4TRACE((11,"TGo4Analysis::RunImplicitLoop(Int_t)",__LINE__, __FILE__));
612  Int_t cnt = 0; // number of actually processed events
613  Int_t nextcnt = 0; // number of actually processed events
614  if (process_event_interval>1.) process_event_interval = 1.;
615 
616  if (times < 0) times = fBatchLoopCount;
617 
618  fxRate = new TGo4Ratemeter();
619  TString ratefmt = TString::Format("\rCnt = %s Rate = %s Ev/s", TGo4Log::GetPrintfArg(kULong64_t),"%5.*f");
620  TString ratestr; // string used for rate output
621  Bool_t userate = showrate || (process_event_interval>0.);
622  Bool_t process_events = kFALSE;
623  if (userate)
624  fxRate->SetUpdateInterval(process_event_interval>0. ? process_event_interval : 1.);
625  if (showrate) fxRate->Reset();
626 
627  TTimeStamp last_update;
628 
629  try
630  {
631  if (times>0)
632  Message(1, "Analysis loop for %d cycles is starting...", times);
633  else
634  Message(1, "Analysis loop is starting...");
635 
636  while (fxDoWorkingFlag != flagStop) {
637 
638  if ((times>0) && (cnt>=times)) break;
639 
640  if (userate && fxRate->Update(nextcnt)) {
641 
642  process_events = kTRUE;
643 
644  bool need_update = false;
645  TTimeStamp now;
646  if ((now.AsDouble() - last_update.AsDouble()) >= 1.) {
647  last_update = now; need_update = true;
648  }
649 
650  if (need_update) {
652 
653  TDatime dt;
654  fxRate->SetDateTime(dt.AsSQLString());
655 
656  TGo4AnalysisStep* firststep = GetAnalysisStep(0);
657  if(firststep) {
659  } else {
660  fxRate->SetCurrentSource("- No event source -");
661  }
662 
663  if (showrate) {
664  int width = (fxRate->GetRate()>1e4) ? 0 : (fxRate->GetRate()<1. ? 3 : 1);
665  ratestr.Form(ratefmt.Data(), fxRate->GetCurrentCount(), width, fxRate->GetRate());
666  TGo4Log::Printf(kTRUE, ratestr.Data());
667  }
669  }
670  }
671 
672  nextcnt = 0;
673 
674  try
675  {
676  if (process_events) {
677  // put events processing in exception-handling area
678  process_events = kFALSE;
679  gSystem->ProcessEvents();
680  ProcessEvents();
681  }
682 
683  if (fxDoWorkingFlag == flagRunning) {
684  MainCycle();
685  cnt++; // account completely executed cycles
686  nextcnt = 1; // we process one event
687  } else {
688  gSystem->Sleep(100);
689  }
690 
691  }
692  catch(TGo4UserException& ex)
693  {
694  if(ex.GetPriority()>2)
695  {
696  PostLoop();
697  if(iswebserver)
698  {
699  fxDoWorkingFlag = flagPause; // errors: stop event loop
700  ex.Handle();
701  }
702  else
703  {
704  throw; // return to shell if not remotely controlled
705  }
706  }
707  else
708  {
709  ex.Handle(); // warnings and infos: continue loop after display message
710  }
711  }
712  catch(TGo4EventEndException& ex)
713  {
714  Message(1,"End of event source %s: name:%s msg:%s",ex.GetSourceClass(), ex.GetSourceName(),ex.GetErrMess());
715  PostLoop();
716  if(iswebserver)
717  {
718  fxDoWorkingFlag = flagPause; // errors: stop event loop
719  ex.Handle();
720  }
721  else
722  {
723  throw; // return to shell if not remotely controlled
724  }
725  }
726 
727  catch(TGo4EventErrorException& ex)
728  {
729  if(ex.GetPriority()>0)
730  {
731  Message(ex.GetPriority(),"%s",ex.GetErrMess());
732  PostLoop();
733  if(iswebserver)
734  {
735  fxDoWorkingFlag = flagPause;// errors: stop event loop
736  ex.Handle();
737  }
738  else
739  {
740  throw; // return to shell if not remotely controlled
741  }
742  }
743  else
744  {
745  // SL:12.2011 even error display can be skipped, continue without stop
746  // Message(1,"Eventsource %s:%s %s",ex.GetSourceClass(),
747  // ex.GetSourceName(),ex.GetErrMess());
748  ex.Handle(); // infos: continue loop after display message
749  }
750  }
751 
752  catch(TGo4EventTimeoutException& ex)
753  {
754  ex.Handle(); // just show timeout message, continue event loop
755  }
756 
757  catch(...)
758  {
759  PostLoop(); // make sure that postloop is executed for all exceptions
760  if(iswebserver)
761  {
763  Message(1, "!!! Unexpected exception in %d cycle !!!", cnt);
764  }
765  else
766  {
767  throw;
768  }
769  }
771  }// while loop
772 
773  Message(1, "Analysis implicit Loop has finished after %d cycles.", cnt);
774 
775  // postloop only if analysis not yet closed
777  PostLoop();
778  } // try
779 
780  catch(TGo4Exception& ex) {
781  Message(1, "%s appeared in %d cycle.", ex.What(), cnt);
782  ex.Handle();
783  }
784  catch(std::exception& ex) { // treat standard library exceptions
785  Message(1, "standard exception %s appeared in %d cycle.", ex.what(), cnt);
786  }
787  catch(...) {
788  Message(1, "!!! Unexpected exception in %d cycle !!!", cnt);
789  }
790 
791  if (showrate) {
792  printf("\n"); fflush(stdout);
793  }
794  delete fxRate;
795  fxRate=0;
797  return cnt;
798 }
799 
801 // dynamic list stuff:
802 
803 
804 Bool_t TGo4Analysis::RemoveDynamicEntry(const char * entryname, const char* listname)
805 {
806  GO4TRACE((11,"TGo4Analysis::RemoveDynamicEntry(const char *, const char* )",__LINE__, __FILE__));
807  Bool_t rev=fxObjectManager->RemoveDynamicEntry(entryname);
808  if(rev) UpdateNamesList();
809  return rev;
810 }
811 
812 
814 // status related methods:
815 
817 {
818  GO4TRACE((11,"TGo4Analysis::UpdateStatus(TGo4AnalysisStatus*)",__LINE__, __FILE__));
819  fxStepManager->UpdateStatus(state);
820  if(state!=0) {
825  state->SetAutoSaveOn(fbAutoSaveOn);
826  state->SetConfigFileName(fxConfigFilename.Data());
827  } // if(state!=0)
828 }
829 
831 {
832  GO4TRACE((11,"TGo4Analysis::SetStatus(TGo4AnalysisStatus*)",__LINE__, __FILE__));
833  if(state!=0) {
834  // first we close down existing analysis:
835  CloseAnalysis();
837  SetAutoSave(state->IsAutoSaveOn());
839  state->IsAutoSaveOverwrite(),
840  state->GetAutoSaveCompression());
841  fxStepManager->SetStatus(state);
842  }
843 }
844 
845 
846 Bool_t TGo4Analysis::LoadStatus(const char* filename)
847 {
848  GO4TRACE((11,"TGo4Analysis::LoadStatus(const char*)",__LINE__, __FILE__));
849  //
850  Bool_t rev=kFALSE;
851  TString fname = filename ? filename : fgcDEFAULTSTATUSFILENAME;
852 
853  // file suffix if not given by user
854  if(!fname.Contains(fgcDEFAULTFILESUF)) fname.Append(fgcDEFAULTFILESUF);
855 
856  TFile* statusfile = TFile::Open(fname.Data(), "READ");
857  if(statusfile && statusfile->IsOpen()) {
858  TGo4AnalysisStatus* state=
859  dynamic_cast<TGo4AnalysisStatus*>( statusfile->Get( GetName() ) );
860  if (state==0) {
861  TIter iter(statusfile->GetListOfKeys());
862  TKey* key = 0;
863  while ((key = (TKey*)iter()) != 0) {
864  if (strcmp(key->GetClassName(),"TGo4AnalysisStatus")==0) break;
865  }
866 
867  if (key!=0) state = dynamic_cast<TGo4AnalysisStatus*>( statusfile->Get( key->GetName() ) );
868  }
869 
870  // name of status object is name of analysis itself
871  if(state) {
872  Message(1,"Analysis %s: Found status object %s in file %s",
873  GetName(), state->GetName(), fname.Data());
874  SetStatus(state);
875  fxConfigFilename = fname; // remember last configuration file name
876  Message(0,"Analysis: New analysis state is set.");
877  rev = kTRUE;
878  } else {
879  Message(3,"Analysis LoadStatus: Could not find status %s in file %s", GetName(), fname.Data());
880  rev = kFALSE;
881  } // if(state)
882  } else {
883  Message(3,"Analysis LoadStatus: Failed to open file %s", fname.Data());
884  rev = kFALSE;
885  } // if(statusfile && statusfile->IsOpen())
886 
887  delete statusfile;
888 
889  return rev;
890 }
891 
892 Bool_t TGo4Analysis::SaveStatus(const char* filename)
893 {
894  GO4TRACE((11,"TGo4Analysis::SaveStatus(const char*)",__LINE__, __FILE__));
895  Bool_t rev=kFALSE;
896  char buffer[1024];
897  if(filename)
898  strncpy(buffer, filename, sizeof(buffer)-100);
899  else
900  strncpy(buffer,fgcDEFAULTSTATUSFILENAME, sizeof(buffer)-100);
901  if(!strstr(buffer,fgcDEFAULTFILESUF))
902  strcat(buffer,fgcDEFAULTFILESUF); // file suffix if not given by user
903  TFile* statusfile = TFile::Open(buffer,"RECREATE");
904  if(statusfile && statusfile->IsOpen()) {
905  fxConfigFilename=buffer; // remember name of status
906  statusfile->cd();
908  if(state) {
909  state->Write();
910  delete state;
911  delete statusfile;
912  rev=kTRUE;
913  Message(-1,"Analysis SaveStatus: Saved Analysis settings to file %s", buffer);
914  } else {
915  Message(3,"Analysis SaveStatus: FAILED to create status object !!!");
916  rev=kFALSE;
917  }
918  } else {
919  Message(3,"Analysis SaveStatus: Failed to open file %s ",
920  buffer);
921  rev=kFALSE;
922  } // if(statusfile && statusfile->IsOpen())
923  return rev;
924 }
925 
927 {
928  GO4TRACE((11,"TGo4Analysis::CreateStatus()",__LINE__, __FILE__));
929  TDirectory* filsav=gDirectory;
930  gROOT->cd();
932  UpdateStatus(state);
933  filsav->cd();
934  return state;
935 }
936 
938 {
939  GO4TRACE((11,"TGo4Analysis::CreateWebStatus()",__LINE__, __FILE__));
940  TDirectory* filsav=gDirectory;
941  gROOT->cd();
943  UpdateStatus(state);
944  filsav->cd();
945  return state;
946 }
947 
948 
949 
950 
951 void TGo4Analysis::Print(Option_t*) const
952 {
953  TGo4Analysis* localthis=const_cast<TGo4Analysis*>(this);
954  TGo4AnalysisStatus* state=localthis->CreateStatus();
955  state->PrintStatus();
956  delete state;
957 }
958 
960 {
961  GO4TRACE((11,"TGo4Analysis::CreateSingleEventTree(TGo4EventElement*)",__LINE__, __FILE__));
962 
963  return event ? event->CreateSampleTree(&fxSampleEvent) : 0;
964 }
965 
966 TTree* TGo4Analysis::CreateSingleEventTree(const char* name, Bool_t isoutput)
967 {
968  GO4TRACE((11,"TGo4Analysis::CreateSingleEventTree(const char*, Bool_t)",__LINE__, __FILE__));
969  //
970  TGo4EventElement* event=0;
971  if(isoutput) event = GetOutputEvent(name);
972  else event = GetInputEvent(name);
973  if(event==0) event=GetEventStructure(name);
974 
975  return CreateSingleEventTree(event);
976 }
977 
979 {
980  GO4TRACE((14,"TGo4Analysis::CloseAnalysis()",__LINE__, __FILE__));
981  //
982  if(fbInitIsDone) {
983  AutoSave();
986  fbInitIsDone = kFALSE;
988  }
989 }
990 
992 {
993  GO4TRACE((11,"TGo4Analysis:PreLoop()",__LINE__, __FILE__));
994  TGo4LockGuard autoguard(fxAutoSaveMutex);
995  // avoid conflict with possible user object modifications during startup autosave!
996  fiAutoSaveCount = 0;
997  Int_t rev = UserPreLoop();
998  for (Int_t num = 0; num < fxStepManager->GetNumberOfAnalysisSteps(); num++) {
1000  TGo4EventProcessor* proc = step ? step->GetEventProcessor() : 0;
1001  if (proc) proc->UserPreLoop();
1002  }
1003 
1004  fxAutoSaveClock->Start(kTRUE);
1005  return rev;
1006 }
1007 
1009 {
1010  GO4TRACE((11,"TGo4Analysis::PostLoop()",__LINE__, __FILE__));
1011  TGo4LockGuard autoguard(fxAutoSaveMutex);
1012  Int_t rev=0;
1014  // TTree* mytree = CreateSingleEventTree("Unpack");
1015  // TFile* myfile = TFile::Open("eventsample.root","RECREATE");
1016  // mytree->SetDirectory(myfile);
1017  // mytree->Write();
1018  // delete myfile;
1019  // std::cout <<"___________Wrote eventsample to file eventsample.root" << std::endl;
1021  if(fbInitIsDone) {
1022  for (Int_t num = 0; num < fxStepManager->GetNumberOfAnalysisSteps(); num++) {
1024  TGo4EventProcessor* proc = step ? step->GetEventProcessor() : 0;
1025  if (proc) proc->UserPostLoop();
1026  }
1027 
1028  rev = UserPostLoop(); // do not call userpostloop after error in initialization
1029  }
1030  return rev;
1031 }
1032 
1034 {
1035  GO4TRACE((11,"TGo4Analysis::UserPreLoop()",__LINE__, __FILE__));
1036  //
1037  Message(0,"Analysis BaseClass -- executing default User Preloop");
1038  return 0;
1039 }
1040 
1042 {
1043  GO4TRACE((11,"TGo4Analysis::UserPostLoop()",__LINE__, __FILE__));
1044  //
1045  Message(0,"Analysis BaseClass -- executing default User Postloop");
1046  return 0;
1047 }
1048 
1049 void TGo4Analysis::SetAutoSaveFile(const char * filename, Bool_t overwrite, Int_t compression)
1050 {
1051 // if(!fbAutoSaveOn) return; // do not set autosave file if disabled!
1052  //TGo4LockGuard autoguard(fxAutoSaveMutex);
1053  TString buffer;
1054  if(filename) buffer = filename;
1055  else buffer = fgcDEFAULTFILENAME;
1056  if(!buffer.Contains(fgcDEFAULTFILESUF))
1057  buffer.Append(fgcDEFAULTFILESUF); // file suffix if not given by user
1058  // new: just set parameters, do not open file here:
1059  fxAutoFileName = buffer;
1060  fbAutoSaveOverwrite = overwrite;
1061  fiAutoSaveCompression = compression;
1062 }
1063 
1065 {
1066  return fxAutoFileName.Length() > 0;
1067 }
1068 
1070 {
1071  GO4TRACE((12,"TGo4Analysis::LockAutoSave()",__LINE__, __FILE__));
1072  Int_t rev(-1);
1073  if (TThread::Exists()>0 && fxAutoSaveMutex)
1074  rev = fxAutoSaveMutex->Lock();
1075  return rev;
1076 }
1077 
1079 {
1080  GO4TRACE((12,"TGo4Analysis::UnLockAutoSave()",__LINE__, __FILE__));
1081  Int_t rev(-1);
1082  if (TThread::Exists()>0 && fxAutoSaveMutex)
1083  rev = fxAutoSaveMutex->UnLock();
1084 
1085  return rev;
1086 }
1087 
1089 {
1090  GO4TRACE((12,"TGo4Analysis::AutoSave()",__LINE__, __FILE__));
1091 
1092  if(!fbAutoSaveOn) return;
1093  TGo4LockGuard autoguard(fxAutoSaveMutex);
1094  Message(0,"Analysis -- AutoSaving....");
1095  //UpdateNamesList();
1097  OpenAutoSaveFile(true);
1100  Message(0,"Analysis -- AutoSave done.");
1101 }
1102 
1103 void TGo4Analysis::OpenAutoSaveFile(bool for_writing)
1104 {
1105  if(!fbAutoSaveOn) return;
1106  TGo4LockGuard autoguard(fxAutoSaveMutex);
1107  gROOT->cd();
1108  if (for_writing) {
1109  delete fxAutoFile;
1110  fxAutoFile = TFile::Open(fxAutoFileName.Data() ,"RECREATE");
1111  if (fxAutoFile==0)
1112  Message(3,"Fail to open AutoSave file %s", fxAutoFileName.Data());
1113  else
1114  Message(-1,"Opening AutoSave file %s with RECREATE mode",fxAutoFileName.Data());
1115  if (fxAutoFile) fxAutoFile->SetCompressionLevel(fiAutoSaveCompression);
1116  } else {
1117  if(fxAutoFile==0) {
1118  if (!gSystem->AccessPathName(fxAutoFileName.Data()))
1119  fxAutoFile = TFile::Open(fxAutoFileName.Data(), "READ");
1120  if (fxAutoFile==0)
1121  Message(3,"Fail to open AutoSave file %s", fxAutoFileName.Data());
1122  else
1123  Message(-1,"Opening AutoSave file %s with READ mode",fxAutoFileName.Data());
1124 
1125  } else {
1126  Message(-1,"Reusing AutoSave file %s with READ mode",fxAutoFileName.Data());
1127  }
1128  } // if(fbAutoSaveOverwrite)
1129 
1130  gROOT->cd();
1131 }
1132 
1133 
1135 {
1136  if(fxAutoFile) {
1137  TGo4LockGuard autoguard(fxAutoSaveMutex);
1138  delete fxAutoFile;
1139  fxAutoFile=0;
1140  Message(-1,"AutoSave file %s was closed.",fxAutoFileName.Data());
1141  }
1142 }
1143 
1144 
1146 {
1147  GO4TRACE((11,"TGo4Analysis::UpdateNamesList()",__LINE__, __FILE__));
1148  //
1149  //std::cout <<"UpdateNamesList: current dir:"<< gDirectory->GetName() << std::endl;
1150  // first try: update all
1151  delete fxObjectNames;
1153  Message(0,"Analysis BaseClass -- Nameslist updated.");
1154 }
1155 
1156 
1157 Bool_t TGo4Analysis::LoadObjects(const char* filename)
1158 {
1159  TGo4LockGuard autoguard(fxAutoSaveMutex);
1160  if(filename) fxAutoFileName = filename;
1161 
1162  if(!fbAutoSaveOn) {
1163  TGo4Log::Info("Analysis LoadObjects: AUTOSAVE file is DISABLED, did NOT read objects back from file %s", fxAutoFileName.Data());
1164  return kFALSE;
1165  }
1166 
1167  if (fbAutoSaveOverwrite) {
1168  TGo4Log::Info("Analysis LoadObjects: AUTOSAVE is in overwrite mode - no objects will be loaded from %s", fxAutoFileName.Data());
1169  return kTRUE;
1170  }
1171 
1172  Bool_t rev(kTRUE);
1173  OpenAutoSaveFile(false);
1174  if(fxAutoFile && fxAutoFile->IsOpen()) {
1175  TGo4Log::Info("Analysis LoadObjects: Loading from autosave file %s ", fxAutoFile->GetName());
1177  } else {
1178  TGo4Log::Info("Analysis LoadObjects: Failed to load from file %s", fxAutoFileName.Data());
1179  rev = kFALSE;
1180  }
1182  gROOT->cd();
1183  return rev;
1184 }
1185 
1186 void TGo4Analysis::Message(Int_t prio, const char* text,...)
1187 {
1188  char txtbuf[TGo4Log::fguMESLEN];
1189  va_list args;
1190  va_start(args, text);
1191  vsnprintf(txtbuf, TGo4Log::fguMESLEN, text, args);
1192  va_end(args);
1193  SendMessageToGUI(prio, kTRUE, txtbuf);
1194 }
1195 
1196 void TGo4Analysis::SendMessageToGUI(Int_t level, Bool_t printout, const char* text)
1197 {
1198  if(fxAnalysisSlave) {
1199  // gui mode: send Text via status channel - also sniffer will be informed
1200  fxAnalysisSlave->SendStatusMessage(level, printout, text);
1201  } else {
1202  // batch mode: no gui connection, handle local printout
1203  Bool_t previousmode = TGo4Log::IsOutputEnabled();
1204  TGo4Log::OutputEnable(printout); // override the messaging state
1205  TGo4Log::Message(level, text);
1206  TGo4Log::OutputEnable(previousmode);
1207 
1208  if (fSniffer) fSniffer->StatusMessage(level, printout, text);
1209  } // if (fxAnalysisSlave)
1210 
1211 }
1212 
1214 {
1215  if (ob==0) return;
1216 
1217  if(fxAnalysisSlave==0) {
1218  Message(2,"Could not send object %s to GUI in batch mode.", ob->GetName());
1219  return;
1220  }
1221 
1222  TString pathname;
1223 
1224  if (ObjectManager()->FindObjectPathName(ob, pathname)) {
1225  TGo4ObjEnvelope* envelope = new TGo4ObjEnvelope(ob, ob->GetName(), pathname.Data());
1226  fxAnalysisSlave->SendObject(envelope);
1227  delete envelope;
1228  return;
1229  }
1230 
1231  fxAnalysisSlave->SendObject(dynamic_cast<TNamed*>(ob));
1232 }
1233 
1235 {
1236  if(fxAnalysisSlave)
1237  return fxAnalysisSlave->MainIsRunning();
1238 
1239  return TGo4Analysis::fbExists; // should be kTRUE
1240 }
1241 
1243 {
1244  if(fxAnalysisSlave==0) return;
1245  if(on)
1247  else
1248  fxAnalysisSlave->Stop();
1249 }
1250 
1252 {
1253  #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
1254  #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
1255  Bool_t unlockedcint=kFALSE;
1257  if(gCINTMutex) {
1258  gCINTMutex->UnLock();
1259  unlockedcint=kTRUE;
1260  }
1261  #endif
1262  #endif
1263  Int_t cycles=0;
1265  while(!IsRunning())
1266  {
1267  //std::cout <<"WWWWWWWait for Start before Sleep..." << std::endl;
1268  gSystem->Sleep(fgiMACROSTARTPOLL);
1269  cycles++;
1270  Bool_t sysret = gSystem->ProcessEvents();
1271  if (sysret || (fxDoWorkingFlag == flagStop)) {
1272  cycles=-1;
1273  break;
1274  // allows cint canvas menu "Interrupt" to get us out of here!
1275  // additionally, without ProcessEvents no connect/disconnect of Go4
1276  // would be possible from this wait loop
1277  }
1278  }
1279  #if ROOT_VERSION_CODE > ROOT_VERSION(5,2,0)
1280  #if ROOT_VERSION_CODE < ROOT_VERSION(5,99,0)
1281  if(gCINTMutex && unlockedcint)
1283  gCINTMutex->Lock();
1284  #endif
1285  #endif
1286  return cycles;
1287 }
1288 
1289 void TGo4Analysis::StartObjectServer(const char* basename, const char* passwd)
1290 {
1291  if(fxAnalysisSlave) {
1292  Message(1,"Start object server not yet enabled.");
1293  //fxAnalysisSlave->StartObjectServer(basename,passwd);
1294  } else {
1295  Message(2,"Could not start object server in batch mode.");
1296  }
1297 }
1298 
1300 {
1301  if(fxAnalysisSlave) {
1302  //fxAnalysisSlave->StopObjectServer();
1303  Message(1,"Stop object server not yet enabled.");
1304  } else {
1305  Message(2,"Could not stop object server in batch mode.");
1306  }
1307 }
1308 
1310 {
1311  // this method to be called from ctrl-c signal handler of analysis server
1312  //std::cout <<"######### TGo4Analysis::ShutdownServer()" << std::endl;
1313  if(fxAnalysisSlave)
1314  {
1315  TGo4Log::Message(1,"Analysis server is initiating shutdown after ctrl-c, please wait!!\n");
1316  fxAnalysisSlave->SubmitShutdown(); // shutdown will be performed in local command thread
1317  }
1318 
1319 }
1320 
1321 
1322 
1323 void TGo4Analysis::ShowEvent(const char* stepname, Bool_t isoutput)
1324 {
1325  TTree* sevtree=CreateSingleEventTree(stepname,isoutput);
1326  if(sevtree) {
1327  if(isoutput)
1328  Message(1,"Showing Output Event %s of step %s",sevtree->GetName(),stepname);
1329  else
1330  Message(1,"Showing Input Event %s of step %s",sevtree->GetName(),stepname);
1331  sevtree->Show(0);
1332  std::cout << std::endl;
1333  delete sevtree;
1334  }
1335 }
1336 
1338 // Methods that forward to object manager:
1339 
1340 Bool_t TGo4Analysis::AddDynamicHistogram(const char* name,
1341  const char* histo,
1342  const char* hevx, const char* hmemx,
1343  const char* hevy, const char* hmemy,
1344  const char* hevz, const char* hmemz,
1345  const char* condition,
1346  const char* cevx, const char* cmemx,
1347  const char* cevy, const char* cmemy)
1348 {
1349  return fxObjectManager->AddDynamicHistogram(name,
1350  histo, hevx, hmemx, hevy, hmemy, hevz, hmemz,
1351  condition, cevx, cmemx, cevy, cmemy);
1352 }
1353 
1354 Bool_t TGo4Analysis::AddTreeHistogram(const char* hisname, const char* treename, const char* varexp, const char* cutexp)
1355 {
1356  Bool_t rev=fxObjectManager->AddTreeHistogram(hisname,treename,varexp,cutexp);
1357  if(rev) UpdateNamesList();
1358  return rev;
1359 }
1360 
1362 {
1363  return fxObjectManager->AddEventProcessor(pro);
1364 }
1365 
1367 {
1368  return fxObjectManager->AddEventSource(source);
1369 }
1370 
1372 {
1373  return fxObjectManager->AddEventStore(store);
1374 }
1375 
1377 {
1378  return fxObjectManager->AddEventStructure(ev);
1379 }
1380 
1381 Bool_t TGo4Analysis::AddHistogram(TH1 * his , const char* subfolder, Bool_t replace)
1382 {
1383  return fxObjectManager->AddHistogram(his,subfolder, replace);
1384 }
1385 
1386 Bool_t TGo4Analysis::AddObject(TNamed * anything, const char* subfolder, Bool_t replace)
1387 {
1388  return fxObjectManager->AddObject(anything,subfolder,replace);
1389 }
1390 
1391 Bool_t TGo4Analysis::AddParameter(TGo4Parameter * par, const char* subfolder)
1392 {
1393  return fxObjectManager->AddParameter(par,subfolder);
1394 }
1395 
1396 Bool_t TGo4Analysis::AddPicture(TGo4Picture * pic, const char* subfolder)
1397 {
1398  return fxObjectManager->AddPicture(pic,subfolder);
1399 }
1400 
1401 Bool_t TGo4Analysis::AddCanvas(TCanvas * can, const char* subfolder)
1402 {
1403  return fxObjectManager->AddCanvas(can,subfolder);
1404 }
1405 
1406 Bool_t TGo4Analysis::AddTree(TTree* tree, const char* subfolder)
1407 {
1408  if(tree) tree->ResetBit(TGo4Status::kGo4BackStoreReset);
1409  return fxObjectManager->AddTree(tree, subfolder);
1410 }
1411 
1412 Bool_t TGo4Analysis::AddAnalysisCondition(TGo4Condition * con, const char* subfolder)
1413 {
1414  return fxObjectManager->AddAnalysisCondition(con,subfolder);
1415 }
1416 
1417 TGo4Condition * TGo4Analysis::GetAnalysisCondition(const char * name, const char* cond_cl)
1418 {
1419  return fxObjectManager->GetAnalysisCondition(name, cond_cl);
1420 }
1421 
1423 {
1424  return fxStepManager->GetAnalysisStep(name);
1425 }
1426 
1428 {
1429  return fxStepManager->GetAnalysisStepNum(number);
1430 }
1431 
1433 {
1435 }
1436 
1438 {
1439  return fxObjectManager->GetEventStructure(name);
1440 }
1441 
1442 TH1* TGo4Analysis::GetHistogram(const char * name)
1443 {
1444  return fxObjectManager->GetHistogram(name);
1445 }
1446 
1447 TNamed * TGo4Analysis::GetObject(const char * name, const char* folder)
1448 {
1449  return fxObjectManager->GetObject(name,folder);
1450 }
1451 
1452 TGo4Parameter * TGo4Analysis::GetParameter(const char * name, const char* par_class)
1453 {
1454  return fxObjectManager->GetParameter(name, par_class);
1455 }
1456 
1458 {
1459  return fxObjectManager->GetPicture(name);
1460 }
1461 
1462 TCanvas * TGo4Analysis::GetCanvas(const char * name)
1463 {
1464  return fxObjectManager->GetCanvas(name);
1465 }
1466 
1467 TTree * TGo4Analysis::GetTree(const char * name)
1468 {
1469  return fxObjectManager->GetTree(name);
1470 }
1471 
1473 {
1474  return fxObjectManager->CreateNamesList();
1475 }
1476 
1478 {
1479  return fxObjectManager->GetObjectFolder();
1480 }
1481 
1482 TGo4ObjectStatus * TGo4Analysis::CreateObjectStatus(const char * name, const char* folder)
1483 {
1484  return fxObjectManager->CreateObjectStatus(name,folder);
1485 }
1486 
1488 {
1489  return fxObjectManager->CreateTreeStructure(treename);
1490 }
1491 
1493 {
1494  return fxObjectManager->RemoveEventSource(source);
1495 }
1496 
1498 {
1499  return fxObjectManager->RemoveEventStore(store);
1500 }
1501 
1503 {
1505 }
1506 
1507 Bool_t TGo4Analysis::RemoveHistogram(const char * name, Bool_t del)
1508 {
1509  return fxObjectManager->RemoveHistogram(name,del);
1510 }
1511 
1512 Bool_t TGo4Analysis::RemoveObject(const char * name, Bool_t del)
1513 {
1514  return fxObjectManager->RemoveObject(name,del);
1515 }
1516 
1517 Bool_t TGo4Analysis::RemoveParameter(const char * name)
1518 {
1519  return fxObjectManager->RemoveParameter(name);
1520 }
1521 
1522 Bool_t TGo4Analysis::RemovePicture(const char * name)
1523 {
1524  return fxObjectManager->RemovePicture(name);
1525 }
1526 
1527 Bool_t TGo4Analysis::RemoveCanvas(const char * name)
1528 {
1529  return fxObjectManager->RemoveCanvas(name);
1530 }
1531 
1532 Bool_t TGo4Analysis::RemoveTree(TTree * tree, const char* stepname)
1533 {
1534  return fxObjectManager->RemoveTree(tree, stepname);
1535 }
1536 
1538 {
1540 }
1541 
1543 {
1545 }
1546 
1547 Bool_t TGo4Analysis::DeleteObjects(const char * name)
1548 {
1549  return fxObjectManager->DeleteObjects(name);
1550 }
1551 
1552 Bool_t TGo4Analysis::ClearObjects(const char * name)
1553 {
1554  return fxObjectManager->ClearObjects(name);
1555 }
1556 
1557 Bool_t TGo4Analysis::ProtectObjects(const char * name, const Option_t* flags)
1558 {
1559  return fxObjectManager->ProtectObjects(name, flags);
1560 }
1561 
1562 Bool_t TGo4Analysis::ResetBackStores(Bool_t clearflag)
1563 {
1564  return fxObjectManager->ResetBackStores(clearflag);
1565 }
1566 
1567 Bool_t TGo4Analysis::SetAnalysisCondition(const char * name, TGo4Condition* con, Bool_t counter)
1568 {
1569  return fxObjectManager->SetAnalysisCondition(name, con, counter);
1570 }
1571 
1572 Bool_t TGo4Analysis::SetParameter(const char* name, TGo4Parameter* par)
1573 {
1574  return fxObjectManager->SetParameter(name, par);
1575 }
1576 
1578 {
1579  return fxObjectManager->SetParameterStatus(name, par);
1580 }
1581 
1582 Bool_t TGo4Analysis::SetPicture(const char * name, TGo4Picture * pic)
1583 {
1584  return fxObjectManager->SetPicture(name, pic);
1585 }
1586 
1588 {
1590 }
1591 
1592 void TGo4Analysis::PrintConditions(const char* expression)
1593 {
1594  fxObjectManager->PrintConditions(expression);
1595 }
1596 
1597 void TGo4Analysis::PrintHistograms(const char* expression)
1598 {
1599  fxObjectManager->PrintHistograms(expression);
1600 }
1601 
1602 void TGo4Analysis::PrintParameters(const char* expression)
1603 {
1604  fxObjectManager->PrintParameters(expression);
1605 }
1606 
1608 {
1610 }
1611 
1612 TObject* TGo4Analysis::NextMatchingObject(const char* expr, const char* folder, Bool_t reset)
1613 {
1614  return fxObjectManager->NextMatchingObject(expr,folder,reset);
1615 }
1616 
1617 
1619 // Methods that forward to stepmanager:
1620 
1622 {
1623  return fxStepManager->GetInputEvent(stepindex);
1624 }
1625 
1627 {
1628  return fxStepManager->GetInputEvent(stepname);
1629 }
1630 
1632 {
1633  return fxStepManager->GetOutputEvent();
1634 }
1635 
1637 {
1638  return fxStepManager->GetOutputEvent(stepindex);
1639 }
1640 
1642 {
1643  return fxStepManager->GetOutputEvent(stepname);
1644 }
1645 
1647 {
1648  return fxStepManager->NewStepProcessor(name,par);
1649 }
1650 
1652 {
1653  return fxStepManager->NewStepSource(name,par);
1654 }
1655 
1657 {
1658  return fxStepManager->NewStepStore(name,par);
1659 }
1660 
1662 {
1663  return fxObjectManager->AddDynamicEntry(entry);
1664 }
1665 
1667 {
1669 }
1670 
1671 Bool_t TGo4Analysis::SetFirstStep(const char* name)
1672 {
1673  return fxStepManager->SetFirstStep(name);
1674 }
1675 
1676 Bool_t TGo4Analysis::SetLastStep(const char * name)
1677 {
1678  return fxStepManager->SetLastStep(name);
1679 }
1680 
1681 Bool_t TGo4Analysis::SetStepStorage(const char * name, Bool_t on)
1682 {
1683  return fxStepManager->SetStepStorage(name,on);
1684 }
1685 
1687 {
1689 }
1690 
1692 {
1693  return fxStepManager->AddAnalysisStep(next);
1694 }
1695 
1697 {
1699 }
1700 
1702 {
1703  fxStepManager->SetOutputEvent(event);
1704 }
1705 
1706 Int_t TGo4Analysis::StoreParameter(const char * name, TGo4Parameter* par)
1707 {
1708  return fxStepManager->Store(name, par);
1709 }
1710 
1711 Int_t TGo4Analysis::StoreCondition(const char * name, TGo4Condition* con)
1712 {
1713  return fxStepManager->Store(name, con);
1714 }
1715 
1716 Int_t TGo4Analysis::StoreFitter(const char * name, TGo4Fitter* fit)
1717 {
1718  return fxStepManager->Store(name, fit);
1719 }
1720 
1721 Int_t TGo4Analysis::StoreFolder(const char * name, TFolder* folder)
1722 {
1723  return fxStepManager->Store(name, folder);
1724 }
1725 
1726 Int_t TGo4Analysis::StoreFolder(const char * stepname, const char * foldername)
1727 {
1728  TFolder* myfolder = fxObjectManager->FindSubFolder(GetObjectFolder(), foldername, kFALSE);
1729  return myfolder ? fxStepManager->Store(stepname, myfolder) : 2;
1730 }
1731 
1732 void TGo4Analysis::DefineServerPasswords(const char* admin, const char* controller, const char* observer)
1733 {
1734  fServerAdminPass = admin ? admin : "";
1735  fServerCtrlPass = controller ? controller : "";
1736  fServerObserverPass = observer ? observer : "";
1737 }
1738 
1739 void TGo4Analysis::SetObserverPassword(const char* passwd)
1740 {
1741  fServerObserverPass = passwd ? passwd : "";
1742 }
1743 
1744 void TGo4Analysis::SetControllerPassword(const char* passwd)
1745 {
1746  fServerCtrlPass = passwd ? passwd : "";
1747 }
1748 
1750 {
1751  fServerAdminPass = passwd ? passwd : "";
1752 }
1753 
1754 TH1* TGo4Analysis::MakeTH1(char type, const char* fullname, const char* title,
1755  Int_t nbinsx, Double_t xlow, Double_t xup,
1756  const char* xtitle, const char* ytitle)
1757 {
1758  fbObjMade = kFALSE;
1759  TString foldername, histoname;
1760 
1761  if ((fullname==0) || (strlen(fullname)==0)) {
1762  TGo4Log::Error("Histogram name not specified, can be a hard error");
1763  return 0;
1764  }
1765  const char* separ = strrchr(fullname, '/');
1766  if (separ!=0) {
1767  histoname = separ + 1;
1768  foldername.Append(fullname, separ - fullname);
1769  } else
1770  histoname = fullname;
1771 
1772  int itype = 0;
1773  const char* sclass = "TH1I";
1774  switch (type) {
1775  case 'I': case 'i': itype = 0; sclass = "TH1I"; break;
1776  case 'F': case 'f': itype = 1; sclass = "TH1F"; break;
1777  case 'D': case 'd': itype = 2; sclass = "TH1D"; break;
1778  case 'S': case 's': itype = 3; sclass = "TH1S"; break;
1779  case 'C': case 'c': itype = 4; sclass = "TH1C"; break;
1780  default: TGo4Log::Error("There is no histogram type: %c, use I instead", type); break;
1781  }
1782 
1783  TH1* oldh = GetHistogram(fullname);
1784 
1785  if (oldh!=0) {
1786  if (oldh->InheritsFrom(sclass) && fbMakeWithAutosave) {
1787  if (title) oldh->SetTitle(title);
1788  if (xtitle) oldh->GetXaxis()->SetTitle(xtitle);
1789  if (ytitle) oldh->GetYaxis()->SetTitle(ytitle);
1790  return oldh;
1791  }
1792 
1793  if (fbMakeWithAutosave)
1794  TGo4Log::Info("There is histogram %s with type %s other than specified %s, create new and reuse content",
1795  fullname, oldh->ClassName(), sclass);
1796 
1797  // do not delete histogram immediately
1798  RemoveHistogram(fullname, kFALSE);
1799 
1800  // prevent ROOT to complain about same name
1801  oldh->SetName("___");
1802  }
1803 
1804  TH1* newh = 0;
1805 
1806  switch (itype) {
1807  case 0: newh = new TH1I(histoname, title, nbinsx, xlow, xup); break;
1808  case 1: newh = new TH1F(histoname, title, nbinsx, xlow, xup); break;
1809  case 2: newh = new TH1D(histoname, title, nbinsx, xlow, xup); break;
1810  case 3: newh = new TH1S(histoname, title, nbinsx, xlow, xup); break;
1811  case 4: newh = new TH1C(histoname, title, nbinsx, xlow, xup); break;
1812  }
1813 
1814  newh->SetTitle(title);
1815 
1816  if (xtitle) newh->GetXaxis()->SetTitle(xtitle);
1817  if (ytitle) newh->GetYaxis()->SetTitle(ytitle);
1818 
1819  if (oldh) {
1820  if ((oldh->GetDimension()==1) && fbMakeWithAutosave) newh->Add(oldh);
1821  delete oldh; oldh = 0;
1822  }
1823 
1824  if (foldername.Length() > 0)
1825  AddHistogram(newh, foldername.Data());
1826  else
1827  AddHistogram(newh);
1828 
1829  fbObjMade = kTRUE;
1830 
1831  return newh;
1832 }
1833 
1834 TH2* TGo4Analysis::MakeTH2(char type, const char* fullname, const char* title,
1835  Int_t nbinsx, Double_t xlow, Double_t xup,
1836  Int_t nbinsy, Double_t ylow, Double_t yup,
1837  const char* xtitle, const char* ytitle, const char* ztitle)
1838 {
1839  fbObjMade = kFALSE;
1840  TString foldername, histoname;
1841 
1842  if ((fullname==0) || (strlen(fullname)==0)) {
1843  TGo4Log::Error("Histogram name not specified, can be a hard error");
1844  return 0;
1845  }
1846  const char* separ = strrchr(fullname, '/');
1847  if (separ!=0) {
1848  histoname = separ + 1;
1849  foldername.Append(fullname, separ - fullname);
1850  } else
1851  histoname = fullname;
1852 
1853  int itype = 0;
1854  const char* sclass = "TH2I";
1855  switch (type) {
1856  case 'I': case 'i': itype = 0; sclass = "TH2I"; break;
1857  case 'F': case 'f': itype = 1; sclass = "TH2F"; break;
1858  case 'D': case 'd': itype = 2; sclass = "TH2D"; break;
1859  case 'S': case 's': itype = 3; sclass = "TH2S"; break;
1860  case 'C': case 'c': itype = 4; sclass = "TH2C"; break;
1861  default: TGo4Log::Error("There is no histogram type: %c, use I instead", type); break;
1862  }
1863 
1864  TH1* oldh = GetHistogram(fullname);
1865 
1866  if (oldh!=0) {
1867  if (oldh->InheritsFrom(sclass) && fbMakeWithAutosave) {
1868  if (title) oldh->SetTitle(title);
1869  if (xtitle) oldh->GetXaxis()->SetTitle(xtitle);
1870  if (ytitle) oldh->GetYaxis()->SetTitle(ytitle);
1871  return (TH2*) oldh;
1872  }
1873 
1874  if (fbMakeWithAutosave)
1875  TGo4Log::Info("There is histogram %s with type %s other than specified %s, create new and reuse content",
1876  fullname, oldh->ClassName(), sclass);
1877 
1878  // do not delete histogram immediately
1879  RemoveHistogram(fullname, kFALSE);
1880 
1881  // prevent ROOT to complain about same name
1882  oldh->SetName("___");
1883  }
1884 
1885  TH2* newh = 0;
1886 
1887  switch (itype) {
1888  case 0: newh = new TH2I(histoname, title, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
1889  case 1: newh = new TH2F(histoname, title, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
1890  case 2: newh = new TH2D(histoname, title, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
1891  case 3: newh = new TH2S(histoname, title, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
1892  case 4: newh = new TH2C(histoname, title, nbinsx, xlow, xup, nbinsy, ylow, yup); break;
1893  }
1894 
1895  newh->SetTitle(title);
1896 
1897  if (xtitle) newh->GetXaxis()->SetTitle(xtitle);
1898  if (ytitle) newh->GetYaxis()->SetTitle(ytitle);
1899  if (ztitle) newh->GetZaxis()->SetTitle(ztitle);
1900 
1901  if (oldh) {
1902  if ((oldh->GetDimension()==2) && fbMakeWithAutosave) newh->Add(oldh);
1903  delete oldh;
1904  oldh = 0;
1905  }
1906 
1907  if (foldername.Length() > 0)
1908  AddHistogram(newh, foldername.Data());
1909  else
1910  AddHistogram(newh);
1911 
1912  fbObjMade = kTRUE;
1913 
1914  return newh;
1915 }
1916 
1918  Double_t xmin, Double_t xmax,
1919  const char* HistoName)
1920 {
1921  fbObjMade = kFALSE;
1922  TString foldername, condname;
1923 
1924  if ((fullname==0) || (strlen(fullname)==0)) {
1925  TGo4Log::Error("Condition name not specified, can be a hard error");
1926  return 0;
1927  }
1928  const char* separ = strrchr(fullname, '/');
1929  if (separ!=0) {
1930  condname = separ + 1;
1931  foldername.Append(fullname, separ - fullname);
1932  } else
1933  condname = fullname;
1934 
1935  TGo4Condition* cond = GetAnalysisCondition(fullname);
1936 
1937  if (cond!=0) {
1938  if (cond->InheritsFrom(TGo4WinCond::Class()) && fbMakeWithAutosave) {
1939  cond->ResetCounts();
1940  return (TGo4WinCond*) cond;
1941  }
1942  RemoveAnalysisCondition(fullname);
1943  }
1944 
1945  TGo4WinCond* wcond = new TGo4WinCond(condname);
1946  wcond->SetValues(xmin, xmax);
1947  wcond->SetHistogram(HistoName);
1948  wcond->Enable();
1949 
1950  if (foldername.Length() > 0)
1951  AddAnalysisCondition(wcond, foldername.Data());
1952  else
1953  AddAnalysisCondition(wcond);
1954 
1955  fbObjMade = kTRUE;
1956 
1957  return wcond;
1958 }
1959 
1961  Double_t xmin, Double_t xmax,
1962  Double_t ymin, Double_t ymax,
1963  const char* HistoName)
1964 {
1965  fbObjMade = kFALSE;
1966  TString foldername, condname;
1967 
1968  if ((fullname==0) || (strlen(fullname)==0)) {
1969  TGo4Log::Error("Condition name not specified, can be a hard error");
1970  return 0;
1971  }
1972  const char* separ = strrchr(fullname, '/');
1973  if (separ!=0) {
1974  condname = separ + 1;
1975  foldername.Append(fullname, separ - fullname);
1976  } else
1977  condname = fullname;
1978 
1979  TGo4Condition* cond = GetAnalysisCondition(fullname);
1980 
1981  if (cond!=0) {
1982  if (cond->InheritsFrom(TGo4WinCond::Class()) && fbMakeWithAutosave) {
1983  cond->ResetCounts();
1984  return (TGo4WinCond*) cond;
1985  }
1986  RemoveAnalysisCondition(fullname);
1987  }
1988 
1989  TGo4WinCond* wcond = new TGo4WinCond(condname);
1990  wcond->SetValues(xmin, xmax, ymin, ymax);
1991  wcond->SetHistogram(HistoName);
1992  wcond->Enable();
1993 
1994  if (foldername.Length() > 0)
1995  AddAnalysisCondition(wcond, foldername.Data());
1996  else
1997  AddAnalysisCondition(wcond);
1998 
1999  fbObjMade = kTRUE;
2000 
2001  return wcond;
2002 }
2003 
2005  Int_t npoints,
2006  Double_t (*points) [2],
2007  const char* HistoName,
2008  Bool_t shapedcond)
2009 {
2010  fbObjMade = kFALSE;
2011  TString foldername, condname;
2012 
2013  if ((fullname==0) || (strlen(fullname)==0)) {
2014  TGo4Log::Error("Condition name not specified, can be a hard error");
2015  return 0;
2016  }
2017  const char* separ = strrchr(fullname, '/');
2018  if (separ!=0) {
2019  condname = separ + 1;
2020  foldername.Append(fullname, separ - fullname);
2021  } else
2022  condname = fullname;
2023 
2024  TGo4Condition* cond = GetAnalysisCondition(fullname);
2025 
2026  if (cond!=0) {
2027  if (cond->InheritsFrom(TGo4PolyCond::Class()) && fbMakeWithAutosave) {
2028  cond->ResetCounts();
2029  return (TGo4PolyCond*) cond;
2030  }
2031  RemoveAnalysisCondition(fullname);
2032  }
2033 
2034  TArrayD fullx(npoints+1), fully(npoints+1);
2035 
2036  for (int i=0;i<npoints;i++) {
2037  fullx[i] = points[i][0];
2038  fully[i] = points[i][1];
2039  }
2040 
2041  // connect first and last points
2042  if ((fullx[0]!=fullx[npoints-1]) || (fully[0]!=fully[npoints-1])) {
2043  fullx[npoints] = fullx[0];
2044  fully[npoints] = fully[0];
2045  npoints++;
2046  }
2047 
2048  TCutG mycat("initialcut", npoints, fullx.GetArray(), fully.GetArray());
2049  TGo4PolyCond* pcond;
2050  if(shapedcond)
2051  pcond = new TGo4ShapedCond(condname);
2052  else
2053  pcond = new TGo4PolyCond(condname);
2054  pcond->SetValues(&mycat);
2055  pcond->Enable();
2056 
2057  pcond->SetHistogram(HistoName);
2058 
2059  if (foldername.Length() > 0)
2060  AddAnalysisCondition(pcond, foldername.Data());
2061  else
2062  AddAnalysisCondition(pcond);
2063 
2064  fbObjMade = kTRUE;
2065 
2066  return pcond;
2067 }
2068 
2069 
2071  Int_t npoints,
2072  Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta,
2073  const char* HistoName)
2074 {
2075  fbObjMade = kFALSE;
2076  TString foldername, condname;
2077 
2078  if ((fullname==0) || (strlen(fullname)==0)) {
2079  TGo4Log::Error("Condition name not specified, can be a hard error");
2080  return 0;
2081  }
2082  const char* separ = strrchr(fullname, '/');
2083  if (separ!=0) {
2084  condname = separ + 1;
2085  foldername.Append(fullname, separ - fullname);
2086  } else
2087  condname = fullname;
2088 
2089  TGo4Condition* cond = GetAnalysisCondition(fullname);
2090 
2091  if (cond!=0) {
2092  if (cond->InheritsFrom(TGo4ShapedCond::Class()) && fbMakeWithAutosave) {
2093  cond->ResetCounts();
2094  return (TGo4ShapedCond*) cond;
2095  }
2096  RemoveAnalysisCondition(fullname);
2097  }
2098 
2099  TGo4ShapedCond* econd = new TGo4ShapedCond(condname);
2100  econd->SetEllipse(cx,cy,a1,a2,theta,npoints);
2101  econd->Enable();
2102  econd->SetHistogram(HistoName);
2103  if (foldername.Length() > 0)
2104  AddAnalysisCondition(econd, foldername.Data());
2105  else
2106  AddAnalysisCondition(econd);
2107 
2108  fbObjMade = kTRUE;
2109 
2110  return econd;
2111 }
2112 
2113 
2115  Int_t npoints, Double_t cx, Double_t cy, Double_t r,
2116  const char* HistoName)
2117 {
2118  TGo4ShapedCond* elli=MakeEllipseCond(fullname,npoints,cx,cy, r, r, 0, HistoName);
2119  elli->SetCircle(); // mark "circle shape" property
2120  return elli;
2121 }
2122 
2123 TGo4ShapedCond* TGo4Analysis::MakeBoxCond(const char* fullname, Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta,
2124  const char* HistoName)
2125 {
2126  TGo4ShapedCond* elli=MakeEllipseCond(fullname,4,cx,cy, a1, a2, theta, HistoName);
2127  elli->SetBox(); // convert to "box shape" property
2128  return elli;
2129 }
2130 
2131 
2132 
2134  Int_t npoints,
2135  Double_t (*points) [2],
2136  const char* HistoName)
2137 {
2138  TGo4ShapedCond* elli=dynamic_cast<TGo4ShapedCond*>(MakePolyCond(fullname, npoints, points, HistoName,true));
2139  elli->SetFreeShape();
2140  return elli;
2141 }
2142 
2143 
2144 
2145 
2147  const char* classname,
2148  const char* newcmd)
2149 {
2150  fbObjMade = kFALSE;
2151  TString foldername, paramname;
2152 
2153  if ((fullname==0) || (strlen(fullname)==0)) {
2154  TGo4Log::Error("Parameter name not specified, can be a hard error");
2155  return 0;
2156  }
2157  const char* separ = strrchr(fullname, '/');
2158  if (separ!=0) {
2159  paramname = separ + 1;
2160  foldername.Append(fullname, separ - fullname);
2161  } else
2162  paramname = fullname;
2163 
2164  TGo4Parameter* param = GetParameter(fullname);
2165 
2166  if (param!=0) {
2167  if (!param->InheritsFrom(classname)) {
2168  TGo4Log::Info("There is parameter %s with type %s other than specified %s, rebuild",
2169  fullname, param->ClassName(), classname);
2170  RemoveParameter(fullname);
2171  param = 0;
2172  }
2173  }
2174 
2175  if (param==0) {
2176  paramname = TString("\"") + paramname + TString("\"");
2177 
2178  TString cmd;
2179  if ((newcmd!=0) && (strstr(newcmd,"new ")==newcmd))
2180  cmd = TString::Format(newcmd, paramname.Data());
2181  else
2182  cmd = TString::Format("new %s(%s)", classname, paramname.Data());
2183 
2184  Long_t res = gROOT->ProcessLineFast(cmd.Data());
2185 
2186  if (res==0) {
2187  TGo4Log::Error("Cannot create parameter of class %s", classname);
2188  return 0;
2189  }
2190 
2191  param = (TGo4Parameter*) res;
2192 
2193  if (foldername.Length() > 0)
2194  AddParameter(param, foldername.Data());
2195  else
2196  AddParameter(param);
2197 
2198  fbObjMade = kTRUE;
2199  }
2200 
2201  if ((newcmd!=0) && (strstr(newcmd,"set_")==newcmd)) {
2202  // executing optional set macro
2203 
2204  ExecuteScript(newcmd);
2205  }
2206 
2207  return param;
2208 }
2209 
2210 Long_t TGo4Analysis::ExecuteScript(const char* macro_name)
2211 {
2212  if ((macro_name==0) || (strlen(macro_name)==0)) return -1;
2213 
2214  // exclude arguments which could be specified with macro name
2215  TString file_name(macro_name);
2216  Ssiz_t pos = file_name.First('(');
2217  if (pos>0) file_name.Resize(pos);
2218  pos = file_name.First('+');
2219  if (pos>0) file_name.Resize(pos);
2220  while ((file_name.Length()>0) && (file_name[file_name.Length()-1] == ' '))
2221  file_name.Resize(file_name.Length()-1);
2222  while ((file_name.Length()>0) && (file_name[0]==' '))
2223  file_name.Remove(0, 1);
2224 
2225  if (gSystem->AccessPathName(file_name.Data())) {
2226  TGo4Log::Error("ROOT script %s nof found", file_name.Data());
2227  return -1;
2228  }
2229 
2230  TGo4Log::Info("Executing ROOT script %s", macro_name);
2231  return gROOT->ProcessLineSync(Form(".x %s", macro_name)); // here faster than ExecuteLine...
2232 }
2233 
2234 Long_t TGo4Analysis::ExecutePython(const char* macro_name, Int_t* errcode)
2235 {
2236  if ((macro_name==0) || (strlen(macro_name)==0)) return -1;
2237  TString comstring=macro_name;
2238  comstring.Prepend(TGo4Analysis::fgcPYPROMPT); // emulate interactive command line mode here
2239  return ExecuteLine(comstring.Data(), errcode);
2240 }
2241 
2242 
2243 Long_t TGo4Analysis::ExecuteLine(const char* command, Int_t* errcode)
2244 {
2245  TString comstring;
2246 if (strchr(command,TGo4Analysis::fgcPYPROMPT) && (strchr(command,TGo4Analysis::fgcPYPROMPT) == strrchr(command,TGo4Analysis::fgcPYPROMPT))) {
2247  // this one is by Sven Augustin, MPI Heidelberg
2248  comstring = command;
2249  comstring = comstring.Strip(TString::kBoth);
2250  comstring = comstring.Strip(TString::kLeading,TGo4Analysis::fgcPYPROMPT);
2251  comstring = comstring.Strip(TString::kLeading);
2252  TGo4Log::Debug("Executing Python script: %s", comstring.Data());
2253  const TString PY_EXT = ".py";
2254  int imin = comstring.Index(PY_EXT + " ");
2255  int imax = comstring.Length();
2256  if (imin == -1) {
2257  imin = imax;
2258  } else {
2259  imin += PY_EXT.Length();
2260  }
2261  int ilen = imax - imin;
2262  TString scrstring = comstring(0, imin);
2263  TString argstring = comstring(imin, ilen);
2264 
2265  comstring = "TPython::Exec(\"import sys; sys.argv = [\'" + scrstring + "\'] + \'" + argstring + "\'.split()\");";
2266  comstring += "TPython::LoadMacro(\"" + scrstring + "\");";
2267 
2268  if(!fbPythonBound) {
2269  TString go4sys = TGo4Log::GO4SYS();
2270  TString pyinit = TGo4Analysis::fgcPYINIT; // JAM todo: put python path and filename into settings
2271  comstring.Prepend("TPython::LoadMacro(\"" + go4sys + pyinit +"\");");
2272  comstring.Prepend("TPython::Bind(go4, \"go4\");" );
2273  fbPythonBound = kTRUE;
2274  }
2275 } else {
2276  comstring="";
2277  const char* cursor = command;
2278  const char* at=0;
2279  do {
2280  Ssiz_t len=strlen(cursor);
2281  at = strstr(cursor,"@");
2282  if(at) {
2283  //std::cout <<"Found at: "<<at << std::endl;
2284  len=(Ssiz_t) (at-cursor);
2285  comstring.Append(cursor,len);
2286  comstring.Append("TGo4Analysis::Instance()->");
2287  cursor=at+1;
2288  } else {
2289  //std::cout <<"Appended "<<cursor << std::endl;
2290  comstring.Append(cursor);
2291  }
2292  } while(at);
2293  }
2294 
2295 
2296  TGo4Log::Debug("ExecuteLine: %s", comstring.Data());
2297 
2298 // TInterpreter* theI = gROOT->GetInterpreter();
2299 // printf ("ExecuteLine sees interpreter of class %s \n",theI ? theI->IsA()->GetName() : "NULL");
2300 // printf ("IsProcessLineLocked is %s \n", theI->IsProcessLineLocked() ? "true" : "false");
2301 // printf ("gInterpreterMutex: 0x%x gGlobalMutex: 0x%x \n", gInterpreterMutex, gGlobalMutex);
2302 
2303 
2304  //gROOT->GetInterpreter()->RewindInterpreterMutex();
2305  // TCling__ResetInterpreterMutex();
2306 // theI->SetProcessLineLock(kTRUE);
2307  Long_t rev=gROOT->ProcessLineSync(comstring, errcode);
2308 // theI->SetProcessLineLock(kFALSE);
2309  return rev;
2310  }
2311 
2313 {
2314  if (fxAnalysisSlave) {
2315  // fxAnalysisSlave->GetTask()->SubmitCommand("THStop");
2316  fxAnalysisSlave->Stop();
2317  } else {
2320  }
2321 }
2322 
2324 {
2325  if (fxAnalysisSlave)
2326  {
2328  // fxAnalysisSlave->GetTask()->SubmitCommand("THStart");
2329  }
2330  else
2331  {
2332  // JAM reproduce behavior of analysis client, check init state before executing preloop
2333  if (fbInitIsDone)
2334  {
2336  {
2337  PreLoop();
2338  if(fxRate) fxRate->Reset(); // reset counters and time whenever started again
2339  }
2341  }
2342  else
2343  {
2344  Message(2, TString::Format("Analysis %s was not initialized! Please SUBMIT settings first.", GetName()));
2345  }
2346 
2347  }
2348 }
2349 
2350 
2351 #ifdef WIN32
2352 
2353 #include "windows.h"
2354 
2355 
2356 namespace {
2357 
2358  static BOOL Go4ConsoleSigHandler(DWORD sig)
2359  {
2360  // WinNT signal handler.
2361 
2362  switch (sig) {
2363  case CTRL_C_EVENT:
2364  if (TGo4Analysis::Exists())
2366  return TRUE;
2367  case CTRL_BREAK_EVENT:
2368  case CTRL_LOGOFF_EVENT:
2369  case CTRL_SHUTDOWN_EVENT:
2370  case CTRL_CLOSE_EVENT:
2371  default:
2372  printf(" non CTRL-C signal - ignore\n");
2373  return TRUE;
2374  }
2375  }
2376 
2377  void InstallGo4CtrlCHandler(bool on)
2378  {
2379  ::SetConsoleCtrlHandler((PHANDLER_ROUTINE)Go4ConsoleSigHandler, on);
2380  }
2381 
2382 }
2383 
2384 
2385 
2386 #endif
Bool_t AddTreeHistogram(const char *hisname, const char *treename, const char *varexp, const char *cutexp)
Bool_t SetParameter(const char *name, TGo4Parameter *par, TFolder *parent=0)
Int_t Store(const char *name, TGo4Parameter *obj)
void SetAutoFileName(const char *name)
void SetOutputEvent(TGo4EventElement *event)
void SetRunning(Bool_t on=kTRUE)
const char * GetErrMess() const
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)
Bool_t SetAnalysisCondition(const char *name, TGo4Condition *con, Bool_t counter=kTRUE, TFolder *parent=0)
void PrintParameters(const char *expression=0)
static const Int_t fgiMACROSTARTPOLL
TGo4Analysis(const char *name=0)
static Bool_t IsServerMode()
static const char * fgcPYINIT
Bool_t NewStepProcessor(const char *name, TGo4EventProcessorParameter *par)
void SetEllipse(Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta=0, Int_t npoints=0)
Bool_t NewStepSource(const char *name, TGo4EventSourceParameter *par)
Bool_t RemoveEventProcessor(TGo4EventProcessor *pro)
Bool_t NewStepProcessor(const char *name, TGo4EventProcessorParameter *par)
virtual void StatusMessage(int level, Bool_t printout, const TString &)
void UpdateStatus(TGo4AnalysisStatus *state)
Bool_t RemoveEventStructure(TGo4EventElement *ev)
TGo4ShapedCond * MakeFreeShapeCond(const char *fullname, Int_t npoints, Double_t(*points)[2], const char *HistoName=0)
Bool_t SetStepStorage(const char *name, Bool_t on)
Bool_t LoadStatus(const char *filename=0)
Bool_t AddCanvas(TCanvas *can, const char *subfolder=0)
void SetDateTime(const char *str)
Definition: TGo4Ratemeter.h:70
Int_t GetAutoSaveCompression() const
virtual void SendStatusMessage(Int_t level, Bool_t printout, const TString &text)
TGo4ShapedCond * MakeCircleCond(const char *fullname, Int_t npoints, Double_t cx, Double_t cy, Double_t r, const char *HistoName=0)
virtual Int_t UserPreLoop()
TGo4AnalysisClient * fxAnalysisSlave
void SetStatus(TGo4AnalysisStatus *state)
void SetStepChecking(Bool_t on=kTRUE)
void SetAnalysisName(const char *name)
Bool_t AddObject(TNamed *anything, const char *subfolder=0, Bool_t replace=kTRUE)
void SetOutputEvent(TGo4EventElement *event)
void DefineServerPasswords(const char *admin, const char *controller, const char *observer)
Bool_t RemoveParameter(const char *name)
Bool_t AddParameter(TGo4Parameter *par, const char *subfolder=0)
void UpdateStatus(TGo4AnalysisStatus *state)
const char * GetStatusMessage() const
Bool_t AddDynamicEntry(TGo4DynamicEntry *entry)
static void SetCommandList(TGo4CommandProtoList *list)
virtual void UserPreLoop()
Bool_t SetParameter(const char *name, TGo4Parameter *par)
static void UnRegister(TGo4CommandReceiver *p)
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)
static Bool_t CheckVersion(Int_t version)
Definition: TGo4Version.cxx:42
virtual void CloseAnalysis()
Int_t StoreFolder(const char *stepname, TFolder *folder)
void SetCurrentSource(const char *str)
Definition: TGo4Ratemeter.h:71
Bool_t LoadObjects(const char *filename=0)
TGo4TreeStructure * CreateTreeStructure(const char *treename)
void SetObserverPassword(const char *passwd)
Int_t StoreParameter(const char *name, TGo4Parameter *par)
TGo4InterruptHandler * fxInterruptHandler
Bool_t RemovePicture(const char *name)
virtual const char * What()
void SetAutoSaveOn(Bool_t on=kTRUE)
Bool_t AddDynamicHistogram(const char *name, const char *histo, const char *hevx, const char *hmemx, const char *hevy=0, const char *hmemy=0, const char *hevz=0, const char *hmemz=0, const char *condition=0, const char *cevx=0, const char *cmemx=0, const char *cevy=0, const char *cmemy=0)
Bool_t MainIsRunning()
Definition: TGo4Slave.h:92
virtual Int_t PrintStatus(Text_t *buffer=0, Int_t buflen=0)
static void CloseLogfile()
Definition: TGo4Log.cxx:449
void SetControllerPassword(const char *passwd)
static Bool_t IsOutputEnabled()
Definition: TGo4Log.cxx:364
Bool_t ClearObjects(const char *name)
TString fServerCtrlPass
Bool_t DeleteObjects(const char *name)
Bool_t RemoveObject(const char *name, Bool_t del=kTRUE)
static const char * fgcDEFAULTSTATUSFILENAME
TGo4Picture * GetPicture(const char *name)
Int_t IsErrorStopEnabled()
void SendMessageToGUI(Int_t level, Bool_t printout, const char *text)
void SetStepChecking(Bool_t on=kTRUE)
static Bool_t IsClientMode()
Bool_t AddCanvas(TCanvas *can, const char *subfolder=0)
TGo4AnalysisObjectNames * fxObjectNames
Int_t StoreFitter(const char *name, TGo4Fitter *fit)
static const char * GetPrintfArg(Int_t type_id)
Definition: TGo4Log.cxx:343
Bool_t AddPicture(TGo4Picture *pic, const char *subfolder=0)
Bool_t RemoveEventSource(TGo4EventSource *source)
Bool_t RemoveDynamicEntry(const char *entryname)
TH1 * GetHistogram(const char *name)
void ShowEvent(const char *stepname, Bool_t isoutput=kTRUE)
friend class TGo4AnalysisWebStatus
void SetUpdateInterval(double v)
Definition: TGo4Ratemeter.h:82
TString fServerAdminPass
TString fxDefaultTestFileName
Bool_t SetParameterStatus(const char *name, TGo4ParameterStatus *par)
TString fxConfigFilename
static void Register(const char *name, TGo4CommandReceiver *p)
virtual void RatemeterUpdate(TGo4Ratemeter *)
Bool_t RemoveAnalysisCondition(const char *name)
TGo4AnalysisObjectManager * fxObjectManager
virtual Int_t UserEventFunc()
Bool_t SetFirstStep(const char *name)
static void OutputEnable(Bool_t on=kTRUE)
Definition: TGo4Log.cxx:358
Int_t GetPriority() const
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)
Bool_t FindObjectPathName(TObject *obj, TString &pathname, TFolder *fold=0)
Int_t fiAutoSaveInterval
TGo4AnalysisStepManager * fxStepManager
void PrintHistograms(const char *expression=0)
void SetDynListInterval(Int_t val)
void SetRunning(Bool_t on=kTRUE)
Definition: TGo4Ratemeter.h:69
TGo4AnalysisObjectNames * CreateNamesList()
TMutex * fxAutoSaveMutex
void PrintConditions(const char *expression=0)
virtual void ResetCounts()
TGo4EventElement * GetOutputEvent()
TTree * CreateSingleEventTree(const char *name, Bool_t isoutput=kTRUE)
Bool_t fbMakeWithAutosave
TGo4EventElement * GetEventStructure(const char *name)
const char * GetEntryClass() const
Bool_t RemoveEventStructure(TGo4EventElement *ev)
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=0)
Bool_t AddHistogram(TH1 *his, const char *subfolder=0, Bool_t replace=kTRUE)
Bool_t RemoveEventStore(TGo4EventStore *store)
TGo4AnalysisStep * GetAnalysisStep(const char *name)
static const char * fgcTOPDYNAMICLIST
virtual void UserPostLoop()
void SetAdministratorPassword(const char *passwd)
Bool_t AddHistogram(TH1 *his, const char *subfolder=0, Bool_t replace=kTRUE)
Bool_t AddEventProcessor(TGo4EventProcessor *pro)
Long_t ExecutePython(const char *script_name, Int_t *errcode=0)
Bool_t AddEventSource(TGo4EventSource *source)
static const char fgcPYPROMPT
void SetNewInputFile(Bool_t on=kTRUE)
void ProcessCrtlCSignal()
virtual void Enable()
Bool_t AddAnalysisCondition(TGo4Condition *con, const char *subfolder=0)
Bool_t SetAnalysisCondition(const char *name, TGo4Condition *con, Bool_t counter=kTRUE)
TString fxAutoFileName
Bool_t ResetBackStores(Bool_t clearflag=kFALSE)
Bool_t SetStepStorage(const char *name, Bool_t on)
static const char * fgcDEFAULTFILENAME
const char * GetAutoFileName() const
TGo4Parameter * MakeParameter(const char *fullname, const char *classname, const char *cmd=0)
void PrintHistograms(const char *expression=0)
TGo4EventElement * GetEventStructure(const char *name)
static const char * fgcDEFAULTFILESUF
#define __GO4RELEASE__
Definition: TGo4Version.h:25
Bool_t RemoveEventSource(TGo4EventSource *source)
TH1 * GetHistogram(const char *name)
Int_t RunImplicitLoop(Int_t times, Bool_t showrate=kFALSE, Double_t process_event_interval=-1., Bool_t iswebserver=kFALSE)
TGo4EventElement * GetInputEvent(const char *stepname)
Int_t IsAutoSaveOverwrite() const
TCanvas * GetCanvas(const char *name)
TStopwatch * fxAutoSaveClock
void SetAutoSave(Bool_t on=kTRUE)
Bool_t AddObject(TNamed *anything, const char *subfolder=0, Bool_t replace=kTRUE)
Bool_t RemoveEventStore(TGo4EventStore *store)
#define TRUE
Definition: f_stccomm.h:356
void SendObjectToGUI(TObject *ob)
TString fServerObserverPass
static TGo4CommandInvoker * Instance()
Bool_t RemoveCanvas(const char *name)
Bool_t AddEventStructure(TGo4EventElement *ev)
Bool_t AddEventStore(TGo4EventStore *store)
void Message(Int_t prio, const char *text,...)
Bool_t AddEventSource(TGo4EventSource *source)
const char * GetSourceName() const
Bool_t AddPicture(TGo4Picture *pic, const char *subfolder=0)
void OpenAutoSaveFile(bool for_writing=false)
Bool_t AddParameter(TGo4Parameter *par, const char *subfolder=0)
Double_t GetRate() const
Definition: TGo4Ratemeter.h:50
TFolder * FindSubFolder(TFolder *parent, const char *subfolder, Bool_t create=kTRUE)
Bool_t AddAnalysisCondition(TGo4Condition *con, const char *subfolder=0)
Int_t StoreCondition(const char *name, TGo4Condition *con)
Bool_t AddEventProcessor(TGo4EventProcessor *pro)
Bool_t RemoveTree(TTree *tree, const char *stepname=0)
TGo4Parameter * GetParameter(const char *name, const char *parameter_class=0)
void SetCircle(Double_t cx, Double_t cy, Double_t r, Int_t npoints=0)
Bool_t ResetBackStores(Bool_t clearflag=kFALSE)
Int_t IsAutoSaveOn() const
Long_t ExecuteScript(const char *script_name)
void SetHistogram(const char *name)
void SendObject(TObject *obj, const char *receiver=0)
Definition: TGo4Slave.cxx:120
TTree * GetTree(const char *name)
Bool_t NewStepStore(const char *name, TGo4EventStoreParameter *par)
static Bool_t IsBatchMode()
Bool_t DeleteObjects(const char *name)
static Bool_t fbExists
Bool_t RemoveCanvas(const char *name)
Bool_t AddTree(TTree *tree, const char *subfolder=0)
Bool_t RemoveEventProcessor(TGo4EventProcessor *pro)
Bool_t AddAnalysisStep(TGo4AnalysisStep *next)
static const char * Message(Int_t prio, const char *text,...)
Definition: TGo4Log.cxx:209
TGo4EventElement * GetInputEvent(const char *stepname)
TString fAnalysisName
TGo4Parameter * GetParameter(const char *name, const char *parameter_class=0)
const char * GetEntryName() const
virtual Int_t UserPostLoop()
void StartObjectServer(const char *basename, const char *passwd)
TGo4AnalysisObjectNames * CreateNamesList()
TGo4EventElement * GetOutputEvent(const char *stepname)
TObject * NextMatchingObject(const char *expr, const char *folder, Bool_t reset)
Bool_t ClearObjects(const char *name)
TGo4Picture * GetPicture(const char *name)
TGo4Ratemeter * fxRate
#define __GO4BUILDVERSION__
Definition: TGo4Version.h:24
Int_t fiAutoSaveCompression
virtual void SetValues(Double_t low1, Double_t up1)
virtual const char * GetName() const
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=0)
const char * GetStatusMessage() const
static TGo4Version * Instance()
Definition: TGo4Version.cxx:22
static TGo4Analysis * fxInstance
Bool_t AddTree(TTree *tree, const char *subfolder=0)
TGo4AnalysisObjectManager * ObjectManager() const
Bool_t RemoveTree(TTree *tree, const char *stepname=0)
virtual void ProcessSnifferEvents()
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 ~TGo4Analysis()
Bool_t RemoveAnalysisCondition(const char *name)
TGo4AnalysisSniffer * fSniffer
TGo4ObjectStatus * CreateObjectStatus(const char *name, const char *folder=0)
static void Printf(Bool_t _stdout, const char *text)
Definition: TGo4Log.cxx:255
Bool_t Update(Int_t increment=1)
virtual Bool_t InitEventClasses()
virtual void Print(Option_t *opt="") const
Bool_t NewStepStore(const char *name, TGo4EventStoreParameter *par)
virtual Bool_t Notify()
virtual Int_t Handle()
TObject * NextMatchingObject(const char *expr=0, const char *folder=0, Bool_t reset=kFALSE)
#define GO4TRACE(X)
Definition: TGo4Log.h:26
static Int_t fiRunningMode
TGo4AnalysisStep * GetAnalysisStep(const char *name)
Bool_t RemoveObject(const char *name, Bool_t del=kTRUE)
static Int_t GetIgnoreLevel()
Definition: TGo4Log.cxx:328
Bool_t RemoveHistogram(const char *name, Bool_t del=kTRUE)
void PrintParameters(const char *expression=0)
void SetAutoSaveOverwrite(Bool_t over=kTRUE)
Bool_t IsAutoSaveFileName() const
TGo4ObjectStatus * CreateObjectStatus(const char *name, const char *folder=0)
Long_t ExecuteLine(const char *command, Int_t *errcode=0)
void SetAutoSaveFile(const char *filename=0, Bool_t overwrite=kFALSE, Int_t compression=5)
TGo4AnalysisStep * GetAnalysisStepNum(Int_t number)
Bool_t AddAnalysisStep(TGo4AnalysisStep *next)
Bool_t ProtectObjects(const char *name, const Option_t *flags)
static TString subGO4SYS(const char *subdir)
Definition: TGo4Log.cxx:192
Bool_t ProtectObjects(const char *name, const Option_t *flags)
Bool_t SetPicture(const char *name, TGo4Picture *pic)
Bool_t SaveStatus(const char *filename=0)
Bool_t AddTreeHistogram(const char *hisname, const char *treename, const char *varexp, const char *cutexp)
void SetConfigFileName(const char *name)
Bool_t SetPicture(const char *name, TGo4Picture *pic, TFolder *parent=0)
TGo4AnalysisStep * GetAnalysisStepNum(Int_t number)
TNamed * GetObject(const char *name, const char *folder=0)
Bool_t RemoveDynamicEntry(const char *entryname, const char *listname=0)
ULong64_t GetCurrentCount() const
Definition: TGo4Ratemeter.h:54
Bool_t RemoveParameter(const char *name)
void UpdateStatusBuffer()
Definition: TGo4Slave.cxx:157
Bool_t SetParameterStatus(const char *name, TGo4ParameterStatus *par, TFolder *parent=0)
Bool_t fbAutoSaveOverwrite
void SetAutoSaveInterval(Int_t i)
Bool_t AddDynamicHistogram(const char *name, const char *histo, const char *hevx, const char *hmemx, const char *hevy=0, const char *hmemy=0, const char *hevz=0, const char *hmemz=0, const char *condition=0, const char *cevx=0, const char *cmemx=0, const char *cevy=0, const char *cmemy=0)
TNamed * GetObject(const char *name, const char *folder=0)
Bool_t AddDynamicEntry(TGo4DynamicEntry *entry)
TGo4AnalysisStatus * CreateStatus()
void SetBox(Double_t cx, Double_t cy, Double_t a1, Double_t a2, Double_t theta=0)
Bool_t AddEventStructure(TGo4EventElement *ev)
static Bool_t Exists()
void UpdateRate(Int_t counts=1)
static const char * GO4SYS()
Definition: TGo4Log.cxx:158
Bool_t RemoveHistogram(const char *name, Bool_t del=kTRUE)
Bool_t LoadObjects(TFile *statusfile)
Int_t ProcessAnalysisSteps()
enum TGo4Analysis::@0 fxDoWorkingFlag
Bool_t AddEventStore(TGo4EventStore *store)
const char * GetSourceClass() const
static const Int_t fgiDYNLISTINTERVAL
static void SetRunningMode(int mode)
static TGo4Analysis * Instance()
TGo4EventElement * fxSampleEvent
static const Int_t fgiAUTOSAVECOUNTS
TTree * GetTree(const char *name)
Bool_t SetFirstStep(const char *name)
const char * GetMessage() const
const char * GetEventSourceName()
Int_t GetDynListInterval()
TGo4EventProcessor * GetEventProcessor() const
TGo4AnalysisWebStatus * CreateWebStatus()
TGo4PolyCond * MakePolyCond(const char *fullname, Int_t npoints, Double_t(*points)[2], const char *HistoName=0, Bool_t shapedcond=kFALSE)
static void Error(const char *text,...)
Definition: TGo4Log.cxx:309
Bool_t NewStepSource(const char *name, TGo4EventSourceParameter *par)
void PrintConditions(const char *expression=0)
void SetAutoSaveCompression(Int_t i=5)
TGo4TreeStructure * CreateTreeStructure(TTree *thetree)
static void Info(const char *text,...)
Definition: TGo4Log.cxx:283
TFolder * GetObjectFolder()
Bool_t SetLastStep(const char *name)
Int_t GetAutoSaveInterval() const
Bool_t RemovePicture(const char *name)
TCanvas * GetCanvas(const char *name)
Bool_t SetLastStep(const char *name)
void SetAutoSaveInterval(Int_t interval=0)
TGo4WinCond * MakeWinCond(const char *fullname, Double_t xmin, Double_t xmax, const char *HistoName=0)
static void Debug(const char *text,...)
Definition: TGo4Log.cxx:270
void SetStatus(TGo4AnalysisStatus *state)