Commit 1bfa1979 authored by Keerthi Nakkalil's avatar Keerthi Nakkalil
Browse files

Codes for trip dac scan. Works for three data files.

parent 897cbf52
void trimdac_scan(){
std::vector<TH1D*>histo;
std::vector<std::string>filenames={
std::string("dacs0x0_bl_thr.dat"),
std::string("dacs0x1_bl_thr.dat"),
std::string("dacs0x2_bl_thr.dat"),
std::string("dacs0x3_bl_thr.dat"),
std::string("dacs0x4_bl_thr.dat"),
std::string("dacs0x5_bl_thr.dat"),
std::string("dacs0x6_bl_thr.dat"),
std::string("dacs0x7_bl_thr.dat"),
std::string("dacs0x8_bl_thr.dat"),
std::string("dacs0x9_bl_thr.dat"),
std::string("dacs0xA_bl_thr.dat"),
std::string("dacs0xB_bl_thr.dat"),
std::string("dacs0xC_bl_thr.dat"),
std::string("dacs0xD_bl_thr.dat"),
std::string("dacs0xE_bl_thr.dat"),
std::string("dacs0xF_bl_thr.dat")
};
std::vector<int>colors={kTeal+3,kPink-3,kOrange+8,kRed+4 ,kCyan+2,kMagenta+1,kGreen-3,kPink-6,kBlue+3,kYellow+3,kPink+2,kBlue-6,kRed-1,kYellow-5,kRed-8,kAzure};
double data;
TCanvas*c1 = new TCanvas();
THStack*hs = new THStack("hs", "Trim dac scan");
for(int ctr=0;ctr<17;ctr++){
std::ifstream datafile(filenames.at(ctr).c_str());
std::string histo_name = "h"+ filenames.at(ctr);
TH1D* h1= new TH1D(histo_name.c_str(),"Trim dac scan", 175,950,1300);
if(datafile.is_open()){
cout<<" The data file "<<filenames.at(ctr) << " is opened ..."<<std::endl;
while(!datafile.eof()){
datafile>>data;
// cout<<data<<std::endl;
h1->Fill(data);
}
h1->SetLineColor(colors.at(ctr));
histo.push_back(h1);
cout<<filenames.at(ctr)<<"histogram is filled..."<<std::endl;
}
//datafile.close();
}
cout<<"size of the histo vector is "<<histo.size()<<std::endl;
for(int i=0;i<histo.size();i++){
cout<<"stacking"<< histo.at(i)<<std::endl;
hs->Add(histo.at(i),"sames");
}
hs->Draw("hist nostack");
hs->GetXaxis()->SetTitle("Threshold [LSB]");
hs->GetYaxis()->SetTitle(" #pixels");
cout<<"Done.."<<std::endl;
}
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