ANASEN_analysis/scratch/sx3z_vs_phiz/scan_offset.C
Sudarsan Balakrishnan eb54b6ab68 Improved sx3 strip range, and added step-ladder correction to PCZ
1) Environment variables allowing flip and offset of anode wires
2) Environment variables allowing for selection of runs' start and stop time positions, to help with phi scanning runs
3) *fix histograms defined that incorporate step-ladder corrections applied to pcz, hard-coded currently in sx3cal/sx3z_vs_pcz/testmodel.h. Will need a better home in the future
4) EXFit2.C has the capability to now gainmatch all sx3 pads, and position along strip is still found from the central three pad edges. Treatment for (backE-missingfrontE) is being considered.
2026-04-14 14:07:18 -04:00

82 lines
2.2 KiB
C

#include "testmodel.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 scan_offset(){
signal(SIGINT,handler);
TCanvas c("c1","c1",0,0,1600,800);
c.Divide(2,1);
TF1 f1("model",model,-200,200,2);
f1.SetNpx(10000);
std::vector<double> pars = {0.0,1.};
f1.SetParameters(pars.data());
f1.SetLineColor(kGreen+2);
f1.SetLineStyle(kLine);
TFile* f=NULL;
std::vector<TFile*> files;
int ctr=0;
for(int i=12; i<=21; i++) {
auto c1=c.cd(1);
c1->SetGrid(1,1);
f = new TFile(Form("../../results_run%d.root",i));
if(i==12) {
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
TH2F *h23 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int_A1C2"));
h23->SetLineColorAlpha(kOrange,0.75);
h23->Draw("box SAME");
} else {
//TH2F *h2 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int"));
//TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess_A1C2_strip12"));
TH2F *h2 = (TH2F*)(f->Get("pcz_vs_sx3pczguess_A1C2"));
//TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
if(!h2) continue;
h2->SetTitle(Form("case%d",i));
//h2->Draw("colz same");
h2->SetLineColorAlpha(colors[ctr],0.75);
h2->Draw("box same");
f1.Draw("same");
}
TF1 eqline("x","x",-200,200);
eqline.Draw("SAME");
c1->Modified();
c1->Update();
ctr+=1;
auto c2=c.cd(2);
c2->SetGrid(1,1);
TH2F *h3 = (TH2F*)(f->Get("sx3phi_vs_pcphi1"));
// TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
if(!h3) continue;
h3->SetTitle(Form("case%d",i));
h3->Draw("colz");
eqline.Draw("SAME");
c2->Modified();
c2->Update();
while(gPad->WaitPrimitive());
files.emplace_back(f);
if(i==21) {
i=11;
c.Clear();
c.Divide(2,1);
ctr=0;
}
if(quit) break;
}
for(auto file : files) {
file->Close();
}
}