deleted: pccal/anode_gainmatch.C

deleted:    pccal/anode_gm_coeffs.dat
	deleted:    pccal/cathode_gainmatch.C
	deleted:    pccal/cathode_gm_coeffs.dat
	deleted:    pccal/slope_intercept_26Al.dat
	deleted:    scratch/sx3z_vs_phiz/scan_offset.C
	deleted:    scratch/sx3z_vs_phiz/scan_offset_fix.C
	deleted:    scratch/sx3z_vs_phiz/stitch.C
	deleted:    scratch/sx3z_vs_phiz/testmodel.h
	deleted:    scratch/test_eloss.h
	renamed:    pccal/pc_gm_coeffs.dat -> slope_intercept_results_17F.dat
This commit is contained in:
Vignesh Sitaraman 2026-05-05 16:41:11 -04:00
parent 3f55a2a81e
commit e25a63cd14
11 changed files with 0 additions and 441 deletions

View File

@ -1,67 +0,0 @@
void anode_gainmatch(){
TFile *f = new TFile("../results_run16.root");
TH2F *pc_index_h2d = (TH2F*)(f->Get("hRawPC/PC_Index_Vs_Energy"));
std::cout << pc_index_h2d << std::endl;
TCanvas c("c1","c1",0,0,1600,800);
//TCanvas c_g("cg","cg",0,900,400,400);
c.Divide(2,1);
auto c1=c.cd(1);
pc_index_h2d->Draw("COLZ");
pc_index_h2d->GetYaxis()->SetRangeUser(240,5000);
auto c2=c.cd(2);
c2->SetLogy();
TH1F *h_1d=NULL;
int bin_index=1;
std::vector<std::vector<double>> all_peaks;
std::vector<int> found_wire_list;
while(bin_index<=24) {
h_1d=(TH1F*)(pc_index_h2d->ProjectionY("_py",bin_index,bin_index));
auto c1 = c.cd(1);
TBox box(pc_index_h2d->GetXaxis()->GetBinLowEdge(bin_index),0,pc_index_h2d->GetXaxis()->GetBinUpEdge(bin_index),pc_index_h2d->GetYaxis()->GetXmax());
box.SetFillColorAlpha(kYellow+3,0.3);
box.Draw("SAME");
c1->Modified(); c1->Update();
//while(c1->WaitPrimitive());
TSpectrum s;
auto c2 = c.cd(2);
h_1d->Draw();
c2->Modified(); c2->Update();
int npeaks = s.Search(h_1d,8,"",0.02); std::cout << npeaks << std::endl;
if(npeaks>=3) {
std::vector<double> xpeaks(s.GetPositionX(),s.GetPositionX()+npeaks);
std::sort(xpeaks.begin(),xpeaks.end(),std::greater());
found_wire_list.push_back((int)pc_index_h2d->GetXaxis()->GetBinCenter(bin_index));
all_peaks.push_back(xpeaks);
}
while(c2->WaitPrimitive());
bin_index++;
}
c.cd(2)->SetLogy(kFALSE);
gStyle->SetOptFit(1111);
std::ofstream outfile("anode_gm_coeffs.dat");
outfile << found_wire_list.at(0) << " "
<< 1.0 << " "
<< 0.0 << std::endl;
for(int i=0; i<all_peaks.size(); i++){
if(i==1) continue;
TGraph g(all_peaks.at(i).size(), all_peaks.at(i).data(), all_peaks.at(1).data());
auto c2 = c.cd(2);
g.SetMarkerStyle(20);
//g.Print();
g.Draw("AP");
g.Fit("pol1");
outfile << found_wire_list.at(i) << " "
<< ((TF1*)g.FindObject("pol1"))->GetParameter(1) << " "
<< ((TF1*)g.FindObject("pol1"))->GetParameter(0) << std::endl;
c2->Modified();
c2->Update();
while(c2->WaitPrimitive());
}
outfile.close();
f->Close();
return;
}

View File

@ -1,24 +0,0 @@
0 1 0
0 0.937314 -16.871
2 0.965461 -1.54376
3 0.926501 -3.27662
4 0.905634 2.54577
5 0.905634 -11.0387
6 0.853919 6.23079
7 0.945588 -9.54044
8 0.884454 -11.8262
9 0.922501 -3.42538
10 0.903053 9.28069
11 0.914653 9.87642
12 0.965332 13.2526
13 0.923847 -3.41775
14 0.93845 25.9901
15 0.955424 12.324
16 0.95116 4.99595
17 0.910745 2.86648
18 0.941376 4.57217
19 0.871622 932.111
20 1.00624 7.86358
21 0.969834 -45.001
22 0.89304 -31.5635
23 0.933226 4.02193

View File

@ -1,69 +0,0 @@
void cathode_gainmatch(){
TFile *f = new TFile("../results_run17.root");
TH2F *pc_index_h2d = (TH2F*)(f->Get("hRawPC/PC_Index_Vs_Energy"));
std::cout << pc_index_h2d << std::endl;
TCanvas c("c1","c1",0,0,1600,800);
//TCanvas c_g("cg","cg",0,900,400,400);
c.Divide(2,1);
auto c1=c.cd(1);
pc_index_h2d->Draw("COLZ");
pc_index_h2d->GetYaxis()->SetRangeUser(600,pc_index_h2d->GetYaxis()->GetXmax());
auto c2=c.cd(2);
c2->SetLogy();
TH1F *h_1d=NULL;
int bin_index=25;
std::vector<double> pulser_heights = {0.01,0.05,0.1,0.15,0.2,0.25,0.3,0.5};
std::vector<std::vector<double>> all_peaks;
std::vector<int> found_wire_list;
while(bin_index<=48) {
h_1d=(TH1F*)(pc_index_h2d->ProjectionY("_py",bin_index,bin_index));
auto c1 = c.cd(1);
TBox box(pc_index_h2d->GetXaxis()->GetBinLowEdge(bin_index),0,pc_index_h2d->GetXaxis()->GetBinUpEdge(bin_index),pc_index_h2d->GetYaxis()->GetXmax());
box.SetFillColorAlpha(kYellow+3,0.3);
box.Draw("SAME");
c1->Modified(); c1->Update();
//while(c1->WaitPrimitive());
TSpectrum s;
auto c2 = c.cd(2);
h_1d->Draw();
c2->Modified(); c2->Update();
int npeaks = s.Search(h_1d,20,"",0.1); std::cout << npeaks << std::endl;
if(npeaks==8) {
std::vector<double> xpeaks(s.GetPositionX(),s.GetPositionX()+npeaks);
for(int i=0; i<8; i++) {
std::cout << pc_index_h2d->GetXaxis()->GetBinCenter(bin_index) << " " << xpeaks.at(i) << " " << xpeaks.at(i)/pulser_heights.at(i) << std::endl;
}
std::sort(xpeaks.begin(),xpeaks.end(),std::greater());
found_wire_list.push_back((int)pc_index_h2d->GetXaxis()->GetBinCenter(bin_index));
all_peaks.push_back(xpeaks);
}
while(c2->WaitPrimitive());
bin_index++;
}
c.cd(2)->SetLogy(kFALSE);
gStyle->SetOptFit(1111);
std::ofstream outfile("cathode_gm_coeffs.dat");
outfile << found_wire_list.at(0) << " "
<< 1.0 << " "
<< 0.0 << std::endl;
for(int i=1; i<all_peaks.size(); i++){
TGraph g(all_peaks.at(i).size(), all_peaks.at(i).data(), all_peaks.at(0).data());
auto c2 = c.cd(2);
g.SetMarkerStyle(20);
//g.Print();
g.Draw("AP");
g.Fit("pol1");
outfile << found_wire_list.at(i) << " "
<< ((TF1*)g.FindObject("pol1"))->GetParameter(1) << " "
<< ((TF1*)g.FindObject("pol1"))->GetParameter(0) << std::endl;
c2->Modified();
c2->Update();
while(c2->WaitPrimitive());
}
outfile.close();
f->Close();
return;
}

View File

@ -1,21 +0,0 @@
24 1 0
25 0.941896 6.16135
26 0.980284 2.86886
27 0.983166 -3.82952
28 0.978704 -2.89713
29 0.964947 2.25786
30 0.94514 0.925074
31 0.977231 1.6493
32 0.919527 5.82742
33 0.972243 2.88061
34 0.928892 7.61384
35 0.947376 -0.644223
36 0.875342 6.066
38 0.970953 6.262
40 0.918408 -3.27891
41 0.913619 4.11288
42 0.954083 2.21261
43 0.993037 5.48924
45 0.926406 -19.719
46 1.00459 5.14574
47 0.942483 5.54183

View File

@ -1,50 +0,0 @@
#Histogram Number Slope Intercept
#Histogram Number Slope Intercept
0 0.931015 -1.35431
1 1 -1.87356e-10
2 0.964185 1.49989
3 0.92638 -1.30621
4 0.905569 1.00834
5 0.901182 0.470903
6 0.853932 3.32687
7 0.942785 1.08887
8 0.878904 -0.0107433
9 0.922662 -2.32259
10 0.903343 8.38332
11 0.914227 6.56108
12 0.961008 23.0982
13 0.920976 5.22104
14 0.936584 31.5073
15 0.959044 5.43267
16 0.95263 -0.404053
17 0.90953 4.82833
18 0.940277 10.3629
19 0.86746 -17.8678
20 1.00683 4.76371
21 0.968342 -43.9496
22 0.892882 -32.0742
23 0.933615 1.10704
24 1 -2.89219e-10
25 0.942098 -0.105169
26 0.980862 -0.732032
27 0.982975 -2.22704
28 0.978815 -1.51477
29 0.965245 -2.19515
30 0.945384 -0.892599
31 0.977408 -0.908592
32 0.919546 3.25464
33 0.972194 2.44956
34 0.92852 5.44745
35 0.947098 1.40531
36 0.875491 -1.13145
37 1 0
38 0.970862 2.86019
39 1 0
40 0.91793 -3.80615
41 0.913897 -2.12964
42 0.954014 -0.760604
43 0.993616 -1.40278
44 1 0
45 0.926169 -21.2016
46 1.00577 -2.14281
47 0.943312 -1.26464

View File

@ -1,81 +0,0 @@
#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();
}
}

View File

@ -1,81 +0,0 @@
#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_fix(){
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("pczfix_vs_qqqpczguess_A1C2"));
h23->SetLineColorAlpha(kOrange,0.75);
h23->Draw("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("pczfix_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();
}
}

View File

@ -1,5 +0,0 @@
{
}

View File

@ -1,43 +0,0 @@
#include <TF1.h>
double model(double* x, double* p) {
double result = x[0];
double factor = 29.0;
double slope = 0.7;
if(TMath::Abs(x[0]) < 16.2) result=x[0]*slope;
else if(TMath::Abs(x[0]) < 49.8 ) result=x[0]*slope+TMath::Sign(1.0,x[0])*factor;
else if(TMath::Abs(x[0]) < 85.2 ) result=x[0]*slope+TMath::Sign(1.0,x[0])*factor*2;
else result=x[0]*slope+TMath::Sign(1.0,x[0])*factor*2;
return result;
}
double model_invert(double *y, double *q) {
double result=y[0];
double slope = 0.7;
double factor = 40.0;
if(TMath::Abs(y[0]) < 16.2/slope) result = y[0]/slope;
else if(TMath::Abs(y[0]) < 49.8/slope ) result=y[0]/slope-TMath::Sign(1.0,y[0])*factor;
else if(TMath::Abs(y[0]) < 85.2/slope ) result=y[0]/slope-TMath::Sign(1.0,y[0])*factor*2;
else result=y[0]/slope-TMath::Sign(1.0,y[0])*factor*2;
return result;
}
/*void testmodel() {
TF1 eqline("x","x",-200,200);
eqline.Draw("");
eqline.SetLineStyle(kDashed);
//TF1 f1("model",model,-200,200,2);
TF1 f1("model_inv",model_invert,-200,200,2);
eqline.SetNpx(10000);
f1.SetNpx(10000);
std::vector<double> pars = {0.0,1.};
f1.SetParameters(pars.data());
f1.SetLineColor(kGreen+2);
f1.SetLineStyle(kLine);
f1.Draw("L SAME");
gPad->Modified(); gPad->Update();
while(gPad->WaitPrimitive());
}*/

View File

View File