16 #include <THnSparse.h>
27 TString filename_mc_smeared =
"",
31 gSystem->Load(
"libeicsmear");
34 TFile *file_mc =
new TFile(filename_mc,
"OPEN");
35 TFile *file_mc_smeared =
new TFile(filename_mc_smeared,
"OPEN");
38 TTree *
tree = (TTree*)file_mc->Get(
"EICTree");
39 TTree *tree_smeared = (TTree*)file_mc_smeared->Get(
"Smeared");
42 TFile *file_out =
new TFile(filename_output,
"RECREATE");
45 tree->AddFriend(tree_smeared);
47 erhic::EventPythia *
event = NULL;
48 Smear::Event *eventS = NULL;
50 tree->SetBranchAddress(
"event", &
event);
51 tree->SetBranchAddress(
"eventS", &eventS);
54 TH2F* h_eta =
new TH2F(
"h_eta",
"Momentum vs. Pseudorapidity",80,-4,4,45,-5,40 );
55 TH2F* h_eta_accept = (TH2F*)h_eta->Clone(
"h_eta_accept");
56 h_eta->GetXaxis()->SetTitle(
"#eta");
57 h_eta->GetYaxis()->SetTitle(
"Momentum (GeV)");
60 TCanvas *c1 =
new TCanvas;
64 unsigned max_event = tree->GetEntries();
66 for (
unsigned ievent = 0; ievent < max_event; ievent++ )
68 if ( ievent%1000 == 0 )
69 cout <<
"Processing event " << ievent << endl;
72 tree->GetEntry(ievent);
75 float y =
event->GetTrueY();
76 if ( y > 0.99 || y < 0.01 )
79 float eta =
event->ScatteredLepton()->GetEta();
80 float p =
event->ScatteredLepton()->GetP();
89 h_eta_accept->Write();
94 h_eta->Draw(
"sameaxis");