GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TMeshUnpackProc.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 "TMeshUnpackProc.h"
15
16#include "TGo4MbsEvent.h"
17#include "TGo4Log.h"
18
19#include "TMeshRawEvent.h"
20#include "TMeshB1InputEvent.h"
21#include "TMeshB2InputEvent.h"
22
23//***********************************************************
28
29//***********************************************************
30// this one is used in TXXXUnpackFact.cxx
33{
34 TGo4Log::Info("TMeshUnpackProc: Create %s", name);
35}
36
37//***********************************************************
41
42//-----------------------------------------------------------
44{
45 if(!poutevt) return;
46 // process subcomponents independently
47 // note: this will run subevent loop each time, which is not performance optimized in this example
48 // however, for the general case this unpacker decoupling is more suitable
49 UnpackBranch1(&(poutevt->fxSub1));
50 UnpackBranch2(&(poutevt->fxSub2));
51 UnpackBranch3(&(poutevt->fxSub3));
52 poutevt->SetValid(kTRUE); // to store
53}
54
55
57{
58 fInput = dynamic_cast<TGo4MbsEvent *>(GetInputEvent()); // from this
59 if(!fInput) {
60 TGo4Log::Error("UnpackBranch1: no input event !");
61 return;
62 }
63
64 Int_t index = 0, value = 0, lwords = 0;
65 Int_t *pdata = nullptr;
66 fInput->ResetIterator();
67 while (auto psubevt = fInput->NextSubEvent()) // subevent loop
68 {
69 if( psubevt->GetSubcrate() == 1)
70 {
71 pdata=psubevt->GetDataField();
72 lwords= (psubevt->GetDlen() -2) * sizeof(Short_t)/sizeof(Int_t);
73 if(lwords >= 8) lwords=8; // take only first 8 lwords
74 for(Int_t i = 0; i<lwords; ++i)
75 {
76 index = *pdata&0xfff; // in case low word is index
77 value = *pdata; // save for 2d histogram
78 //value = (*pdata>>16)&0xfff; // in case high word is data
79 if((value != 0) && (index >= 0)) {
80 poutevt->fiCrate1[i] = value; // fill output event
81 }
82 pdata++;
83 } // for SEW LW
84 } // if (subcrate)
85
86 } // while
87 poutevt->SetValid(kTRUE); // to store
88}
89
91{
92 fInput = dynamic_cast<TGo4MbsEvent *>(GetInputEvent()); // from this
93 if(!fInput) {
94 TGo4Log::Error("UnpackBranch2: no input event !");
95 return;
96 }
97
98 Int_t index = 0, value = 0, lwords = 0;
99 Int_t *pdata = nullptr;
100 fInput->ResetIterator();
101 while (auto psubevt = fInput->NextSubEvent()) // subevent loop
102 {
103 if( psubevt->GetSubcrate() == 2)
104 {
105 pdata=psubevt->GetDataField();
106 lwords= (psubevt->GetDlen() -2) * sizeof(Short_t)/sizeof(Int_t);
107 if(lwords >= 8) lwords=8;
108 for(Int_t i = 0; i<lwords; ++i)
109 {
110 index = *pdata&0xfff;
111 //value=(*pdata>>16)&0xfff;
112 value = *pdata;
113 if((value != 0) && (index >= 0)) {
114 poutevt->fiCrate2[i] = value;
115 }
116 pdata++;
117 } // for SEW LW
118 } // if (subcrate)
119 } // while
120 poutevt->SetValid(kTRUE); // to store
121}
122
124{
125 fInput = dynamic_cast<TGo4MbsEvent *>(GetInputEvent()); // from this
126 if(!fInput) {
127 TGo4Log::Error("UnpackBranch3: no input event !");
128 return;
129 }
130
131 Int_t index = 0, value = 0, lwords = 0;
132 Int_t *pdata = nullptr;
133 fInput->ResetIterator();
134 while (auto psubevt = fInput->NextSubEvent()) // subevent loop
135 {
136 if( psubevt->GetSubcrate() == 3)
137 {
138 pdata=psubevt->GetDataField();
139 lwords= (psubevt->GetDlen() -2) * sizeof(Short_t)/sizeof(Int_t);
140 if(lwords >= 8) lwords=8; // take only first 8 lwords
141 for(Int_t i = 0; i<lwords; ++i)
142 {
143 index = *pdata&0xfff; // in case low word is index
144 //value = (*pdata>>16)&0xfff; // in case high word is data
145 value = *pdata;
146 if((value != 0) && (index >= 0)) {
147 poutevt->fiCrate3[i] = value; // fill output event
148 }
149 pdata++;
150 } // for SEW LW
151 } // if (subcrate)
152 } // while
153 poutevt->SetValid(kTRUE); // to store
154}
void SetValid(Bool_t on)
Switches the valid state of this event.
TGo4EventProcessor(const char *name)
TGo4EventElement * GetInputEvent()
Access to external raw event which is set as association member.
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
Definition TGo4Log.cxx:294
static void Error(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 3.
Definition TGo4Log.cxx:320
Wrapper for the standard gsi event structure as delivered from mbs.
TMeshB3InputEvent fxSub3
TMeshB2InputEvent fxSub2
TMeshB1InputEvent fxSub1
we compose data structure from subbranches:
void UnpackBranch3(TMeshB3InputEvent *target)
TGo4MbsEvent * fInput
virtual ~TMeshUnpackProc()
void Unpack(TMeshRawEvent *target)
void UnpackBranch2(TMeshB2InputEvent *target)
void UnpackBranch1(TMeshB1InputEvent *target)