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