GSI Object Oriented Online Offline (Go4) GO4-6.4.5
Loading...
Searching...
No Matches
TXXXAnalysis.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 "TXXXAnalysis.h"
15
16#include "TGo4Version.h"
17#include "TGo4Log.h"
18#include "TGo4StepFactory.h"
19#include "TGo4AnalysisStep.h"
20
21#include "TXXXControl.h"
22
23//***********************************************************
27
28//***********************************************************
29// this constructor is called by go4analysis executable
30TXXXAnalysis::TXXXAnalysis(int argc, char **argv) :
31 TGo4Analysis(argc, argv)
32{
34 TGo4Log::Error("Go4 version mismatch");
35 exit(-1);
36 }
37
38 TGo4Log::Info("Create TXXXAnalysis name: %s", argv[0]);
39
40 TGo4StepFactory* factory = new TGo4StepFactory("Factory");
41 factory->DefEventProcessor("XXXProc","TXXXProc");// object name, class name
42 factory->DefOutputEvent("XXXEvent","TXXXEvent"); // object name, class name
43
44 // TGo4EventSourceParameter *sourcepar = new TGo4MbsTransportParameter("r3b");
46
47 TString parname = TString::Format("%sOutput", argv[0]);
48 TGo4FileStoreParameter* storepar = new TGo4FileStoreParameter(parname.Data());
49 storepar->SetOverwriteMode(kTRUE);
50
51 TGo4AnalysisStep *step = new TGo4AnalysisStep("Analysis", factory, sourcepar, storepar);
52
53 step->SetSourceEnabled(kTRUE);
54 step->SetStoreEnabled(kFALSE);
55 step->SetProcessEnabled(kTRUE);
56 step->SetErrorStopEnabled(kTRUE);
57
58 // Now the first analysis step is set up.
59 // Other steps could be created here
60 AddAnalysisStep(step);
61
62 // uncomment following line to define custom passwords for analysis server
63 // DefineServerPasswords("XXXadmin", "XXXctrl", "XXXview");
64
66 // At this point, autosave file has not yet been read!
67 // Therefore parameter values set here will be overwritten
68 // if an autosave file is there.
69 fCtl = new TXXXControl("Control");
71}
72
73//***********************************************************
75{
76 TGo4Log::Info("TXXXAnalysis: Delete instance");
77}
78
79//-----------------------------------------------------------
81{
82 // all this is optional:
83 TGo4Log::Info("TXXXAnalysis: PreLoop");
84 // get pointer to input event (used in postloop and event function):
85 fMbsEvent = dynamic_cast<TGo4MbsEvent *>(GetInputEvent("Analysis")); // of step "Analysis"
86 if(fMbsEvent) fMbsEvent->PrintMbsFileHeader();
87 // fileheader structure (lmd file only):
88
89 fEvents = 0; // event counter
90 fLastEvent = 0; // number of last event processed
91 return 0;
92}
93//-----------------------------------------------------------
95{
96 // all this is optional:
97 TGo4Log::Info("TXXXAnalysis: PostLoop");
98 TGo4Log::Info("Last event #: %d Total events: %d", fLastEvent, fEvents);
99 fMbsEvent = nullptr; // reset to avoid invalid pointer if analysis is changed in between
100 fEvents = 0;
101 return 0;
102}
103
104//-----------------------------------------------------------
106{
107 // all this is optional:
108 // This function is called once for each event after all steps.
109 if(fMbsEvent) {
110 fEvents++;
111 fLastEvent = fMbsEvent->GetCount();
112 }
113 if((fEvents == 1) || IsNewInputFile()) {
114 TGo4Log::Info("First event #: %d", fLastEvent);
115 }
116 return 0;
117}
#define __GO4BUILDVERSION__
Definition TGo4Version.h:24
void SetErrorStopEnabled(Bool_t on)
Enables or disables the stop-on-error mode.
void SetProcessEnabled(Bool_t on=kTRUE)
Enables or disables the event processing.
void SetStoreEnabled(Bool_t on=kTRUE)
Enables or disables the event store.
void SetSourceEnabled(Bool_t on=kTRUE)
Enables or disables the event source.
TGo4EventElement * GetInputEvent(const char *stepname) const
Returns the input event structure of analysis step.
TGo4Analysis(const char *name=nullptr)
Protected constructor for singleton instance.
friend class TGo4AnalysisStep
Bool_t AddParameter(TGo4Parameter *par, const char *subfolder=nullptr)
Puts a new parameter object in corresponding folder.
const char * GetDefaultTestFileName() const
Returns default lmd test file name (in GO4SYS installation directory).
Bool_t AddAnalysisStep(TGo4AnalysisStep *next)
Method for user analysis constructor to setup the list of analysis steps.
Bool_t IsNewInputFile() const
True if input filelist has changed to a new lmd file.
Basic type for all classes containing information to parameterize the event source.
void SetOverwriteMode(Bool_t over=kTRUE)
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
Definition TGo4Log.cxx:302
static void Error(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 3.
Definition TGo4Log.cxx:328
Wrapper for the standard gsi event structure as delivered from mbs.
MBS file parameter.
Ready to use step factory.
void DefEventProcessor(const char *Pname, const char *Pclass)
Configure name and class name for event processor.
void DefOutputEvent(const char *Oname, const char *Oclass)
Configure name and class name for output event.
static Bool_t CheckVersion(Int_t version)
Returns true if Version number matches the argument of the Method.
TGo4MbsEvent * fMbsEvent
Int_t UserPostLoop() override
User defined function called once after processing the main event loop.
TXXXControl * fCtl
Int_t UserPreLoop() override
User defined function called once before processing the main event loop.
virtual ~TXXXAnalysis()
Int_t UserEventFunc() override
User defined function which processes the actual analysis.