-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotWF_cut.C
More file actions
executable file
·88 lines (60 loc) · 2.35 KB
/
Copy pathplotWF_cut.C
File metadata and controls
executable file
·88 lines (60 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
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
//to run with ranges [0.125;2]right, [0.13;2]left on 4.1
//to run with ranges [0.125;2]right, [0.13;2]left on 1.3
void plotWF_cut(const char * filename){
TFile * file= TFile::Open(filename);
//TTree * WFTree = (TTree*)file->Get("wf");
TTree * digiTree = (TTree*)file->Get("digi");
Float_t amp_max[54];
int k;
Double_t max=0;
TH1F *hr_amp =new TH1F("hr_amp","histos_ampr",500,0.0,1);
TH1F *hl_amp =new TH1F("hl_amp","histos_ampl",500,0.0,1);
TF1 *fit_r = new TF1("f_r","landau",0.06,1);
TF1 *fit_l = new TF1("f_l","landau",0.1,1);
TH1F *hr_cut =new TH1F("hr_cut","histos_cut",500,0.0,1);
TH1F *hl_cut =new TH1F("hl_cut","histos_cut ",500,0.0,1);
digiTree->SetBranchAddress("amp_max",&_max);
max=4096;
for(k=0;k<digiTree->GetEntries();k++){
if (k%3000==0) cout<<"On entry " <<k<<endl;
digiTree->GetEntry(k);
hr_amp->Fill(amp_max[3]/max);
hl_amp->Fill(amp_max[4]/max);
}//chiudo for k
hr_amp->Scale(1/(hr_amp->Integral()));
hl_amp->Scale(1/(hl_amp->Integral()));
cout<< max << endl;
hr_amp->Fit("f_r","R0");
hl_amp->Fit("f_l","R0");
for(k=0;k<digiTree->GetEntries();k++){
digiTree->GetEntry(k);
if (0.8*fit_l->GetParameter(1) < amp_max[4]/max && amp_max[4]/max < 3*fit_l->GetParameter(1)){
hr_cut->Fill(amp_max[3]/max);
hl_cut->Fill(amp_max[4]/max);}
}//chiudo for k
hr_cut->Scale(1/(hr_cut->Integral()));
hl_cut->Scale(1/(hl_cut->Integral()));
hr_cut->Scale(hr_amp->Integral(0.8*fit_r->GetParameter(1)*500, 3*fit_r->GetParameter(1)*500)/hr_amp->Integral());
hl_cut->Scale(hl_amp->Integral(0.8*fit_l->GetParameter(1)*500, 3*fit_l->GetParameter(1)*500)/hl_amp->Integral());
TCanvas* wf_c =new TCanvas("wf","Plot wf",1200,550);
wf_c->Clear();
wf_c->Divide(2,1);
wf_c->cd(1)->SetLogy();
//gStyle->SetOptFit();
hr_amp->SetLineColor(4);
hr_amp->GetXaxis()->SetTitle("max.amplitude [mV]");
hr_amp->GetYaxis()->SetTitle("counts");
hr_amp->Draw("HISTO");
fit_r->DrawF1(0,1,"same");
hr_cut->SetLineColor(kBlack);
hr_cut->Draw("HISTO same");
wf_c->cd(2)->SetLogy();
hl_amp->SetLineColor(4);
hl_amp->GetXaxis()->SetTitle("max.amplitude [mV]");
hl_amp->GetYaxis()->SetTitle("counts");
//gStyle->SetOptFit();
hl_amp->Draw("HISTO");
hl_cut->SetLineColor(kBlack);
fit_l->DrawF1(0,1,"same");
hl_cut->Draw("HISTO same");
}