figures.cxx 5.43 KB
Newer Older
1 2 3 4
//#include "TMarker.h"

using namespace std;

5 6 7
void figures()
{

8 9 10 11 12 13
	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;

14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

	if (pedestals) {
		TFile *frPed = new TFile("../data/WPT_tests/680pF_7okt/raw_data/TestTriggerMode_680pF_10minutes_7okt_0000.root");
		TH2D *hPedRaw = (TH2D*)frPed->Get("adcAll");
		TH2D *hPedA = (TH2D*)frPed->Get("adcAllWoBaseline");

		TCanvas *c1 = new TCanvas("c1", "Pedestals raw");
		hPedRaw->GetXaxis()->SetRangeUser(0, 64);
		hPedRaw->GetXaxis()->SetTitle("PMT pixel");
		hPedRaw->GetYaxis()->SetTitle("A_{raw}");
		hPedRaw->GetYaxis()->SetTitleOffset(1.38);
		hPedRaw->Draw();
		c1->SaveAs("figures/pedestalsRaw.png");

		TCanvas *c2 = new TCanvas("c2", "Pedestals");
		hPedA->GetXaxis()->SetRangeUser(0, 64);
		hPedA->GetXaxis()->SetTitle("PMT pixel");
		hPedA->GetYaxis()->SetTitle("A");
		hPedA->GetYaxis()->SetTitleOffset(1.38);
		hPedA->Draw();
		c2->SaveAs("figures/pedestalsCorr.png");
	}


	if (nlCorr) {
		TFile *frCorr = new TFile("objects/histOutput680.root");
		TH1D *hPeaks = (TH1D*)frCorr->Get("ch15");

		TCanvas *c3 = new TCanvas("c3", "Voltage on 680pF");
		hPeaks->SetAxisRange(100, 2000);
		hPeaks->SetXTitle("A");
		hPeaks->SetTitleSize(0.06);
		hPeaks->SetTitleOffset(0.73);
		hPeaks->GetXaxis()->CenterTitle();
		hPeaks->SetYTitle("Events");
		hPeaks->Draw();
		c3->SaveAs("figures/voltageAmplitudes.png");

		TFile *frGraph = new TFile("objects/calGraphs680.root");
		TGraph *gCorr = (TGraph*)frGraph->Get("gcal15");

		TCanvas *c4 = new TCanvas("c4", "Dimensionless correction");
		gCorr->GetXaxis()->SetRangeUser(-100, 1800);
		gCorr->GetXaxis()->CenterTitle();
		gCorr->GetXaxis()->SetTitle("A");
		gCorr->GetXaxis()->SetTitleSize(0.06);
		gCorr->GetXaxis()->SetTitleOffset(0.76);
		gCorr->GetYaxis()->CenterTitle();
		gCorr->GetYaxis()->SetTitle("A'");
		gCorr->GetYaxis()->SetTitleSize(0.06);
		gCorr->GetYaxis()->SetTitleOffset(0.76);
		gCorr->SetLineColor(kBlue);
		gCorr->SetLineWidth(4);
		gCorr->Draw();
		c4->SaveAs("figures/calGraph.png");

	}

	if (pedCorr) {
		TFile *frPed = new TFile("../data/WPT_tests/680pF_7okt/raw_data/TestTriggerMode_680pF_10minutes_7okt_0000.root");
		TH2D *hPedAnl = (TH2D*)frPed->Get("fhAdcAllWoBaselineNonLinear");
		TH2D *hPedAnlCorr = (TH2D*)frPed->Get("fhAdcAllWoBaselineNLcorr");

		TCanvas *c5 = new TCanvas("c5", "Position of corrected pedestals");
		hPedAnl->GetXaxis()->SetRangeUser(0, 64);
		hPedAnl->GetXaxis()->SetTitle("PMT pixel");
		hPedAnl->GetXaxis()->CenterTitle();
		hPedAnl->GetYaxis()->SetRangeUser(-50, 200);
		hPedAnl->GetYaxis()->SetTitle("A'");
		hPedAnl->GetYaxis()->SetTitleSize(0.06);
		hPedAnl->GetYaxis()->SetTitleOffset(0.8);
		hPedAnl->GetYaxis()->CenterTitle();
		hPedAnl->Draw("col");
		c5->SaveAs("figures/pedestalsNL.png");

		TCanvas *c6 = new TCanvas("c6", "Corrected non-linear pedestals ");
//		hPedAnlCorr->GetXaxis()->SetRangeUser(0, 64);
		hPedAnlCorr->GetXaxis()->SetTitle("PMT pixel");
		hPedAnlCorr->GetYaxis()->SetRangeUser(-50, 200);
		hPedAnlCorr->GetYaxis()->SetTitle("A*");
		hPedAnlCorr->GetYaxis()->SetTitleSize(0.06);
		hPedAnlCorr->GetYaxis()->SetTitleOffset(0.8);
		hPedAnlCorr->GetYaxis()->CenterTitle();
		hPedAnlCorr->Draw("col");
		c6->SaveAs("figures/pedestalsNLcorr.png");
	}

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
	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");

	}
188
}