GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TXXXAnlProc.cxx
Go to the documentation of this file.
1 // $Id: TXXXAnlProc.cxx 933 2013-01-29 15:27:58Z 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 für 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 <math.h>
17 
18 #include "TH1.h"
19 #include "TH2.h"
20 #include "TROOT.h"
21 
22 #include "TGo4WinCond.h"
23 #include "TGo4Analysis.h"
24 
25 #include "TXXXAnlEvent.h"
26 #include "TXXXUnpackEvent.h"
27 #include "TXXXParameter.h"
28 
29 //-----------------------------------------------------------
32  fSum1(0), fSum2(0), fSum3(0),
33  fParam(0), fWinCon(0)
34 {
35 }
36 
37 //-----------------------------------------------------------
38 TXXXAnlProc::TXXXAnlProc(const char* name) :
39  TGo4EventProcessor(name),
40  fSum1(0), fSum2(0), fSum3(0),
41  fParam(0), fWinCon(0)
42 {
43  TGo4Log::Info("TXXXAnlProc: Create");
45 
46  // here already exisitng parameter will be returned
47  // one not need to specify macro here - it is already executed in first step
48  fParam = (TXXXParameter*) MakeParameter("XXXParameter", "TXXXParameter");
49 
50  // this one is created in TXXXAnalysis, because it is used in both steps
51  fWinCon = (TGo4WinCond *) GetAnalysisCondition("wincon1", "TGo4WinCond");
52  if (fWinCon) fWinCon->PrintCondition(true);
53 
54  if(fParam->fbHisto) {
55  fSum1 = MakeTH1('I', "Sum1", "Sum over 8 channels", 5000, 1., 5001.);
56  fSum2 = MakeTH1('I', "Sum2", "Sum over 8 channels shift 1", 5000, 1., 5001.);
57  fSum3 = MakeTH1('I', "Sum3", "Sum over 8 channels shift 2", 5000, 1., 5001.);
58  }
59 }
60 //-----------------------------------------------------------
62 {
63  TGo4Log::Info("TXXXAnlProc: Delete");
64  if(fParam->fbHisto){
65  if (fWinCon) fWinCon->PrintCondition(true);
66  }
67 }
68 //-----------------------------------------------------------
70 {
71  Bool_t isValid=kFALSE; // validity of output event
72 
74  TXXXAnlEvent* out_evt = (TXXXAnlEvent*) dest;
75 
76  // see comments in UnpackProc
77  if((inp_evt==0) || !inp_evt->IsValid()){ // input invalid
78  out_evt->SetValid(isValid); // invalid
79  return isValid; // must be same is for SetValid
80  }
81  isValid=kTRUE;
82 
83  Int_t cnt(0);
84  for(Int_t ii=0;ii<XXX_NUM_CHAN/2;ii++)
85  out_evt->frData[cnt++] = inp_evt->fiCrate1[ii];
86 
87  for(Int_t ii=0; ii<XXX_NUM_CHAN/2; ii++)
88  out_evt->frData[cnt++] = inp_evt->fiCrate2[ii];
89 
90  if(fParam->fbHisto) { // histogramming
91  for(Int_t ii=0;ii<XXX_NUM_CHAN;ii++)
92  if(out_evt->frData[ii]) {
93  if(fWinCon && fWinCon->Test(out_evt->frData[ii])) fSum1->Fill(out_evt->frData[ii]);
94  fSum2->Fill(out_evt->frData[ii] + fParam->frP1);
95  fSum3->Fill(out_evt->frData[ii] + fParam->frP2);
96  }
97  }
98 
99  // see comments in UnpackProc
100  out_evt->SetValid(isValid);
101  return isValid;
102 }
TGo4Parameter * MakeParameter(const char *fullname, const char *classname, const char *newcmd=0)
virtual Bool_t BuildEvent(TGo4EventElement *dest)
Definition: TXXXAnlProc.cxx:69
Int_t fiCrate1[XXX_NUM_CHAN]
virtual ~TXXXAnlProc()
Definition: TXXXAnlProc.cxx:61
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:83
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:283