Belle II Software development
NoKickCuts.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <tracking/trackFindingVXD/sectorMapTools/NoKickCuts.h>
10
11#include "TH3.h"
12
13#include "TFile.h"
14#include <string>
15
16using namespace Belle2;
17
18std::vector<double> NoKickCuts::cutSelector(double sinTheta, double momentum, int layer1, int layer2, EParameters par)
19{
20 std::vector<double> out;
21 for (int i = c_Min; i <= c_Max; i++) {
22 double cut = getCut(layer1, layer2, par, (EMinMax)i, c_Norm) /
23 (sqrt(sinTheta) * pow(momentum, getCut(layer1, layer2, par, (EMinMax)i, c_Pow)))
24 + getCut(layer1, layer2, par, (EMinMax)i, c_Bkg);
25 out.push_back(cut);
26 }
27 return out;
28}
29
30double NoKickCuts::getCut(int layer1, int layer2, EParameters par, EMinMax m, ECutName cut)
31{
32 std::vector<std::vector <std::vector <std::vector<double>>>> cutVector;
33 double out;
34
35 switch (cut) {
36 case c_Norm:
37 cutVector = m_cutNorm;
38 break;
39
40 case c_Pow:
41 cutVector = m_cutPow;
42 break;
43
44 case c_Bkg:
45 cutVector = m_cutBkg;
46 break;
47 }
55 out = cutVector.at(m).at(par).at(layer1).at(layer2);
56 return out;
57}
58
59void NoKickCuts::FillCuts(std::string m_fileName)
60{
61 TFile* file = TFile::Open(m_fileName.c_str());
62
63
64 TH3F* input_norm_m = (TH3F*)file->Get("output_norm_m");
65 TH3F* input_pow_m = (TH3F*)file->Get("output_pow_m");
66 TH3F* input_bkg_m = (TH3F*)file->Get("output_bkg_m") ;
67
68 TH3F* input_norm_M = (TH3F*)file->Get("output_norm_M");
69 TH3F* input_pow_M = (TH3F*)file->Get("output_pow_M");
70 TH3F* input_bkg_M = (TH3F*)file->Get("output_bkg_M");
71
72
73 for (int mm = 0; mm < 2; mm++) {
74 std::vector<std::vector<std::vector<double>>> m_cutNorm_minmax;
75 std::vector<std::vector<std::vector<double>>> m_cutPow_minmax;
76 std::vector<std::vector<std::vector<double>>> m_cutBkg_minmax;
77 for (int par = 0; par < m_nbinpar; par++) {
78 std::vector<std::vector<double>> m_cutNorm_par;
79 std::vector<std::vector<double>> m_cutPow_par;
80 std::vector<std::vector<double>> m_cutBkg_par;
81 for (int lay1 = 0; lay1 < m_nbinlay; lay1++) {
82 std::vector<double> m_cutNorm_lay1;
83 std::vector<double> m_cutPow_lay1;
84 std::vector<double> m_cutBkg_lay1;
85 for (int lay2 = 0; lay2 < m_nbinlay; lay2++) {
86 int binNumber = input_norm_m->GetBin(par, lay1, lay2);
87
88 if (mm == 0) {
89 m_cutNorm_lay1.push_back(input_norm_m->GetBinContent(binNumber));
90 m_cutPow_lay1.push_back(input_pow_m->GetBinContent(binNumber));
91 m_cutBkg_lay1.push_back(input_bkg_m->GetBinContent(binNumber));
92 }
93 if (mm == 1) {
94 m_cutNorm_lay1.push_back(input_norm_M->GetBinContent(binNumber));
95 m_cutPow_lay1.push_back(input_pow_M->GetBinContent(binNumber));
96 m_cutBkg_lay1.push_back(input_bkg_M->GetBinContent(binNumber));
97 }
98 }
99 m_cutNorm_par.push_back(m_cutNorm_lay1);
100 m_cutPow_par.push_back(m_cutPow_lay1);
101 m_cutBkg_par.push_back(m_cutBkg_lay1);
102 m_cutNorm_lay1.clear();
103 m_cutPow_lay1.clear();
104 m_cutBkg_lay1.clear();
105 }
106 m_cutNorm_minmax.push_back(m_cutNorm_par);
107 m_cutPow_minmax.push_back(m_cutPow_par);
108 m_cutBkg_minmax.push_back(m_cutBkg_par);
109 m_cutNorm_par.clear();
110 m_cutPow_par.clear();
111 m_cutBkg_par.clear();
112 }
113 m_cutNorm.push_back(m_cutNorm_minmax);
114 m_cutPow.push_back(m_cutPow_minmax);
115 m_cutBkg.push_back(m_cutBkg_minmax);
116 m_cutNorm_minmax.clear();
117 m_cutPow_minmax.clear();
118 m_cutBkg_minmax.clear();
119 }
120 file->Close();
121 delete file;
122
123
124}
std::vector< std::vector< std::vector< std::vector< double > > > > m_cutPow
matrix of fit-parameter of cut, power
Definition: NoKickCuts.h:86
void FillCuts(std::string m_fileName)
This method fill the cuts (used in NoKickCutsEval method) to create the cutfile.
Definition: NoKickCuts.cc:59
double getCut(int layer1, int layer2, EParameters par, EMinMax m, ECutName cut)
Definition: NoKickCuts.cc:30
EParameters
enum for parameters name
Definition: NoKickCuts.h:44
int m_nbinpar
number of track parameter
Definition: NoKickCuts.h:89
ECutName
enum for the cuts name
Definition: NoKickCuts.h:53
EMinMax
enum for minimum/maximum value of cuts
Definition: NoKickCuts.h:38
int m_nbinlay
number of layers (IP too)
Definition: NoKickCuts.h:90
std::vector< std::vector< std::vector< std::vector< double > > > > m_cutNorm
matrix of fit-parameter of cut, norm
Definition: NoKickCuts.h:85
std::vector< std::vector< std::vector< std::vector< double > > > > m_cutBkg
matrix of fit-parameter of cut, constant
Definition: NoKickCuts.h:87
std::vector< double > cutSelector(double sintheta, double momentum, int layer1, int layer2, EParameters par)
This methods selects 2 cuts (minimum and maximum inside a vector) from the information of theta,...
Definition: NoKickCuts.cc:18
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28
Abstract base class for different kinds of events.