Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:14:30

0001 #include <string>
0002 #include <vector>
0003 #include <utility>
0004 
0005 class TFile;
0006 /* class TTree; */
0007 class TChain;
0008 class TH1;
0009 class TH2;
0010 class BinnedHistSet;
0011 
0012 class PhiHists
0013 {
0014     public:
0015     BinnedHistSet *phi_pT, *phi_pT_blue_up, *phi_pT_blue_down, *phi_pT_yellow_up, *phi_pT_yellow_down;
0016     BinnedHistSet *phi_pT_blue_up_forward, *phi_pT_blue_down_forward, *phi_pT_yellow_up_forward, *phi_pT_yellow_down_forward;
0017     BinnedHistSet *phi_pT_blue_up_backward, *phi_pT_blue_down_backward, *phi_pT_yellow_up_backward, *phi_pT_yellow_down_backward;
0018     BinnedHistSet *phi_xF, *phi_xF_blue_up, *phi_xF_blue_down, *phi_xF_yellow_up, *phi_xF_yellow_down;
0019     BinnedHistSet *phi_eta, *phi_eta_blue_up, *phi_eta_blue_down, *phi_eta_yellow_up, *phi_eta_yellow_down;
0020     BinnedHistSet *phi_vtxz, *phi_vtxz_blue_up, *phi_vtxz_blue_down, *phi_vtxz_yellow_up, *phi_vtxz_yellow_down;
0021     /* PhiHists() {} */
0022     /* ~PhiHists() {} */
0023 };
0024 
0025 class TSSAhistmaker {
0026     public:
0027     TSSAhistmaker(const std::string treebasename, const int jobnumber, const std::string histfname);
0028     ~TSSAhistmaker();
0029 
0030     bool InRange(float mass, std::pair<float, float> range);
0031     void GetTrees();
0032     void MakePhiHists(std::string which); // which = pi0, eta, pi0bkgr, etabkgr
0033     void MakeAllHists();
0034     void FillPhiHists(std::string which, int index); // which = pi0, eta, pi0bkgr, etabkgr
0035     /* void FillAllPhiHists(int index); */
0036     /* void LoopClusters(); */
0037     /* void LoopDiphotons(); */
0038     void LoopTrees();
0039     void Cleanup();
0040     void main();
0041 
0042     private:
0043     // files and trees
0044     std::string treebasepath = "";
0045     int jobnum = 0;
0046     int nTreesInChain = 100;
0047     std::string treefilename = "";
0048     std::string histfilename = "";
0049     TFile* infile_trees = nullptr;
0050     TFile* outfile_hists = nullptr;
0051     /* TTree* tree_clusters = nullptr; */
0052     /* TTree* tree_diphotons = nullptr; */
0053     TChain* tree_event = nullptr;
0054     TChain* tree_clusters = nullptr;
0055     TChain* tree_diphotons = nullptr;
0056 
0057     // branches
0058     float crossingAngle = -9999999.9;
0059     float vtxz = -9999999.9;
0060     bool minbiastrig_live = false;
0061     bool photontrig_live = false;
0062     bool minbiastrig_scaled = false;
0063     bool photontrig_scaled = false;
0064     int bspin = 0;
0065     int yspin = 0;
0066     int nAllClusters = 0;
0067     std::vector<float>* cluster_E = nullptr;
0068     std::vector<float>* cluster_Ecore = nullptr;
0069     std::vector<float>* cluster_Eta = nullptr;
0070     std::vector<float>* cluster_Phi = nullptr;
0071     std::vector<float>* cluster_pT = nullptr;
0072     std::vector<float>* cluster_xF = nullptr;
0073     std::vector<float>* cluster_Chi2 = nullptr;
0074     std::vector<float>* diphoton_E = nullptr;
0075     std::vector<float>* diphoton_M = nullptr;
0076     std::vector<float>* diphoton_Eta = nullptr;
0077     std::vector<float>* diphoton_Phi = nullptr;
0078     std::vector<float>* diphoton_pT = nullptr;
0079     std::vector<float>* diphoton_xF = nullptr;
0080     std::vector<int>* diphoton_clus1index = nullptr;
0081     std::vector<int>* diphoton_clus2index = nullptr;
0082     std::vector<float>* diphoton_deltaR = nullptr;
0083     std::vector<float>* diphoton_asym = nullptr;
0084 
0085     // event-level distributions
0086     TH1* h_vtxz = nullptr;
0087     TH1* h_Nevents = nullptr;
0088     TH1* h_Npi0s = nullptr;
0089     TH1* h_Netas = nullptr;
0090     TH1* h_crossingAngle = nullptr;
0091     
0092     // cluster distributions
0093     /* TH1* h_nAllClusters = nullptr; */
0094     /* TH1* h_nGoodClusters = nullptr; */
0095     TH1* h_nClustersMinbiasTrig = nullptr;
0096     TH1* h_nClustersPhotonTrig = nullptr;
0097 
0098     // meson reco details
0099     /* std::pair<float, float> pi0MassRange{0.117, 0.167}; */
0100     std::pair<float, float> pi0MassRange{0.08, 0.22};
0101     /* std::pair<float, float> pi0BkgrLowRange{0.047, 0.097}; */
0102     /* std::pair<float, float> pi0BkgrHighRange{0.177, 0.227}; */
0103     std::pair<float, float> pi0BkgrLowRange{0.02, 0.07};
0104     std::pair<float, float> pi0BkgrHighRange{0.23, 0.28};
0105     /* std::pair<float, float> etaMassRange{0.494, 0.634}; */
0106     std::pair<float, float> etaMassRange{0.45, 0.75};
0107     std::pair<float, float> etaBkgrLowRange{0.330, 0.430};
0108     /* std::pair<float, float> etaBkgrHighRange{0.700, 0.800}; */
0109     std::pair<float, float> etaBkgrHighRange{0.770, 0.870};
0110 
0111     // diphoton distributions
0112     TH1* h_diphotonMass = nullptr;
0113     BinnedHistSet* bhs_diphotonMass_pT_pi0binning = nullptr;
0114     BinnedHistSet* bhs_diphotonMass_pT_etabinning = nullptr;
0115     BinnedHistSet* bhs_pi0_pT_pT = nullptr;
0116     BinnedHistSet* bhs_eta_pT_pT = nullptr;
0117     BinnedHistSet* bhs_diphotonxF_xF = nullptr;
0118     BinnedHistSet* bhs_diphotoneta_eta = nullptr;
0119     BinnedHistSet* bhs_diphotonvtxz_vtxz = nullptr;
0120     TH2* h_DiphotonMassAsym = nullptr;
0121     TH2* h_DiphotonMassdeltaR = nullptr;
0122     TH2* h_DiphotondeltaRAsym = nullptr;
0123     TH2* h_DiphotondeltaRAsym_pi0 = nullptr;
0124     TH2* h_DiphotondeltaRAsym_pi0_smalldR = nullptr;
0125     TH2* h_DiphotondeltaRAsym_eta = nullptr;
0126     TH2* h_DiphotondeltaRAsym_etabkgr = nullptr;
0127     TH2* h_DiphotonMassAsym_highpT = nullptr;
0128     TH2* h_DiphotonMassdeltaR_highpT = nullptr;
0129     TH2* h_DiphotondeltaRAsym_highpT = nullptr;
0130     TH2* h_DiphotondeltaRAsym_highpT_smalldR = nullptr;
0131     TH2* h_DiphotondeltaRAsym_eta_highpT = nullptr;
0132     TH2* h_DiphotondeltaRAsym_etabkgr_highpT = nullptr;
0133     // Armeteros-Podalanski plots
0134     TH2* h_armen_all = nullptr;
0135     TH2* h_armen_pi0 = nullptr;
0136     TH2* h_armen_pi0bkgr = nullptr;
0137     TH2* h_armen_eta = nullptr;
0138     TH2* h_armen_etabkgr = nullptr;
0139     TH2* h_armen_eta_highpT = nullptr;
0140     TH2* h_armen_etabkgr_highpT = nullptr;
0141     TH1* h_armen_p_L = nullptr;
0142     TH1* h_armen_p_T = nullptr;
0143     TH2* h_armen_alpha_alphaE = nullptr;
0144     TH2* h_armen_alpha_deltaR = nullptr;
0145     TH2* h_armen_alpha_deltaR_pi0 = nullptr;
0146     TH2* h_armen_alpha_deltaR_eta = nullptr;
0147     TH2* h_armen_p_T_deltaR = nullptr;
0148     TH2* h_armen_pT_p_L = nullptr;
0149     TH2* h_armen_pT_p_T = nullptr;
0150     
0151     // phi histograms for asymmetries
0152     const float PI = 3.141592;
0153     int nHistBins_phi = 12;
0154     std::vector<double> pTbins_pi0 = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 10.0};
0155     std::vector<double> pTbins_eta = {2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 10.0, 20.0};
0156     std::vector<double> xFbins = {-0.15, -0.10, -0.06, -0.03, 0.0, 0.03, 0.06, 0.10, 0.15};
0157     std::vector<double> etabins = {-3.0, -1.75, -1.15, -0.35, 0.0, 0.35, 1.15, 1.75, 3.0};
0158     std::vector<double> vtxzbins = {-200.0, -100.0, -50.0, -30.0, 0.0, 30.0, 50.0, 100.0, 200.0};
0159     PhiHists* pi0Hists = nullptr;
0160     PhiHists* etaHists = nullptr;
0161     PhiHists* pi0BkgrHists = nullptr;
0162     PhiHists* etaBkgrHists = nullptr;
0163     PhiHists* pi0Hists_lowEta = nullptr;
0164     PhiHists* etaHists_lowEta = nullptr;
0165     PhiHists* pi0BkgrHists_lowEta = nullptr;
0166     PhiHists* etaBkgrHists_lowEta = nullptr;
0167     PhiHists* pi0Hists_highEta = nullptr;
0168     PhiHists* etaHists_highEta = nullptr;
0169     PhiHists* pi0BkgrHists_highEta = nullptr;
0170     PhiHists* etaBkgrHists_highEta = nullptr;
0171 };