BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
HadronInterface.h
Go to the documentation of this file.
1//********************************************************************************
2// This file is part of the Widget, a package for performing dE/dx calibration.
3//
4// Author: Jake Bennett
5// Date: July 8, 2015
6//
7// HadronInterface is a class designed to be the point of contact with the user.
8// This class interfaces with the other Widget classes to perform the generation,
9// simulation, fitting, and correction tasks necessary for dE/dx calibration.
10//
11// For additional details, see the Widget document.
12//
13//********************************************************************************
14#ifndef HADRONINTERFACE_H
15#define HADRONINTERFACE_H
16
17#include <string>
18#include <iostream>
19#include <fstream>
20#include <cmath>
21#include <vector>
22
23#include "TFile.h"
24#include "TTree.h"
25#include "TH1F.h"
26#include "TH2F.h"
27#include "TF1.h"
28#include "TString.h"
29#include "TCanvas.h"
30#include "TRandom.h"
31#include "TMath.h"
32#include "TFitter.h"
33#include "TLegend.h"
34#include "TApplication.h"
35
38#include "HadronCalibration.h"
39#include "HadronPrep.h"
40
41using std::cout;
42using std::endl;
43
45
46 public:
47
49 virtual ~HadronInterface() {}
50
51 // set the member variables from the given configuration file
52 void SetupFromConfigFile( std::string configfile );
53
54 // set the name of the file containing the calibration parameters
55 void SetParamFile( std::string paramfile );
56
57 // print the HadronInterface parameters
58 void PrintParameters();
59
60 // declare the number of events and beta-gamma range for each particle type
61 void AddParticle( TString particle, TString filename, int nevents, int bgbins, double upperbg, double lowerbg, int cosbins, double uppercos, double lowercos );
62
63 // generate a set of histograms for validation/monitoring
64 void QualityCheck( TString outfilename );
65
66 // generate a sample of events and fill the vectors
67 void GenerateSample( TString particle );
68
69 // simulate a sample of events and fill the vectors
70 void SimulateSample( TString infilename, TString particle );
71
72 // simulate a sample of events and fill the vectors
73 void SimulateReconstruction( TString infilename, TString outfilename );
74
75 // ---------- methods for the hadron calibration ----------
76
77 // prepare the sample by fitting as a function of beta-gamma and cos(theta)
78 void PrepareSample( TString outfilename, bool correct, int particle );
79
80 // prepare the sample by fitting as a function of beta-gamma
81 void PrepareResults( TString outfilename, bool correct );
82
83 // perform the hadron saturation correction
84 void SaturationCorrection( TString prepfilename, std::string parfile );
85
86 // perform the beta-gamma fits
87 void BetaGammaFits( std::vector< TString > particles, TString filename );
88
89 // make some plots
90 void PlotBGCurve( std::vector< TString > particles, TString filename );
91
92 // perform the sigma fits (vs. nhit and sin(theta))
93 void SigmaFits( TString filename );
94
95 // plot efficiency
96 void PlotEfficiency( TString saveas );
97
98 private:
99
100 TString m_filenames[5]; // names of ROOT files that contain hit information
101 int m_nevents[5]; // the number of events stored in the vectors below
102 int m_mcFlag; // flag for hadron correction: 0 if data, 1 if mc
103 int m_type; // flag for MC type: 0 if BESIII, 1 if BELLEII
104
105 std::string m_paramfile; // file containing calibration parameters
106
107 std::vector< TString > m_types; // vector of particle types
108 std::map< TString, int > m_index; // map particle name to vector index
109 std::map< TString, double > m_mass; // map particle name to particle mass
110
111 int m_bgbins[5]; // number of beta-gamma bins
112 double m_upperbg[5]; // upper bound on beta-gamma
113 double m_lowerbg[5]; // lower bound on beta-gamma
114
115 int m_cosbins[5]; // number of cos(theta) bins
116 double m_uppercos[5]; // upper bound on cos(theta)
117 double m_lowercos[5]; // lower bound on cos(theta)
118};
119#endif
virtual ~HadronInterface()
void BetaGammaFits(std::vector< TString > particles, TString filename)
void SetParamFile(std::string paramfile)
void SimulateSample(TString infilename, TString particle)
void QualityCheck(TString outfilename)
void PrepareResults(TString outfilename, bool correct)
void PlotEfficiency(TString saveas)
void PrepareSample(TString outfilename, bool correct, int particle)
void SaturationCorrection(TString prepfilename, std::string parfile)
void PlotBGCurve(std::vector< TString > particles, TString filename)
void SetupFromConfigFile(std::string configfile)
void GenerateSample(TString particle)
void AddParticle(TString particle, TString filename, int nevents, int bgbins, double upperbg, double lowerbg, int cosbins, double uppercos, double lowercos)
void SigmaFits(TString filename)
void SimulateReconstruction(TString infilename, TString outfilename)