GSI Object Oriented Online Offline (Go4) GO4-6.4.0
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// Text_t lmdfile[512]; // source file
45// sprintf(lmdfile,"%s/data/test.lmd",getenv("GO4SYS"));
46 // TGo4EventSourceParameter *sourcepar = new TGo4MbsTransportParameter("r3b");
48
49 TString parname = TString::Format("%sOutput", argv[0]);
50 TGo4FileStoreParameter* storepar = new TGo4FileStoreParameter(parname.Data());
51 storepar->SetOverwriteMode(kTRUE);
52
53 TGo4AnalysisStep *step = new TGo4AnalysisStep("Analysis", factory, sourcepar, storepar);
54
55 step->SetSourceEnabled(kTRUE);
56 step->SetStoreEnabled(kFALSE);
57 step->SetProcessEnabled(kTRUE);
58 step->SetErrorStopEnabled(kTRUE);
59
60 // Now the first analysis step is set up.
61 // Other steps could be created here
62 AddAnalysisStep(step);
63
64 // uncomment following line to define custom passwords for analysis server
65 // DefineServerPasswords("XXXadmin", "XXXctrl", "XXXview");
66
68 // At this point, autosave file has not yet been read!
69 // Therefore parameter values set here will be overwritten
70 // if an autosave file is there.
71 fCtl = new TXXXControl("Control");
73}
74
75//***********************************************************
77{
78 TGo4Log::Info("TXXXAnalysis: Delete instance");
79}
80
81//-----------------------------------------------------------
83{
84 // all this is optional:
85 TGo4Log::Info("TXXXAnalysis: PreLoop");
86 // get pointer to input event (used in postloop and event function):
87 fMbsEvent = dynamic_cast<TGo4MbsEvent *>(GetInputEvent("Analysis")); // of step "Analysis"
88 if(fMbsEvent) fMbsEvent->PrintMbsFileHeader();
89 // fileheader structure (lmd file only):
90
91 fEvents = 0; // event counter
92 fLastEvent = 0; // number of last event processed
93 return 0;
94}
95//-----------------------------------------------------------
97{
98 // all this is optional:
99 TGo4Log::Info("TXXXAnalysis: PostLoop");
100 TGo4Log::Info("Last event #: %d Total events: %d", fLastEvent, fEvents);
101 fMbsEvent = nullptr; // reset to avoid invalid pointer if analysis is changed in between
102 fEvents = 0;
103 return 0;
104}
105
106//-----------------------------------------------------------
108{
109 // all this is optional:
110 // This function is called once for each event after all steps.
111 if(fMbsEvent) {
112 fEvents++;
113 fLastEvent = fMbsEvent->GetCount();
114 }
115 if((fEvents == 1) || IsNewInputFile()) {
116 TGo4Log::Info("First event #: %d", fLastEvent);
117 }
118 return 0;
119}
#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:294
static void Error(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 3.
Definition TGo4Log.cxx:320
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.