Commit 54be77b6 authored by Keerthi Nakkalil's avatar Keerthi Nakkalil
Browse files

Final codes for gain measurements. No more bad/strange pixels. Fit range was...

Final codes for gain measurements. No more bad/strange pixels. Fit range was adjusted to get the correct values
parent cbb8487f
......@@ -17,7 +17,7 @@ void fit_gaussian_noise(TH1D* hist_255,int colors,int markers,double fitmin,doub
//Assigning Initial values to the parameters
fitgauss->SetParameter(0,200.0);
int lastbin1 = hist_255->FindLastBinAbove(200);
int lastbin1 = hist_255->FindLastBinAbove(100,1);
double mean = hist_255->GetBinCenter(lastbin1);
fitgauss->SetParameter(1,mean);
......@@ -30,9 +30,6 @@ void fit_gaussian_noise(TH1D* hist_255,int colors,int markers,double fitmin,doub
fitgauss->SetLineColor(2);
hist_255->Fit("fitgauss"," R");
/*std::ofstream fitpars;
fitpars.open("fit_parameters.txt",std::ofstream::app);
fitpars<<pixel_address<<"_"<<pixel_address<< " "<< fitgauss->GetParameter(1)<<std::endl;*/
hist_255->GetListOfFunctions()->FindObject("fitgauss")->Draw("same");
hist_255->SetStats(0);
}
......@@ -69,11 +66,6 @@ void fit_modified_erf(TH1D* hist_255,int colors,int markers,double injected_volt
fiterf->SetLineWidth(2);
fiterf->SetLineColor(2);
/* if(mean<1000&&sigma<0){
TF1::RejectPoint();
return 0;
}
else{*/
hist_255->Fit("fiterf","R");
std::ofstream fitpars;
fitpars.open("fit_parameters.txt",std::ofstream::app);
......@@ -81,10 +73,10 @@ void fit_modified_erf(TH1D* hist_255,int colors,int markers,double injected_volt
<< std::setw(3)<< std::setfill('0')<<pixel_address<<"\t"
<<injected_voltage<<"\t"<< fiterf->GetParameter(1)<<std::endl;
// fitpars <<injected_voltage<<"\t"<< fiterf->GetParameter(1)<<std::endl;
hist_255->GetListOfFunctions()->FindObject("fiterf")->Draw("same");
hist_255->SetStats(0);
// }
}
std::vector<TH1D*> gain_measurement_pixel(int i, int j)
......@@ -92,9 +84,8 @@ std::vector<TH1D*> gain_measurement_pixel(int i, int j)
std::vector<int>colors={kAzure,kTeal+3,kViolet+3,kOrange+4};
std::vector<int>markers={1,1,1,1};
std::vector<double>fitmin ={1220.,1200.,1150.,1000.0};
std::vector<double>fitmax={1700.,1420.,1240.,1500.0};
std::vector<double>fitmax={1750.,1440.,1240.,1500.0};
std::vector<TH1D*> hist_255;
// double amplitude[3]={298.2559,149.6258,49.1753};
std::vector<double>injected_voltage = {298.2559,149.6258,49.1753};
//The data files are named as following : 000_000.dat to 256_256.dat
......@@ -112,9 +103,6 @@ std::vector<TH1D*> gain_measurement_pixel(int i, int j)
for(int amp = 0; amp < 4; amp++) {
// std::vector<std::ifstream>amplitude_file;
// amplitude_file.open(filenames.at(amp).c_str());
std::ifstream amplitude_file(filenames.at(amp).c_str());
if(amplitude_file.is_open()) {
cout<<"The data file " << filenames.at(amp)<< " is opened..."<<std::endl;
......@@ -233,7 +221,6 @@ void gain_measurement()
for(int j = 0; j < pixel_histograms.size(); j++) {
hs->Add(pixel_histograms.at(j));
}
// cout<<"The size of pixel_histogram vector is"<<pixel_histograms.size()<<std::endl;
}
TCanvas* c1 = new TCanvas("c1");
c1->Divide(2,2);
......@@ -245,7 +232,7 @@ void gain_measurement()
hs->GetYaxis()->SetTitle("# signals above the threshold");
TLegend *leg = new TLegend(0.7,0.7,0.9,0.9);
// leg->SetBorderSize(0);
if(pixel_histograms.at(0)){
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment