-
Notifications
You must be signed in to change notification settings - Fork 120
Expand file tree
/
Copy pathR3BEventFilter.h
More file actions
120 lines (100 loc) · 3.61 KB
/
R3BEventFilter.h
File metadata and controls
120 lines (100 loc) · 3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/******************************************************************************
* Copyright (C) 2025 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
* Copyright (C) 2025 Members of R3B Collaboration *
* *
* This software is distributed under the terms of the *
* GNU General Public Licence (GPL) version 3, *
* copied verbatim in the file "LICENSE". *
* *
* In applying this license GSI does not waive the privileges and immunities *
* granted to it by virtue of its status as an Intergovernmental Organization *
* or submit itself to any jurisdiction. *
******************************************************************************/
// ----------------------------------------------------------------
// ----- R3BEventFilter -----
// ----- Created 05/10/25 by J.L. Rodriguez-Sanchez -----
// ----------------------------------------------------------------
/*
* This class selects which events should be stored in the ROOT file.
* It acts as a filter, deciding whether an event is kept or discarded.
*/
#pragma once
// ROOT headers
#include <TCutG.h>
#include <TMath.h>
#include <TString.h>
// FAIR headers
#include <FairTask.h>
// R3B headers
#include "R3BEventHeader.h"
#include "R3BFrsData.h"
class TClonesArray;
class R3BEventFilter : public FairTask
{
public:
/**
* Default constructor.
* Creates an instance of the task with default parameters.
*/
R3BEventFilter();
/**
* Standard constructor.
* Creates an instance of the task.
* @param name a name of the task.
* @param iVerbose a verbosity level.
*/
explicit R3BEventFilter(const TString& name, Int_t iVerbose = 1);
/**
* Destructor.
* Frees the memory used by the object.
*/
~R3BEventFilter() = default;
/**
* Method for task initialization.
* This function is called by the framework before
* the event loop.
* @return Initialization status. kSUCCESS, kERROR or kFATAL.
*/
InitStatus Init() override;
InitStatus ReInit() override;
/**
* Method for event loop implementation.
* Is called by the framework every time a new event is read.
* @param option an execution option.
*/
void Exec(Option_t* option) override;
/**
* A method for finish of processing of an event.
* Is called by the framework for each event after executing
* the tasks.
*/
void FinishEvent() override;
void SetParContainers() override;
void SetTCutFrsId(const TCutG* cut)
{
if (cut)
{
fCutFrsId.reset(static_cast<TCutG*>(cut->Clone()));
fCutFrsId->SetName("fCutFrsId");
}
else
{
fCutFrsId.reset();
}
}
void SetChargeLimits(const std::vector<std::vector<double>>& vec) { fChargeLimits = vec; }
void SetTofd() { fUseTofd = true; }
void UseTwoPlanes() { fUseAllPlanes = false; }
private:
void SetParameter();
void StoreEvent(bool valid = true);
R3BEventHeader* fHeader = nullptr;
TClonesArray* fTofdHit = nullptr;
TClonesArray* fFrsData = nullptr;
std::unique_ptr<TCutG> fCutFrsId;
std::vector<std::vector<double>> fChargeLimits;
bool fUseTofd = false;
bool fUseAllPlanes = true;
public:
ClassDefOverride(R3BEventFilter, 1); // NOLINT
};