-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path111.cpp
51 lines (37 loc) · 1.05 KB
/
111.cpp
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
#include <stdio.h>
#include <TMath.h>
#include <TCanvas.h>
#include <iostream>
#include <TROOT.h>
#include <TChain.h>
#include <TObject.h>
#include <TRandom.h>
#include <TFile.h>
#include <math.h>
#include <TF1Convolution.h>
#include <TF1.h>
#include <TH1F.h>
#include <TGraph.h>
#include <TStopwatch.h>
using namespace std;
void 111()
{
TFile *file = new TFile("flat_scint3_box15_gap01_x_z_1.5_1.5mm_e200.root");
TH1F* hist = (TH1F *)file->Get("fCounterSipm");
TH1F *h_file = new TH1F("h_file","h_file",200,0.,1600.);
Int_t nentries = (Int_t)hist->GetEntries();
for (int i=0;i < nentries; i++)
{
Double_t x = hist->GetBinContent();
x += gRandom->Gaus(0.,3.);
h_file->Fill(x);
}
TF1Convolution *f_conv = new TF1Convolution("fCounterSipm","gaus",0.,1600.,true);
f_conv->SetRange(0.,1600.);
// f_conv->SetNofPointsFFT(1000);
TF1 *f = new TF1("f",*f_conv, 0., 1600., f_conv->GetNpar());
f->SetParameters(1.,-0.3,0.,1.);
new TCanvas("c","c",800,1000);
h_ExpGauss -> Fit("f");
h_ExpGauss->Draw();
}