Belle II Software  release-05-02-19
CDCDedx2DCellAlgorithm.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2016 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: jvbennett *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <calibration/CalibrationAlgorithm.h>
14 
15 #include <TH1F.h>
16 
17 #include <iostream>
18 
19 namespace Belle2 {
28  class CDCDedx2DCellAlgorithm : public CalibrationAlgorithm {
29 
30  public:
31 
36 
40  virtual ~CDCDedx2DCellAlgorithm() {}
41 
45  void setGlobalEntaBins(int value) {fnEntaBinG = value;}
46 
50  void setGlobalDocaBins(int value) {fnDocaBinG = value;}
51 
55  void setAsymmetricBins(bool value) {IsLocalBin = value;}
56 
60  void setRotationSymmetry(bool value) {IsRS = value;}
61 
65  void setOutFilePrefix(const std::string& value) {fSetPrefix = value;}
66 
70  void setMonitoringPlots(bool value = false) {IsMakePlots = value;}
74  int GetRotationSymmericBin(int nbin, int ibin)
75  {
76 
77  if (nbin % 4 != 0)return -1;
78  int jbin;
79  if (ibin <= nbin / 4) jbin = ibin + nbin / 2 ;
80  else if (ibin > 3 * nbin / 4) jbin = ibin - nbin / 2 ;
81  else jbin = ibin;
82 
83  return jbin;
84  }
85 
89  void GetVariableBin(int nbin, std::vector<int>& nBinEnta0to100Per)
90  {
91 
92  if (nbin % 8 != 0) {
93  std::cout << "Please select global in multiple of 8 " << std::endl;
94  return ;
95  }
96 
97  int jbin = -1;
98  std::vector<int> nBinEnta0to25Per;
99  for (int ibin = 0; ibin < nbin / 4; ibin++) {
100  if (ibin < nbin / 8) jbin++;
101  else if (TMath::Abs(ibin - nbin / 8) % 2 == 0)jbin++;
102  nBinEnta0to25Per.push_back(jbin);
103  }
104 
105  std::vector<int> temp = nBinEnta0to25Per;
106  std::reverse(temp.begin(), temp.end());
107 
108  std::vector<int> nBinEnta25to50Per; //second half (0 to pi/2)
109  for (unsigned int it = 0; it < temp.size(); ++it)nBinEnta25to50Per.push_back(2 * jbin - temp.at(it) + 1);
110 
111  std::vector<int> nBinEnta0to50Per = nBinEnta0to25Per;
112  nBinEnta0to50Per.insert(nBinEnta0to50Per.end(), nBinEnta25to50Per.begin(), nBinEnta25to50Per.end());
113 
114  std::vector<int> nBinEnta50to100Per;
115  for (unsigned int it = 0; it < nBinEnta0to50Per.size(); ++it) {
116  nBinEnta50to100Per.push_back(nBinEnta0to50Per.at(nBinEnta0to50Per.size() - 1) + nBinEnta0to50Per.at(it) + 1);
117  }
118 
119  nBinEnta0to100Per = nBinEnta0to50Per;
120  nBinEnta0to100Per.insert(nBinEnta0to100Per.end(), nBinEnta50to100Per.begin(), nBinEnta50to100Per.end());
121 
122  TH1F* tempEnta = new TH1F("tempEnta", "tempEnta", fnEntaBinG, feaLE, feaUE);
123  fEntaBinValues.push_back(tempEnta->GetBinLowEdge(1)); //first and last manual
124  for (unsigned int i = 0; i < nBinEnta0to100Per.size() - 1; ++i) {
125  if (nBinEnta0to100Per.at(i) < nBinEnta0to100Per.at(i + 1)) {
126  double binval = tempEnta->GetBinLowEdge(i + 1) + tempEnta->GetBinWidth(i + 1);
127  if (TMath::Abs(binval) < 10e-5)binval = 0; //avoid infinite deep
128  fEntaBinValues.push_back(binval);
129  } else continue;
130  }
131  fEntaBinValues.push_back(tempEnta->GetBinLowEdge(fnEntaBinG) + tempEnta->GetBinWidth(fnEntaBinG));
132  delete tempEnta;
133  }
134 
135 
136  protected:
137 
141  virtual EResult calibrate() override;
142 
143  private:
144 
150  int fnEntaBinG;
151  int fnDocaBinG;
152  int fnEntaBinL;
153  int fnDocaBinL;
155  Double_t feaLE;
156  Double_t feaUE;
157  Double_t feaBS;
159  Double_t fdocaLE;
160  Double_t fdocaUE;
161  Double_t fdocaBS;
163  std::string fSetPrefix;
164  std::vector<int> fDocaBinNums;
165  std::vector<double> fDocaBinValues;
167  std::vector<int> fEntaBinNums;
168  std::vector<double> fEntaBinValues;
170  bool IsLocalBin;
171  bool IsMakePlots;
172  bool IsRS;
173  };
175 } // namespace Belle2
Belle2::CDCDedx2DCellAlgorithm::fdocaUE
Double_t fdocaUE
Upper edge of doca.
Definition: CDCDedx2DCellAlgorithm.h:168
Belle2::CDCDedx2DCellAlgorithm::setAsymmetricBins
void setAsymmetricBins(bool value)
Set asym bins flag to on or off.
Definition: CDCDedx2DCellAlgorithm.h:63
Belle2::CDCDedx2DCellAlgorithm::setMonitoringPlots
void setMonitoringPlots(bool value=false)
funtion to set flag active for plotting
Definition: CDCDedx2DCellAlgorithm.h:78
Belle2::CDCDedx2DCellAlgorithm::setGlobalDocaBins
void setGlobalDocaBins(int value)
Set doca angle bins, Global anything is fine for the moment.
Definition: CDCDedx2DCellAlgorithm.h:58
Belle2::CDCDedx2DCellAlgorithm::IsRS
bool IsRS
if rotation symmtery requested
Definition: CDCDedx2DCellAlgorithm.h:180
Belle2::CDCDedx2DCellAlgorithm::IsMakePlots
bool IsMakePlots
produce plots for status
Definition: CDCDedx2DCellAlgorithm.h:179
Belle2::CDCDedx2DCellAlgorithm::GetRotationSymmericBin
int GetRotationSymmericBin(int nbin, int ibin)
funtion to set rotation symmetry
Definition: CDCDedx2DCellAlgorithm.h:82
Belle2::CDCDedx2DCellAlgorithm::fDocaBinValues
std::vector< double > fDocaBinValues
Vector for doca asym bin #.
Definition: CDCDedx2DCellAlgorithm.h:173
Belle2::CDCDedx2DCellAlgorithm::fnDocaBinG
int fnDocaBinG
doca angle bins, Global
Definition: CDCDedx2DCellAlgorithm.h:159
Belle2::CDCDedx2DCellAlgorithm::fDocaBinNums
std::vector< int > fDocaBinNums
Vector for enta asym bin #.
Definition: CDCDedx2DCellAlgorithm.h:172
Belle2::CDCDedx2DCellAlgorithm::fnDocaBinL
int fnDocaBinL
doca angle bins, Local
Definition: CDCDedx2DCellAlgorithm.h:161
Belle2::CDCDedx2DCellAlgorithm::setRotationSymmetry
void setRotationSymmetry(bool value)
Set asym bins flag to on or off.
Definition: CDCDedx2DCellAlgorithm.h:68
Belle2::CDCDedx2DCellAlgorithm::calibrate
virtual EResult calibrate() override
2D Cell algorithm algorithm
Definition: CDCDedx2DCellAlgorithm.cc:55
Belle2::CDCDedx2DCellAlgorithm::fdocaLE
Double_t fdocaLE
Lower edge of doca.
Definition: CDCDedx2DCellAlgorithm.h:167
Belle2::CDCDedx2DCellAlgorithm::fSetPrefix
std::string fSetPrefix
prefix to filename
Definition: CDCDedx2DCellAlgorithm.h:171
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::CDCDedx2DCellAlgorithm::fEntaBinValues
std::vector< double > fEntaBinValues
Vector for doca asym bin values.
Definition: CDCDedx2DCellAlgorithm.h:176
Belle2::CDCDedx2DCellAlgorithm::setOutFilePrefix
void setOutFilePrefix(const std::string &value)
adding prefix to filenae for uniqueness in each iter
Definition: CDCDedx2DCellAlgorithm.h:73
Belle2::CDCDedx2DCellAlgorithm::fEntaBinNums
std::vector< int > fEntaBinNums
Vector for enta asym bin values.
Definition: CDCDedx2DCellAlgorithm.h:175
Belle2::CDCDedx2DCellAlgorithm::feaUE
Double_t feaUE
Upper edge of enta angle.
Definition: CDCDedx2DCellAlgorithm.h:164
Belle2::CDCDedx2DCellAlgorithm::feaLE
Double_t feaLE
Lower edge of enta angle.
Definition: CDCDedx2DCellAlgorithm.h:163
Belle2::CalibrationAlgorithm::EResult
EResult
The result of calibration.
Definition: CalibrationAlgorithm.h:50
Belle2::CDCDedx2DCellAlgorithm::fdocaBS
Double_t fdocaBS
Binwidth edge of doca.
Definition: CDCDedx2DCellAlgorithm.h:169
Belle2::CDCDedx2DCellAlgorithm::fnEntaBinL
int fnEntaBinL
etna angle bins, Local
Definition: CDCDedx2DCellAlgorithm.h:160
Belle2::CDCDedx2DCellAlgorithm::CDCDedx2DCellAlgorithm
CDCDedx2DCellAlgorithm()
Constructor: Sets the description the properties and the parameters of the algorithm.
Definition: CDCDedx2DCellAlgorithm.cc:32
Belle2::CDCDedx2DCellAlgorithm::setGlobalEntaBins
void setGlobalEntaBins(int value)
Set etna angle bins, Global in multiple of 8.
Definition: CDCDedx2DCellAlgorithm.h:53
Belle2::CDCDedx2DCellAlgorithm::IsLocalBin
bool IsLocalBin
if local variable bin requested
Definition: CDCDedx2DCellAlgorithm.h:178
Belle2::CDCDedx2DCellAlgorithm::~CDCDedx2DCellAlgorithm
virtual ~CDCDedx2DCellAlgorithm()
Destructor.
Definition: CDCDedx2DCellAlgorithm.h:48
Belle2::CDCDedx2DCellAlgorithm::feaBS
Double_t feaBS
Binwidth edge of enta angle.
Definition: CDCDedx2DCellAlgorithm.h:165
Belle2::CDCDedx2DCellAlgorithm::GetVariableBin
void GetVariableBin(int nbin, std::vector< int > &nBinEnta0to100Per)
funtion to set variable bins
Definition: CDCDedx2DCellAlgorithm.h:97
Belle2::CDCDedx2DCellAlgorithm::fnEntaBinG
int fnEntaBinG
Save arithmetic and truncated mean for the 'dedx' values.
Definition: CDCDedx2DCellAlgorithm.h:158