Skip to content
Snippets Groups Projects
Commit 6f5f70ac authored by Ryan-Ambrose's avatar Ryan-Ambrose Committed by Eric Pooser
Browse files

SHMS HGC (#239)

* Calibration script now uses normalized energy for particle ID and can update calibration constants directly. Both scripts use PROOF-lite by default. Added a run_cal script for ease of use. README now reflects updated scripts.

* Calibration/running script cleanup
parent 44163f75
No related branches found
No related tags found
No related merge requests found
...@@ -106,8 +106,8 @@ void calibration::SlaveBegin(TTree * /*tree*/) ...@@ -106,8 +106,8 @@ void calibration::SlaveBegin(TTree * /*tree*/)
if (!fNGC) //Set up histograms for HGC if (!fNGC) //Set up histograms for HGC
{ {
ADC_min = 0; ADC_min = -4000;
ADC_max = 7000; ADC_max = 12000;
bins = abs(ADC_min) + abs(ADC_max); bins = abs(ADC_min) + abs(ADC_max);
} }
...@@ -128,11 +128,11 @@ void calibration::SlaveBegin(TTree * /*tree*/) ...@@ -128,11 +128,11 @@ void calibration::SlaveBegin(TTree * /*tree*/)
} }
} }
fCut_everything = new TH2F("Cut_everything", "Visualization of no cuts; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 1000, 0, 4.0, 1000, 0, 4.0); fCut_everything = new TH2F("Cut_everything", "Visualization of no cuts; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 200, 0, 1.0, 200, 0, 1.0);
GetOutputList()->Add(fCut_everything); GetOutputList()->Add(fCut_everything);
fCut_electron = new TH2F("Cut_electron", "Visualization of electron cut; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 1000, 0, 4.0, 1000, 0, 4.0); fCut_electron = new TH2F("Cut_electron", "Visualization of electron cut; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 200, 0, 1.0, 200, 0, 1.0);
GetOutputList()->Add(fCut_electron); GetOutputList()->Add(fCut_electron);
fCut_pion = new TH2F("Cut_pion", "Visualization of pion cut; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 1000, 0, 4.0, 1000, 0, 4.0); fCut_pion = new TH2F("Cut_pion", "Visualization of pion cut; Calorimeter Energy (GeV); Pre-Shower Energy (GeV)", 200, 0, 1.0, 200, 0, 1.0);
GetOutputList()->Add(fCut_pion); GetOutputList()->Add(fCut_pion);
printf("\n\n"); printf("\n\n");
...@@ -396,7 +396,7 @@ Bool_t calibration::Process(Long64_t entry) ...@@ -396,7 +396,7 @@ Bool_t calibration::Process(Long64_t entry)
Float_t p = ((P_gtr_dp/100.0)*central_p) + central_p; Float_t p = ((P_gtr_dp/100.0)*central_p) + central_p;
//Fill histogram visualizaing the electron selection //Fill histogram visualizaing the electron selection
fCut_everything->Fill(P_cal_fly_earray, P_cal_pr_eplane); fCut_everything->Fill(P_cal_fly_earray/p, P_cal_pr_eplane/p);
//Cut on Shower vs preshower is a tilted ellipse, this requires an angle of rotation (in radians), x/y center, semimajor and semiminor axis //Cut on Shower vs preshower is a tilted ellipse, this requires an angle of rotation (in radians), x/y center, semimajor and semiminor axis
Float_t piangle = 0.0; Float_t piangle = 0.0;
...@@ -408,7 +408,7 @@ Bool_t calibration::Process(Long64_t entry) ...@@ -408,7 +408,7 @@ Bool_t calibration::Process(Long64_t entry)
pow((P_cal_fly_earray/p - pix_center)*sin(piangle) - (P_cal_pr_eplane/p - piy_center)*cos(piangle),2)/pow(pisemiminor_axis,2) < 1) pow((P_cal_fly_earray/p - pix_center)*sin(piangle) - (P_cal_pr_eplane/p - piy_center)*cos(piangle),2)/pow(pisemiminor_axis,2) < 1)
{ {
//Fill histogram visualizing the electron selection //Fill histogram visualizing the electron selection
fCut_pion->Fill(P_cal_fly_earray, P_cal_pr_eplane); fCut_pion->Fill(P_cal_fly_earray/p, P_cal_pr_eplane/p);
//Fill histogram of the full PulseInt spectra for each PMT //Fill histogram of the full PulseInt spectra for each PMT
fNGC ? fPulseInt[ipmt]->Fill(P_ngcer_goodAdcPulseInt[ipmt]) : fPulseInt[ipmt]->Fill(P_hgcer_goodAdcPulseInt[ipmt]); fNGC ? fPulseInt[ipmt]->Fill(P_ngcer_goodAdcPulseInt[ipmt]) : fPulseInt[ipmt]->Fill(P_hgcer_goodAdcPulseInt[ipmt]);
...@@ -472,9 +472,9 @@ void calibration::Terminate() ...@@ -472,9 +472,9 @@ void calibration::Terminate()
{ {
for (Int_t iquad=0; iquad<4; iquad++) for (Int_t iquad=0; iquad<4; iquad++)
{ {
fNGC ? PulseInt_quad[iquad][ipmt]->Rebin(25) : PulseInt_quad[iquad][ipmt]->Rebin(25); fNGC ? PulseInt_quad[iquad][ipmt]->Rebin(20) : PulseInt_quad[iquad][ipmt]->Rebin(20);
} }
fNGC ? PulseInt[ipmt]->Rebin(25) : PulseInt[ipmt]->Rebin(25); fNGC ? PulseInt[ipmt]->Rebin(20) : PulseInt[ipmt]->Rebin(20);
} }
...@@ -489,57 +489,8 @@ void calibration::Terminate() ...@@ -489,57 +489,8 @@ void calibration::Terminate()
fPions ? fCut_pion->Draw("Colz") : fCut_electron->Draw("Colz"); fPions ? fCut_pion->Draw("Colz") : fCut_electron->Draw("Colz");
} }
//Single Gaussian to find mean/std. dev. of peaks
TF1 *Gauss1 = new TF1("Gauss1",gauss,-500,7000,3);
Gauss1->SetParNames("Amplitude","Mean","Std. Dev.");
//Quantities to keep track of
Float_t scale = 0.0; //average amplitude of SPE signals (channels ADC)
Float_t sigma = 0.0; //standard dev. of the pedistal fir (channels ADC)
gStyle->SetOptFit(111); gStyle->SetOptFit(111);
Int_t passes = 0; //Used to tell # of entries is scale
//Main loop for calibration
for (Int_t ipmt=0; ipmt < (fNGC ? fngc_pmts : fhgc_pmts); ipmt++)
{
//TSpectrum class is used to find the SPE peak using the search method
TSpectrum *s = new TSpectrum(2);
//Create Canvas to see the search result for the SPE
quad_cuts_ipmt = new TCanvas(Form("quad_cuts_%d",ipmt), Form("First Photoelectron peaks PMT%d",ipmt+1));
quad_cuts_ipmt->Divide(2,2);
for (Int_t iquad=0; iquad<4; iquad++)
{
quad_cuts_ipmt->cd(iquad+1);
s->Search(PulseInt_quad[iquad][ipmt], 2.5, "nobackground", 0.001);
TList *functions = PulseInt_quad[iquad][ipmt]->GetListOfFunctions();
TPolyMarker *pm = (TPolyMarker*)functions->FindObject("TPolyMarker");
Double_t *xpeaks = pm->GetX();
if (iquad != ipmt)
{
Gauss1->SetRange(xpeaks[0]-150, xpeaks[0]+150);
Gauss1->SetParameter(1, xpeaks[0]);
Gauss1->SetParameter(2, 200.);
Gauss1->SetParLimits(0, 0., 2000.);
Gauss1->SetParLimits(1, xpeaks[0]-150, xpeaks[0]+150);
Gauss1->SetParLimits(2, 10., 500.);
PulseInt_quad[iquad][ipmt]->Fit("Gauss1","RQ");
//Store std. dev. of pedistal and mean of SPE
scale += xpeaks[1];
sigma += Gauss1->GetParameter(2);
}
}
scale = scale/3;
sigma = sigma/3;
cout << Form("The values for 'scale' and 'sigma' for PMT%d are:\n", ipmt+1) << scale << " " << sigma << "\n";
}
/*
//Single Gaussian to find mean of SPE //Single Gaussian to find mean of SPE
TF1 *Gauss1 = new TF1("Gauss1",gauss,-500,7000,3); TF1 *Gauss1 = new TF1("Gauss1",gauss,-500,7000,3);
Gauss1->SetParNames("Amplitude","Mean","Std. Dev."); Gauss1->SetParNames("Amplitude","Mean","Std. Dev.");
...@@ -559,16 +510,6 @@ void calibration::Terminate() ...@@ -559,16 +510,6 @@ void calibration::Terminate()
//Linear function used to determine goodness-of-fit for NPE spacing //Linear function used to determine goodness-of-fit for NPE spacing
TF1 *Linear = new TF1("Linear",linear,0,4,2); TF1 *Linear = new TF1("Linear",linear,0,4,2);
Linear->SetParNames("Slope", "Intercept"); Linear->SetParNames("Slope", "Intercept");
//Rebin the histograms into something more sensible, add functionality to bin HGC & NGC independently
for (Int_t ipmt=0; ipmt < (fNGC ? fngc_pmts : fhgc_pmts); ipmt++)
{
for (Int_t iquad=0; iquad<4; iquad++)
{
fNGC ? PulseInt_quad[iquad][ipmt]->Rebin(25) : PulseInt_quad[iquad][ipmt]->Rebin(25);
}
fNGC ? PulseInt[ipmt]->Rebin(25) : PulseInt[ipmt]->Rebin(25);
}
//An array is used to store the means for the SPE, and to determine NPE spacing //An array is used to store the means for the SPE, and to determine NPE spacing
Double_t mean[3]; Double_t mean[3];
...@@ -1018,5 +959,4 @@ void calibration::Terminate() ...@@ -1018,5 +959,4 @@ void calibration::Terminate()
calibration.close(); calibration.close();
} }
*/
} }
...@@ -25,11 +25,10 @@ void run_cal(Int_t RunNumber = 0, Int_t NumEvents = 0) ...@@ -25,11 +25,10 @@ void run_cal(Int_t RunNumber = 0, Int_t NumEvents = 0)
getline(std::cin, calib_raw); getline(std::cin, calib_raw);
TString calib_option = calib_raw; TString calib_option = calib_raw;
/*
string eff_raw; string eff_raw;
cout << "\nEnter options for efficiency (enter NA to skip): "; cout << "\nEnter options for efficiency (enter NA to skip): ";
getline(std::cin, eff_raw); getline(std::cin, eff_raw);
TString eff_option = eff_raw;*/ TString eff_option = eff_raw;
TChain ch("T"); TChain ch("T");
ch.Add(Form("../../ROOTfiles/shms_replay_%d_%d.root", RunNumber, NumEvents)); ch.Add(Form("../../ROOTfiles/shms_replay_%d_%d.root", RunNumber, NumEvents));
...@@ -66,5 +65,5 @@ void run_cal(Int_t RunNumber = 0, Int_t NumEvents = 0) ...@@ -66,5 +65,5 @@ void run_cal(Int_t RunNumber = 0, Int_t NumEvents = 0)
} }
} }
//if (eff_option != "NA") ch.Process("efficiencies.C+",eff_option); if (eff_option != "NA") ch.Process("efficiencies.C+",eff_option);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment