File indexing completed on 2025-08-09 08:12:20
0001 #ifndef TRACKLETHISTOGRAMFILL_H
0002 #define TRACKLETHISTOGRAMFILL_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
0015 #include <TObjArray.h>
0016
0017 #include "../EvtVtxZTracklet/structure.h"
0018 #include "../Constants.h"
0019
0020 class TrackletHistogramFill{
0021
0022 public:
0023 TrackletHistogramFill(
0024 int process_id_in,
0025 int runnumber_in,
0026
0027 std::string output_directory_in,
0028 std::string output_file_name_suffix_in
0029 );
0030
0031 void SetvtxZReweight(bool tag){ vtxZReweight = tag; }
0032 void SetBcoFullDiffCut(bool tag){ BcoFullDiffCut = tag; }
0033 void SetINTT_vtxZ_QA(bool tag){ INTT_vtxZ_QA = tag; }
0034 void SetWithRotate(bool tag){ isWithRotate = tag; }
0035 void SetClusQA(std::pair<bool, std::pair<double, double>> pair_in) {isClusQA = pair_in;}
0036
0037 void SetVtxZReweightHist(TH1D * input_hist) {h1D_vtxZReweightFactor = (TH1D*)input_hist->Clone();}
0038
0039 virtual void PrepareOutPutFileName();
0040 std::string GetOutputFileName() {return output_filename;}
0041 virtual void PrepareOutPutRootFile();
0042 virtual void PrepareHistograms();
0043 void FillHistogram(
0044
0045 float MBD_z_vtx,
0046 int is_min_bias,
0047 float MBD_centrality,
0048 float MBD_south_charge_sum,
0049 float MBD_north_charge_sum,
0050
0051
0052 int InttBcoFullDiff_next,
0053
0054
0055 int MBDNSg2,
0056
0057
0058
0059
0060
0061
0062
0063
0064 std::vector<unsigned char> *ClusLadderZId,
0065
0066 std::vector<int> *ClusAdc,
0067 std::vector<float> *ClusPhiSize,
0068
0069
0070 double INTTvtxZ,
0071 double INTTvtxZError,
0072
0073
0074 double TrapezoidalFitWidth,
0075 double TrapezoidalFWHM,
0076
0077
0078 std::vector<pair_str> *evt_TrackletPair_vec,
0079 std::vector<pair_str> *evt_TrackletPairRotate_vec,
0080
0081
0082
0083
0084 float TruthPV_trig_z,
0085 int NTruthVtx,
0086 int NPrimaryG4P,
0087
0088 std::vector<float> *PrimaryG4P_Eta,
0089
0090
0091
0092 std::vector<int> *PrimaryG4P_isChargeHadron
0093 );
0094 void EndRun();
0095
0096 protected:
0097
0098
0099 int process_id;
0100 int runnumber;
0101 std::string output_directory;
0102 std::string output_file_name_suffix;
0103
0104 bool vtxZReweight;
0105 bool BcoFullDiffCut;
0106 bool INTT_vtxZ_QA;
0107 bool isWithRotate;
0108 std::pair<bool, std::pair<double, double>> isClusQA;
0109
0110
0111 TFile * file_out;
0112 TTree * tree_out_par;
0113 std::string output_filename;
0114
0115
0116 void EvtCleanUp();
0117 std::map<int,int> Used_Clus_index_map;
0118 std::vector<double> Pair_DeltaPhi_vec;
0119
0120
0121
0122 std::map<std::string,TH1D*> h1D_map;
0123 std::map<std::string, TH2D*> h2D_map;
0124
0125 TH1D * h1D_PairDeltaEta_inclusive;
0126 TH1D * h1D_PairDeltaPhi_inclusive;
0127
0128
0129 TH1D * h1D_centrality_bin;
0130
0131
0132
0133
0134 TH1D * h1D_vtxZReweightFactor = nullptr;
0135 double vtxZReweightFactor;
0136
0137
0138
0139
0140 double CentralityFineEdge_min = -0.005;
0141 double CentralityFineEdge_max = 1.005;
0142 int nCentralityFineBin = 101;
0143
0144
0145 double EtaEdge_min = -2.7;
0146 double EtaEdge_max = 2.7;
0147 int nEtaBin = 27;
0148 TH1D * h1D_eta_template;
0149
0150
0151 double VtxZEdge_min = -45;
0152 double VtxZEdge_max = 45;
0153 int nVtxZBin = 18;
0154 TH1D * h1D_vtxz_template;
0155
0156
0157 double DeltaPhiEdge_min = -0.07;
0158 double DeltaPhiEdge_max = 0.07;
0159 int nDeltaPhiBin = 140;
0160
0161
0162 double DeltaEtaEdge_min = -1.;
0163 double DeltaEtaEdge_max = 1.;
0164 int nDeltaEtaBin = 100;
0165
0166 std::vector<int> typeA_sensorZID = {0,2};
0167
0168 std::pair<double, double> cut_GlobalMBDvtxZ = Constants::cut_GlobalMBDvtxZ;
0169 std::pair<double, double> cut_vtxZDiff = Constants::cut_vtxZDiff;
0170 std::pair<double, double> cut_TrapezoidalFitWidth = Constants::cut_TrapezoidalFitWidth;
0171 std::pair<double, double> cut_TrapezoidalFWHM = Constants::cut_TrapezoidalFWHM;
0172 std::pair<double, double> cut_INTTvtxZError = Constants::cut_INTTvtxZError;
0173
0174 int cut_InttBcoFullDIff_next = Constants::cut_InttBcoFullDIff_next;
0175
0176 std::vector<double> centrality_edges = Constants::centrality_edges;
0177 int nCentrality_bin;
0178
0179
0180 std::pair<double, double> cut_bestPair_DeltaPhi = {0,0.017};
0181 std::pair<double, double> cut_GoodProtoTracklet_DeltaPhi = {-0.017,0.017};
0182 };
0183
0184 #endif