File indexing completed on 2025-08-09 08:12:15
0001 #ifndef VTXZDIST_H
0002 #define VTXZDIST_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 #include "../../EvtVtxZTracklet/structure.h"
0033
0034 class vtxZDist{
0035 public:
0036 vtxZDist(
0037 int process_id_in,
0038 int runnumber_in,
0039 int run_nEvents_in,
0040 std::string input_directory_in,
0041 std::string input_file_name_in,
0042 std::string output_directory_in,
0043
0044 std::string output_file_name_suffix_in = "",
0045
0046 bool Apply_cut_in = false,
0047 bool ApplyVtxZReWeighting_in = false,
0048 std::pair<bool, int> ApplyEvtBcoFullDiffCut_in = {true, 61}
0049 );
0050
0051 std::string GetOutputFileName() {return output_filename;}
0052 void SetINTTvtxZReweighting(TH1D * h1D_INTT_vtxZ_reweighting_in) {h1D_INTT_vtxZ_reweighting = (TH1D*)h1D_INTT_vtxZ_reweighting_in->Clone("INTT_vtxZ_reweighting");}
0053 void PrepareEvent();
0054 void EndRun();
0055
0056 protected:
0057
0058
0059 int process_id;
0060 int runnumber;
0061 int run_nEvents;
0062 std::string input_directory;
0063 std::string input_file_name;
0064 std::string output_directory;
0065 std::string output_file_name_suffix;
0066 bool Apply_cut;
0067 bool ApplyVtxZReWeighting;
0068 std::pair<bool, int> ApplyEvtBcoFullDiffCut;
0069
0070
0071 void PrepareInputFile();
0072 std::map<std::string, int> GetInputTreeBranches(TTree * m_tree_in);
0073 TFile * file_in;
0074 TTree * tree_in;
0075 std::string tree_name = "EventTree";
0076
0077 bool is_min_bias;
0078 float MBD_centrality;
0079 float MBD_z_vtx;
0080 float MBD_charge_sum;
0081
0082 double INTTvtxZ;
0083 double INTTvtxZError;
0084 double NgroupTrapezoidal;
0085 double NgroupCoarse;
0086 double TrapezoidalFitWidth;
0087 double TrapezoidalFWHM;
0088
0089 int NClus;
0090 int NClus_Layer1;
0091
0092
0093
0094 int MBDNSg2;
0095 int MBDNSg2_vtxZ10cm;
0096 int MBDNSg2_vtxZ30cm;
0097
0098 int InttBcoFullDiff_next;
0099
0100
0101 int NTruthVtx;
0102 float TruthPV_trig_z;
0103
0104
0105
0106 int m_withTrig = false;
0107
0108
0109 void PrepareOutPutFileName();
0110 void PrepareOutputFile();
0111 std::string output_filename;
0112
0113 TFile * file_out;
0114
0115
0116 void PrepareHist();
0117 std::map<std::string, TH1D*> h1D_map;
0118 std::map<std::string, TH2D*> h2D_map;
0119 TH1D * h1D_INTT_vtxZ_reweighting = nullptr;
0120 TH1D * h1D_centrality_bin;
0121
0122
0123
0124
0125
0126
0127 std::vector<double> centrality_edges = Constants::centrality_edges;
0128 int nCentrality_bin;
0129
0130 int nVtxZ_bin = 120;
0131 std::pair<double, double> vtxZ_range = {-60, 60};
0132
0133 int nVtxZ_bin_narrow = 20;
0134 std::pair<double, double> vtxZ_range_narrow = {-20, 20};
0135
0136 int HighNClus = 500;
0137
0138 double cut_GoodRecoVtxZ = Constants::cut_GoodRecoVtxZ;
0139
0140 std::pair<double, double> cut_vtxZDiff = Constants::cut_vtxZDiff;
0141 std::pair<double, double> cut_TrapezoidalFitWidth = Constants::cut_TrapezoidalFitWidth;
0142 std::pair<double, double> cut_TrapezoidalFWHM = Constants::cut_TrapezoidalFWHM;
0143 std::pair<double, double> cut_INTTvtxZError = Constants::cut_INTTvtxZError;
0144 std::pair<double, double> cut_GlobalMBDvtxZ = Constants::cut_GlobalMBDvtxZ;
0145 std::pair<double, double> cut_AnaVtxZ = Constants::cut_AnaVtxZ;
0146
0147 double VtxZEdge_min = Constants::VtxZEdge_min;
0148 double VtxZEdge_max = Constants::VtxZEdge_max;
0149 int nVtxZBin = Constants::nVtxZBin;
0150
0151 int cut_InttBcoFullDIff_next = Constants::cut_InttBcoFullDIff_next;
0152 int Semi_inclusive_bin = Constants::Semi_inclusive_bin;
0153
0154 };
0155
0156 #endif