00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TXXXAnlProc.h"
00017
00018 #include <iostream.h>
00019
00020 #include "TXXXAnlEvent.h"
00021 #include "Go4Analysis/TGo4Analysis.h"
00022
00023
00024
00025 TXXXAnlProc::TXXXAnlProc(Text_t * name)
00026 :TGo4EventProcessor(name)
00027 {
00028 cout << "**** TXXXAnlProc: Create" << endl;
00030 fParam1 = (TXXXParameter*) GetParameter("XXXPar1");
00031 fParam2 = (TXXXParameter*) GetParameter("XXXPar2");
00032 fWinCon = (TGo4WinCond *) GetAnalysisCondition("wincon1");
00033
00034
00035 if(GetHistogram("Sum1")==0)
00036 {
00037 fSum1 = new TH1I ("Sum1", "Sum over 8 channels",5000,1,5001);
00038 fSum2 = new TH1I ("Sum2", "Sum over 8 channels shift 1",5000,1,5001);
00039 fSum3 = new TH1I ("Sum3", "Sum over 8 channels shift 2",5000,1,5001);
00040 fCaliSum1= new TH1I ("Sum1Calib", "Sum over 8 channels(keV)",5000,1,20);
00041 AddHistogram(fSum1);
00042 AddHistogram(fSum2);
00043 AddHistogram(fSum3);
00044 AddHistogram(fCaliSum1);
00045 fCaligraph=new TGraph;
00046 fCaligraph->SetName("Calibration");
00047 fCaligraph->SetMarkerStyle(3);
00048 AddObject(fCaligraph);
00049
00050 fxGraph1=new TGraph;
00051 fxGraph1->SetName("Testgraph1");
00052 fxGraph1->SetMarkerStyle(5);
00053
00054 for(Int_t i=0;i<50;++i)
00055 {
00056 fxGraph1->SetPoint(i,i,30*sin((Double_t)(i)/10));
00057 }
00058 fxGraph2=new TGraph;
00059 fxGraph2->SetName("Testgraph2");
00060 fxGraph2->SetMarkerStyle(4);
00061
00062 for(Int_t i=0;i<50;++i)
00063 {
00064 fxGraph2->SetPoint(i,i,30*cos((Double_t)(i)/10));
00065 }
00066 fxMultiGraph=new TMultiGraph("MultiTest","This is a test multigraph");
00067 fxMultiGraph->Add(fxGraph1);
00068 fxMultiGraph->Add(fxGraph2);
00069 AddObject(fxMultiGraph);
00070
00071
00072 }
00073 else
00074 {
00075 fSum1 =(TH1I*)GetHistogram("Sum1");
00076 fSum2 =(TH1I*)GetHistogram("Sum2");
00077 fSum3 =(TH1I*)GetHistogram("Sum3");
00078 fCaliSum1=(TH1I*)GetHistogram("Sum1Calib");
00079 fCaligraph= (TGraph*)GetObject("Calibration");
00080 cout << "AnlProc: Restored histograms from autosave" << endl;
00081 }
00082 if(GetParameter("CaliPar")==0)
00083 {
00084
00085 fCalipar=new TXXXCalibPar("CaliPar",GetHistogram("Cr1Ch01"),fCaligraph);
00086 AddParameter(fCalipar);
00087 }
00088 else
00089 {
00090
00091 fCalipar= (TXXXCalibPar*) GetParameter("CaliPar");
00092 }
00093 }
00094
00095 TXXXAnlProc::TXXXAnlProc()
00096 : TGo4EventProcessor("XXXAnlProc"),fSum1(0),fSum2(0),fSum3(0),
00097 fInput(0),fParam1(0),fParam2(0),fWinCon(0)
00098 {
00099 }
00100
00101 TXXXAnlProc::~TXXXAnlProc()
00102 {
00103 }
00104
00105
00106
00107 void TXXXAnlProc::XXXEventAnalysis(TXXXAnlEvent* poutevt)
00108 {
00109 Int_t ii,i;
00110 fInput = (TXXXUnpackEvent*) GetInputEvent();
00111
00112 poutevt->SetValid(kTRUE);
00113 i=0;
00114 for(ii=0;ii<4;ii++)
00115 {
00116 poutevt->frData[i]=(Float_t)fInput->fiCrate1[ii];
00117 if(fInput->fiCrate1[ii]) fCaliSum1->Fill(fCalipar->Energy(fInput->fiCrate1[ii]));
00118 i++;
00119 }
00120 for(ii=0;ii<4;ii++)
00121 {
00122 poutevt->frData[i]=(Float_t)fInput->fiCrate2[ii];
00123 if(fInput->fiCrate2[ii]) fCaliSum1->Fill(fCalipar->Energy(fInput->fiCrate2[ii]));
00124 i++;
00125 }
00126 for(ii=0;ii<8;ii++)
00127 {
00128 if(poutevt->frData[ii])
00129 {
00130 if(fWinCon->Test(poutevt->frData[ii])) fSum1->Fill(poutevt->frData[ii]);
00131 fSum2->Fill(poutevt->frData[ii]+fParam1->frP1);
00132 fSum3->Fill(poutevt->frData[ii]+fParam2->frP1);
00133 }
00134 }
00135
00136 }
00137
00138
00139 ClassImp(TXXXAnlProc)
00140
00141
00142
00143
00144