File indexing completed on 2025-12-16 09:16:13
0001 #ifndef BINNING_H
0002 #define BINNING_H
0003
0004 #include <map>
0005
0006 struct HistogramInfo
0007 {
0008 std::string name;
0009 std::string title;
0010 std::string axis_label;
0011 int nBins;
0012 float min;
0013 float max;
0014 std::string cut_string;
0015 std::string bin_string() const
0016 {
0017 return std::to_string(nBins)+","+std::to_string(min)+","+std::to_string(max);
0018 }
0019 };
0020
0021 TH1F* makeHistogram(std::string basename, std::string basetitle, HistogramInfo hinfo)
0022 {
0023 TH1F* h = new TH1F((basename+hinfo.name).c_str(),(basetitle+hinfo.title).c_str(),hinfo.nBins,hinfo.min,hinfo.max);
0024 return h;
0025 }
0026
0027 TH2F* make2DHistogram(std::string basename, std::string basetitle, HistogramInfo hinfo_x, HistogramInfo hinfo_y)
0028 {
0029 TH2F* h = new TH2F((basename+hinfo_x.name+hinfo_y.name).c_str(),(basetitle+hinfo_x.title+hinfo_y.title+";"+hinfo_x.axis_label+";"+hinfo_y.axis_label).c_str(),hinfo_x.nBins,hinfo_x.min,hinfo_x.max,hinfo_y.nBins,hinfo_y.min,hinfo_y.max);
0030 return h;
0031 }
0032
0033 namespace BinInfo
0034 {
0035 static const HistogramInfo final_pt_bins = {
0036 .name = "_vspt",
0037 .title = " vs. pT",
0038 .axis_label = "pT [GeV]",
0039 .nBins = 10,
0040 .min = 0.,
0041 .max = 5.,
0042 .cut_string = ""
0043 };
0044
0045 static const HistogramInfo final_rapidity_bins = {
0046 .name = "_vsy",
0047 .title = " vs. rapidity",
0048 .axis_label = "y",
0049 .nBins = 10,
0050 .min = -1.5,
0051 .max = 1.5,
0052 .cut_string = ""
0053 };
0054
0055 static const HistogramInfo final_phi_bins = {
0056 .name = "_vsphi",
0057 .title = " vs. phi",
0058 .axis_label = "#{phi}",
0059 .nBins = 10,
0060 .min = -3.15,
0061 .max = 3.15,
0062 .cut_string = ""
0063 };
0064
0065 static const HistogramInfo final_ntrack_bins = {
0066 .name = "_vsntrk",
0067 .title = " vs. nTracks",
0068 .axis_label = "number of tracks",
0069 .nBins = 11,
0070 .min = -0.5,
0071 .max = 100.5,
0072 .cut_string = ""
0073 };
0074
0075 static const HistogramInfo pt_bins = {
0076 .name = "_vspt",
0077 .title = " vs. pT",
0078 .axis_label = "pT [GeV]",
0079 .nBins = 100,
0080 .min = 0.,
0081 .max = 5.,
0082 .cut_string = ""
0083 };
0084
0085 static const HistogramInfo rapidity_bins = {
0086 .name = "_vsy",
0087 .title = " vs. rapidity",
0088 .axis_label = "y",
0089 .nBins = 100,
0090 .min = -1.5,
0091 .max = 1.5,
0092 .cut_string = ""
0093 };
0094
0095 static const HistogramInfo phi_bins = {
0096 .name = "_vsphi",
0097 .title = " vs. phi",
0098 .axis_label = "#{phi}",
0099 .nBins = 100,
0100 .min = -3.15,
0101 .max = 3.15,
0102 .cut_string = ""
0103 };
0104
0105 static const HistogramInfo ntrack_bins = {
0106 .name = "_vsntrk",
0107 .title = " vs. nTracks",
0108 .axis_label = "number of tracks",
0109 .nBins = 201,
0110 .min = -0.5,
0111 .max = 200.5,
0112 .cut_string = ""
0113 };
0114
0115 static const std::map<std::string,HistogramInfo> mass_bins = {
0116 {"K_S0", { .name = "Kshort_mass", .title = "K^0_S mass", .axis_label = "mass [GeV/c^{2}]",
0117 .nBins = 100, .min = 0.4, .max = 0.6,
0118
0119
0120
0121
0122
0123
0124
0125
0126 .cut_string = "" } },
0127 {"phi", { .name = "phi_mass", .title = "${phi} mass", .axis_label = "mass [GeV/c^{2}]",
0128 .nBins = 100, .min = 0.95, .max = 1.1,
0129 .cut_string = "track_1_MVTX_nStates>=2 && track_2_MVTX_nStates>=2 &&"
0130 "track_1_IP_xy<=0.05 && track_2_IP_xy<=0.05 && "
0131 "phi_decayLength<=0.05" } },
0132 {"Lambda0", { .name = "lambda_mass", .title = "${Lambda} mass", .axis_label = "mass [GeV/c^{2}]",
0133 .nBins = 100, .min = 1.05, .max = 1.2,
0134
0135
0136
0137
0138
0139
0140
0141
0142 .cut_string = "" } }
0143 };
0144 }
0145 #endif