Commit 4015a449 authored by Keerthi Nakkalil's avatar Keerthi Nakkalil
Browse files

codes for all the pixels, not yet working

parent 7622e9eb
double xmin=850.0,xmax = 1750.0,nbins=450.0;
/////////////////////////////////////////////////////////////
// The function fit_1d sets the cosmetics for the histograms/
// and fits the histogram with modified erf function. /
......@@ -47,8 +49,8 @@ TH1D *fit_1d(TH1D* &hist_255,int colors,int markers,int &amplitude,double fitmin
std::vector<TH1D*> gain_measurement(int i, int j)
{
int x,y, nbins = 450;
double xmin=850.0,xmax = 1750.0;
int x,y;
//double xmin=850.0,xmax = 1750.0;
std::vector<int>colors={kAzure,kTeal+3,kViolet+3};
std::vector<int>markers={2,3,5};
......@@ -63,16 +65,23 @@ std::vector<TH1D*> gain_measurement(int i, int j)
<< std::setw(3) << std::setfill('0') << j <<".dat";
std::cout << sfilename.str() << std::endl;
amp03.open(std::string("amp03/" + sfilename.str()).c_str());
amp02.open(sfilename.str().c_str());
amp01.open(sfilename.str().c_str());
amp02.open(std::string("amp02/" + sfilename.str()).c_str());
amp01.open(std::string("amp01/" + sfilename.str()).c_str());
if(amp03.is_open())
{
cout<<"The data file 255_255 is opened..."<<std::endl;
TH1D *h3 = new TH1D("h3","Threshold gain measurement",nbins,xmin,xmax);
cout<<"The data file " << i << "_"<< j << " is opened..."<<std::endl;
TH1D *h3 = (TH1D*)gROOT->FindObject("h3");
delete h3;//to prevent memomory leak
h3 = new TH1D("h3","Threshold gain measurement",nbins,xmin,xmax);
hist_255.push_back(h3);
amp03.clear();
amp03.seekg(118 ,std::ios_base::beg);
while(!amp03.eof())
{
// cout<<"The values from the file amp03 is extracted..."<<std::endl;
......@@ -89,9 +98,15 @@ std::vector<TH1D*> gain_measurement(int i, int j)
if(amp02.is_open())
{
cout<<"The data file 255_255 is opened..."<<std::endl;
TH1D *h2 = new TH1D("h2","Threshold gain measurement",nbins,xmin,xmax);
cout<<"The data file" << i << "_" << j << " is opened..."<<std::endl;
TH1D *h2 = (TH1D*)gROOT->FindObject("h2");
delete h2;
h2 = new TH1D("h2","Threshold gain measurement",nbins,xmin,xmax);
hist_255.push_back(h2);
amp02.clear();
amp02.seekg(118 ,std::ios_base::beg);
while(!amp02.eof())
{
amp02>>x>>y;
......@@ -107,8 +122,15 @@ std::vector<TH1D*> gain_measurement(int i, int j)
if(amp01.is_open())
{
cout<<"The data file " << i << "_" << j << " is opened..."<<std::endl;
TH1D *h1 = new TH1D("h1","Threshold gain measurement",nbins,xmin,xmax);
TH1D *h1 = (TH1D*)gROOT->FindObject("h1");
delete h1;
h1 = new TH1D("h1","Threshold gain measurement",nbins,xmin,xmax);
hist_255.push_back(h1);
amp01.clear();
amp01.seekg(114 ,std::ios_base::beg);
while(!amp01.eof())
{
amp01>>x>>y;
......@@ -141,14 +163,22 @@ std::vector<TH1D*> gain_measurement(int i, int j)
return hist_255;
}
void complete_plot()
void gain_measurement()
{
TH1D *hist_final = new TH1D("hist_final","Threshold gain measurements",nbins,xmin,xmax);
std::vector<TH1D*>histograms;
for(int row=0;row<256;row++)
{
for(int col=0;col<256;col++)
if(row==col)
{
auto histograms = gain_measurement(row,col);
histograms.push_back(gain_measurement(row,col));
for(int i=0;i<histograms.size();++i)
{
hist_final->Fill(histograms.at(i)) ;
hist_final->Draw();
}
}
}
}
Markdown is supported
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