Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #include <vector>
0002 int eicsmear_dvmp_plot2()
0003 {
0004 
0005   /* PRELIMINARY ROOT STUFF */
0006   /*gSystem->Load("libeicsmear");
0007   gROOT->LoadMacro("/sphenix/user/gregtom3/SBU/research/macros/macros/sPHENIXStyle/sPhenixStyle.C");
0008   SetsPhenixStyle();*/
0009 
0010 
0011   /* Open TFile */
0012   TFile *input = new TFile("/sphenix/user/gregtom3/data/Fall2018/JPsi_reco_studies/theEvents.root","READ");
0013 
0014   /* Open TTree in TFile */
0015   TTree *t = (TTree*)input->Get("Tree");
0016   TH1F *h1_p_1 = new TH1F("h1_p_1","h1_p_1",100,-4,4);
0017   TH1F *h1_p_2 = new TH1F("h1_p_2","h1_p_2",100,0,50);
0018   TH1F *h1_p_3 = new TH1F("h1_p_3","h1_p_3",100,0,50);
0019   TH1F *h1_p_4 = new TH1F("h1_p_4","h1_p_4",100,0,50);
0020   TH2F* h2_p = new TH2F("h2_p","h2_p",200,-6,6,200,0,2);
0021   //BinLogX(h2_p);
0022   BinLogY(h2_p);
0023 
0024   // t->Draw("2*18*se_p_truth*(1-cos(3.14159265-2*atan(exp(-se_eta_truth)))):2*275*sp_p_truth*(1-cos(2*atan(exp(-sp_eta_truth))))>>h2_p","jpsi_eta_truth>4","colz");
0025   // t->Draw("sqrt(jpsi_px_reco*jpsi_px_reco+jpsi_py_reco*jpsi_py_reco+jpsi_pz_reco*jpsi_pz_reco):jpsi_eta_reco>>h2_p","","colz");
0026 
0027   // t->Draw("se_eta_truth>>h1_p_1","(se_eta_reco!=0&&de_eta_reco!=0&&dp_eta_reco!=0)");
0028   
0029   // X - Q2 PLOT //
0030   //t->Draw("2*18*se_p_reco*(1-cos(3.14159265-2*atan(exp(-se_eta_reco)))):2*18*se_p_reco*(1-cos(3.14159265-2*atan(exp(-se_eta_reco))))/(4*18*275*(1-(se_p_reco/18)+(2*18*se_p_reco*(1-cos(3.14159265-2*atan(exp(-se_eta_reco))))/(4*18*18))))>>h2_p","","colz");
0031   // gPad->SetLogx();
0032   //gPad->SetLogy();
0033   t->Draw("2*18*se_p_reco*(1-cos(3.14159265-2*atan(exp(-se_eta_reco)))):jpsi_eta_reco>>h2_p","sp_p_truth>274","colz");
0034   h2_p->SetTitle("x vs. Q2 (18x275 Sartre DVMP Reco)");
0035   h2_p->GetXaxis()->SetTitle("Reco x");
0036   h2_p->GetYaxis()->SetTitle("Reco Q2");
0037   
0038 }
0039 
0040 void BinLogY(TH2F*h) 
0041 {
0042 
0043    TAxis *axis = h->GetYaxis(); 
0044    int bins = axis->GetNbins();
0045 
0046    Axis_t from = axis->GetXmin();
0047    Axis_t to = axis->GetXmax();
0048    Axis_t width = (to - from) / bins;
0049    Axis_t *new_bins = new Axis_t[bins + 1];
0050 
0051    for (int i = 0; i <= bins; i++) {
0052      new_bins[i] = TMath::Power(10, from + i * width);
0053    } 
0054    axis->Set(bins, new_bins); 
0055    delete new_bins; 
0056 }
0057 
0058 void BinLogX(TH2F*h) 
0059 {
0060 
0061    TAxis *axis = h->GetXaxis(); 
0062    int bins = axis->GetNbins();
0063 
0064    Axis_t from = axis->GetXmin();
0065    Axis_t to = axis->GetXmax();
0066    Axis_t width = (to - from) / bins;
0067    Axis_t *new_bins = new Axis_t[bins + 1];
0068 
0069    for (int i = 0; i <= bins; i++) {
0070      new_bins[i] = TMath::Power(10, from + i * width);
0071    } 
0072    axis->Set(bins, new_bins); 
0073    delete new_bins; 
0074 }