Difference between revisions of "CH ROOT Nonuniform Binning"

From New IAC Wiki
Jump to navigation Jump to search
Line 30: Line 30:
 
Error: Bins must be in increasing order  
 
Error: Bins must be in increasing order  
  
This error was thrown by having an integer at +1 the value it should have been at when making the histogram. The following should allow you to find bins that are at a lower value than the previous
+
This error was thrown by having an integer at +1 the value it should have been at when making the histogram. The following should allow you to find bins that are at a lower value than the previous. This for loop will parse through the entire bins array and print the bins
  
 
  for(int i=0; i<=4096; i++){
 
  for(int i=0; i<=4096; i++){
  if(bins[i]>=bins[i+1]){cout << bin[i] << endl;
+
  if(bins[i]>=bins[i+1]){cout << i  <<"    " << bins[i] <<"    " << bins[i+1] << endl;
 
  }
 
  }
 +
 +
  
 
----
 
----
 
[[PAS Feasibility Study Runs]]
 
[[PAS Feasibility Study Runs]]

Revision as of 00:32, 16 September 2021

Rebinning via Energy Calibration

Regarding use of 4096 channel peak sensing ADC

  • Creates an array 4097 entries long to be used for bin edges
double bins[4097];
  • Opens a for loop for bin creation
for(int i=0; i<=4096; i++){
  • Fills arrays with values for bin edges using the energy calibration fit for HPGe detector
bins[i] =  i*i*(-0.000000861277) + i*(0.449519)-36.2928;
  • Cout statement to print bin edges to the terminal window as for loop is processing
cout << bins[i] << endl;
  • Closes the for loop and begins evaluation
} 

At this point you should have an array filled with values for bin edges. Note that channel zero is now mapped to ~ -36KeV




Debugging

Error: Bins must be in increasing order

This error was thrown by having an integer at +1 the value it should have been at when making the histogram. The following should allow you to find bins that are at a lower value than the previous. This for loop will parse through the entire bins array and print the bins

for(int i=0; i<=4096; i++){
if(bins[i]>=bins[i+1]){cout << i  <<"    " << bins[i] <<"     " << bins[i+1] << endl;
}



PAS Feasibility Study Runs