Fork me on GitHub

Changeset fe3908f in git for examples/Validation.C


Ignore:
Timestamp:
Jun 27, 2016, 4:40:50 PM (8 years ago)
Author:
Alexandre Mertens <alexandre.mertens@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
a3a556c
Parents:
734b267
Message:

working with calos

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/Validation.C

    r734b267 rfe3908f  
    5757double ptrangemin = 10;
    5858double ptrangemax = 10000;
    59 static const int Nbins = 10;
     59static const int Nbins = 20;
    6060
    6161int objStyle = 1;
     
    101101    obj = object;
    102102
    103     cenResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", 500, -0.4, 0.4);
     103    cenResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_cen", 500, -1, 1);
    104104    fwdResolHist = new TH1D(obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_fwd", obj+"_delta_pt_"+Form("%4.2f",ptmin)+"_"+Form("%4.2f",ptmax)+"_fwd", 500, 0.4, 0.4);
    105105
     
    317317  Long64_t allEntries = treeReader->GetEntries();
    318318
    319 cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl;
     319  cout << "** Computing resolution of " << branchJet->GetName() << " induced by " << branchGenJet->GetName() << endl;
    320320
    321321  Jet *jet, *genjet;
     
    338338
    339339    // Loop over all reconstructed jets in event
    340     for(i = 0; i < branchJet->GetEntriesFast(); ++i)
     340    for(i = 0; i < TMath::Min(2,branchJet->GetEntriesFast()); ++i) //branchJet->GetEntriesFast(); ++i)
    341341    {
    342342
     
    347347
    348348     // Loop over all hard partons in event
    349      for(j = 0; j < branchGenJet->GetEntriesFast(); ++j)
     349     for(j = 0; j < TMath::Min(2,branchGenJet->GetEntriesFast()); ++j)
    350350     {
    351351        genjet = (Jet*) branchGenJet->At(j);
     
    365365      }
    366366
    367       if(deltaR < 0.1)
     367      if(deltaR < 0.3)
    368368      {
    369369        pt  = genJetMomentum.Pt();
     
    372372        for (bin = 0; bin < Nbins; bin++)
    373373        {
    374             if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > 0.0 && eta < 0.5)
     374            if(pt > histos->at(bin).ptmin && pt < histos->at(bin).ptmax && eta > 0.0 && eta < 2.5)
    375375            {
    376376                histos->at(bin).cenResolHist->Fill((bestGenJetMomentum.E()-jetMomentum.E())/bestGenJetMomentum.E());
     
    389389    delete f1;
    390390    return make_pair (sig, sigErr);
     391    //return make_pair (hist->GetRMS(), hist->GetRMSError());
    391392}
    392393
     
    395396{
    396397    Int_t bin;
    397     TGraphErrors gr = TGraphErrors(Nbins);
     398    Int_t count = 0;
     399    TGraphErrors gr = TGraphErrors(Nbins/2);
    398400    Double_t sig = 0;
    399401    Double_t sigErr = 0;
     
    406408            std::cout << " entries : " << histos->at(bin).cenResolHist->GetEntries() << std::endl;
    407409            std::pair<Double_t, Double_t> sigvalues = GausFit(histos->at(bin).cenResolHist);
    408             gr.SetPoint(bin,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
    409             gr.SetPointError(bin,0, sigvalues.second);
     410            gr.SetPoint(count,(histos->at(bin).ptmin+histos->at(bin).ptmax)/2.0, sigvalues.first);
     411            gr.SetPointError(count,0, sigvalues.second);
     412            count++;
    410413        }
    411414        /*
     
    516519  gPad->SetBottomMargin(0.2);
    517520  gPad->SetLeftMargin(0.2);
     521  gPad->Modified();
     522  gPad->Update();
    518523 
    519524}
     
    653658  C_el2->SaveAs(elRes+".eps");
    654659
     660  gDirectory->cd(0);
    655661
    656662/*
     
    802808  TGraphErrors gr_pfjets = EresGraph(&plots_pfjets, true);
    803809  gr_pfjets.SetName("pfJet");
     810
     811
     812  // PFJets Energy Resolution
     813  std::vector<resolPlot> plots_calojets;
     814  HistogramsCollection(&plots_calojets, TMath::Log10(ptrangemin), TMath::Log10(ptrangemax), "CaloJet");
     815  GetJetsEres( &plots_calojets, branchCaloJet, branchGenJet, treeReader);
     816  TGraphErrors gr_calojets = EresGraph(&plots_calojets, true);
     817  gr_calojets.SetName("caloJet");
     818
     819
     820  TString jetRes = "jetERes";
     821  TCanvas *C_jet = new TCanvas(jetRes,jetRes, 1000, 500);
     822  TMultiGraph *mg_jet = new TMultiGraph(jetRes,jetRes);
     823  TLegend *leg_jet = new TLegend(0.52,0.7,0.9,0.9);
     824
     825  addGraph(mg_jet, &gr_calojets, leg_jet, 3);
     826  addGraph(mg_jet, &gr_pfjets, leg_jet, 1);
     827
     828  mg_jet->Draw("ACX");
     829  leg_jet->Draw();
     830
     831  DrawAxis(mg_jet, leg_jet, 0.25);
     832
     833  C_jet->SaveAs(jetRes+".eps");
    804834
    805835 
     
    820850  { 
    821851      plots_pfjets.at(bin).cenResolHist->Write();
     852      plots_calojets.at(bin).cenResolHist->Write();
    822853      plots_el.at(bin).cenResolHist->Write();
    823854      plots_eltrack.at(bin).cenResolHist->Write();
     
    848879  C_el1->Write();
    849880  C_el2->Write();
     881  C_jet->Write();
    850882/*
    851883  C_mu->Write();
     
    853885*/
    854886  gr_pfjets.Write();
    855   //gr_calojets.Write();
     887  gr_calojets.Write();
    856888
    857889  fout->Write();
Note: See TracChangeset for help on using the changeset viewer.