We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 489f76d commit f4b418bCopy full SHA for f4b418b
2 files changed
analysis/offline/R3BEventFilter.cxx
@@ -56,8 +56,6 @@ void R3BEventFilter::SetParContainers()
56
return;
57
}
58
59
-R3BEventFilter::~R3BEventFilter() { delete fCutFrsId; }
60
-
61
void R3BEventFilter::SetParameter()
62
{
63
//--- Parameter Containers ---
@@ -77,14 +75,15 @@ InitStatus R3BEventFilter::Init()
77
75
78
76
fFrsData = dynamic_cast<TClonesArray*>(mgr->GetObject("FrsData"));
79
80
- if (fCutFrsId == nullptr)
+ if (!fCutFrsId)
81
82
- fCutFrsId = new TCutG("fCutFrsId", 5);
83
- fCutFrsId->SetPoint(0, 0.5, 0.5);
84
- fCutFrsId->SetPoint(1, 4., 0.5);
85
- fCutFrsId->SetPoint(2, 4., 4.);
86
- fCutFrsId->SetPoint(3, 0.5, 4.);
87
- fCutFrsId->SetPoint(4, 0.5, 0.5);
+ auto tmp = std::make_unique<TCutG>("fCutFrsId", 5);
+ tmp->SetPoint(0, 0.5, 0.5);
+ tmp->SetPoint(1, 4., 0.5);
+ tmp->SetPoint(2, 4., 4.);
+ tmp->SetPoint(3, 0.5, 4.);
+ tmp->SetPoint(4, 0.5, 0.5);
+ fCutFrsId = std::move(tmp);
88
89
90
if (fChargeLimits.empty())
analysis/offline/R3BEventFilter.h
@@ -85,10 +85,21 @@ class R3BEventFilter : public FairTask
void SetParContainers() override;
- inline void SetTCutFrsId(TCutG* tcut) { fCutFrsId = tcut; };
- inline void SetChargeLimits(const std::vector<std::vector<double>>& vec) { fChargeLimits = vec; }
- inline void SetTofd() { fUseTofd = true; }
91
- inline void UseTwoPlanes() { fUseAllPlanes = false; }
+ void SetTCutFrsId(const TCutG* cut)
+ {
+ if (cut)
92
+ fCutFrsId.reset(static_cast<TCutG*>(cut->Clone()));
93
+ fCutFrsId->SetName("fCutFrsId");
94
+ }
95
+ else
96
97
+ fCutFrsId.reset();
98
99
100
+ void SetChargeLimits(const std::vector<std::vector<double>>& vec) { fChargeLimits = vec; }
101
+ void SetTofd() { fUseTofd = true; }
102
+ void UseTwoPlanes() { fUseAllPlanes = false; }
103
104
private:
105
void SetParameter();
@@ -98,7 +109,7 @@ class R3BEventFilter : public FairTask
109
TClonesArray* fTofdHit = nullptr;
110
TClonesArray* fFrsData = nullptr;
111
- TCutG* fCutFrsId = nullptr;
112
+ std::unique_ptr<TCutG> fCutFrsId;
113
std::vector<std::vector<double>> fChargeLimits;
114
115
bool fUseTofd = false;
0 commit comments