A lot of the files are identical to old ones, but the main changes are: 1) EXFit2.C in sx3cal - Finds front/right gains for each strip using the known middle two pad edges, but gainmatches all backs 2) Define new 'fix' loci, arising from the step-ladder correction to A1C2 events. This is tested in scratch/sx3z_vs_pcz/testmodel.h, will be given a better name in the future. 3) Explore A1C2 and A1C3 loci in detail 4) environment variables to 'flip' and 'offset' wires during sort. All env vars are set in shell scripts that call them 5) environment variables that allow for timestamp bounds to be set and unset. Default limiting values are 0 and dbl_max so no harm done unless these specific env vars are set. 6) Some bookkeeping indicating 27Al instead of 26Al in all places.
68 lines
2.8 KiB
C
68 lines
2.8 KiB
C
{
|
|
int index = 1;
|
|
TFile *f = new TFile("../results_run01.root");
|
|
TH2F *h2=NULL;
|
|
TH1F *h1x=NULL, *h1y=NULL;
|
|
//f->cd("evsx");
|
|
//f->ls();
|
|
|
|
double known_xpos[2][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();
|
|
xpos.push_back(xleft); xposkn.push_back(known_xpos[backnum-1][0]);
|
|
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();
|
|
|
|
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();
|
|
}
|