Belle II Software  release-06-01-15
ARICHReconstructionPar.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 <arich/dbobjects/ARICHReconstructionPar.h>
10 
11 #include <iostream>
12 #include <vector>
13 
14 using namespace std;
15 using namespace Belle2;
16 
17 
18 void ARICHReconstructionPar::initializeDefault()
19 {
20 
21  double parsBkg[8] = {1, 0, 0.0062, 5.0, 0.10364, 20.0596, 0.002103, -0.0031283};
22  m_bkgPDF = new TF1("bkgPDF",
23  "((1-[1])*[2]*exp(-[3]*x) + [1]*([4]*exp(-[5]*x)+[6]+[7]*x))*(1-1/1.5/1.5/[0]/[0])*TMath::Floor(1.5*[0])");
24  m_bkgPDF->SetParameters(parsBkg);
25 
26  double parsRes[4] = {1.12147e-01, 3.81701e+00, 0.0093, -6.14984e-04};
27  m_thcResolution = new TF1("thcResolution", "[0]*exp(-[1]*x)+[2]+[3]*x");
28  m_thcResolution->SetParameters(parsRes);
29 
30  m_pars = {0.18, 0.13};
31  m_flatBkgPerPad = 0.0014;
32 
33  m_aerogelFOM = {11.3, 13.0};
34 }
35 
36 double ARICHReconstructionPar::getBackgroundPerPad(double th_cer, const std::vector<double>& pars) const
37 {
38 
39  int ipar = 0;
40  for (auto par : pars) {
41  m_bkgPDF->SetParameter(ipar, par);
42  ipar++;
43  }
44  return m_bkgPDF->Eval(th_cer) + m_flatBkgPerPad;
45 }
46 
47 double ARICHReconstructionPar::getExpectedBackgroundHits(const std::vector<double>& pars, double minThc, double maxThc) const
48 {
49 
50  int ipar = 0;
51  for (auto par : pars) {
52  m_bkgPDF->SetParameter(ipar, par);
53  ipar++;
54  }
55 
56  // parameters of fit of pol3 to the number of nPads per ring with given theta and width 5mrad
57  double surf[4] = { -2.19669e-02, 3.59010e+01, -2.77441e+01, 1.43564e+02};
58  double step = 0.005;
59  double thc = minThc + step / 2.;
60  double bkg = 0;
61  while (thc < maxThc) {
62  bkg += (surf[0] + surf[1] * thc + surf[2] * pow(thc, 2) + surf[3] * pow(thc, 3)) * getBackgroundPerPad(thc, pars);
63  thc += step;
64  }
65  return bkg;
66 
67 }
68 
69 double ARICHReconstructionPar::getNPadsInRing(double maxThc, double minThc, double trackTh) const
70 {
71 
72  double s1 = sqrt(tan(maxThc)) * pow((tan(maxThc + trackTh) + tan(maxThc - trackTh)) / 2, 3. / 2.);
73  double s2 = 0;
74  if (minThc > 0) s2 = sqrt(tan(minThc)) * pow((tan(minThc + trackTh) + tan(minThc - trackTh)) / 2, 3. / 2.);
75  return 3.1416 * 0.18 * 0.18 * (s1 - s2) * 0.6 / 0.005 / 0.005; // pi*dist^2*s*avg_geo_acc/pad_size
76 }
77 
78 void ARICHReconstructionPar::print() const
79 {
80 
81  cout << endl << "-----bkg PDF-----" << endl;
82  m_bkgPDF->Print();
83  int Npar = m_bkgPDF->GetNpar();
84  std::vector<double> bkgPars(Npar, 0);
85  m_bkgPDF->GetParameters(bkgPars.data());
86  for (int i = 0; i < Npar; i++)cout << Form("bkg Pars %d = %e", i, bkgPars[i]) << endl;
87 
88  cout << endl << "-----flat backgroud per pad-----" << endl;
89  cout << " flat background per pad is " << m_flatBkgPerPad << endl;
90 
91  cout << endl << "----additional parameters (for wide gaus)-----" << endl;
92  for (int i = 0; i < (int)m_pars.size(); i++) {
93  printf("m_pars[%d] = %e\n", i, m_pars[i]);
94  }
95 
96  cout << endl << "----Aerogel FOM-----" << endl;
97  for (int i = 0; i < (int)m_aerogelFOM.size(); i++) {
98  printf("m_aerogelFOM[%d] = %f\n", i, m_aerogelFOM[i]);
99  }
100 
101  cout << endl << "----- Resolution PDF-----" << endl;
102  m_thcResolution->Print();
103  double resPars[4];
104  m_thcResolution->GetParameters(resPars);
105  for (int i = 0; i < 4; i++)cout << Form("resolution Pars %d = %e", i, resPars[i]) << endl;
106 
107 }
Abstract base class for different kinds of events.