modified: Analyzer.C
modified the analyser to include gain matching for the anodes and the cathodes modified: FitHistogramsWithTSpectrum_Sequential_Improved.C modified: MatchAndPlotCentroids.C modified: centroids.txt modified: slope_intercept_results.txt
This commit is contained in:
parent
b99ad4e4d7
commit
56a6389b4f
42
Analyzer.C
42
Analyzer.C
|
@ -33,6 +33,7 @@ TH2F *hqqqVpcE;
|
||||||
TH2F *hsx3VpcE;
|
TH2F *hsx3VpcE;
|
||||||
TH2F *hanVScatsum;
|
TH2F *hanVScatsum;
|
||||||
TH2F *hanVScatsum_a[24];
|
TH2F *hanVScatsum_a[24];
|
||||||
|
TH1F *hPC_E[48];
|
||||||
TH1F *hAnodeMultiplicity;
|
TH1F *hAnodeMultiplicity;
|
||||||
|
|
||||||
int padID = 0;
|
int padID = 0;
|
||||||
|
@ -91,6 +92,12 @@ void Analyzer::Begin(TTree * /*tree*/)
|
||||||
TString histTitle = Form("Anode %d vs Cathode Sum; Anode E; Cathode Sum E", i);
|
TString histTitle = Form("Anode %d vs Cathode Sum; Anode E; Cathode Sum E", i);
|
||||||
hanVScatsum_a[i] = new TH2F(histName, histTitle, 400, 0, 10000, 400, 0, 16000);
|
hanVScatsum_a[i] = new TH2F(histName, histTitle, 400, 0, 10000, 400, 0, 16000);
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < 48; i++)
|
||||||
|
{
|
||||||
|
TString histName = Form("hCathode_%d", i);
|
||||||
|
TString histTitle = Form("Cathode_E_%d;", i);
|
||||||
|
hPC_E[i] = new TH1F(histName, histTitle, 3200, 0, 32000);
|
||||||
|
}
|
||||||
sx3_contr.ConstructGeo();
|
sx3_contr.ConstructGeo();
|
||||||
pw_contr.ConstructGeo();
|
pw_contr.ConstructGeo();
|
||||||
|
|
||||||
|
@ -105,6 +112,8 @@ void Analyzer::Begin(TTree * /*tree*/)
|
||||||
{
|
{
|
||||||
std::stringstream ss(line);
|
std::stringstream ss(line);
|
||||||
ss >> index >> slope >> intercept;
|
ss >> index >> slope >> intercept;
|
||||||
|
// wires 37, 39, 44 have fit data that is incorrect or not present, they have thus been set to 1,0 (slope, intercept) for convenience
|
||||||
|
// wire 19 the 4th point was genereated using the slope of the line produced uising the other 3 points from the wire 1 vs wire 19 plot
|
||||||
if (index >= 0 && index <= 47)
|
if (index >= 0 && index <= 47)
|
||||||
{
|
{
|
||||||
slopeInterceptMap[index] = std::make_pair(slope, intercept);
|
slopeInterceptMap[index] = std::make_pair(slope, intercept);
|
||||||
|
@ -328,7 +337,20 @@ Bool_t Analyzer::Process(Long64_t entry)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (pc.e[i] > 100)
|
if (pc.e[i] > 100)
|
||||||
|
{
|
||||||
ID.push_back(std::pair<int, int>(pc.id[i], i));
|
ID.push_back(std::pair<int, int>(pc.id[i], i));
|
||||||
|
if (pc.index[i] >= 0 && pc.index[i] < 48 && hPC_E[pc.index[i]] != nullptr)
|
||||||
|
{
|
||||||
|
// if (pc.index[i] >= 24 && pc.index[i] < 48) {
|
||||||
|
hPC_E[pc.index[i]]->Fill(pc.e[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// }
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Warning: Invalid index %d or null pointer detected!\n", pc.index[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (pc.e[i] > 100)
|
if (pc.e[i] > 100)
|
||||||
E.push_back(std::pair<int, double>(pc.index[i], pc.e[i]));
|
E.push_back(std::pair<int, double>(pc.index[i], pc.e[i]));
|
||||||
|
|
||||||
|
@ -353,7 +375,6 @@ Bool_t Analyzer::Process(Long64_t entry)
|
||||||
// printf("index: %d, New cathode energy: %d \n",pc.index[i], pc.e[i]);
|
// printf("index: %d, New cathode energy: %d \n",pc.index[i], pc.e[i]);
|
||||||
}
|
}
|
||||||
hpcIndexVE_GM->Fill(pc.index[i], pc.e[i]);
|
hpcIndexVE_GM->Fill(pc.index[i], pc.e[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -707,4 +728,23 @@ void Analyzer::Terminate()
|
||||||
canvas->cd(padID)->SetGrid(1);
|
canvas->cd(padID)->SetGrid(1);
|
||||||
// hZProj->Draw();
|
// hZProj->Draw();
|
||||||
hanVScatsum->Draw("colz");
|
hanVScatsum->Draw("colz");
|
||||||
|
|
||||||
|
TFile *outRoot = new TFile("Histograms.root", "RECREATE");
|
||||||
|
|
||||||
|
if (!outRoot->IsOpen())
|
||||||
|
{
|
||||||
|
std::cerr << "Error opening file for writing!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through histograms and write them to the ROOT file
|
||||||
|
for (int i = 0; i < 48; i++)
|
||||||
|
{
|
||||||
|
if (hPC_E[i] != nullptr)
|
||||||
|
{
|
||||||
|
hPC_E[i]->Write(); // Write histogram to file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
outRoot->Close();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include <TText.h>
|
#include <TText.h>
|
||||||
|
|
||||||
void FitHistogramsWithTSpectrum_Sequential_Improved() {
|
void FitHistogramsWithTSpectrum_Sequential_Improved() {
|
||||||
TFile *inputFile = new TFile("../Histograms_anodes.root", "READ");
|
TFile *inputFile = new TFile("Histograms_anodes.root", "READ");
|
||||||
if (!inputFile || inputFile->IsZombie()) {
|
if (!inputFile || inputFile->IsZombie()) {
|
||||||
std::cerr << "Error opening the input file!" << std::endl;
|
std::cerr << "Error opening the input file!" << std::endl;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -49,9 +49,10 @@ void MatchAndPlotCentroids() {
|
||||||
}
|
}
|
||||||
outputFile << "Histogram Number\tSlope\tIntercept\n";
|
outputFile << "Histogram Number\tSlope\tIntercept\n";
|
||||||
// Loop through histograms 25 to 47
|
// Loop through histograms 25 to 47
|
||||||
for (int targetHist = 0; targetHist <= 23; ++targetHist) {
|
for (int targetHist = 0; targetHist <= 23; targetHist++) {
|
||||||
// Ensure the target histogram exists and matches in peak numbers
|
// Ensure the target histogram exists and matches in peak numbers
|
||||||
if (centroidData.find(targetHist) == centroidData.end() || centroidData[targetHist].size() != referenceCentroids.size()) {
|
if (centroidData.find(targetHist) == centroidData.end() || centroidData[targetHist].size() != referenceCentroids.size()) {
|
||||||
|
//4th cnetroid data point for 19 was generated using the 3 datqa points for the slope of wires 0 and 19
|
||||||
std::cout << "Skipping Histogram " << targetHist << " due to mismatched or missing data." << std::endl;
|
std::cout << "Skipping Histogram " << targetHist << " due to mismatched or missing data." << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -67,8 +68,8 @@ void MatchAndPlotCentroids() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xValues.size() < 4) {
|
if (xValues.size() < 3) {
|
||||||
std::cout << "Skipping Histogram " << targetHist << " as it has less than 4 matching centroids." << std::endl;
|
std::cout << "Skipping Histogram " << targetHist << " as it has less than 3 matching centroids." << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
HistogramIndex PeakNumber Centroid Amplitude Sigma
|
HistogramIndex PeakNumber Centroid Amplitude Sigma
|
||||||
|
0 1 991.118
|
||||||
|
0 2 2026.83
|
||||||
|
0 3 3060.26
|
||||||
|
0 4 4092.45
|
||||||
1 1 922.213
|
1 1 922.213
|
||||||
1 2 1885.55
|
1 2 1885.55
|
||||||
1 3 2845.53
|
1 3 2845.53
|
||||||
|
@ -71,6 +75,10 @@ HistogramIndex PeakNumber Centroid Amplitude Sigma
|
||||||
18 2 1990.64
|
18 2 1990.64
|
||||||
18 3 3005.46
|
18 3 3005.46
|
||||||
18 4 4048.99
|
18 4 4048.99
|
||||||
|
19 1 1082.91
|
||||||
|
19 2 2194.08
|
||||||
|
19 3 3303.65
|
||||||
|
19 4 4411.32
|
||||||
20 1 912.778
|
20 1 912.778
|
||||||
20 2 1866.83
|
20 2 1866.83
|
||||||
20 3 2819.21
|
20 3 2819.21
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Histogram Number Slope Intercept
|
Histogram Number Slope Intercept
|
||||||
0 1 0
|
0 0.931015 -1.35431
|
||||||
1 1 -1.87356e-10
|
1 1 -1.87356e-10
|
||||||
2 0.964185 1.49989
|
2 0.964185 1.49989
|
||||||
3 0.92638 -1.30621
|
3 0.92638 -1.30621
|
||||||
|
@ -18,7 +18,7 @@ Histogram Number Slope Intercept
|
||||||
16 0.95263 -0.404053
|
16 0.95263 -0.404053
|
||||||
17 0.90953 4.82833
|
17 0.90953 4.82833
|
||||||
18 0.940277 10.3629
|
18 0.940277 10.3629
|
||||||
19 1 0
|
19 0.86746 -17.8678
|
||||||
20 1.00683 4.76371
|
20 1.00683 4.76371
|
||||||
21 0.968342 -43.9496
|
21 0.968342 -43.9496
|
||||||
22 0.892882 -32.0742
|
22 0.892882 -32.0742
|
||||||
|
|
Loading…
Reference in New Issue
Block a user