ANASEN_analysis/scratch/sx3z_vs_phiz/scan_offset.C
Sudarsan Balakrishnan 2f43903269 * Main logic broken up into subunits that aim to be self-contained. The entirety of the analysis is aimed to follow:
- find sx3 events, gainmatch them, calibrate, make a vector of these called SX3_Events
	- same step for QQQ, call it QQQ_Events
	- find anodeWire clusters, cathodeWire clusters, make vectors of these
	- make PC_Events from wire clusters, save 'anode only' and 'cathode only' cases just in case

* since PC_Events, QQQ_Events, SX3_Events are all STL containers, we can pass them to functions that perform modular analyses
* In this commit:
	- 4-wire offsets used, along with reliably figuring out phi-offset between QQQ/SX3/PC. We are close, except for some QQQ fine-tuning due to their angular extent not being 90 deg
	- the pczfix step now makes sense, 1-wire calculations also loosely match between guess and pcz
	- the nonlinearity correction/dynamic range fix is just adding to the resolution
	- p(a,a) data analysable by QQQ alphas show good kinematics, when doing the following gates:
		>  A1C1 event pczs dithered, A1C2 events made into pczfix
		>  phicut (45 deg) to gate out p+a correlations, SiE < 5 MeV && PCa > 6000 to select the alpha blob in p+a
		>  Some selection on VertexReconXY so that the Perp() of the vertex is < 6mm
		>  Selection on VertexReconZ so that z is in [-173.6, 100]. Fine alignment pending

	- Doing all the above gives reasonable p(a,a) kinematic curves with good statistics, Ex peaked at -0.7 MeV, close but not perfect
	- The above steps, when repeated with oneWire anode events stored in aClusters also yields a very reasonable kinematic locus, and Ex value, even more statistics
	- Not sure how much of this is autocorrelation stuff but
		> VertexReconZ vs Ef in QQQ (Ef is eloss-fixed alpha energy using path length) shows sensible trends.
	- Why Ex is not centered around zero might need more thought.
	- VertexReconXY is suspiciously well-centered, might need some more thought as well.

* Some infrastructure that allows processing of 17F data is also in the pipeline now.
* One fairly important bug got fixed which was ignoring qqq.id[0] when making QQQ_Events

* Ideally, follow-ups to the above done on 27Al, 17F will make their own functions that are then called separately using booleans at the very top.
* The fate of proton dE signals is out to jury.
2026-05-29 17:45:57 -04:00

107 lines
3.3 KiB
C

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,2);
TFile* f=NULL;
std::vector<TFile*> files;
int ctr=0;
for(int i=12; i<=21; i++) {
if(i>=13 && i<=17) continue;
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"));
//TH2F *h23 = (TH2F*)(f->Get("phicut/pczguess_vs_pc_int_self"));
std::cout << "aaa" << h23 << std::endl;
h23->SetLineColorAlpha(kOrange,0.75);
h23->GetYaxis()->SetRangeUser(-200,200);
h23->Draw("col");
} {
//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("pcz_vs_sx3pczguess_self"));
std::cout << h2 << std::endl;
//TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
if(h2) {
h2->SetTitle(Form("case%d",i));
//h2->Draw("colz same");
h2->SetLineColorAlpha(colors[ctr],0.75);
h2->Draw("col same");
}
}
c1->Modified();
c1->Update();
ctr+=1;
auto c1a = c.cd(2);
c1a->SetGrid(1,1);
TH2F *h24 = (TH2F*)(f->Get("sx3phi_vs_pcphi1"));
if(h24) {
h24->Draw("box");
h24->SetLineColor(kRed);
}
TH2F *h25 = (TH2F*)(f->Get("phiPC_vs_phiQQQ_TimeCut"));
if(h25) {
h25->SetLineColor(kBlue);
h25->Draw("box same");
}
c1a->Modified();
c1a->Update();
auto c2=c.cd(3);
c2->SetGrid(1,1);
TH2F *h3 = (TH2F*)(f->Get("d_sx3pczguess_minus_pcz_a1c2"));
// TH2F *h2 = (TH2F*)(f->Get("hPCQQQ/PC_XY_Projection_QQQ2"));
if(h3) {
h3->SetLineColor(kRed);
h3->SetTitle(Form("z_vs_guess_run%d",i));
h3->Draw("colz");
}
TH2F *h4 = (TH2F*)(f->Get("d_qqqpczguess_minus_pcz_a1c2"));
//TH2F *h4 = (TH2F*)(f->Get("d_sx3pczguess_minus_pczfix_a1c2"));
if(h4)
h4->Draw("colz same");
c2->Modified();
c2->Update();
auto c23 = c.cd(4);
c23->SetGrid(1,1);
TH1F *hdiff2 = (TH1F*)(f->Get("d_sx3phi_minus_pcphi1"));
if(hdiff2) {
hdiff2->SetLineColor(kRed);
hdiff2->Draw("");
}
TH1F *hdiff = (TH1F*)(f->Get("d_phiPC_phiQQQ_TimeCut"));
if(hdiff) {
hdiff->SetLineColor(kBlue);
hdiff->Draw("SAME");
}
c23->Modified();
c23->Update();
while(gPad->WaitPrimitive());
files.emplace_back(f);
std::cout <<"Test" << std::endl;
if(i==21) {
i=11;
c.Clear();
c.Divide(2,2);
ctr=0;
}
//if(quit) break;
}
for(auto file : files) {
file->Close();
}
}