GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
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 //-----------------------------------------------------------
28 {
29 }
30 
31 //-----------------------------------------------------------
32 TXXXAnlProc::TXXXAnlProc(const char *name) :
33  TGo4EventProcessor(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 
67  TXXXAnlEvent* out_evt = (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 }
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)
Int_t fiCrate1[XXX_NUM_CHAN]
virtual ~TXXXAnlProc()
Definition: TXXXAnlProc.cxx:54
void SetValid(Bool_t on)
static void Info(const char *text,...) GO4_PRINTF_ARGS
Definition: TGo4Log.cxx:294
TH1 * fSum3
Definition: TXXXAnlProc.h:34
Int_t fiCrate2[XXX_NUM_CHAN]
Bool_t IsValid() const
TH1 * fSum2
Definition: TXXXAnlProc.h:33
TGo4Parameter * MakeParameter(const char *fullname, const char *classname, const char *newcmd=nullptr)
TH1 * fSum1
Definition: TXXXAnlProc.h:32
void PrintCondition(Bool_t full=kTRUE) override
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=nullptr)
TGo4EventElement * GetInputEvent()
Bool_t BuildEvent(TGo4EventElement *dest) override
Definition: TXXXAnlProc.cxx:62
TXXXParameter * fParam
Definition: TXXXAnlProc.h:36
TGo4WinCond * fWinCon
Definition: TXXXAnlProc.h:37
Bool_t Test(Double_t v1) override
Definition: TGo4WinCond.cxx:86
#define XXX_NUM_CHAN
Float_t frData[XXX_NUM_CHAN]
Definition: TXXXAnlEvent.h:28