00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TYYYAnalysis.h"
00017
00018 #include <iostream.h>
00019
00020 #include "TCanvas.h"
00021
00022 #include "TYYYRawEvent.h"
00023
00024
00025
00026 TYYYAnalysis::TYYYAnalysis()
00027 : fUserFile(0),fRawEvent(0),fUnpackEvent(0)
00028 {
00029 cout << "Wrong constructor TYYYAnalysis()!" << endl;
00030 }
00031
00032
00033 TYYYAnalysis::TYYYAnalysis(Text_t * lmd, Text_t * out1, Text_t * out2)
00034 : fUserFile(0),
00035 fRawEvent(0),
00036 fUnpackEvent(0),
00037 fSize(0),
00038 fEvents(0),
00039 fLastEvent(0)
00040 {
00041
00042
00043
00044 cout << "**** TYYYAnalysis: Create" << endl;
00045
00046
00047
00048
00049 TYYYUnpackFact* factory1 = new TYYYUnpackFact("Unpack-factory");
00050 TGo4UserSourceParameter* source1 = new TGo4UserSourceParameter(lmd);
00051 TGo4FileStoreParameter* store1 = new TGo4FileStoreParameter(out1);
00052 TGo4AnalysisStep* step1 = new TGo4AnalysisStep("Unpack",factory1,source1,store1,0);
00053 store1->SetOverwriteMode(kTRUE);
00054 step1->SetSourceEnabled(kTRUE);
00055 step1->SetStoreEnabled(kFALSE);
00056 step1->SetProcessEnabled(kTRUE);
00057 step1->SetErrorStopEnabled(kTRUE);
00058 AddAnalysisStep(step1);
00059
00060
00061
00063
00064
00065
00066 fPar = new TYYYParameter("YYYPar1");
00067 fPar->frP1 = 100;
00068 fPar->frP2 = 200;
00069 AddParameter(fPar);
00070 TCanvas* mycan=new TCanvas("TestCanvas","Does this work?");
00071 mycan->Divide(2,2);
00072 AddCanvas(mycan);
00073
00074
00075 }
00076
00077
00078 TYYYAnalysis::~TYYYAnalysis()
00079 {
00080 cout << "**** TYYYAnalysis: Delete" << endl;
00081 }
00082
00083
00084
00085 Int_t TYYYAnalysis::UserPreLoop()
00086 {
00087 cout << "**** TYYYAnalysis: PreLoop" << endl;
00088
00089 fRawEvent = dynamic_cast<TYYYRawEvent*> (GetInputEvent("Unpack"));
00090 fUnpackEvent = dynamic_cast<TYYYUnpackEvent*> (GetOutputEvent("Unpack"));
00091 fEvents=0;
00092 fLastEvent=0;
00093
00094
00095
00096 fSize=(TH1D*)GetHistogram("Eventsize");
00097 if(fSize==0)
00098 {
00099 fSize = new TH1D ("Eventsize", "Read columns",160,1,160);
00100 AddHistogram(fSize);
00101 }
00102 ClearObjects("Histograms");
00103
00104 return 0;
00105 }
00106
00107 Int_t TYYYAnalysis::UserPostLoop()
00108 {
00109 cout << "**** TYYYAnalysis: PostLoop" << endl;
00110 cout << " Total events: " << fEvents << endl;
00111 TCanvas* can=GetCanvas("TestCanvas");
00112 TH1* hx=GetHistogram("Xfinal");
00113 TH1* hy=GetHistogram("Yfinal");
00114 TH1* hvx=GetHistogram("Vxfinal");
00115 TH1* hvy=GetHistogram("Vyfinal");
00116 if(can)
00117 {
00118 can->cd(1);
00119 if(hx) hx->Draw();
00120 can->cd(2);
00121 if(hy) hy->Draw();
00122 can->cd(3);
00123 if(hvx) hvx->Draw();
00124 can->cd(4);
00125 if(hvy) hvy->Draw();
00126 }
00127
00128
00129 fUnpackEvent = 0;
00130 fRawEvent = 0;
00131 fEvents=0;
00132 return 0;
00133 }
00134
00135
00136 Int_t TYYYAnalysis::UserEventFunc()
00137 {
00139 Int_t value=0;
00140 if(fRawEvent) value = fRawEvent->GetColumns();
00141 fSize->Fill(value);
00142 fEvents++;
00143 return 0;
00144 }
00145
00146
00147 ClassImp(TYYYAnalysis)
00148
00149
00150
00151
00152