Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-09 08:12:09

0001 #ifndef GETMULTIPLICITYMAP_H
0002 #define GETMULTIPLICITYMAP_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 #include <TKey.h>
0031 
0032 #include "../../Constants.h"
0033 
0034 class GetMultiplicityMap{
0035     public:
0036         GetMultiplicityMap(
0037             int runnumber_in,
0038             std::string data_directory_in,
0039             std::string data_file_name_in,
0040             std::string MC_directory_in,
0041             std::string MC_file_name_in,
0042             std::string output_directory_in,
0043 
0044             std::string output_file_name_suffix_in,
0045 
0046             double SetMbinFloat_in,
0047             std::pair<double, double> VtxZRange_in,
0048             bool IsZClustering_in,
0049             bool BcoFullDiffCut_in,
0050             std::pair<bool, std::pair<double, double>> isClusQA_in // note : {adc, phi size}
0051         );
0052 
0053         std::string GetOutputFileName() {return output_filename;}
0054 
0055         void GetUsedZIDVec();
0056         // void GetLadderRadius();
0057         void h2DNormalizedByRadius();
0058         void h2DNormalized();
0059         void DataMCDivision();
0060         void PrepareMulMap();
0061 
0062         void EndRun();
0063 
0064     protected:
0065 
0066         // note : for constructor
0067         int runnumber;
0068         std::string data_directory;
0069         std::string data_file_name;
0070         std::string MC_directory;
0071         std::string MC_file_name;
0072         std::string output_directory;
0073 
0074         std::string output_file_name_suffix;
0075 
0076         double SetMbinFloat;
0077         std::pair<double, double> VtxZRange;
0078         bool IsZClustering;
0079         bool BcoFullDiffCut;
0080         std::pair<bool, std::pair<double, double>> isClusQA; // note : {adc, phi size}
0081 
0082         // note : for the input file
0083         TFile * file_in_data;
0084         TFile * file_in_MC;
0085 
0086         std::map<std::string, std::pair<TH1D*, TH1D*>> h1D_target_map;
0087         std::map<std::string, std::pair<TH2D*, TH2D*>> h2D_target_map;
0088 
0089         void PrepareInputRootFile();
0090 
0091         // note : for analysis 
0092         std::vector<int> used_zid_data_vec;
0093         std::vector<int> used_zid_MC_vec;
0094 
0095 
0096         // note : for the output file
0097         std::string output_filename;
0098         TFile * file_out;
0099         void PrepareOutPutFileName();
0100         void PrepareOutPutRootFile();
0101 
0102         // note : for histogram
0103         void PrepareHistograms();
0104         std::map<std::string, TH2D*> h2D_map;
0105         std::map<std::string, TH1D*> h1D_map;
0106         TH2D * h2D_MulMap;
0107         TH2D * h2D_MaskedMap;
0108         TH2D * h2D_RatioMap;
0109 
0110         // note : for constant
0111         std::pair<double,double> Ratio_cut_pair = {0.8, 1.2};
0112 
0113         double sensor_width = 1.9968; // note : in cm
0114         int nZbin = Constants::nZbin;
0115         double Zmin = Constants::Zmin;
0116         double Zmax = Constants::Zmax;
0117 };
0118 
0119 #endif