Commit fbb03671 authored by Vratislav Chudoba's avatar Vratislav Chudoba

Scripts modified. Probably to make them in accordance with text in latex file.

parent 5dc6f938
......@@ -12,18 +12,18 @@ void cal1ePeaks()
//name of input root file
TString iFile;
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/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/HV900_Sci_mounted_Am241in_front_10cm_thr28_nxtrim1_11oct_30min_0000.root", location.Data());
//name of file with calibration parameters
TString oFile = "parameters/cal1e_HV1000_nonLin.par";
// TString oFile = "cal1e_HV950.par";
TString oFile = "parameters/cal1e_HV950_nonLin.par";
// TString oFile = "cal1e_HV900.par";
//name of file with peak ranges
TString pFile = "../parameters/peaksRange1000HV.par";
// TString pFile = "../parameters/peaksRange950HV.par";
// TString pFile = "../parameters/peaksRange1000HV.par";
TString pFile = "../parameters/peaksRange950HV.par";
// TString pFile = "";
//2D histogram to be calibrated
......
......@@ -8,13 +8,15 @@ void calTransition47()
{
//input files
TString inHistFile = "objects/histOutput47.root";
TString inCalParFile = "../parameters/cal1e_HV1000.par";
TString inHalfVoltPosFile = "parameters/halfVoltPositions680.par";
TString inHistFile = "../parameters/histOutput47.root";
TString inHalfVoltPosFile = "../parameters/halfVoltPositions680.par";
// TString inCalParFile = "../parameters/cal1e_HV1000_nonLin.par";
TString inCalParFile = "../parameters/cal1e_HV950_nonLin.par";
//output file
//output files
TString outPosFile = "parameters/threeVoltPositions47.par";
TString outCalFile = "parameters/cal1e_47_HV1000.par";
// TString outCalFile = "parameters/cal1e_47_HV1000_nonLin.par";
TString outCalFile = "parameters/cal1e_47_HV950_nonLin.par";
TFile *fr = new TFile(inHistFile.Data());
if (fr->IsZombie()) {
......@@ -36,14 +38,14 @@ void calTransition47()
Error("cal1ePeaks.cxx", "File with input parameters %s was not open.", inHalfVoltPosFile.Data());
return;
}
Info("calTransition47.cxx", "File with 0.5 V positions %s will be loaded.", inHalfVoltPosFile.Data());
Info("calTransition47.cxx", "File with 0.5 V positions at 680 pF %s will be loaded.", inHalfVoltPosFile.Data());
//output files
ofstream calPosFile;
calPosFile.open(outPosFile.Data());
if (calPosFile.is_open()) {
Info("calTransition47.cxx", "Positions of 0.5V peak will be saved in %s.", outPosFile.Data());
Info("calTransition47.cxx", "Positions of 3.0V peak at 4.7 pF will be saved in %s.", outPosFile.Data());
} else {
Error("calTransition47.cxx", "File %s was not open.", outPosFile.Data());
return;
......@@ -52,7 +54,7 @@ void calTransition47()
ofstream calFile;
calFile.open(outCalFile.Data());
if (calFile.is_open()) {
Info("calTransition47.cxx", "Positions of 0.5V peak will be saved in %s.", outCalFile.Data());
Info("calTransition47.cxx", "Calibration parameters for 4.7 nF will be saved in %s.", outCalFile.Data());
} else {
Error("calTransition47.cxx", "File %s was not open.", outCalFile.Data());
return;
......@@ -122,8 +124,8 @@ void calTransition47()
std::getline(inHalfVoltFile, line);
std::istringstream(line,ios_base::in) >> ch >> halfVoltPos;
// cout << i << "\t" << energy[0] << "\t" << calPar << "\t\t" << halfVoltPos << endl;
cout << energy[0]*calPar / (6*halfVoltPos) << endl;
// cout << i << "\t" << energy[0] << "\t" << calPar << "\t\t" << halfVoltPos << "\t" << energy[0]*calPar / (6*halfVoltPos) << endl;
// cout << energy[0]*calPar / (6*halfVoltPos) << endl;
calFile << i << "\t" << energy[0]*calPar / (6*halfVoltPos) << endl;
}
......
......@@ -3,13 +3,15 @@ void extract1DHists()
//output in channel units
// TString outputFile = "histOutput.root";
TString outputFile = "objects/histOutput680.root";
// TString outputFile = "objects/histOutput680.root";
TString outputFile = "objects/histHalfVolts680.root";
//output in 1e units
// TString outputFile = "histOutput1e_HV1000.root";
// TString outputFile = "histOutput1e_HV950.root";
TString histName = "adcAllWoBaseline";
// TString histName = "adcAllWoBaseline";
TString histName = "fhAdcAllWoBaselineNLcorr";
// TString histName = "cal1eAdcAllWoBaseline";
TString location = "../data/WPT_tests";
......@@ -71,6 +73,14 @@ void extract1DHists()
TH2D *hraw20 = (TH2D*)fr20->Get(histName.Data());
TH2D *hraw21 = (TH2D*)fr21->Get(histName.Data());
TH2D *hraw22 = (TH2D*)fr22->Get(histName.Data());
if (!hraw0 || !hraw1 || !hraw2 || !hraw3 || !hraw4
|| !hraw10 || !hraw11 || !hraw12 || !hraw13
|| !hraw20 || !hraw21 || !hraw22) {
Error("extract1DHists.cxx", "At least one of histograms was not found.");
return;
}
TH2D *hSum2 = new TH2D(*hraw20);
hSum2->Add(hraw21);
hSum2->Add(hraw22);
......
......@@ -4,7 +4,7 @@ void extract1DHists47()
//output in channel units
TString outputFile = "objects/histOutput47.root";
TString histName = "adcAllWoBaseline";
TString histName = "fhAdcAllWoBaselineNLcorr";
TString location = "../data/WPT_tests";
// TString suffix = "";
......@@ -26,6 +26,11 @@ void extract1DHists47()
TH2D *hraw0 = (TH2D*)fr0->Get(histName.Data());
TH2D *hraw1 = (TH2D*)fr1->Get(histName.Data());
if (!hraw0 || !hraw1) {
Error("extract1DHists47.cxx", "At least one of histograms was not found.");
return;
}
TH2D *hSum = new TH2D(*hraw0);
hSum->Add(hraw1);
......
//#include "TMarker.h"
using namespace std;
void figures()
{
Bool_t pedestals = 0;
Bool_t nlCorr = 0;
Bool_t pedCorr = 1;
const Bool_t pedestals = 0;
const Bool_t nlCorr = 0;
const Bool_t pedCorr = 0;
const Bool_t calDemonstration = 0;
const Bool_t pedTest = 1;
if (pedestals) {
TFile *frPed = new TFile("../data/WPT_tests/680pF_7okt/raw_data/TestTriggerMode_680pF_10minutes_7okt_0000.root");
......@@ -91,4 +98,91 @@ void figures()
c6->SaveAs("figures/pedestalsNLcorr.png");
}
if (calDemonstration) {
TFile *frCal680 = new TFile("../data/WPT_tests/680pF_11okt_measure_with_opt_grease/HV1000_Sci_mounted_Am241in_front_10cm_thr32_nxtrim1_11oct_30min_0000_cal.root");
TH1D *hRaw = (TH1D*)frCal680->Get("adcAllSum");
TH1D *hCal = (TH1D*)frCal680->Get("calAdcAllSum");
TH1D *hCorr1 = (TH1D*)frCal680->Get("fhAdcAllSumWoBaselineNonLinear");
TH1D *hCorr2 = (TH1D*)frCal680->Get("fhAdcAllSumWoBaselineNLcorr");
TCanvas *c7 = new TCanvas("c7", "Demonstration of calibration");
c7->Divide(2, 2);
c7->cd(1);
hCorr1->Draw();
c7->cd(2);
hRaw->Draw();
c7->cd(3);
hCorr2->Draw();
c7->cd(4);
hCal->Draw();
}
if (pedTest) {
TFile *frGraph = new TFile("../parameters/calGraphs680.root");
ifstream iPeds;
iPeds.open("parameters/correctedPedsPositions.par");
//canvases for calibration
TString cName;
TString cTitle;
const Int_t pads = 9;
const Int_t noCanvas = 64/pads+1;
TCanvas *cWork[noCanvas];
for (Int_t i = 0; i < noCanvas; i++) {
cName.Form("can%d", i);
cTitle.Form("canvas %d", i);
cWork[i] = new TCanvas(cName.Data(), cTitle.Data(), 0, 0, 960, 700);
// cWork[i]->SetName(cName.Data());
// cWork[i]->SetTitle(cTitle.Data());
if (pads == 6) cWork[i]->Divide(2, 3);
if (pads == 9) cWork[i]->Divide(3, 3);
cWork[i]->cd(1);
}
Int_t pixel = -1, ped = 0;
TString gName;
// TGraph *gr[64];
TGraph *gr;
for (Int_t i = 0; i < 64; i++) {
iPeds >> pixel >> ped;
Int_t cNumber = i/pads;
cWork[cNumber]->cd(i-pads*cNumber+1);
gName.Form("gcal%d", i);
gr = (TGraph*)frGraph->Get(gName.Data());
gr->GetXaxis()->SetRangeUser(-30, 30);
gr->GetXaxis()->SetTitle("A");
gr->GetXaxis()->CenterTitle();
gr->GetXaxis()->SetTitleSize(0.08);
gr->GetXaxis()->SetTitleOffset(0.5);
gr->GetYaxis()->SetRangeUser(0, 50);
gr->GetYaxis()->SetTitle("A'");
gr->GetYaxis()->CenterTitle();
gr->GetYaxis()->SetTitleSize(0.08);
gr->GetYaxis()->SetTitleOffset(0.6);
gr->Draw();
TMarker *point = new TMarker(0, ped, 3);
point->SetMarkerSize(3);
point->SetMarkerColor(kRed);
point->Draw();
// cout << pixel << "\t" << gName.Data() << endl;
}
cWork[2]->SaveAs("figures/pedestalsTest.png");
}
}
......@@ -16,8 +16,13 @@ void showHists47()
// TH2D *hraw0 = (TH2D*)fr0->Get("cal1eAdcAllWoBaseline");
// TH2D *hraw1 = (TH2D*)fr1->Get("cal1eAdcAllWoBaseline");
TH2D *hraw0 = (TH2D*)fr0->Get("adcAllWoBaseline");
TH2D *hraw1 = (TH2D*)fr1->Get("adcAllWoBaseline");
TH2D *hraw0 = (TH2D*)fr0->Get("fhAdcAllWoBaselineNLcorr");
TH2D *hraw1 = (TH2D*)fr1->Get("fhAdcAllWoBaselineNLcorr");
if (!hraw0 || !hraw1) {
Error("showHists47.cxx", "At least one of histograms was not found.");
return;
}
TCanvas *c1 = new TCanvas();
c1->Divide(2,2);
......
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