Go to the documentation of this file.00001 #include "TFaspAnalysis.h"
00002
00003 #include <stdlib.h>
00004
00005 #include "TCanvas.h"
00006 #include "TH1.h"
00007 #include "TFile.h"
00008
00009 #include "Go4EventServer.h"
00010 #include "TGo4AnalysisStep.h"
00011 #include "TGo4Version.h"
00012 #include "TGo4Log.h"
00013
00014 #include "TFaspEvent.h"
00015 #include "TFaspProc.h"
00016 #include "TGo4StepFactory.h"
00017 #include "TGo4MbsEvent.h"
00018
00019 TFaspAnalysis::TFaspAnalysis() :
00020 TGo4Analysis(),
00021 fRawEvent(0),
00022 fUnpackEvent(0),
00023 fEvents(0)
00024 {
00025 TGo4Log::Error("Wrong constructor TFaspAnalysis()!");
00026 }
00027
00029 TFaspAnalysis::TFaspAnalysis(int argc, char** argv) :
00030 TGo4Analysis(argc, argv),
00031 fRawEvent(0),
00032 fUnpackEvent(0),
00033 fEvents(0)
00034 {
00035 if (!TGo4Version::CheckVersion(__GO4BUILDVERSION__)) {
00036 TGo4Log::Error("Go4 version mismatch");
00037 exit(-1);
00038 }
00039
00040 TGo4Log::Info("TFaspAnalysis: Create");
00041
00045
00046 TGo4StepFactory* factory1 = new TGo4StepFactory ("Unpack-factory");
00047
00048 factory1->DefUserEventSource ("TFaspSource");
00049 factory1->DefInputEvent ("RawEvent","TGo4MbsEvent");
00050 factory1->DefEventProcessor ("UnpackProc", "TFaspProc");
00051 factory1->DefOutputEvent ("UnpackEvent", "TFaspEvent");
00052
00053 TGo4UserSourceParameter* source1 = new TGo4UserSourceParameter ("test1.dat");
00054 TGo4FileStoreParameter* store1 = new TGo4FileStoreParameter (Form("%sOutput", argv[0]));
00055 store1->SetOverwriteMode (kTRUE);
00056 TGo4AnalysisStep* step1 = new TGo4AnalysisStep ("Unpack",factory1,source1,store1,0);
00057
00058 step1->SetSourceEnabled (kTRUE);
00059 step1->SetStoreEnabled (kFALSE);
00060 step1->SetProcessEnabled (kTRUE);
00061 step1->SetErrorStopEnabled (kTRUE);
00062
00063 AddAnalysisStep(step1);
00064 }
00065
00066 TFaspAnalysis::~TFaspAnalysis()
00067 {
00068 TGo4Log::Info("TFaspAnalysis: Delete");
00069 }
00070
00071 Int_t TFaspAnalysis::UserPreLoop()
00072 {
00073 TGo4Log::Info("TFaspAnalysis: PreLoop");
00074
00076 fRawEvent = dynamic_cast<TGo4MbsEvent*> (GetInputEvent("Unpack"));
00077 fUnpackEvent = dynamic_cast<TFaspEvent*> (GetOutputEvent("Unpack"));
00078 fEvents = 0;
00079
00080 return 0;
00081 }
00082
00083 Int_t TFaspAnalysis::UserPostLoop()
00084 {
00085 TGo4Log::Info("TFaspAnalysis: PostLoop total events: %d", fEvents);
00086 return 0;
00087 }
00088
00089 Int_t TFaspAnalysis::UserEventFunc()
00090 {
00092 fEvents++;
00093 return 0;
00094 }