Commit bab4d184 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Some scripts changed. Probably also optimized.

parent 73459264
...@@ -7,35 +7,37 @@ void cal1ePeaks() ...@@ -7,35 +7,37 @@ void cal1ePeaks()
{ {
TString location = "../data/WPT_tests"; TString location = "../data/WPT_tests";
TString suffix = "_nonLin";
//name of input root file //name of input root file
TString iFile; TString iFile;
iFile.Form("%s/680pF_11okt_measure_with_opt_grease/HV1000_Sci_mounted_Am241in_front_10cm_thr32_nxtrim1_11oct_30min_0000.root", location.Data()); iFile.Form("%s/680pF_11okt_measure_with_opt_grease/HV1000_Sci_mounted_Am241in_front_10cm_thr32_nxtrim1_11oct_30min_0000%s.root", location.Data(), suffix.Data());
// iFile.Form("%s/680pF_11okt_measure_with_opt_grease/HV950_Sci_mounted_Am241in_front_10cm_thr32_nxtrim1_11oct_30min_0000.root", location.Data()); // iFile.Form("%s/680pF_11okt_measure_with_opt_grease/HV950_Sci_mounted_Am241in_front_10cm_thr32_nxtrim1_11oct_30min_0000.root", location.Data());
// iFile.Form("%s/680pF_11okt_measure_with_opt_grease/HV900_Sci_mounted_Am241in_front_10cm_thr28_nxtrim1_11oct_30min_0000.root", location.Data()); // iFile.Form("%s/680pF_11okt_measure_with_opt_grease/HV900_Sci_mounted_Am241in_front_10cm_thr28_nxtrim1_11oct_30min_0000.root", location.Data());
//name of file with calibration parameters //name of file with calibration parameters
TString oFile = "cal1e_HV1000.par"; TString oFile = "cal1e_HV1000_nonLin.par";
// TString oFile = "cal1e_HV950.par"; // TString oFile = "cal1e_HV950.par";
// TString oFile = "cal1e_HV900.par"; // TString oFile = "cal1e_HV900.par";
//name of file with peak ranges //name of file with peak ranges
TString pFile = "peaksRange1000HV.par"; TString pFile = "../parameters/peaksRange1000HV.par";
// TString pFile = "../parameters/peaksRange950HV.par"; // TString pFile = "../parameters/peaksRange950HV.par";
// TString pFile = ""; // TString pFile = "";
//2D histogram to be calibrated
// TString histName = "adcAllWoBaseline";
TString histName = "fhCalAdcAllWoBaselineNonLinear";
ofstream calFile; ofstream calFile;
calFile.open(oFile.Data()); calFile.open(oFile.Data());
if (calFile.is_open()) { if (calFile.is_open()) {
Info("calPeaks", "Calibration parameters will be saved in %s.", oFile.Data()); Info("cal1ePeaks.cxx", "Calibration parameters will be saved in %s.", oFile.Data());
} else { } else {
Error("calPeaks", "File %s was not open.", oFile.Data()); Error("cal1ePeaks.cxx", "File %s was not open.", oFile.Data());
return; return;
} }
//2D histogram to be calibrated
TString histName = "adcAllWoBaseline";
//xaxis range //xaxis range
const Double_t xmin = 0; const Double_t xmin = 0;
const Double_t xmax = 600.; const Double_t xmax = 600.;
...@@ -47,7 +49,7 @@ void cal1ePeaks() ...@@ -47,7 +49,7 @@ void cal1ePeaks()
if (useParFile) { if (useParFile) {
parFile.open(pFile.Data()); parFile.open(pFile.Data());
if (!parFile.is_open()) { if (!parFile.is_open()) {
Error("calPeaks", "File with input parameters %s was not open.", pFile.Data()); Error("cal1ePeaks.cxx", "File with input parameters %s was not open.", pFile.Data());
return; return;
} }
Info("calPeaks", "File with peak ranges %s will be loaded.", pFile.Data()); Info("calPeaks", "File with peak ranges %s will be loaded.", pFile.Data());
...@@ -56,6 +58,10 @@ void cal1ePeaks() ...@@ -56,6 +58,10 @@ void cal1ePeaks()
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
TFile *fr = new TFile(iFile.Data()); TFile *fr = new TFile(iFile.Data());
if (fr->IsZombie()) {
Error("cal1ePeaks.cxx", "Files %s was not open.", iFile.Data());
return;
}
TH2D *h2 = (TH2D*)fr->Get(histName.Data()); TH2D *h2 = (TH2D*)fr->Get(histName.Data());
......
...@@ -2,15 +2,19 @@ ...@@ -2,15 +2,19 @@
#include <vector> // std::vector #include <vector> // std::vector
#include <algorithm> #include <algorithm>
using namespace std;
void calPeaksVoltage() void calPeaksVoltage()
{ {
TString inFile = "histOutput680.root"; TString inFile = "parameters/histOutput680.root";
// TString inFile = "histOutput.root"; // TString inFile = "histOutput.root";
TString outFile = "calGraphs680.root"; TString outFile = "../parameters/calGraphs680.root";
// TString outFile = "calGraphs.root"; // TString outFile = "calGraphs.root";
TString outPeaksFile = "parameters/halfVoltPositions680.par";
TFile *fr = new TFile(inFile.Data()); TFile *fr = new TFile(inFile.Data());
if (fr->IsZombie()) { if (fr->IsZombie()) {
Error("calPeaksVoltage.cxx", "File %s was not open correctly.", inFile.Data()); Error("calPeaksVoltage.cxx", "File %s was not open correctly.", inFile.Data());
...@@ -42,7 +46,14 @@ void calPeaksVoltage() ...@@ -42,7 +46,14 @@ void calPeaksVoltage()
cWork[i]->cd(1); cWork[i]->cd(1);
} }
ofstream calFile;
calFile.open(outPeaksFile.Data());
if (calFile.is_open()) {
Info("calPeaksVoltage.cxx", "Positions of 0.5V peak will be saved in %s.", outPeaksFile.Data());
} else {
Error("calPeaksVoltage.cxx", "File %s was not open.", outPeaksFile.Data());
return;
}
TFile fw(outFile.Data(), "RECREATE"); TFile fw(outFile.Data(), "RECREATE");
if (fw.IsZombie()) { if (fw.IsZombie()) {
...@@ -51,6 +62,8 @@ void calPeaksVoltage() ...@@ -51,6 +62,8 @@ void calPeaksVoltage()
} }
TString gName; TString gName;
Double_t x, y;
for (Int_t i = 0; i < 64; i++) { for (Int_t i = 0; i < 64; i++) {
hch[i]->GetXaxis()->SetRangeUser(100, 2000); hch[i]->GetXaxis()->SetRangeUser(100, 2000);
Int_t cNumber = i/6; Int_t cNumber = i/6;
...@@ -60,6 +73,10 @@ void calPeaksVoltage() ...@@ -60,6 +73,10 @@ void calPeaksVoltage()
if (i == 42) { if (i == 42) {
gr[i] = searchPeaks(hch[i], 0.08); gr[i] = searchPeaks(hch[i], 0.08);
} }
//take a peak corresponding to 0.5 V for 680 pF
gr[i]->GetPoint(1, x, y);
calFile << i << "\t" << x << endl;
// cout << i << "\t" << x << endl;
fw.cd(); fw.cd();
gName.Form("gcal%d", i); gName.Form("gcal%d", i);
gr[i]->SetName(gName.Data()); gr[i]->SetName(gName.Data());
...@@ -68,6 +85,8 @@ void calPeaksVoltage() ...@@ -68,6 +85,8 @@ void calPeaksVoltage()
fw.Close(); fw.Close();
calFile.close();
return; return;
} }
......
...@@ -3,17 +3,18 @@ void extract1DHists() ...@@ -3,17 +3,18 @@ void extract1DHists()
//output in channel units //output in channel units
// TString outputFile = "histOutput.root"; // TString outputFile = "histOutput.root";
// TString outputFile = "histOutput680.root"; TString outputFile = "parameters/histOutput680.root";
//output in 1e units //output in 1e units
TString outputFile = "histOutput1e.root"; // TString outputFile = "histOutput1e_HV1000.root";
// TString outputFile = "histOutput1e_HV950.root";
// TString histName = "adcAllWoBaseline";
TString histName = "adcAllWoBaseline"; TString histName = "adcAllWoBaseline";
// TString histName = "cal1eAdcAllWoBaseline";
TString location = "../data/WPT_tests"; TString location = "../data/WPT_tests";
// TString suffix = ""; TString suffix = "";
TString suffix = "_HV1000"; // TString suffix = "_HV1000";
TString f0, f1, f2, f3, f4, TString f0, f1, f2, f3, f4,
f10, f11, f12, f13, f10, f11, f12, f13,
......
void showHistOutput() void showHistOutput()
{ {
TFile *fr = new TFile("histOutput.root");
//channel units
//TString fName = "histOutput.root";
// TString fName = "histOutput680.root";
TString fName = "histOutput47.root";
const Double_t xmin = 100.;
const Double_t xmax = 2000.;
//1e units
// TString fName = "histOutput1e_HV1000.root";
//TString fName = "histOutput1e_HV950.root";
// const Double_t xmin = 0.5;
// const Double_t xmax = 12.;
TFile *fr = new TFile(fName.Data());
if (fr->IsZombie()) {
Error("showHistOutput.cxx", "Files %s was not open.", fName.Data());
return;
}
TH1D *hch[64]; TH1D *hch[64];
TString histName; TString histName;
...@@ -17,9 +37,6 @@ void showHistOutput() ...@@ -17,9 +37,6 @@ void showHistOutput()
const Int_t pads = 9; const Int_t pads = 9;
const Int_t noCanvas = 64/pads+1; const Int_t noCanvas = 64/pads+1;
const Double_t xmin = 100;
const Double_t xmax = 2000.;
TCanvas *cWork[noCanvas]; TCanvas *cWork[noCanvas];
for (Int_t i = 0; i < noCanvas; i++) { for (Int_t i = 0; i < noCanvas; i++) {
cName.Form("can%d", i); cName.Form("can%d", i);
......
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