GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TXXXAnlProc.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 "TXXXAnlProc.h"
15
16#include "TH1.h"
17
18#include "TGo4WinCond.h"
19#include "TGo4Analysis.h"
20
21#include "TXXXAnlEvent.h"
22#include "TXXXUnpackEvent.h"
23#include "TXXXParameter.h"
24
25//-----------------------------------------------------------
30
31//-----------------------------------------------------------
32TXXXAnlProc::TXXXAnlProc(const char *name) :
34{
35 TGo4Log::Info("TXXXAnlProc: Create");
37
38 // here already exisitng parameter will be returned
39 // one not need to specify macro here - it is already executed in first step
40 fParam = (TXXXParameter*) MakeParameter("XXXParameter", "TXXXParameter");
41
42 // this one is created in TXXXAnalysis, because it is used in both steps
43 fWinCon = (TGo4WinCond *) GetAnalysisCondition("wincon1", "TGo4WinCond");
44 if (fWinCon) fWinCon->PrintCondition(true);
45
46 if(fParam->fbHisto) {
47 fSum1 = MakeTH1('I', "Sum1", "Sum over 8 channels", 5000, 1., 5001.);
48 fSum2 = MakeTH1('I', "Sum2", "Sum over 8 channels shift 1", 5000, 1., 5001.);
49 fSum3 = MakeTH1('I', "Sum3", "Sum over 8 channels shift 2", 5000, 1., 5001.);
50 }
51}
52
53//-----------------------------------------------------------
55{
56 TGo4Log::Info("TXXXAnlProc: Delete");
57 if(fParam->fbHisto && fWinCon)
58 fWinCon->PrintCondition(true);
59}
60
61//-----------------------------------------------------------
63{
64 Bool_t isValid = kFALSE; // validity of output event
65
66 auto inp_evt = static_cast<TXXXUnpackEvent *>(GetInputEvent());
67 auto out_evt = static_cast<TXXXAnlEvent *>(dest);
68
69 // see comments in UnpackProc
70 if(!inp_evt || !inp_evt->IsValid()){ // input invalid
71 out_evt->SetValid(isValid); // invalid
72 return isValid; // must be same is for SetValid
73 }
74 isValid = kTRUE;
75
76 Int_t cnt = 0;
77 for (Int_t ii = 0; ii < XXX_NUM_CHAN / 2; ii++)
78 out_evt->frData[cnt++] = inp_evt->fiCrate1[ii];
79
80 for (Int_t ii = 0; ii < XXX_NUM_CHAN / 2; ii++)
81 out_evt->frData[cnt++] = inp_evt->fiCrate2[ii];
82
83 if (fParam->fbHisto) { // histogramming
84 for (Int_t ii = 0; ii < XXX_NUM_CHAN; ii++)
85 if (out_evt->frData[ii]) {
86 if (fWinCon && fWinCon->Test(out_evt->frData[ii]))
87 fSum1->Fill(out_evt->frData[ii]);
88 fSum2->Fill(out_evt->frData[ii] + fParam->frP1);
89 fSum3->Fill(out_evt->frData[ii] + fParam->frP2);
90 }
91 }
92
93 // see comments in UnpackProc
94 out_evt->SetValid(isValid);
95 return isValid;
96}
#define XXX_NUM_CHAN
TH1 * MakeTH1(char type, const char *fullname, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, const char *xtitle=nullptr, const char *ytitle=nullptr)
Create one dimensional histogram of specified type.
TGo4Parameter * MakeParameter(const char *fullname, const char *classname, const char *newcmd=nullptr)
Create parameter of specified class,.
TGo4EventProcessor(const char *name)
TGo4EventElement * GetInputEvent()
Access to external raw event which is set as association member.
friend class TGo4EventElement
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=nullptr)
Get condition from go4 framework.
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
Definition TGo4Log.cxx:294
Window condition.
Definition TGo4WinCond.h:26
Float_t frData[XXX_NUM_CHAN]
virtual ~TXXXAnlProc()
TGo4WinCond * fWinCon
Definition TXXXAnlProc.h:37
TXXXParameter * fParam
Definition TXXXAnlProc.h:36
Bool_t BuildEvent(TGo4EventElement *dest) override
Fill the destination event dest.