histPresent.C 5.59 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include "TH2F.h"
#include "TH3F.h"
#include "TStyle.h"

void histPresent (

	const char *filename = "analysis_07_8.root",
//	const char *filename = "analysis_07_8_smooth.root",
//	const char *filename = "analysis_08_2.root",
//	const char *filename = "analysis_08_2_smooth.root",
	const char *foldername = "nustar_present",
//	const char *ext = ".eps",
	const char *ext = ".pdf",

15
	const Bool_t can1 = 1, const Bool_t can2 = 1,
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 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
	const Bool_t can3 = 1, const Bool_t can4 = 0)
	//const Bool_t can5 = 0/*, const Bool_t can6 = 0*/) 
{
	using std::cout;
	using std::endl;
	gSystem->Load("../libData.so");
	TFile *f = new TFile(Form("../data/dataDSR4/%s", filename));
	TTree *t = (TTree*)f->Get("atree");

	if(can1){
		
		TCanvas *c1 = new TCanvas("c1", "canvas 1");
		c1->Divide(2,2);

		c1->cd(1);
		//TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15);
		TH1F *h1 = new TH1F("h1", "CFD", 50, 0, 20);
		t->Draw("Ach0.fTimeCFD - Ach1.fTimeCFD >> h1","Ach0.fTimeCFD>100. && Ach0.fTimeCFD<160 && Ach1.fTimeCFD>100. && Ach1.fTimeCFD<160","");
		//x
		h1->GetXaxis()->SetTitle("Time difference [ns]");
		h1->GetXaxis()->CenterTitle();
		//h1->Fit("gaus", "","",-3,2);
		h1->Fit("gaus", "","",8,13);
		gStyle->SetOptFit();
		
		c1->Update();

		c1->cd(2);
		//TH1F *h2 = new TH1F("h2", "LED",50, -10, 10);
		TH1F *h2 = new TH1F("h2", "LED",50, 0, 20);
		t->Draw("Ach0.fTimeLED - Ach1.fTimeLED  >> h2","Ach0.fTimeLED>100. && Ach0.fTimeLED < 150 && Ach1.fTimeLED>100 && Ach1.fTimeLED < 150","col");
		//x
		h2->GetXaxis()->SetTitle("Time difference [ns]");
		h2->GetXaxis()->CenterTitle();
		//h2->Fit("gaus", "","",-3,1);
		h2->Fit("gaus", "","",7,12);
		gStyle->SetOptFit();
	
		c1->Update();
	
/*		c1->cd(3);
		//TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20);
		TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100,0, 20);
		t->Draw("Ach0.fTimeFront - Ach1.fTimeFront  >> h3","Ach0.fTimeFront>100. && Ach0.fTimeFront < 150 && Ach1.fTimeFront>100 && Ach1.fTimeFront < 150","col");
		//x
		h3->GetXaxis()->SetTitle("Time difference [ns]");
		h3->GetXaxis()->CenterTitle();
		//h3->Fit("gaus", "","",-3,2);
		h3->Fit("gaus", "","",9,12);
		gStyle->SetOptFit();*/

		c1->cd(3);
		//TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20);
		TH1F *h3 = new TH1F("h3", "Middle point of front level", 100,1, 20);
		t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h3","","col");
		//x
		h3->GetXaxis()->SetTitle("Time difference [ns]");
		h3->GetXaxis()->CenterTitle();
		//h3->Fit("gaus", "","",-3,2);
		h3->Fit("gaus", "","",9,12);
		gStyle->SetOptFit();

		c1->Update();

		c1->cd(4);
		//TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10);
		TH1F *h4 = new TH1F("h4", "the 10 percent point of front edge", 80, 1, 20);
		t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h4","","");
		h4->GetXaxis()->SetTitle("Time difference [ns]");
		h4->GetXaxis()->CenterTitle();
		//h4->Fit("gaus","","",-3,1);
		h4->Fit("gaus","","",9,13);
		gStyle->SetOptFit();



		c1->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas%s", foldername, ext));
	}

	if(can2){
		
		TCanvas *c2 = new TCanvas("c2", "canvas 2");
		c2->Divide(2,2);

		c2->cd(1);
		//TH1F *h1 = new TH1F("h1", "CFD", 50, -15, 15);
		TH1F *h5 = new TH1F("h5", "ToT", 50, 0, 12);
		t->Draw("Ach0.fToT >> h5","Ach0.fToT > 0","");
		//x
		h5->GetXaxis()->SetTitle("Time over threshold [ns]");
		h5->GetXaxis()->CenterTitle();
		//h1->Fit("gaus", "","",-3,2);
		//h1->Fit("gaus", "","",8,13);
		//gStyle->SetOptFit();
		
		c2->Update();

		c2->cd(2);
		//TH1F *h2 = new TH1F("h2", "LED",50, -10, 10);
		TH1F *h6 = new TH1F("h6", "ToT",50, 0, 12);
		t->Draw("Ach1.fToT >> h6","Ach1.fToT > 0","col");
		//x
		h6->GetXaxis()->SetTitle("Time over threshold [ns]");
		h6->GetXaxis()->CenterTitle();
		//h2->Fit("gaus", "","",-3,1);
		//h2->Fit("gaus", "","",7,12);
		//gStyle->SetOptFit();
	
		c2->Update();

		c2->cd(3);
		//TH1F *h3 = new TH1F("h3", "Front edge fit crossing zero level", 100, -20, 20);
		TH1F *h7 = new TH1F("h7", "Middle point of front level", 80,1, 20);
		t->Draw("Ach0.fTimeMid - Ach1.fTimeMid >> h7","Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6. ","col");
		//x
		h7->GetXaxis()->SetTitle("Time difference [ns]");
		h7->GetXaxis()->CenterTitle();
		//h3->Fit("gaus", "","",-3,2);
		h7->Fit("gaus", "","",9,12);
		gStyle->SetOptFit();

		c2->Update();

		c2->cd(4);
		//TH1F *h4 = new TH1F("h4", "the middle point of front edge", 50, -10, 10);
		TH1F *h8 = new TH1F("h8", "the 10 percent point of front edge", 80, 1, 20);
		t->Draw("Ach0.fTime10 - Ach1.fTime10 >> h8"," Ach0.fToT > 2. && Ach0.fToT < 6. && Ach1.fToT > 2. && Ach1.fToT < 6.","");
		h8->GetXaxis()->SetTitle("Time difference [ns]");
		h8->GetXaxis()->CenterTitle();
		//h4->Fit("gaus","","",-3,1);
		h8->Fit("gaus","","",9,13);
		gStyle->SetOptFit();

		c2->Print(Form("../macros/picsDRS4/%s/Smoothed_deltas_tot_corr%s", foldername, ext));

	}


	if(can3){
		
		TCanvas *c3 = new TCanvas("c3", "canvas 3");
		c3->Divide(2,2);

		c3->cd(1);
		TH1F *h9 = new TH1F("h9", "Charge CFD", 200, 0 ,0.5e-9);
		t->Draw("Ach0.fChargeCFD >> h9","","");	
		c3->Update();

		c3->cd(2);
		TH1F *h10 = new TH1F("h10", "Charge LED",200, 0 ,0.5e-9);
		t->Draw("Ach0.fChargeLED >> h10","","");
		c3->Update();

		c3->cd(3);
		TH1F *h11 = new TH1F("h11", "Sum of charges CFD for 4 channels",200, 0 ,10e-9);
		t->Draw("Ach0.fChargeCFD + Ach1.fChargeCFD + Ach2.fChargeCFD + Ach3.fChargeCFD >> h11","","");
		c3->Update();

		c3->cd(4);
		TH1F *h12 = new TH1F("h12", "Sum of charges LED for 4 channels",200, 0 ,10e-9);
		t->Draw("Ach0.fChargeLED + Ach1.fChargeLED + Ach2.fChargeLED + Ach3.fChargeLED >> h12","","");
		c3->Update();

	}

}