10#include "QAEventTask.h"
16#include "QAPlotReport.h"
21 QAEventTask::QAEventTask() : fEventQA(nullptr), fTempEventPlot(nullptr) { AddTags(
"qa"); }
23 QAEventTask::~QAEventTask() {
24 if (fEventQA)
delete fEventQA;
25 if (fTempEventPlot)
delete fTempEventPlot;
28 QAEventTask::QAEventTask(
const QAEventTask& other) : EventAna(other), fEventQA(nullptr), fTempEventPlot(nullptr) {
30 fEventQA = new TObjArray();
31 for (int i = 0; i < other.fEventQA->GetEntriesFast(); i++) {
32 QAPlot* plot = (QAPlot*) other.fEventQA->UncheckedAt(i);
33 fEventQA->Add(plot->MakeCopy());
36 if (other.fTempEventPlot) { fTempEventPlot = other.fTempEventPlot->MakeCopy(); }
37 fEventColNames = other.fEventColNames;
40 Task::EInitFlag QAEventTask::Init() {
41 Task::EInitFlag stat = EventAna::Init();
42 if (stat == Task::EInitFlag::kFATAL)
return stat;
43 if (fTempEventPlot ==
nullptr) {
44 Cout::PrintInfo(
"Lack of Event QA", EInfo::kError);
45 return Task::EInitFlag::kFATAL;
47 fEventQA =
new TObjArray();
48 for (
int i = 0; i < fEventCollectionsNo; i++) {
50 plot->
Init(GetTaskID());
53 delete fTempEventPlot;
54 fTempEventPlot =
nullptr;
56 return Task::EInitFlag::kSUCCESS;
60 Package* report = EventAna::Report();
61 for (
int i = 0; i < fEventCollectionsNo; i++) {
64 if (i < (
int) fEventColNames.size()) {
65 event_report->SetName(fEventColNames[i]);
67 event_report->SetName(Form(
"Ev %i", i));
75 void QAEventTask::SetQAPlot(
const QAPlot& plot) {
76 if (plot.GetUpdateRatio() == ECutUpdate::kEvent) fTempEventPlot = plot.
MakeCopy();
79 void QAEventTask::ProcessEvent() { GetQAPlot(fCurrentEventCollectionID)->
Fill(fCurrentEvent); }
82 if (
this == &other)
return *
this;
83 if (other.fTempEventPlot) {
84 if (fTempEventPlot)
delete fTempEventPlot;
85 fTempEventPlot = other.fTempEventPlot->
MakeCopy();
87 fEventColNames = other.fEventColNames;
void AddObject(TObject *object)
virtual void Recalculate()
virtual void Fill(TObject *obj)
virtual Bool_t Init(Int_t id_task=-1)
virtual QAPlot * MakeCopy() const