9#include "EventComplexCut.h"
11#include "ComplexEvent.h"
13#include "DataFormatManager.h"
19 EventComplexCut::EventComplexCut() :
20 EventCut(1), fRealCut(NULL), fImgCut(NULL), fStep(0), fNullObjects(0), fAcceptNulls(kFALSE) {}
22 EventComplexCut::EventComplexCut(
const EventCut* real,
const EventCut* img) :
23 EventCut(real->GetCutSize() + img->GetCutSize()),
24 fRealCut((EventCut*) real->MakeCopy()),
25 fImgCut((EventCut*) img->MakeCopy()),
27 fAcceptNulls(kFALSE) {
28 for (
int i = 0; i < real->GetCutSize(); i++) {
29 SetUnitName(real->GetUnit(i) +
"_{re}", i);
30 SetMinMax(real->GetMin(i), real->GetMax(i), i);
32 fStep = real->GetCutSize();
34 for (
int i = fStep; i < GetCutSize(); i++) {
35 SetUnitName(img->GetUnit(j) +
"_{img}", i);
36 SetMinMax(img->GetMin(j), img->GetMax(j), i);
41 EventComplexCut::EventComplexCut(
const EventComplexCut& other) : EventComplexCut(other.fRealCut, other.fImgCut) {
42 fNullObjects = other.fNullObjects;
43 fAcceptNulls = other.fAcceptNulls;
46 Bool_t EventComplexCut::Pass(
Event* event) {
49 if (z_event->GetImgEvent() ==
nullptr) {
51 for (
int i = 0; i < fImgCut->GetCutSize(); i++)
52 fImgCut->SetValue(-DBL_MAX, i);
53 stat2 = fImgCut->ForcedUpdate(fAcceptNulls);
55 stat2 = fImgCut->Pass(z_event->GetImgEvent());
57 Bool_t stat1 = fRealCut->Pass(z_event->GetRealEvent());
58 for (
int i = 0; i < fStep; i++) {
59 SetValue(fRealCut->GetValue(i), i);
61 for (
int i = 0; i < fImgCut->GetCutSize(); i++) {
62 SetValue(fImgCut->GetValue(i), fStep + i);
64 if (stat1 && stat2)
return ForcedUpdate(kTRUE);
65 return ForcedUpdate(kFALSE);
68 Bool_t EventComplexCut::Init(Int_t task_id) {
69 if (!EventCut::Init(task_id))
return kFALSE;
71 const Event*
event = manager->
GetFormat(task_id, EFormatDepth::kNonBuffered);
72 if (event->InheritsFrom(
"Hal::ComplexEvent")) {
75 manager->
SetFormat(z->GetRealEvent(), task_id, EFormatDepth::kNonBuffered, kTRUE);
76 ok += fRealCut->Init(task_id);
77 manager->
SetFormat(z->GetImgEvent(), task_id, EFormatDepth::kNonBuffered, kTRUE);
78 ok += fImgCut->Init(task_id);
79 manager->
SetFormat(z, task_id, EFormatDepth::kNonBuffered, kTRUE);
80 for (
int i = 0; i < fRealCut->GetCutSize(); i++) {
81 SetMinMax(fRealCut->GetMin(i), fRealCut->GetMax(i), i);
83 for (
int i = 0; i < fImgCut->GetCutSize(); i++) {
84 SetMinMax(fImgCut->GetMin(i), fImgCut->GetMax(i), i + fStep);
86 if (ok == 2)
return kTRUE;
91 Package* EventComplexCut::Report()
const {
92 Package* pack = EventCut::Report();
108 TString EventComplexCut::CutName(Option_t* )
const {
109 return Form(
"Hal::EventComplexCut(%s,%s)", fRealCut->CutName().Data(), fImgCut->CutName().Data());
112 EventComplexCut::~EventComplexCut() {
113 if (fRealCut)
delete fRealCut;
114 if (fImgCut)
delete fImgCut;
117 EventComplexCut::EventComplexCut(
const EventCut& real,
const EventCut& img) :
118 EventCut(real.GetCutSize() + img.GetCutSize()),
119 fRealCut((EventCut*) real.MakeCopy()),
120 fImgCut((EventCut*) img.MakeCopy()),
122 fAcceptNulls(kFALSE) {
123 for (
int i = 0; i < real.GetCutSize(); i++) {
125 SetMinMax(real.GetMin(i), real.GetMax(i), i);
127 fStep = real.GetCutSize();
131 SetMinMax(img.GetMin(j), img.GetMax(j), i);
138 EventRealCut::EventRealCut() : EventCut(1), fRealCut(nullptr) {}
140 EventRealCut::EventRealCut(
const EventCut* real) : EventCut(real->GetCutSize()), fRealCut((EventCut*) real->MakeCopy()) {
141 for (
int i = 0; i < real->GetCutSize(); i++) {
143 SetMinMax(real->GetMin(i), real->GetMax(i), i);
147 EventRealCut::EventRealCut(
const EventCut& real) : EventCut(real.GetCutSize()), fRealCut((EventCut*) real.MakeCopy()) {
148 for (
int i = 0; i < real.GetCutSize(); i++) {
150 SetMinMax(real.GetMin(i), real.GetMax(i), i);
154 EventRealCut::EventRealCut(
const EventRealCut& other) : EventRealCut(other.GetRealCut()) {}
158 Bool_t passed = fRealCut->
Pass(z_event->GetRealEvent());
168 const Event*
event = manager->
GetFormat(task_id, EFormatDepth::kNonBuffered);
169 if (event->InheritsFrom(
"Hal::ComplexEvent")) {
171 manager->
SetFormat(z->GetRealEvent(), task_id, EFormatDepth::kNonBuffered, kTRUE);
172 Bool_t ok = fRealCut->
Init(task_id);
173 manager->
SetFormat(z, task_id, EFormatDepth::kNonBuffered, kTRUE);
174 for (
int i = 0; i < fRealCut->
GetCutSize(); i++) {
177 if (ok)
return kTRUE;
195 EventRealCut::~EventRealCut() {
196 if (fRealCut)
delete fRealCut;
201 EventImaginaryCut::EventImaginaryCut() : EventCut(1), fImgCut(nullptr), fNullObjects(0), fAcceptNulls(kFALSE) {}
203 EventImaginaryCut::EventImaginaryCut(
const EventCut* img) :
204 EventCut(img->GetCutSize()), fImgCut((EventCut*) img->MakeCopy()), fNullObjects(0), fAcceptNulls(kFALSE) {
205 for (
int i = 0; i < img->GetCutSize(); i++) {
207 SetMinMax(img->GetMin(i), img->GetMax(i), i);
211 EventImaginaryCut::EventImaginaryCut(
const EventCut& img) :
212 EventCut(img.GetCutSize()), fImgCut((EventCut*) img.MakeCopy()), fNullObjects(0), fAcceptNulls(kFALSE) {
213 for (
int i = 0; i < img.GetCutSize(); i++) {
215 SetMinMax(img.GetMin(i), img.GetMax(i), i);
219 EventImaginaryCut::EventImaginaryCut(
const EventImaginaryCut& other) : EventImaginaryCut(other.GetImgCut()) {
220 fNullObjects = other.fNullObjects;
221 fAcceptNulls = other.fAcceptNulls;
226 if (z_event->GetImgEvent() ==
nullptr) {
236 Bool_t passed = fImgCut->
Pass(z_event->GetImgEvent());
246 const Event*
event = manager->
GetFormat(task_id, EFormatDepth::kNonBuffered);
247 if (event->InheritsFrom(
"Hal::ComplexEvent")) {
249 manager->
SetFormat(z->GetImgEvent(), task_id, EFormatDepth::kNonBuffered, kTRUE);
250 Bool_t ok = fImgCut->
Init(task_id);
251 manager->
SetFormat(z, task_id, EFormatDepth::kNonBuffered, kTRUE);
252 for (
int i = 0; i < fImgCut->
GetCutSize(); i++) {
255 if (ok)
return kTRUE;
273 return Form(
"Hal::EventImaginaryCut(%s)", fImgCut->
CutName().Data());
276 EventImaginaryCut::~EventImaginaryCut() {
277 if (fImgCut)
delete fImgCut;
virtual TString CutName(Option_t *opt="") const
virtual Bool_t Init(Int_t=0)
void SetMinMax(Double_t min, Double_t max, Int_t i=0)
Double_t GetValue(Int_t i=0) const
Bool_t ForcedUpdate(Bool_t state)
void SetValue(Double_t val, Int_t i=0)
ULong64_t GetFailed() const
Double_t GetMin(Int_t i=0) const
ULong64_t GetPassed() const
Double_t GetMax(Int_t i=0) const
void SetUnitName(TString name, Int_t i=0)
virtual Package * Report() const
virtual Bool_t Pass(Event *event)=0
virtual TString CutName(Option_t *opt="") const
virtual Package * Report() const
virtual Bool_t Init(Int_t task_id)
virtual Bool_t Pass(Event *event)
virtual Bool_t Pass(Event *event)
virtual Bool_t Init(Int_t task_id)
virtual TString CutName(Option_t *opt="") const
virtual Package * Report() const
void AddObject(TObject *object)