modified: MakeVertex.C

This commit is contained in:
Vignesh Sitaraman 2026-04-17 12:47:20 -04:00
parent b801421d3c
commit 4c8e3b7519
26 changed files with 257 additions and 76 deletions

View File

@ -93,6 +93,7 @@ double qqqGain[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
bool qqqGainValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
double qqqCalib[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
bool qqqCalibValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
bool Diagnostics = false;
double sx3BackGain[24][4][4] = {{{1.}}};
double sx3FrontGain[24][4] = {{1.}};

View File

@ -38,6 +38,7 @@ fi
if [[ 1 -eq 1 ]] ; then
export anode_offset=1
root -q -b -x ../Remapped_files/27Al_Data/root_data/Run_015_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run15.root;
exit
root -q -b -x ../Remapped_files/27Al_Data/root_data/Run_017_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run17.root;
root -q -b -x ../Remapped_files/27Al_Data/root_data/Run_018_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run18.root;
root -q -b -x ../Remapped_files/27Al_Data/root_data/Run_019_mapped.root -e 'tree->Process("MakeVertex.C+O")'; mv Analyzer_SX3.root results_run19.root;

View File

@ -1,23 +1,55 @@
1 front 1 back 2 4.4094
1 front 1 back 1 4.4094
1 front 2 back 2 4.4832
1 front 3 back 2 4.52103
1 front 3 back 1 4.5210
3 front 1 back 2 3.63215
3 front 1 back 1 3.70756
3 front 2 back 2 3.68208
3 front 2 back 1 3.86817
3 front 3 back 2 3.7334
3 front 3 back 1 3.70756
7 front 1 back 2 3.60769
7 front 1 back 1 3.46759
7 front 2 back 2 3.58356
7 front 2 back 1 3.49018
7 front 3 back 2 3.60769
7 front 3 back 1 3.46759
9 front 1 back 2 3.58356
9 front 1 back 1 3.44529
9 front 2 back 2 3.58356
9 front 2 back 1 3.46759
9 front 3 back 2 3.63215
9 front 3 back 1 3.46759
1 front 0 back 3 3.68208
1 front 0 back 0 3.89631
1 front 1 back 2 4.44599
1 front 1 back 3 3.81311
1 front 1 back 0 3.98321
1 front 2 back 2 4.52103
1 front 2 back 3 3.68208
1 front 2 back 0 3.95382
1 front 3 back 2 4.55951
1 front 3 back 3 3.68208
1 front 3 back 0 3.89631
3 front 1 back 2 3.81311
3 front 1 back 1 3.92485
3 front 1 back 3 4.13701
3 front 1 back 0 4.26886
3 front 2 back 2 3.86817
3 front 2 back 1 4.04334
3 front 2 back 3 3.98321
3 front 2 back 0 4.23512
3 front 3 back 2 3.92485
3 front 3 back 1 3.92485
3 front 3 back 3 3.95382
3 front 3 back 0 4.13701
7 front 0 back 2 3.65694
7 front 0 back 1 3.53625
7 front 0 back 3 4.23512
7 front 0 back 0 3.60769
7 front 1 back 2 3.65694
7 front 1 back 1 3.53625
7 front 1 back 3 4.23512
7 front 1 back 0 3.58356
7 front 2 back 2 3.68208
7 front 2 back 1 3.55975
7 front 2 back 3 4.13701
7 front 2 back 0 3.60769
7 front 3 back 2 3.68208
7 front 3 back 1 3.53625
7 front 3 back 3 4.23512
7 front 3 back 0 3.58356
9 front 0 back 2 3.68208
9 front 0 back 1 3.53625
9 front 0 back 3 3.51306
9 front 0 back 0 3.42327
9 front 1 back 2 3.70756
9 front 1 back 1 3.49018
9 front 1 back 3 3.63215
9 front 1 back 0 3.46759
9 front 2 back 2 3.70756
9 front 2 back 1 3.55975
9 front 2 back 3 3.53625
9 front 2 back 0 3.44529
9 front 3 back 2 3.7334
9 front 3 back 1 3.51306
9 front 3 back 3 3.53625
9 front 3 back 0 3.42327

View File

@ -1,12 +1,15 @@
1 lengthcal front 1 1.5121 60.4839
1 lengthcal front 2 -1.5625 62.5
1 lengthcal front 3 2.72177 60.4839
3 lengthcal front 1 -0.595088 59.5088
3 lengthcal front 2 -4.53935 58.5723
3 lengthcal front 3 4.08107 60.4603
7 lengthcal front 1 1.14329 45.7317
7 lengthcal front 2 0.115661 46.2646
7 lengthcal front 3 2.90179 44.6429
9 lengthcal front 1 0.115732 46.2928
9 lengthcal front 2 0.799176 45.6672
9 lengthcal front 3 1.68159 48.0453
1 lengthcal front 0 0.302419 60.4839
1 lengthcal front 1 0.907258 60.4839
1 lengthcal front 2 -2.11694 60.4839
1 lengthcal front 3 3.32661 60.4839
3 lengthcal front 1 -0.302419 60.4839
3 lengthcal front 2 -3.12146 59.4564
3 lengthcal front 3 5.3066 62.4306
7 lengthcal front 0 0.225805 45.1611
7 lengthcal front 1 1.85157 46.2892
7 lengthcal front 2 0.936622 46.8311
7 lengthcal front 3 3.65527 45.6909
9 lengthcal front 0 2.10806 46.8457
9 lengthcal front 1 0.694127 46.2751
9 lengthcal front 2 1.04095 46.2646
9 lengthcal front 3 1.99048 46.8348

View File

@ -1,16 +1,16 @@
1 0 1678.38 1.0
1 1 1678.38 1.07163
1 2 1693.99 1.1035
1 3 1667.9 0.975015
3 0 1597.96 1.0
3 1 1597.96 1.02536
3 2 1821.48 1.29182
3 3 1607.52 0.928543
7 0 1773.34 1.
7 1 1773.34 1.14263
7 2 1573.79 1.06715
7 3 1542.41 0.956475
9 0 1555.08 1.
9 1 1555.08 0.998252
9 2 1559.36 1.00299
9 3 1585.79 1.01582
1 0 1239.16 0.649287
1 1 1853.11 1.08968
1 2 1852.65 1.10279
1 3 1821.01 0.965101
3 0 1749.6 1.
3 1 1749.6 1.01204
3 2 1954.81 1.23687
3 3 1751.15 0.904329
9 0 1838.02 1.07361
9 1 1695.51 0.971866
9 2 1709.36 0.988575
9 3 1719.37 0.982937
7 0 1787.9 1.02266
7 1 1924.89 1.10649
7 2 1706.01 1.03175
7 3 1685.88 0.933633

View File

@ -1,6 +1,6 @@
{
int index = 1;
TFile *f = new TFile("../results_run19.root");
TFile *f = new TFile("../results_run01.root");
TH2F *h2=NULL;
TH1F *h1x=NULL, *h1y=NULL;
//f->cd("evsx");
@ -11,7 +11,7 @@
std::ofstream ofb(Form("backgains%d.dat",index));
std::ofstream off(Form("frontgains%d.dat",index));
for(int i=1; i<4; i++) {
for(int i=0; i<4; i++) {
//do it for pad#2
int backnum=2;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));

79
sx3cal/EXFit2.C Normal file
View File

@ -0,0 +1,79 @@
{
int index = 9;
TFile *f = new TFile("../results_run05.root");
TH2F *h2=NULL;
TH1F *h1x=NULL, *h1y=NULL;
//f->cd("evsx");
//f->ls();
double known_xpos[4][2] = {{0,18.75},{-18.75,0}};
std::vector<double> xpos, xposkn; //first = x = known position, second = y = unknown position
std::ofstream ofb(Form("backgains%d.dat",index));
std::ofstream off(Form("frontgains%d.dat",index));
for(int i=0; i<4; i++) {
//do it for pad#2
int backnum=2;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));
auto macro = [&]() {
h1x = (TH1F*)(h2->ProjectionX("_px"));
double xleft = h1x->GetBinCenter(h1x->FindFirstBinAbove(h1x->GetMaximum()*0.4));
double xright = h1x->GetBinCenter(h1x->FindLastBinAbove(h1x->GetMaximum()*0.4));
//h1x->GetXaxis()->SetRangeUser(4*xleft, xright*4);
h1x->Draw();
TLine L1(xleft,0,xleft,h1x->GetMaximum()); L1.SetLineColor(kRed); L1.Draw("SAME");
TLine L2(xright,0,xright,h1x->GetMaximum()); L2.SetLineColor(kRed); L2.Draw("SAME");
gPad->Modified();
gPad->Update();
if(backnum==1 || backnum==2) xpos.push_back(xleft); xposkn.push_back(known_xpos[backnum-1][0]);
if(backnum==1 || backnum==2) xpos.push_back(xright); xposkn.push_back(known_xpos[backnum-1][1]);
while(gPad->WaitPrimitive());
h1y = (TH1F*)(h2->ProjectionY("_py"));
double ycenter = h1y->GetBinCenter(h1y->GetMaximumBin());
// std::cout << "front " << i << " back " << backnum << " " << xleft << " " << xright << " " << ycenter << " " << 5486/ycenter << std::endl;
ofb << index <<" front " << i << " back " << backnum << " " << 5486/ycenter << std::endl;
h1y->GetXaxis()->SetRangeUser(ycenter-200,ycenter+200);
h1y->Draw();
TLine L3(ycenter,0,ycenter,h1y->GetMaximum()*1.1); L3.SetLineColor(kRed); L3.Draw("SAME");
gPad->Modified();
gPad->Update();
while(gPad->WaitPrimitive());
};
if(h2)
macro();
//repeat for pad#1
backnum=1;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));
if(h2)
macro();
//repeat for pad#2
backnum=3;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));
if(h2)
macro();
//repeat for pad3
backnum=0;
h2 = (TH2F*)(f->Get(Form("evsx/be_vs_x_sx3_id_%d_f%d_b%d",index,i,backnum)));
if(h2)
macro();
double xtofit[] = {xpos[0],xpos[3]};
double xktofit[] = {xposkn[0],xposkn[3]};
TGraph G1(xpos.size(),xpos.data(),xposkn.data());
G1.Draw("APL*");
G1.Fit("pol1","Q");
off << index<<" lengthcal front " << i << " " << G1.GetFunction("pol1")->GetParameter(0) << " " << G1.GetFunction("pol1")->GetParameter(1) << std::endl;
gPad->Modified(); gPad->Update();
while(gPad->WaitPrimitive());
xpos.clear();
xposkn.clear();
}
ofb.close();
off.close();
f->Close();
}

View File

@ -1,10 +1,10 @@
{
TFile *f = new TFile("../results_run19.root");
TFile *f = new TFile("../results_run01.root");
f->cd("l_vs_r");
gDirectory->ls();
int clkpos = 13;
int clkpos = 1;
std::ofstream ofile(Form("rightgains%d.dat",clkpos));
for(int i=1; i<4; i++) {
for(int i=0; i<4; i++) {
TH2F h2(*(TH2F*)(f->Get(Form("l_vs_r/l_vs_r_sx3_id_%d_f%d",clkpos,i))));
h2.Draw();

View File

@ -1,3 +1,12 @@
1 front 1 back 2 4.4094
1 front 2 back 2 4.4832
1 front 3 back 2 4.52103
1 front 0 back 2 4.44599
1 front 0 back 3 3.68208
1 front 0 back 0 3.89631
1 front 1 back 2 4.44599
1 front 1 back 3 3.81311
1 front 1 back 0 3.98321
1 front 2 back 2 4.52103
1 front 2 back 3 3.68208
1 front 2 back 0 3.95382
1 front 3 back 2 4.55951
1 front 3 back 3 3.68208
1 front 3 back 0 3.89631

12
sx3cal/backgains3.dat Normal file
View File

@ -0,0 +1,12 @@
3 front 1 back 2 3.81311
3 front 1 back 1 3.92485
3 front 1 back 3 4.13701
3 front 1 back 0 4.26886
3 front 2 back 2 3.86817
3 front 2 back 1 4.04334
3 front 2 back 3 3.98321
3 front 2 back 0 4.23512
3 front 3 back 2 3.92485
3 front 3 back 1 3.92485
3 front 3 back 3 3.95382
3 front 3 back 0 4.13701

16
sx3cal/backgains7.dat Normal file
View File

@ -0,0 +1,16 @@
7 front 0 back 2 3.65694
7 front 0 back 1 3.53625
7 front 0 back 3 4.23512
7 front 0 back 0 3.60769
7 front 1 back 2 3.65694
7 front 1 back 1 3.53625
7 front 1 back 3 4.23512
7 front 1 back 0 3.58356
7 front 2 back 2 3.68208
7 front 2 back 1 3.55975
7 front 2 back 3 4.13701
7 front 2 back 0 3.60769
7 front 3 back 2 3.68208
7 front 3 back 1 3.53625
7 front 3 back 3 4.23512
7 front 3 back 0 3.58356

View File

@ -1,6 +1,16 @@
9 front 1 back 2 3.58356
9 front 1 back 1 3.44529
9 front 2 back 2 3.58356
9 front 2 back 1 3.46759
9 front 3 back 2 3.63215
9 front 3 back 1 3.46759
9 front 0 back 2 3.68208
9 front 0 back 1 3.53625
9 front 0 back 3 3.51306
9 front 0 back 0 3.42327
9 front 1 back 2 3.70756
9 front 1 back 1 3.49018
9 front 1 back 3 3.63215
9 front 1 back 0 3.46759
9 front 2 back 2 3.70756
9 front 2 back 1 3.55975
9 front 2 back 3 3.53625
9 front 2 back 0 3.44529
9 front 3 back 2 3.7334
9 front 3 back 1 3.51306
9 front 3 back 3 3.53625
9 front 3 back 0 3.42327

View File

@ -1,3 +1,4 @@
1 lengthcal front 1 1.5121 60.4839
1 lengthcal front 2 -1.5625 62.5
1 lengthcal front 0 -0.292969 58.5938
1 lengthcal front 1 0.302419 60.4839
1 lengthcal front 2 -2.55682 56.8182
1 lengthcal front 3 2.72177 60.4839

3
sx3cal/frontgains3.dat Normal file
View File

@ -0,0 +1,3 @@
3 lengthcal front 1 0.468555 62.474
3 lengthcal front 2 -3.17087 60.3975
3 lengthcal front 3 5.24289 63.5502

4
sx3cal/frontgains7.dat Normal file
View File

@ -0,0 +1,4 @@
7 lengthcal front 0 0 44.0628
7 lengthcal front 1 1.68159 48.0453
7 lengthcal front 2 0.80963 46.2646
7 lengthcal front 3 3.5855 46.2646

View File

@ -1,3 +1,4 @@
9 lengthcal front 1 0.115732 46.2928
9 lengthcal front 2 0.799176 45.6672
9 lengthcal front 3 1.68159 48.0453
9 lengthcal front 0 2.10937 46.875
9 lengthcal front 1 0.57866 46.2928
9 lengthcal front 2 1.17187 46.875
9 lengthcal front 3 1.6345 46.6999

View File

@ -1,3 +1,4 @@
1 1 1678.38 1.07163
1 2 1693.99 1.1035
1 3 1667.9 0.975015
1 0 1229.18 1.00572
1 1 1765.87 0.968534
1 2 1778.36 0.877985
1 3 1843.61 0.985871

3
sx3cal/rightgains3.dat Normal file
View File

@ -0,0 +1,3 @@
3 1 1749.6 1.01204
3 2 1954.81 1.23687
3 3 1751.15 0.904329

4
sx3cal/rightgains7.dat Normal file
View File

@ -0,0 +1,4 @@
7 0 1787.9 1.02266
7 1 1924.89 1.10649
7 2 1706.01 1.03175
7 3 1685.88 0.933633

View File

@ -1,3 +1,4 @@
9 1 1555.08 0.998252
9 2 1559.36 1.00299
9 3 1585.79 1.01582
9 0 1838.02 1.07361
9 1 1695.51 0.971866
9 2 1709.36 0.988575
9 3 1719.37 0.982937