Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:12:37

0001 #ifndef GETFINALRESULT_H
0002 #define GETFINALRESULT_H
0003 
0004 #include <iostream>
0005 #include <vector>
0006 #include <string>
0007 #include <numeric>
0008 #include <cctype> // For isdigit
0009 
0010 #include <TFile.h>
0011 #include <TTree.h>
0012 #include <TH2D.h>
0013 #include <TH1D.h>
0014 #include <TMath.h>
0015 #include <TF1.h>
0016 #include <TProfile.h>
0017 #include <TCanvas.h>
0018 #include <TPad.h>
0019 #include <TGraphErrors.h>
0020 #include <TLatex.h>
0021 #include <THStack.h>
0022 #include <TCanvas.h> // note : for the combined case
0023 #include <TGraph.h>  // note : for the combined case
0024 
0025 #include <TKey.h>
0026 #include <TRandom.h> // note : for the offset
0027 #include <TRandom3.h> // note : for the offset
0028 
0029 #include <TColor.h>
0030 #include <TLegend.h>
0031 
0032 #include <TObjArray.h>
0033 
0034 #include "../Constants.h"
0035 #include "sPhenixStyle.h"
0036 
0037 #include "../PreparedNdEta/PreparedNdEtaEach.h"
0038 
0039 using namespace std;
0040 
0041 class GetFinalResult{
0042     public:
0043         GetFinalResult(
0044             int runnumber_in,
0045             int SelectedMbin_in, // note : 0, 1, ---- 10, 70, 100 
0046             std::pair<double,double> vtxZ_range_in, // note : cm
0047             bool isTypeA_in,
0048             bool ApplyGeoAccCorr_in,
0049             std::pair<bool, std::pair<double,double>> cut_EtaRange_in,
0050 
0051             std::string output_file_name_suffix_in,
0052 
0053             std::string output_directory_in
0054         );
0055 
0056         std::string GetSetResultRangeFolderName() {
0057             return SetResultRangeFolderName;
0058         }
0059 
0060         void SetBaseLineDeltaPhiCut(std::pair<double,double> DeltaPhiCut_in) {
0061             BaseLineDeltaPhiCut = DeltaPhiCut_in;
0062         }
0063 
0064         // note : here are for preparing the reco. dNdEta
0065         void PrepareBaseLine(
0066             std::string data_input_directory,
0067             std::string data_input_filename,
0068             
0069             std::string MC_input_directory,
0070             std::string MC1_input_filename,
0071             std::string MC2_input_filename
0072         );
0073         
0074         void PrepareRunSegment(
0075             std::string data_input_directory,
0076             std::vector<std::string> data_input_filename,
0077             
0078             std::string MC_input_directory,
0079             std::string MC1_input_filename,
0080             std::string MC2_input_filename
0081         ); // note : two times
0082         
0083         void PrepareClusAdcCut(
0084             int run_index, // note : 0, 1,
0085             std::string data_input_directory,
0086             std::string data_input_filename,
0087             
0088             std::string MC_input_directory,
0089             std::string MC1_input_filename,
0090             std::string MC2_input_filename
0091         ); // todo : can be twice
0092         
0093         void PrepareClusPhiCut(
0094             std::string data_input_directory,
0095             std::vector<std::string> data_input_filename,
0096             
0097             std::string MC_input_directory,
0098             std::string MC1_input_filename,
0099             std::string MC2_input_filename  
0100         ); 
0101         
0102         void PrepareDeltaPhiCut(
0103             std::vector<double> cut_SigDeltaPhi,    
0104             std::string data_input_directory,
0105             std::string data_input_filename,
0106             
0107             std::string MC_input_directory,
0108             std::string MC1_input_filename,
0109             std::string MC2_input_filename
0110         ); // note : two times 
0111 
0112         void PrepareAMPT(
0113             std::string data_input_directory,
0114             std::vector<std::string> data_input_filename,
0115             
0116             std::string MC_input_directory,
0117             std::string MC1_input_filename,
0118             std::string MC2_input_filename  
0119         );
0120 
0121         void PrepareEPOS(
0122             std::string data_input_directory,
0123             std::vector<std::string> data_input_filename,
0124             
0125             std::string MC_input_directory,
0126             std::string MC1_input_filename,
0127             std::string MC2_input_filename  
0128         );
0129 
0130         void PrepareHIJING_strange(
0131             std::string data_input_directory,
0132             std::vector<std::string> data_input_filename,
0133             
0134             std::string MC_input_directory,
0135             std::string MC1_input_filename,
0136             std::string MC2_input_filename  
0137         );
0138 
0139         // // note : here are for preparing the systematic uncertainty
0140         // void PrepareStat_Unc();
0141         // void PrepareGeoMisalignment_Unc();
0142 
0143         // void PrepareRunSegment_Unc();
0144         // void PrepareClusAdcCut_Unc();
0145         // void PrepareClusPhiCut_Unc();
0146         // void PrepareDeltaPhiCut_Unc();
0147 
0148         // // note : here are for preparing the final result
0149         // void PrepareFinalResult();
0150 
0151     protected:
0152         // Division : -For constructor-----------------------------------------------------------
0153         int runnumber;
0154         int SelectedMbin;
0155         std::pair<double,double> vtxZ_range;
0156         bool isTypeA;
0157         bool ApplyGeoAccCorr;
0158         std::pair<bool, std::pair<double,double>> cut_EtaRange;
0159         std::string output_file_name_suffix;
0160         std::string output_directory;
0161 
0162         // Division : -The strings-----------------------------------------------------------
0163 
0164         std::string SetResultRangeFolderName;
0165         std::string SemiMotherFolderName;
0166         std::string Folder_BaseLine = "Folder_BaseLine";
0167         std::string Folder_RunSegment = "Folder_RunSegment";
0168         std::string Folder_ClusAdcCut = "Folder_ClusAdcCut";
0169         std::string Folder_ClusPhiCut = "Folder_ClusPhiCut";
0170         std::string Folder_DeltaPhiCut = "Folder_DeltaPhiCut";
0171 
0172         std::string Folder_AMPT = "Folder_AMPT";
0173         std::string Folder_EPOS = "Folder_EPOS";
0174         std::string Folder_HIJING_strange = "Folder_HIJING_strange";
0175 
0176         std::string BaseLine_AlphaCorr_directory;
0177         std::string BaseLine_dNdEta_directory;
0178 
0179         std::string no_map = "no_map";
0180 
0181         // Division : -The constants-----------------------------------------------------------
0182         std::pair<double,double> eta_range_dNdEta_Preparation = {-1.9, 1.9};
0183         std::pair<double,double> BaseLineDeltaPhiCut = {-0.026, 0.026};
0184 
0185 
0186         // Division : -the macros-----------------------------------------------------------
0187         std::string Run_PreparedNdEtaEach(
0188             int process_id,
0189             int run_num,
0190             std::string input_directory,
0191             std::string input_filename,
0192             std::string output_directory,
0193             
0194             // todo : modify here
0195             std::string output_file_name_suffix, 
0196 
0197             bool ApplyAlphaCorr,
0198             bool func_ApplyGeoAccCorr,
0199 
0200             bool isTypeA,
0201             std::pair<double,double> cut_INTTvtxZ,
0202             int SelectedMbin,
0203 
0204             std::pair<bool, std::pair<double,double>> setBkgRotated_DeltaPhi_Signal_range,
0205             std::pair<bool, std::pair<double,double>> setEtaRange,
0206             std::string GeoAccCorr_input_directory = "no_map",
0207             std::string alpha_correction_input_directory = "no_map"
0208         );
0209 
0210         std::vector<std::string> PreparedNdEtaPlain(
0211             int index,
0212             bool PrepareAlphaCorr,
0213             bool RunComparison,
0214             std::string sub_folder_name,
0215             std::string data_input_directory,
0216             std::string data_input_filename,
0217             
0218             std::string MC_input_directory,
0219             std::string MC1_input_filename,
0220             std::string MC2_input_filename,
0221 
0222             std::pair<bool, std::pair<double,double>> cut_DeltaPhi_Signal_range = {false, {-0.026, 0.026}}
0223         );
0224 
0225         int DataMcComp(string data_directory_in, string MC_directory_in, string output_directory_in, string output_filename_in);
0226         int McMcComp(  string MC1_directory_in, string MC2_directory_in, string output_directory_in, string output_filename_in);
0227 
0228         std::map<std::string, TH1D*> GetAlphaCorrectionH1DMap(std::string alpha_correction_input_directory_in, std::vector<std::string> map_name_in);
0229         std::map<std::string, TH2D*> GetGeoAccCorrH2DMap(std::string GeoAccCorr_input_directory_in, std::vector<std::string> map_name_in);
0230 };
0231 
0232 #endif