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//***********************************************************
26{
27}
28
29//***********************************************************
30// this constructor is called by go4analysis executable
31TXXXAnalysis::TXXXAnalysis(int argc, char **argv) :
32 TGo4Analysis(argc, argv)
33{
35 TGo4Log::Error("Go4 version mismatch");
36 exit(-1);
37 }
38
39 TGo4Log::Info("Create TXXXAnalysis name: %s", argv[0]);
40
41 TGo4StepFactory* factory = new TGo4StepFactory("Factory");
42 factory->DefEventProcessor("XXXProc","TXXXProc");// object name, class name
43 factory->DefOutputEvent("XXXEvent","TXXXEvent"); // object name, class name
44 factory->DefUserEventStore("TXXXStore"); // class name
45
46 // TGo4EventSourceParameter *sourcepar = new TGo4MbsTransportParameter("r3b");
47 TGo4EventSourceParameter *sourcepar = new TGo4MbsFileParameter(GetDefaultTestFileName());
48
49 TString parname = TString::Format("%sOutput", argv[0]);
50 TGo4UserStoreParameter* storepar = new TGo4UserStoreParameter(parname.Data());
51
52 TGo4AnalysisStep *step = new TGo4AnalysisStep("Analysis", factory, sourcepar, storepar);
53
54 step->SetSourceEnabled(kTRUE);
55 step->SetStoreEnabled(kTRUE);
56 step->SetProcessEnabled(kTRUE);
57 step->SetErrorStopEnabled(kTRUE);
58
59 // Now the first analysis step is set up.
60 // Other steps could be created here
61 AddAnalysisStep(step);
62
63 // uncomment following line to define custom passwords for analysis server
64 // DefineServerPasswords("XXXadmin", "XXXctrl", "XXXview");
65
67 // At this point, autosave file has not yet been read!
68 // Therefore parameter values set here will be overwritten
69 // if an autosave file is there.
70 fCtl = new TXXXControl("Control");
71 AddParameter(fCtl);
72}
73
74//***********************************************************
76{
77 TGo4Log::Info("TXXXAnalysis: Delete instance");
78}
79
80//-----------------------------------------------------------
82{
83 // all this is optional:
84 TGo4Log::Info("TXXXAnalysis: PreLoop");
85 // get pointer to input event (used in postloop and event function):
86 fMbsEvent = dynamic_cast<TGo4MbsEvent *>(GetInputEvent("Analysis")); // of step "Analysis"
87 if(fMbsEvent) fMbsEvent->PrintMbsFileHeader();
88 // fileheader structure (lmd file only):
89
90 fEvents = 0; // event counter
91 fLastEvent = 0; // number of last event processed
92 return 0;
93}
94//-----------------------------------------------------------
96{
97 // all this is optional:
98 TGo4Log::Info("TXXXAnalysis: PostLoop");
99 TGo4Log::Info("Last event #: %d Total events: %d", fLastEvent, fEvents);
100 fMbsEvent = nullptr; // reset to avoid invalid pointer if analysis is changed in between
101 fEvents = 0;
102 return 0;
103}
104
105//-----------------------------------------------------------
107{
108 // all this is optional:
109 // This function is called once for each event after all steps.
110 if(fMbsEvent) {
111 fEvents++;
112 fLastEvent = fMbsEvent->GetCount();
113 }
114 if((fEvents == 1) || IsNewInputFile()) {
115 TGo4Log::Info("First event #: %d", fLastEvent);
116 }
117 return 0;
118}
#define __GO4BUILDVERSION__
Definition TGo4Version.h:24
Contains a single step of the analysis.
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.
The mother of all go4 analysis.
TGo4EventElement * GetInputEvent(const char *stepname) const
Returns the input event structure of analysis step.
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.
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
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 DefUserEventStore(const char *Sclass)
Configure class name for event store.
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.
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.