ANASEN_analysis/scratch/PhiCorr.C
Vignesh Sitaraman 787b1ca498 new file: scratch/PhiCorr.C
renamed:    anasen_labels.csv -> scratch/anasen_labels.csv
	renamed:    grid_generate.py -> scratch/grid_generate.py
	renamed:    shadowplay.py -> scratch/shadowplay.py
2026-05-29 13:32:32 -04:00

44 lines
1.2 KiB
C

#include "../Armory/PC_StepLadder_Correction.h"
int quit = 0;
void handler(int) { quit = 1; }
int colors[] = {kSpring + 3, kRed, kGreen + 3, kBlue + 3, kViolet, kOrange, kSpring - 7, kAzure - 5};
void PhiCorr()
{
signal(SIGINT, handler);
TCanvas c("c1", "c1", 0, 0, 1600, 800);
std::vector<TFile *> files;
for (int i = 12; i <= 300; i++)
{
TFile *f = new TFile(Form("results_run%d.root", i));
if (!f || f->IsZombie() || !f->IsOpen()) { delete f; continue; }
TH1F *h1 = (TH1F *)(f->Get("pcphi_minus_sx3phi_TC"));
TH1F *h2 = (TH1F *)(f->Get("phiPC_minus_phiQQQ_TC"));
if (!h1 || !h2) { f->Close(); delete f; continue; }
files.push_back(f);
c.Clear();
auto c1 = c.cd(1);
c1->SetGrid(1, 1);
h1->SetLineColorAlpha(kRed, 0.75);
h2->GetXaxis()->SetRangeUser(-100, 100);
h2->Draw("");
h2->SetTitle(Form("run%d", i));
h2->SetLineColorAlpha(kBlue, 0.75);
h1->Draw("SAME");
c1->Modified();
c1->Update();
c.SaveAs(Form("scratch/PhiCorr_run%d.png", i));
while (gPad->WaitPrimitive());
if (quit) break;
}
for (auto file : files) file->Close();
}