3 TString filename_mc_smeared =
"")
6 gSystem->Load(
"libeicsmear");
9 TFile *file_mc =
new TFile(filename_mc,
"OPEN");
10 TFile *file_mc_smeared =
new TFile(filename_mc_smeared,
"OPEN");
13 TTree *
tree = (TTree*)file_mc->Get(
"EICTree");
14 TTree *tree_smeared = (TTree*)file_mc_smeared->Get(
"Smeared");
17 tree->AddFriend(tree_smeared);
19 erhic::EventPythia *
event = NULL;
20 Smear::Event *eventS = NULL;
22 tree->SetBranchAddress(
"event", &
event);
23 tree->SetBranchAddress(
"eventS", &eventS);
26 TCut cut_base(
"particles.KS==1 && Smeared.particles.p > 0 && (particles.id==11 || particles.id==22)");
29 unsigned colors[7] = {1,2,3,4,6,7,14};
32 unsigned etas_plotmax = 7;
35 vector< double >
etas;
36 etas.push_back(-2.75);
37 etas.push_back(-2.25);
38 etas.push_back(-1.75);
39 etas.push_back(-0.25);
40 etas.push_back( 0.25);
41 etas.push_back( 1.75);
42 etas.push_back( 2.25);
45 TF1* f_momres =
new TF1(
"f_momres",
"sqrt( ([0])**2 + ([1]/(x**0.5))**2 )" );
47 cout <<
"\nFit function: " << f_momres->GetTitle() <<
"\n" << endl;
50 TCanvas *cscratch =
new TCanvas(
"cscratch");
53 TH1F* hframe =
new TH1F(
"hframe",
"",100,0,40);
54 hframe->GetYaxis()->SetRangeUser(0,0.15);
55 hframe->GetXaxis()->SetTitle(
"Energy (GeV/c)");
56 hframe->GetYaxis()->SetTitle(
"#sigma_{E}/E");
60 TH2F* h2tmp =
new TH2F(
"h2tmp",
"",nbinsp,0,(
float)nbinsp,50,-1,1);
61 h2tmp->GetXaxis()->SetTitle(
"Energy (GeV)");
62 h2tmp->GetYaxis()->SetTitle(
"(#Delta E)/E");
65 TCanvas *c1 =
new TCanvas();
69 TLegend* leg_eta =
new TLegend( 0.25, 0.40, 0.45, 0.90);
72 for (
int i = 0;
i < etas.size();
i++ )
77 double eta = etas.at(
i);
79 cout <<
"\n***Eta = " << eta << endl;
87 TCut cutx( Form(
"particles.p > 1 && ( particles.eta > %f && particles.eta < %f )", eta_min, eta_max) );
88 cout << cutx.GetTitle() << endl;
92 tree->Draw(
"(Smeared.particles.E-particles.E)/particles.E:particles.E >> h2tmp",cut_base && cutx,
"");
96 TH1D* h2tmp_2 = (TH1D*)gDirectory->Get(
"h2tmp_2");
99 TGraphErrors *gres =
new TGraphErrors(nbinsp);
100 gres->SetMarkerColor(colors[
i]);
101 for (
unsigned bini = 1; bini < nbinsp; bini++ )
103 double sigm_i = h2tmp_2->GetBinContent(bini);
104 double sigm_err_i = h2tmp_2->GetBinError(bini);
106 gres->SetPoint( bini-1, h2tmp->GetXaxis()->GetBinCenter(bini), sigm_i );
107 gres->SetPointError( bini-1, 0, sigm_err_i );
111 if ( i < etas_plotmax )
114 leg_eta->AddEntry(gres, Form(
"#eta = %.1f", eta),
"P");
119 f_momres->SetLineColor(colors[i]);
129 TCanvas *
c2 =
new TCanvas();