23#include "TGo4MbsEvent.h"
24#include "TGo4WinCond.h"
25#include "TGo4PolyCond.h"
26#include "TGo4CondArray.h"
27#include "TGo4Picture.h"
56 for (
int i = 0; i < 8; i++) {
61 CreateRawHistograms(5000, 1., 5001.);
64 fCr1Ch1x2 = MakeTH2(
'I',
"Cr1Ch1x2",
"Crate 1 channel 1x2", 200, 1., 5001., 200, 1., 5001.);
65 fHis1 = MakeTH1(
'I',
"His1",
"Condition histogram", 5000, 1., 5001.);
66 fHis2 = MakeTH1(
'I',
"His2",
"Condition histogram", 5000, 1., 5001.);
67 fHis1gate = MakeTH1(
'I',
"His1g",
"Gated histogram", 5000, 1., 5001.);
68 fHis2gate = MakeTH1(
'I',
"His2g",
"Gated histogram", 5000, 1., 5001.);
71 fWinCon1 = MakeWinCond(
"wincon1", 50, 2000);
72 fWinCon2 = MakeWinCond(
"wincon2", 50, 70, 90, 120);
73 fconHis1 = MakeWinCond(
"cHis1", 100, 2000,
"His1");
74 fconHis2 = MakeWinCond(
"cHis2", 100, 2000,
"His2");
76 Double_t cutpnts[3][2] = { {400, 800}, {700, 900}, {600, 1100} };
77 fPolyCon1 = MakePolyCond(
"polycon", 3, cutpnts);
82 fConArr1->SetValues(100,500);
83 fConArr1->Disable(
true);
84 ((*fConArr1)[0])->SetValues(200,400);
85 ((*fConArr1)[1])->SetValues(700,1000);
86 ((*fConArr1)[2])->SetValues(1500,2000);
87 fConArr1->SetHistogram(
"Sum3");
88 AddAnalysisCondition(fConArr1);
90 fConArr1->ResetCounts();
97 Double_t xvalues[4] = { 1000, 2000, 1500, 1000 };
98 Double_t yvalues[4] = { 1000, 1000, 3000, 1000 };
99 TCutG *mycut =
new TCutG(
"cut2", 4, xvalues, yvalues);
101 fConArr2->SetValues(mycut);
102 fConArr2->Disable(
true);
104 AddAnalysisCondition(fConArr2);
107 fConArr2->ResetCounts();
112 fWinCon2->Disable(
true);
113 fWinCon2->Invert(kTRUE);
114 fWinCon1->PrintCondition(
true);
115 fconHis1->PrintCondition(
true);
116 fconHis2->PrintCondition(
true);
118 fPolyCon1->PrintCondition(
true);
119 ((*fConArr2)[0])->Enable();
120 ((*fConArr2)[1])->Enable();
122 fcondSet = GetPicture(
"condSet");
126 fcondSet =
new TGo4Picture(
"condSet",
"Set conditions");
127 fcondSet->SetDivision(2,2);
128 fcondSet->Pic(0,0)->AddObject(fHis1);
129 fcondSet->Pic(0,1)->AddObject(fHis2);
130 fcondSet->Pic(0,0)->AddCondition(fconHis1);
131 fcondSet->Pic(0,1)->AddCondition(fconHis2);
132 fcondSet->Pic(1,0)->AddObject(fHis1gate);
133 fcondSet->Pic(1,1)->AddObject(fHis2gate);
134 fcondSet->Pic(1,0)->SetFillAtt(4, 1001);
135 fcondSet->Pic(1,0)->SetLineAtt(4,1,1);
136 fcondSet->Pic(1,1)->SetFillAtt(9, 1001);
137 fcondSet->Pic(1,1)->SetLineAtt(9,1,1);
138 fcondSet->Pic(0,0)->SetTitleAttr(0.05, 0.85, 0.8, 0.95);
139 AddPicture(fcondSet);
142 fPicture1 = GetPicture(
"Picture1");
144 fPicture1 =
new TGo4Picture(
"Picture1",
"Picture example");
145 fPicture1->SetLinesDivision(3, 2,3,1);
146 fPicture1->LPic(0,0)->AddObject(fCr1Ch[0]);
147 fPicture1->LPic(0,0)->SetFillAtt(5, 3001);
148 fPicture1->LPic(0,0)->SetLineAtt(5,1,1);
149 fPicture1->LPic(0,1)->AddObject(fCr1Ch[1]);
150 fPicture1->LPic(0,1)->SetFillAtt(4, 3001);
151 fPicture1->LPic(0,1)->SetLineAtt(4,1,1);
152 fPicture1->LPic(1,0)->AddObject(fCr1Ch[2]);
153 fPicture1->LPic(1,0)->SetFillAtt(6, 1001);
154 fPicture1->LPic(1,0)->SetLineAtt(6,1,1);
155 fPicture1->LPic(1,1)->AddObject(fCr1Ch[3]);
156 fPicture1->LPic(1,1)->SetFillAtt(7, 1001);
157 fPicture1->LPic(1,1)->SetLineAtt(7,1,1);
158 fPicture1->LPic(1,2)->AddObject(fCr1Ch[4]);
159 fPicture1->LPic(3,0)->AddObject(fCr1Ch1x2);
160 fPicture1->LPic(3,0)->SetDrawOption(
"CONT");
161 fPicture1->LPic(3,0)->AddSpecialObject(
new TArrow(3500., 3500, 2000., 1500., 0.02));
162 fPicture1->LPic(3,0)->AddSpecialObject(
new TLatex(1500, 3500,
"Example of text label in the picture"));
164 AddPicture(fPicture1);
179 for (
int i = 0; i < 8; i++) {
191 TString hname = TString::Format(
"Crate1/Cr1Ch%02d", i + 1);
192 TString htitle = TString::Format(
"Crate 1 channel %2d", i + 1);
193 fCr1Ch[i] =
MakeTH1(
'I', hname.Data(), htitle.Data(), nbins, xmin, xmax);
194 hname = TString::Format(
"Crate2/Cr2Ch%02d", i + 1);
195 htitle = TString::Format(
"Crate 2 channel %2d", i + 1);
196 fCr2Ch[i] =
MakeTH1(
'I', hname.Data(), htitle.Data(), nbins, xmin, xmax);
219 Long_t loop = (
fEvCount / 1000000) % 5;
266 inp_evt->ResetIterator();
267 while (
auto psubevt = inp_evt->NextSubEvent())
269 Int_t *pdata = psubevt->GetDataField();
270 Int_t lwords = psubevt->GetIntLen();
271 Int_t subcrate=psubevt->GetSubcrate();
274 TGo4Log::Info(
"XXXUnpackProc: skip invalid subcrate %d", subcrate);
278 if(lwords >= 8) lwords=8;
280 for(Int_t i = 0; i<lwords; ++i)
287 TXXXUnpackEvent& ev=*out_evt;
288 TXXXModule* mod=
dynamic_cast<TXXXModule*
>(&ev[subcrate][i]);
300 TGo4Log::Info(
"XXXUnpackProc: WARNING: no output event module for crate %d, channel %d", subcrate, i);
308 fCr1Ch[i]->Fill((Float_t)(*pdata));
312 if(
fconHis1->Test((Double_t)*pdata))
314 fHis1->Fill((Float_t)(*pdata));
319 fHis2->Fill((Float_t)(*pdata));
321 if(
fPolyCon1->Test(*pdata,lastvalue))
fCr1Ch1x2->Fill((Float_t)(*pdata),(Float_t)lastvalue);
322 if(((*
fConArr2)[0])->Test(*pdata,lastvalue))
fCr1Ch1x2->Fill((Float_t)(*pdata),(Float_t)lastvalue);
323 if(((*
fConArr2)[1])->Test(*pdata,lastvalue))
fCr1Ch1x2->Fill((Float_t)(*pdata),(Float_t)lastvalue);
327 else if ( subcrate == 2)
329 fCr2Ch[i]->Fill((Float_t)(*pdata));
335 out_evt->SetValid(kTRUE);
The abstract base class for the data elements of which the unpacked events (or detector structure dat...
Abstract event processor.
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 * GetParameter(const char *name, const char *par_class=nullptr)
Get parameter from go4 framework.
TGo4EventElement * GetInputEvent()
Access to external raw event which is set as association member.
Bool_t RemoveHistogram(const char *name)
UnRegister histogram from go4 framework and delete it.
static void Info(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 1.
static void Error(const char *text,...) GO4_PRINTF_ARGS
User shortcut for message with prio 3.
Wrapper for the standard gsi event structure as delivered from mbs.
Picture cconfiguration in Go4.
void SetCalibSpectrum(TH1 *h1)
Reset reference to calibration spectrum in fitter.
Bool_t BuildEvent(TGo4EventElement *dest) override
Fill the destination event dest.
TH1 * fCr1Ch[XXX_NUM_CHAN]
void CreateRawHistograms(int nbins, double xmin, double xmax)
TH1 * fCr2Ch[XXX_NUM_CHAN]
virtual ~TXXXUnpackProc()