GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4AnalysisStatus.cxx
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#include "TGo4AnalysisStatus.h"
15
16#include "TMutex.h"
17#include "TObjArray.h"
18
19#include "TGo4LockGuard.h"
21#include "TROOT.h"
22
23
25 TGo4Status("Go4 Default Analysis Status","Go4 Analysis Status Object")
26{
27}
28
29
31 TGo4Status(name,"Go4 Analysis Status Object")
32{
33 fxStepArray = new TObjArray;
34 fxStepIterator = fxStepArray->MakeIterator();
35 fxStepMutex = new TMutex;
36}
37
39{
40 delete fxStepMutex; fxStepMutex = nullptr;
41 delete fxStepIterator; fxStepIterator = nullptr;
42 if (fxStepArray) fxStepArray->Delete();
43 delete fxStepArray; fxStepArray = nullptr;
44}
45
46void TGo4AnalysisStatus::Print(Option_t *) const
47{
48 PrintLine("----------------------------------------------");
49 PrintLine("++++++ Status of %s ++++++", GetName());
50 PrintLine("First Analysis Step index: \t%d", GetFirstStepIndex());
51 PrintLine("Last Analysis Step index: \t%d", GetLastStepIndex());
52 PrintLine("Autosave Interval: \t\t%d s", GetAutoSaveInterval());
53 PrintLine("Autosave File: \t\t%s", GetAutoFileName());
54 PrintLine("Autosave File compression: \t%d", GetAutoSaveCompression());
55 PrintLine("Autosave overwrite mode: \t%d", IsAutoSaveOverwrite());
56 PrintLine("Autosave enabled: \t\t%d",IsAutoSaveOn());
57 PrintLine("----------------------------------------------");
58 TROOT::IncreaseDirLevel();
59
60 Int_t num = GetNumberOfSteps();
61 for (int indx = 0; indx < num; ++indx) {
62 auto step = GetStepStatus(indx);
63 if (step) step->Print();
64 }
65
66 TROOT::DecreaseDirLevel();
67 PrintLine("----------------------------------------------");
68}
69
71{
72 if(!fxStepArray) return nullptr;
73
74 TGo4LockGuard listguard(fxStepMutex);
75 return dynamic_cast<TGo4AnalysisStepStatus*>( fxStepArray->FindObject(name) );
76}
77
79{
80 if(!fxStepIterator) return nullptr;
81 TGo4LockGuard listguard(fxStepMutex);
82 return dynamic_cast<TGo4AnalysisStepStatus*>( fxStepIterator->Next() );
83}
84
86{
87 TGo4LockGuard listguard(fxStepMutex);
88 delete fxStepIterator;
89 if(fxStepArray)
90 fxStepIterator = fxStepArray->MakeIterator();
91 else
92 fxStepIterator = nullptr;
93}
94
95
97{
98 if(!fxStepArray) return kFALSE;
99 if(next) {
100 TGo4LockGuard listguard(fxStepMutex);
101 fxStepArray->AddLast(next);
102 return kTRUE;
103 }
104 return kFALSE;
105}
106
108{
109 TGo4LockGuard listguard(fxStepMutex);
110 fxStepArray->Delete();
111}
112
113
115{
116 return !fxStepArray ? 0 : fxStepArray->GetLast()+1;
117}
118
119
121{
122 if ((indx < 0) || (indx >= GetNumberOfSteps())) return nullptr;
123 return dynamic_cast<TGo4AnalysisStepStatus*> (fxStepArray->At(indx));
124}
#define TGo4LockGuard
TGo4AnalysisStatus()
default ctor for streamer.
const char * GetAutoFileName() const
Int_t IsAutoSaveOverwrite() const
TObjArray * fxStepArray
Array containing all analysis steps.
TMutex * fxStepMutex
Mutex protecting the analysis step list.
Int_t GetFirstStepIndex() const
Int_t IsAutoSaveOn() const
void Print(Option_t *opt="") const override
basic method to printout status information on stdout; to be overridden by specific subclass
Bool_t AddStepStatus(TGo4AnalysisStepStatus *next)
Add new step status object to analysis status.
Int_t GetAutoSaveCompression() const
Int_t GetLastStepIndex() const
void ClearStepStatus()
Clear all existing step status objects.
Int_t GetNumberOfSteps() const
Gives number of steps.
TIterator * fxStepIterator
Iterator used for analysis step list.
TGo4AnalysisStepStatus * NextStepStatus()
Gives next analysis step status.
TGo4AnalysisStepStatus * GetStepStatus(const char *name)
Access to certain analysis step status by name.
Int_t GetAutoSaveInterval() const
Status object of one analysis step.
static void PrintLine(const char *text,...)
Print single line of debug output with appropriate indent.