GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TXXXAnlProc.cxx
Go to the documentation of this file.
1 // $Id: TXXXAnlProc.cxx 2771 2020-04-16 15:24:45Z linev $
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  fSum1(0), fSum2(0), fSum3(0),
29  fParam(0), fWinCon(0)
30 {
31 }
32 
33 //-----------------------------------------------------------
34 TXXXAnlProc::TXXXAnlProc(const char* name) :
35  TGo4EventProcessor(name),
36  fSum1(0), fSum2(0), fSum3(0),
37  fParam(0), fWinCon(0)
38 {
39  TGo4Log::Info("TXXXAnlProc: Create");
41 
42  // here already exisitng parameter will be returned
43  // one not need to specify macro here - it is already executed in first step
44  fParam = (TXXXParameter*) MakeParameter("XXXParameter", "TXXXParameter");
45 
46  // this one is created in TXXXAnalysis, because it is used in both steps
47  fWinCon = (TGo4WinCond *) GetAnalysisCondition("wincon1", "TGo4WinCond");
48  if (fWinCon) fWinCon->PrintCondition(true);
49 
50  if(fParam->fbHisto) {
51  fSum1 = MakeTH1('I', "Sum1", "Sum over 8 channels", 5000, 1., 5001.);
52  fSum2 = MakeTH1('I', "Sum2", "Sum over 8 channels shift 1", 5000, 1., 5001.);
53  fSum3 = MakeTH1('I', "Sum3", "Sum over 8 channels shift 2", 5000, 1., 5001.);
54  }
55 }
56 //-----------------------------------------------------------
58 {
59  TGo4Log::Info("TXXXAnlProc: Delete");
60  if(fParam->fbHisto){
61  if (fWinCon) fWinCon->PrintCondition(true);
62  }
63 }
64 //-----------------------------------------------------------
66 {
67  Bool_t isValid=kFALSE; // validity of output event
68 
70  TXXXAnlEvent* out_evt = (TXXXAnlEvent*) dest;
71 
72  // see comments in UnpackProc
73  if((inp_evt==0) || !inp_evt->IsValid()){ // input invalid
74  out_evt->SetValid(isValid); // invalid
75  return isValid; // must be same is for SetValid
76  }
77  isValid=kTRUE;
78 
79  Int_t cnt(0);
80  for(Int_t ii=0;ii<XXX_NUM_CHAN/2;ii++)
81  out_evt->frData[cnt++] = inp_evt->fiCrate1[ii];
82 
83  for(Int_t ii=0; ii<XXX_NUM_CHAN/2; ii++)
84  out_evt->frData[cnt++] = inp_evt->fiCrate2[ii];
85 
86  if(fParam->fbHisto) { // histogramming
87  for(Int_t ii=0;ii<XXX_NUM_CHAN;ii++)
88  if(out_evt->frData[ii]) {
89  if(fWinCon && fWinCon->Test(out_evt->frData[ii])) fSum1->Fill(out_evt->frData[ii]);
90  fSum2->Fill(out_evt->frData[ii] + fParam->frP1);
91  fSum3->Fill(out_evt->frData[ii] + fParam->frP2);
92  }
93  }
94 
95  // see comments in UnpackProc
96  out_evt->SetValid(isValid);
97  return isValid;
98 }
TGo4Parameter * MakeParameter(const char *fullname, const char *classname, const char *newcmd=0)
virtual Bool_t BuildEvent(TGo4EventElement *dest)
Definition: TXXXAnlProc.cxx:65
Int_t fiCrate1[XXX_NUM_CHAN]
virtual ~TXXXAnlProc()
Definition: TXXXAnlProc.cxx:57
void SetValid(Bool_t on)
virtual void PrintCondition(Bool_t full=kTRUE)
Bool_t IsValid() const
TH1 * fSum3
Definition: TXXXAnlProc.h:34
TGo4Condition * GetAnalysisCondition(const char *name, const char *cond_cl=0)
Int_t fiCrate2[XXX_NUM_CHAN]
TH1 * fSum2
Definition: TXXXAnlProc.h:33
TH1 * fSum1
Definition: TXXXAnlProc.h:32
TGo4EventElement * GetInputEvent()
virtual Bool_t Test(Double_t v1)
Definition: TGo4WinCond.cxx:86
TXXXParameter * fParam
Definition: TXXXAnlProc.h:36
TH1 * MakeTH1(char type, const char *fullname, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, const char *xtitle=0, const char *ytitle=0)
TGo4WinCond * fWinCon
Definition: TXXXAnlProc.h:37
#define XXX_NUM_CHAN
Float_t frData[XXX_NUM_CHAN]
Definition: TXXXAnlEvent.h:28
static void Info(const char *text,...)
Definition: TGo4Log.cxx:287