CbmRoot
Loading...
Searching...
No Matches
CaToolsWFExpression.h
Go to the documentation of this file.
1/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergey Gorbunov, Sergei Zharko [committer] */
4
5#ifndef CaToolsWFExpression_h
6#define CaToolsWFExpression_h 1
7
8#include "CaToolsDef.h"
9#include "TCut.h"
10#include "TString.h"
11
12#include <cassert>
13#include <tuple>
14#include <vector>
15
16class TTree;
17class TH2F;
18class TPad;
19
20namespace cbm::ca::tools
21{
27 public:
28 static constexpr int kNpars = 1;
29
31 WFExpression() = delete;
32
37 WFExpression(TTree* pTree, const char* exprDist, const char* exprParam);
38
40 WFExpression(const WFExpression& other) = delete;
41
43 WFExpression(WFExpression&& other) = delete;
44
46 ~WFExpression() = default;
47
49 WFExpression& operator=(const WFExpression& other) = delete;
50
53
59 std::tuple<std::vector<float>, std::vector<float>> CalculateParameters();
60
62 void SetCut(const TCut& cut) { fCut = cut; }
63
65 void SetEps(float eps);
66
68 void SetNslices(int nSlices);
69
73 void SetNbins(int nBinsDist, int nBinsParam);
74
76 void SetPadBase(TPad* pad);
77
79 void SetPadSlices(TPad* pad);
80
82 void SetTitle(const char* title) { fsTitle = title; }
83
84 private:
85 // *****************************
86 // ** Private class functions **
87 // *****************************
88
92 std::tuple<float, float, float> ProcessSlice(int iBinMin, int iBinMax);
93
96 // TODO: use other functions for other window shapes: GetParabWindowParams, GetEllipticWindowParams etc.
97
98
99 // *********************
100 // ** Class variables **
101 // *********************
102 TTree* fpTree = nullptr;
103 TH2F* fpHistBase = nullptr;
104
105 TString fsExprDist = "";
106 TString fsExprParam = "";
107
108 TCut fCut = "";
109 int fNslices = 8;
110 float fEps = 0.0005;
111
112
113 std::vector<float> fvUpSBoundaries = std::vector<float>(fNslices);
114 std::vector<float> fvLoSBoundaries = std::vector<float>(fNslices);
115 std::vector<float> fvSCenters = std::vector<float>(fNslices);
116 std::vector<float> fvUpParams = std::vector<float>(kNpars);
117 std::vector<float> fvLoParams = std::vector<float>(kNpars);
118
119 // ----- Plotting options
120 int fNbinsParam = 400;
121 int fNbinsDist = 400;
122 TString fsTitle = "";
123 TString fsName = "";
124 TPad* fpPadBase = nullptr;
125 TPad* fpPadSlices = nullptr;
126 };
127} // namespace cbm::ca::tools
128
129#endif // CaToolsWFExpression_h
Definitions for ca::tools namespace.
WFExpression(WFExpression &&other)=delete
Move constructor.
TString fsExprDist
Expression along the distance axis.
WFExpression(const WFExpression &other)=delete
Copy constructor.
void SetNslices(int nSlices)
Sets number of slices.
int fNbinsParam
Number of bins along the parameter axis.
WFExpression()=delete
TMP: number of parameters.
void GetConstWindowParams()
Gets window parameterisations assuming there is no dependence from parameter.
int fNbinsDist
Number of bins along the distance axis.
void SetCut(const TCut &cut)
Sets cut, including information on the station and track finder iteration.
void SetPadBase(TPad *pad)
Sets base pad pointer.
TH2F * fpHistBase
Base histogram (distance vs. parameter (x0 or y0))
std::vector< float > fvLoSBoundaries
Lower boundaries for diff. slices.
TTree * fpTree
Tree to be analyzed.
float fEps
A fraction of triplets, which can be lost.
std::tuple< float, float, float > ProcessSlice(int iBinMin, int iBinMax)
WFExpression & operator=(WFExpression &&other)=delete
Move assignment operator.
void SetEps(float eps)
Sets fraction of the events, which can be left out of boundaries.
TCut fCut
Cut used to draw and expression.
std::vector< float > fvUpSBoundaries
Upper boundaries for diff. slices.
std::vector< float > fvUpParams
Parameters for max.
int fNslices
Number of slices along the parameter axis.
TString fsName
Name of the expression (expr + cut, must be unique!!, TODO: make a check)
~WFExpression()=default
Destructor.
std::tuple< std::vector< float >, std::vector< float > > CalculateParameters()
TPad * fpPadSlices
Pointer to a pad for slices.
void SetNbins(int nBinsDist, int nBinsParam)
TString fsTitle
Title of expression.
void SetPadSlices(TPad *pad)
Sets slices pad pointer.
std::vector< float > fvLoParams
Parameters for min.
void SetTitle(const char *title)
Sets title of the histograms.
TString fsExprParam
Expression along the parameter axis.
WFExpression & operator=(const WFExpression &other)=delete
Copy assignment operator.
TPad * fpPadBase
Pointer to a pad for base histogram.
std::vector< float > fvSCenters
Slice centers.