ANASEN_analysis/scratch/sx3z_vs_phiz/scan_offset.C
Sudarsan Balakrishnan 7be45f35df Partial commit with key changes as follows:
- wireOffset is now 4 not 3. Phew. Gosh Golly. Change in Armory/ClassPW.h
	- Concomitant changes made to Armory/PC_Stepladder_Correction.h. In this particular version, a shift of 2 anodes in run*.sh has been replaced by an offset in z
	- The above needs to be worked out carefully.
	- The rho_vs_z fixes have NOT been corrected for. This version will likely yield nonsensical results, hence. To be fixed by a subsequent push that also cleans up the histogram plotting somewhat.

*Read again*

The sort uses rho from the 3 wireOffset cases in MakeVertex.C
The code assumes wireOffset=4.
Anywhere this matters, this version will break - caveat Emptor. Pushing here to plant a flag, but to also make sure the key changes are communicated across branches.
2026-05-14 18:18:17 -04:00

86 lines
2.4 KiB
C

#include "testmodel.h"
int quit=0;
void handler(int){quit=0;}
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"));
std::cout << "aaa" << h23 << std::endl;
h23->SetLineColorAlpha(kOrange,0.75);
h23->GetYaxis()->SetRangeUser(-200,200);
h23->Draw("box");
while(gPad->WaitPrimitive());
} 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"));
std::cout << h2 << std::endl;
//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);
std::cout <<"Test" << std::endl;
if(i==21) {
i=11;
c.Clear();
c.Divide(2,1);
ctr=0;
}
//if(quit) break;
}
for(auto file : files) {
file->Close();
}
}