modified: Calibration.C

modified:   GainMatchQQQ.C
	modified:   QQQ_Calcheck.C
	modified:   makeplots.C
This commit is contained in:
Vignesh Sitaraman 2025-12-01 13:49:23 -05:00
parent c32215e293
commit aee3a2467d
4 changed files with 106 additions and 36 deletions

View File

@ -46,8 +46,8 @@ void Calibration::Begin(TTree * /*tree*/)
else else
{ {
int det, ring, wedge; int det, ring, wedge;
double gainw,gainr; double gainw, gainr;
while (infile >> det >> ring >> wedge >> gainw>>gainr) while (infile >> det >> ring >> wedge >> gainw >> gainr)
{ {
qqqwGain[det][ring][wedge] = gainw; qqqwGain[det][ring][wedge] = gainw;
qqqrGain[det][ring][wedge] = gainr; qqqrGain[det][ring][wedge] = gainr;
@ -104,7 +104,7 @@ Bool_t Calibration::Process(Long64_t entry)
// printf("Wedge E: %.2f Gain: %.4f \n", eWedge, qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16]); // printf("Wedge E: %.2f Gain: %.4f \n", eWedge, qqqGain[qqq.id[i]][qqq.ch[i]][qqq.ch[j] - 16]);
chRing = qqq.ch[j] - 16; chRing = qqq.ch[j] - 16;
eRingRaw = qqq.e[j]; eRingRaw = qqq.e[j];
eRing = qqq.e[j] * qqqrGain[qqq.id[j]][qqq.ch[j]][qqq.ch[i]-16]; eRing = qqq.e[j] * qqqrGain[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16];
} }
else if (qqq.ch[j] < 16 && qqq.ch[i] >= 16 && qqqrGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16] && qqqwGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16]) else if (qqq.ch[j] < 16 && qqq.ch[i] >= 16 && qqqrGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16] && qqqwGainValid[qqq.id[j]][qqq.ch[j]][qqq.ch[i] - 16])
{ {
@ -134,6 +134,11 @@ Bool_t Calibration::Process(Long64_t entry)
// hist2d->Fill(eWedge, eRing); // hist2d->Fill(eWedge, eRing);
// if (cut && cut->IsInside(eWedge, eRing)) // if (cut && cut->IsInside(eWedge, eRing))
const double MIN_ADC = 1500.0;
const double MAX_ADC = 3000.0;
if (eWedge >= MIN_ADC && eWedge <= MAX_ADC &&
eRing >= MIN_ADC && eRing <= MAX_ADC)
{ {
// Accumulate data for gain matching // Accumulate data for gain matching
dataPoints[{qqq.id[i], chRing, chWedge}].emplace_back(eWedge, eRing); dataPoints[{qqq.id[i], chRing, chWedge}].emplace_back(eWedge, eRing);
@ -148,7 +153,7 @@ Bool_t Calibration::Process(Long64_t entry)
void Calibration::Terminate() void Calibration::Terminate()
{ {
const double AM241_PEAK = 5485.56; const double AM241_PEAK = 5485.56;
const double P_PEAK=7000; // keV const double P_PEAK = 7000; // keV
double calibArray[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}}; double calibArray[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{0}}};
bool calibValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}}; bool calibValid[MAX_QQQ][MAX_RING][MAX_WEDGE] = {{{false}}};
@ -248,9 +253,9 @@ void Calibration::Terminate()
double eRkeV = eRGM * slope / 1000; double eRkeV = eRGM * slope / 1000;
hCal->Fill(eWkeV, eRkeV); hCal->Fill(eWkeV, eRkeV);
plotter->Fill2D("hCalQQQ", 4000, 0, 100, 4000, 0, 100, eWkeV, eRkeV); plotter->Fill2D("hCalQQQ", 4000, 0, 10, 4000, 0, 10, eWkeV, eRkeV);
plotter->Fill2D(Form("hRCal_qqq%d", det ), 16,0,15, 400, 0, 24, ring, eRkeV, "RingCal"); plotter->Fill2D(Form("hRCal_qqq%d", det), 16, 0, 15, 400, 0, 24, ring, eRkeV, "RingCal");
plotter->Fill2D(Form("hWCal_qqq%d", det ), 16,0,15, 400, 0, 24, wedge, eWkeV, "WedgeCal"); plotter->Fill2D(Form("hWCal_qqq%d", det), 16, 0, 15, 400, 0, 24, wedge, eWkeV, "WedgeCal");
} }
} }

View File

@ -117,22 +117,21 @@ Bool_t GainMatchQQQ::Process(Long64_t entry)
auto [id, chr, chw, er, ew] = tuple; auto [id, chr, chw, er, ew] = tuple;
if (ringMults[chr] > 1 || wedgeMults[chw] > 1) if (ringMults[chr] > 1 || wedgeMults[chw] > 1)
continue; // ignore multiplicity > 1 events continue; // ignore multiplicity > 1 events
double ratio = (ew > 0.0) ? (er / ew) : 0.0; double ratio = (ew > 0.0) ? (er / ew) : 0.0;
double maxslope = 1.5; double maxslope = 1.5;
bool validPoint = false; bool validPoint = false;
if (ratio < maxslope && ratio > 1. / maxslope) if (ratio < maxslope && ratio > 1. / maxslope)
{ {
// Accumulate data for gain matching // Accumulate data for gain matching
dataPoints[{id, chr, chw}].emplace_back(ew, er); dataPoints[{id, chr, chw}].emplace_back(ew, er);
plotter->Fill2D("hAll_in", 4000, 0, 16000, 4000, 0, 16000, ew, er); plotter->Fill2D("hAll_in", 4000, 0, 16000, 4000, 0, 16000, ew, er);
validPoint = true; validPoint = true;
} }
if (!validPoint)
if (!validPoint) {
{ plotter->Fill2D("hAll_out", 4000, 0, 16000, 4000, 0, 16000, ew, er);
plotter->Fill2D("hAll_out", 4000, 0, 16000, 4000, 0, 16000, ew, er); }
}
} }
return kTRUE; return kTRUE;
@ -174,6 +173,7 @@ void GainMatchQQQ::Terminate()
bool solved = false; bool solved = false;
double final_gW = 0.0; double final_gW = 0.0;
double final_gR = 0.0; double final_gR = 0.0;
// make a vector of ring wedge as I go through all points and fit a tgraph on the fly
// Iterative sigma-clipping loop // Iterative sigma-clipping loop
for (int iter = 0; iter < MAX_ITER; ++iter) for (int iter = 0; iter < MAX_ITER; ++iter)

View File

@ -142,14 +142,17 @@ Bool_t QQQ_Calcheck::Process(Long64_t entry)
continue; continue;
// hQQQFVB->Fill(eWedge, eRing); // hQQQFVB->Fill(eWedge, eRing);
plotter->Fill2D(Form("hRaw_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 16000, 400, 0, 16000, eWedgeRaw, eRingRaw, "ERaw"); plotter->Fill2D(Form("hRaw_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 8000, 400, 0, 8000, eWedgeRaw, eRingRaw, "ERaw");
plotter->Fill2D(Form("hGM_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 16000, 400, 0, 16000, eWedge, eRing, "EGM"); plotter->Fill2D(Form("hGM_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 16000, 400, 0, 16000, eWedge, eRing, "EGM");
plotter->Fill2D(Form("hCal_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 24, 400, 0, 24, eWedgeMeV, eRingMeV, "ECal"); plotter->Fill2D(Form("hCal_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 10, 400, 0, 10, eWedgeMeV, eRingMeV, "ECal");
if(eWedgeRaw >1500 && eRingRaw>1500 )
plotter->Fill2D(Form("hCal_cut_qqq%d_ring%d_wedge%d", qqq.id[i], chRing, chWedge), 400, 0, 10, 400, 0, 10, eWedgeMeV, eRingMeV, "ECal_cut");
plotter->Fill2D(Form("hRCal_qqq%d", qqq.id[i]), 16, 0, 15, 1000, 0, 30, chRing, eRingMeV, "RingCal"); plotter->Fill2D(Form("hRCal_qqq%d", qqq.id[i]), 16, 0, 15, 1000, 0, 30, chRing, eRingMeV, "RingCal");
plotter->Fill2D(Form("hWCal_qqq%d", qqq.id[i]), 16, 0, 15, 1000, 0, 30, chWedge, eWedgeMeV, "WedgeCal"); plotter->Fill2D(Form("hWCal_qqq%d", qqq.id[i]), 16, 0, 15, 1000, 0, 30, chWedge, eWedgeMeV, "WedgeCal");
plotter->Fill2D("hRawQQQ", 4000, 0, 16000, 4000, 0, 16000, eWedgeRaw, eRingRaw); plotter->Fill2D("hRawQQQ", 4000, 0, 8000, 4000, 0, 8000, eWedgeRaw, eRingRaw);
plotter->Fill2D("hGMQQQ", 4000, 0, 16000, 4000, 0, 16000, eWedge, eRing); plotter->Fill2D("hGMQQQ", 4000, 0, 16000, 4000, 0, 16000, eWedge, eRing);
plotter->Fill2D("hCalQQQ", 4000, 0, 24, 4000, 0, 24, eWedgeMeV, eRingMeV); plotter->Fill2D("hCalQQQ", 4000, 0, 10, 4000, 0, 10, eWedgeMeV, eRingMeV);
} }
} }
} }

View File

@ -13,13 +13,75 @@
#include "Armory/HistPlotter.h" #include "Armory/HistPlotter.h"
#include "TVector3.h" #include "TVector3.h"
void make_plots(); void makeplots()
{
TCanvas *c1 = new TCanvas("c1", "c1", 0, 0, 1024, 768);
c1->Divide(2, 2);
TH2F *h1, *h2, *h3, *h4 =nullptr; TH2F *h1, *h2, *h3, *h4 = nullptr;
int main(){ std::string type = "Cal_cut";
TFile* inFile = TFile::Open("Cal_checkQQQ.root"); TFile *inFile = TFile::Open("Cal_checkQQQ.root");
TF1 f1("x","x",0 ,80);
make_plots();
return 0; for (int ring = 0; ring < 16; ring++)
{
for (int wedge = 0; wedge < 16; wedge++)
{
c1->cd(1);
h1 = (TH2F *)inFile->Get(Form("E%s/h%s_qqq%d_ring%d_wedge%d", type.c_str(), type.c_str(), 0, ring, wedge));
gPad->SetGrid();
if (h1)
{
h1->SetTitle(Form("QQQ%d Ring %d Wedge %d %s E", 0, ring, wedge, type.c_str()));
h1->Draw("COLZ");
f1.DrawClone("same");
gPad->Modified();
gPad->Update();
}
c1->cd(2);
h2 = (TH2F *)inFile->Get(Form("E%s/h%s_qqq%d_ring%d_wedge%d", type.c_str(), type.c_str(), 1, ring, wedge));
gPad->SetGrid();
if (h2)
{
std::cout<<h2<<std::endl;
h2->SetTitle(Form("QQQ%d Ring %d Wedge %d %s E", 1, ring, wedge, type.c_str()));
h2->Draw("COLZ");
f1.DrawClone("same");
gPad->Modified();
gPad->Update();
}
c1->cd(3);
h3 = (TH2F *)inFile->Get(Form("E%s/h%s_qqq%d_ring%d_wedge%d", type.c_str(), type.c_str(), 2, ring, wedge));
gPad->SetGrid();
if (h3)
{
h3->SetTitle(Form("QQQ%d Ring %d Wedge %d %s E", 2, ring, wedge, type.c_str()));
h3->Draw("COLZ");
f1.DrawClone("same");
gPad->Modified();
gPad->Update();
}
c1->cd(4);
h4 = (TH2F *)inFile->Get(Form("E%s/h%s_qqq%d_ring%d_wedge%d", type.c_str(), type.c_str(), 3, ring, wedge));
gPad->SetGrid();
if (h4)
{
h4->SetTitle(Form("QQQ%d Ring %d Wedge %d %s E", 3, ring, wedge, type.c_str()));
h4->Draw("COLZ");
f1.DrawClone("same");
gPad->Modified();
gPad->Update();
}
while (gPad->WaitPrimitive());
}
}
inFile->Close();
} }