Back to home page

sPhenix code displayed by LXR

 
 

    


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         // division : ---For constructor---------------------------------------------------------------------------------------------------------------------------------------------
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         // division : ---For input file---------------------------------------------------------------------------------------------------------------------------------------------
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         // note : for data?
0088         int MBDNSg2;
0089         int MBDNSg2_vtxZ10cm;
0090         int MBDNSg2_vtxZ30cm;
0091 
0092         int InttBcoFullDiff_next; // note : for data
0093 
0094         // note : for MC
0095         int NTruthVtx;
0096         float TruthPV_trig_z;
0097 
0098 
0099         // note : the flag
0100         int m_withTrig = false;
0101 
0102         // division : ---For output file---------------------------------------------------------------------------------------------------------------------------------------------
0103         void PrepareOutPutFileName();
0104         void PrepareOutputFile();
0105         std::string output_filename;
0106 
0107         TFile * file_out;
0108 
0109         // division : ---For Prepare Hist---------------------------------------------------------------------------------------------------------------------------------------------
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         // division : ---For analysis---------------------------------------------------------------------------------------------------------------------------------------------
0120         std::string ReplaceBy(const std::string& input_str, const std::string& target_str, const std::string& new_str);
0121 
0122 
0123         // division : ---For constants---------------------------------------------------------------------------------------------------------------------------------------------
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; // note : unit [cm]
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         // std::vector<std::pair<double,double>> Mbin_NClus_edges = {
0156         //     {6000,10000}, // note : 1 - 3
0157         //     {6000,10000}, // note : 4 - 6
0158         //     {6000,10000}, // note : 7 - 10
0159 
0160         //     {3500,8500}, // note : 11 - 15,
0161         //     {3500,8500}, // note : 16 - 20,
0162 
0163         //     {2000,6000}, // note : 21 - 25,
0164         //     {2000,6000}, // note : 26 - 30,
0165 
0166         //     {1200,4200}, // note : 31 - 35,
0167         //     {1200,4200}, // note : 36 - 40,
0168 
0169         //     {800,3000}, // note : 41 - 45,
0170         //     {800,3000}, // note : 46 - 50,
0171 
0172         //     {500,2500}, // note : 51 - 55,
0173         //     {500,2500}, // note : 56 - 60,
0174 
0175         //     {200,1600}, // note : 61 - 65,
0176         //     {200,1600}, // note : 66 - 70,
0177             
0178 
0179         //     {200,1600}, // note : 71,
0180         //     {200,1600}, // note : ,
0181         //     {200,1600}, // note : 81,
0182         //     {200,1600}, // note : ,
0183         //     {200,1600}, // note : 91,
0184         //     {200,1600} // note : ,
0185 
0186         // };
0187 
0188         std::vector<std::pair<double,double>> Mbin_NClus_edges = {
0189             {3700,8800}, // note : 1 - 3
0190             {3000,8000}, // note : 4 - 6
0191             {2500,7500}, // note : 7 - 10
0192 
0193             {2000,6500}, // note : 11 - 15,
0194             {1500,5500}, // note : 16 - 20,
0195 
0196             {1000,4700}, // note : 21 - 25, // note : 5
0197             {700,4000}, // note : 26 - 30,
0198 
0199             {700,3300}, // note : 31 - 35,
0200             {400,2800}, // note : 36 - 40,
0201 
0202             {300, 2400}, // note : 41 - 45,
0203             {200, 2000}, // note : 46 - 50,
0204 
0205             {0,1700}, // note : 51 - 55, // note : 11
0206             {0,1300}, // note : 56 - 60,
0207 
0208             {0, 1000}, // note : 61 - 65,
0209             {0, 800}, // note : 66 - 70,
0210             
0211 
0212             {200,1600}, // note : 71,
0213             {200,1600}, // note : ,
0214             {200,1600}, // note : 81,
0215             {200,1600}, // note : ,
0216             {200,1600}, // note : 91,
0217             {200,1600} // note : ,
0218 
0219         };
0220 
0221 };
0222 
0223 #endif