File indexing completed on 2025-08-06 08:12:37
0001 #ifndef INTTVTXZQA_BIAS_H
0002 #define INTTVTXZQA_BIAS_H
0003
0004 #include <iostream>
0005 #include <vector>
0006 #include <string>
0007 #include <numeric>
0008
0009 #include <TFile.h>
0010 #include <TTree.h>
0011 #include <TH2D.h>
0012 #include <TH1D.h>
0013 #include <TMath.h>
0014 #include <TF1.h>
0015 #include <TProfile.h>
0016 #include <TCanvas.h>
0017 #include <TPad.h>
0018 #include <TGraphErrors.h>
0019 #include <TLatex.h>
0020
0021 #include <TCanvas.h> // note : for the combined case
0022 #include <TGraph.h> // note : for the combined case
0023
0024 #include <TRandom.h> // note : for the offset
0025 #include <TRandom3.h> // note : for the offset
0026
0027 #include <TColor.h>
0028
0029 #include <TObjArray.h>
0030
0031 #include "../Constants.h"
0032
0033 class InttVtxZQA_Bias{
0034 public:
0035 InttVtxZQA_Bias(
0036 int process_id_in,
0037 int runnumber_in,
0038 int run_nEvents_in,
0039 std::string input_directory_in,
0040 std::string input_file_name_in,
0041 std::string output_directory_in,
0042
0043 std::string output_file_name_suffix_in = "",
0044
0045 std::pair<bool, int> ApplyEvtBcoFullDiffCut_in = {true, 61}
0046 );
0047
0048 std::string GetOutputFileName() {return output_filename;}
0049 void PrepareEvent();
0050 void EndRun();
0051
0052 protected:
0053
0054
0055 int process_id;
0056 int runnumber;
0057 int run_nEvents;
0058 std::string input_directory;
0059 std::string input_file_name;
0060 std::string output_directory;
0061 std::string output_file_name_suffix;
0062 std::pair<bool, int> ApplyEvtBcoFullDiffCut;
0063
0064
0065 void PrepareInputFile();
0066 std::map<std::string, int> GetInputTreeBranches(TTree * m_tree_in);
0067 TFile * file_in;
0068 TTree * tree_in;
0069 std::string tree_name = "EventTree";
0070
0071 bool is_min_bias;
0072 float MBD_centrality;
0073 float MBD_z_vtx;
0074 float MBD_charge_sum;
0075
0076 double INTTvtxZ;
0077 double INTTvtxZError;
0078 double NgroupTrapezoidal;
0079 double NgroupCoarse;
0080 double TrapezoidalFitWidth;
0081 double TrapezoidalFWHM;
0082
0083 int NClus;
0084 int NClus_Layer1;
0085
0086
0087
0088 int MBDNSg2;
0089 int MBDNSg2_vtxZ10cm;
0090 int MBDNSg2_vtxZ30cm;
0091
0092 int InttBcoFullDiff_next;
0093
0094
0095 int NTruthVtx;
0096 float TruthPV_trig_z;
0097
0098
0099
0100 int m_withTrig = false;
0101
0102
0103 void PrepareOutPutFileName();
0104 void PrepareOutputFile();
0105 std::string output_filename;
0106
0107 TFile * file_out;
0108
0109
0110 void PrepareHist();
0111 std::map<std::string, TH1D*> h1D_NoQA_map;
0112 std::map<std::string, TH2D*> h2D_NoQA_map;
0113
0114 std::map<std::string, TH1D*> h1D_PostQA_map;
0115 std::map<std::string, TH2D*> h2D_PostQA_map;
0116
0117 TH1D * h1D_centrality_bin;
0118
0119
0120 std::string ReplaceBy(const std::string& input_str, const std::string& target_str, const std::string& new_str);
0121
0122
0123
0124 std::vector<double> centrality_edges = Constants::centrality_edges;
0125 int nCentrality_bin;
0126
0127 int nVtxZ_bin = 60;
0128 std::pair<double, double> vtxZ_range = {-60, 60};
0129
0130 int nVtxZ_bin_narrow = 20;
0131 std::pair<double, double> vtxZ_range_narrow = {-20, 20};
0132
0133 int HighNClus = 500;
0134
0135 double cut_GoodRecoVtxZ = Constants::cut_GoodRecoVtxZ;
0136
0137 double CentralityFineEdge_min = -0.5;
0138 double CentralityFineEdge_max = 100.5;
0139 int nCentralityFineBin = 101;
0140
0141 std::pair<double, double> cut_vtxZDiff = Constants::cut_vtxZDiff;
0142 std::pair<double, double> cut_TrapezoidalFitWidth = Constants::cut_TrapezoidalFitWidth;
0143 std::pair<double, double> cut_TrapezoidalFWHM = Constants::cut_TrapezoidalFWHM;
0144 std::pair<double, double> cut_INTTvtxZError = Constants::cut_INTTvtxZError;
0145 std::pair<double, double> cut_GlobalMBDvtxZ = Constants::cut_GlobalMBDvtxZ;
0146 std::pair<double, double> cut_AnaVtxZ = Constants::cut_AnaVtxZ;
0147
0148 double VtxZEdge_min = Constants::VtxZEdge_min;
0149 double VtxZEdge_max = Constants::VtxZEdge_max;
0150 int nVtxZBin = Constants::nVtxZBin;
0151
0152 int cut_InttBcoFullDIff_next = Constants::cut_InttBcoFullDIff_next;
0153 int Semi_inclusive_bin = Constants::Semi_inclusive_bin;
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174
0175
0176
0177
0178
0179
0180
0181
0182
0183
0184
0185
0186
0187
0188 std::vector<std::pair<double,double>> Mbin_NClus_edges = {
0189 {3700,8800},
0190 {3000,8000},
0191 {2500,7500},
0192
0193 {2000,6500},
0194 {1500,5500},
0195
0196 {1000,4700},
0197 {700,4000},
0198
0199 {700,3300},
0200 {400,2800},
0201
0202 {300, 2400},
0203 {200, 2000},
0204
0205 {0,1700},
0206 {0,1300},
0207
0208 {0, 1000},
0209 {0, 800},
0210
0211
0212 {200,1600},
0213 {200,1600},
0214 {200,1600},
0215 {200,1600},
0216 {200,1600},
0217 {200,1600}
0218
0219 };
0220
0221 };
0222
0223 #endif