HowToReadTree()
{

  // declare  tree
  TChain fChain("miniTree");

  // chain all input files
  fChain.Add("../dane_mc/analCutFlowdata_mc12_8TeV.147806.PowhegPythia8_AU2CT10_Zee.merge.NTUP_SMWZ.e1169_s1469_s1470_r3542_r3549_p1067_tid00836694_00_0.root");


  // set address to your variables

  // Declaration of leaf types
  Int_t           EventNumber;
  Float_t         el_cl_Et;
  Float_t         el_cl_eta;
  Float_t         tag_cl_Et;
  Float_t         tag_cl_eta;

  // List of branches
  TBranch        *b_el_cl_Et;   //!
  TBranch        *b_el_cl_eta;   //!
  TBranch        *b_EventNumber;   //!
  TBranch        *b_tag_cl_Et;   //!
  TBranch        *b_tag_cl_eta;   //!

   // Set object pointer
  fChain->SetBranchAddress("tag_cl_Et", &tag_cl_Et, &b_tag_cl_Et);
  fChain->SetBranchAddress("tag_cl_eta", &tag_cl_eta, &b_tag_cl_eta);
  fChain->SetBranchAddress("el_cl_Et", &el_cl_Et, &b_el_cl_Et);
  fChain->SetBranchAddress("el_cl_eta", &el_cl_eta, &b_el_cl_eta);


  // create histograms
  TH1F *h0   = new TH1F("h0"  ,"Event number",100,1.e+6,1.e+7);
  TH1F *h10  = new TH1F("h10" ,"Electron transverse energy",100,0.0, 100.);
  TH1F *h11  = new TH1F("h11" ,"Electron pseudorapidity",100,-3.0, 3.0);

  // loop over all entries in the fChain
  Int_t nevent = fChain.GetEntries(); 
  for (Int_t i=0;i<nevent;i++) {
    fChain.GetEvent(i);  
    //fill histogram for event number
    h0->Fill(EventNumber);

    //fill histogram for kinematical variables of reconstructed electrons 
    // el_cl_Et, tag_cl_Et   - transverse energy (in MeV)
    // el_cl_eta, tag_cl_eta - pseudorapidity
    std::cout << el_cl_Et/1000. << "  " << tag_cl_Et/1000. << std::endl;
    h0->Fill(EventNumber);
    if( el_cl_Et > 0.0 && tag_cl_Et > 0.0 ){
      h10->Fill(el_cl_Et/1000.);
      h11->Fill(el_cl_eta);
      h10->Fill(tag_cl_Et/1000.);
      h11->Fill(tag_cl_eta);
    }
  }
  
  // draw your histogram
  h10->Draw();
  
  // open file to store your histogram
  TFile  outputFile("histos.root","RECREATE");
  outputFile.cd();
  h0->Write();
  h10->Write();
  h11->Write();
  outputFile.Close();

}
