R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BTcutPar.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2022 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2022-2026 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
14// --------------------------------------------------------------
15// ----- R3BTcutPar -----
16// ----- Created Jan 23th 2022 by J.L. Rodriguez-Sanchez -----
17// --------------------------------------------------------------
18
19#include "R3BTcutPar.h"
20#include "R3BLogger.h"
21
22#include <FairParamList.h>
23
24#include <Rtypes.h>
25#include <TArrayF.h>
26
27// ----- Default constructor -----------------------------------------------
28R3BTcutPar::R3BTcutPar(const TString& cutname)
29 : TNamed(cutname, cutname)
30{
31}
32
33// ---- Method putParams ------------------------------------------------------
34void R3BTcutPar::putParams(FairParamList* list)
35{
36 R3BLOG(info, "called for " << fCut->GetN() << " points");
37
38 TArrayF* p = new TArrayF(2);
39 for (int n = 0; n < fCut->GetN(); n++)
40 {
41 Double_t a[2];
42 fCut->GetPoint(n, a[0], a[1]);
43
44 TString name = GetNameObj() + "Point" + n;
45 p->AddAt(a[0], 0);
46 p->AddAt(a[1], 1);
47 list->add(name, *p);
48 }
49 delete p;
50}
51
52// ---- Method getParams ------------------------------------------------------
53TCutG* R3BTcutPar::getParams(FairParamList* list)
54{
55 R3BLOG(info, "called");
56
57 TArrayF* p = new TArrayF(2);
58 for (int n = 0; n < fMaxPoints; n++)
59 {
60 TString name = GetNameObj() + "Point" + n;
61 if (list->fill(name, p))
62 {
63 if (fCut == NULL)
64 fCut = new TCutG(GetNameObj(), 1);
65 fCut->SetPoint(n, p->GetAt(0), p->GetAt(1));
66 }
67 else
68 {
69 break;
70 }
71 }
72 delete p;
73 return fCut;
74}
75
76// ---- Method print ----------------------------------------------------------
78{
79 if (fCut)
80 {
81 R3BLOG(info, "for " << fCut->GetName());
82 for (int n = 0; n < fCut->GetN(); n++)
83 {
84 Double_t a[2];
85 fCut->GetPoint(n, a[0], a[1]);
86 LOG(info) << "CutPoint" << n << ": " << a[0] << " ; " << a[1];
87 }
88 }
89 else
90 {
91 R3BLOG(warn, "Cut parameters not found");
92 }
93}
94
#define R3BLOG(severity, x)
Definition R3BLogger.h:33
ClassImp(R3B::Neuland::Cal2HitPar)
void print()
Method to print values of parameters.
virtual void putParams(FairParamList *list)
Method to store all parameters using FairRuntimeDB.
TString GetNameObj()
Definition R3BTcutPar.h:47
UInt_t fMaxPoints
Definition R3BTcutPar.h:50
R3BTcutPar(const TString &cutname="Cut")
Default constructor.
TCutG * getParams(FairParamList *list)
Method to retrieve all parameters using FairRuntimeDB.
TCutG * fCut
Definition R3BTcutPar.h:51