-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotWF_graph.C
More file actions
executable file
·66 lines (49 loc) · 1.5 KB
/
Copy pathplotWF_graph.C
File metadata and controls
executable file
·66 lines (49 loc) · 1.5 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
using namespace std;
void plotWF_graph(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;
TCanvas* wf_c =new TCanvas("wf","Plot wf",1200,550);
wf_c->Divide(2,1);
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);
digiTree->SetBranchAddress("amp_max",&_max);
/*
for(k=0;k<digiTree->GetEntries();k++){
digiTree->GetEntry(k);
if(amp_max[3]>max) {max=amp_max[3];}
if(amp_max[4]>max) {max=amp_max[4];}
}//chiudo for k
*/
max=4096;
for(k=0;k<digiTree->GetEntries();k++){
if (k%10000==0) cout<<k<<endl;
digiTree->GetEntry(k);
hr_amp->Fill(amp_max[3]/max);
hl_amp->Fill(amp_max[4]/max);
}//chiudo for k
//hl_amp->SetLineColor();
cout<< max << endl;
wf_c->cd(1)->SetLogy();
hr_amp->GetXaxis()->SetTitle("max.amplitude [mV]");
hr_amp->GetYaxis()->SetTitle("counts");
hr_amp->DrawNormalized();
wf_c->cd(2)->SetLogy();
hl_amp->GetXaxis()->SetTitle("max.amplitude [mV]");
hl_amp->GetYaxis()->SetTitle("counts");
hl_amp->DrawNormalized();
TString histoname = "";
histoname.Append("histo");
histoname.Append(filename);
TFile* f2 = new TFile(histoname.Data(),"recreate");
f2->cd();
hr_amp->Write();
hl_amp->Write();
f2->Close();
// wf_c->cd(2)->SetLogy();
//hr_amp->Draw();
//hl_amp->Draw("same");
}