Fork me on GitHub

Changeset dd5e213 in git for examples


Ignore:
Timestamp:
Jan 27, 2017, 3:15:13 PM (8 years ago)
Author:
Pavel Demin <pavel.demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
50759fb
Parents:
95b3531
Message:

add dynamic allocation of arrays to Validation.cpp

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/Validation.cpp

    r95b3531 rdd5e213  
    14561456  TLegend *leg_trkpi_eff_eta = (TLegend*)leg_trkpi_res_eta->Clone();
    14571457
    1458 
    1459   TGraphErrors gr_trkpi_res_pt[n_etabins], gr_trkpi_eff_pt[n_etabins], gr_trkpi_res_eta[n_ptbins], gr_trkpi_eff_eta[n_ptbins];
     1458  TGraphErrors *gr_trkpi_res_pt  = new TGraphErrors[n_etabins];
     1459  TGraphErrors *gr_trkpi_eff_pt  = new TGraphErrors[n_etabins];
     1460  TGraphErrors *gr_trkpi_res_eta = new TGraphErrors[n_ptbins];
     1461  TGraphErrors *gr_trkpi_eff_eta = new TGraphErrors[n_ptbins];
    14601462  TH1D* h_trkpi_eff_pt, *h_trkpi_eff_eta;
    14611463
    1462   std::vector<resolPlot> plots_trkpi_res_pt[n_etabins], plots_trkpi_res_eta[n_ptbins];
     1464  std::vector<resolPlot> *plots_trkpi_res_pt   = new std::vector<resolPlot>[n_etabins];
     1465  std::vector<resolPlot> *plots_trkpi_res_eta  = new std::vector<resolPlot>[n_ptbins];
    14631466
    14641467  // loop over eta bins
     
    15591562  TLegend *leg_trkele_eff_eta = (TLegend*)leg_trkele_res_eta->Clone();
    15601563
    1561   TGraphErrors gr_trkele_res_pt[n_etabins], gr_trkele_eff_pt[n_etabins], gr_trkele_res_eta[n_ptbins], gr_trkele_eff_eta[n_ptbins];
     1564  TGraphErrors *gr_trkele_res_pt  = new TGraphErrors[n_etabins];
     1565  TGraphErrors *gr_trkele_eff_pt  = new TGraphErrors[n_etabins];
     1566  TGraphErrors *gr_trkele_res_eta = new TGraphErrors[n_ptbins];
     1567  TGraphErrors *gr_trkele_eff_eta = new TGraphErrors[n_ptbins];
     1568
    15621569  TH1D* h_trkele_eff_pt, *h_trkele_eff_eta;
    15631570
    1564   std::vector<resolPlot> plots_trkele_res_pt[n_etabins], plots_trkele_res_eta[n_ptbins];
     1571  std::vector<resolPlot> *plots_trkele_res_pt   = new std::vector<resolPlot>[n_etabins];
     1572  std::vector<resolPlot> *plots_trkele_res_eta  = new std::vector<resolPlot>[n_ptbins];
    15651573
    15661574  // loop over eta bins
     
    16631671
    16641672
    1665   TGraphErrors gr_trkmu_res_pt[n_etabins], gr_trkmu_eff_pt[n_etabins], gr_trkmu_res_eta[n_ptbins], gr_trkmu_eff_eta[n_ptbins];
     1673  TGraphErrors *gr_trkmu_res_pt  = new TGraphErrors[n_etabins];
     1674  TGraphErrors *gr_trkmu_eff_pt  = new TGraphErrors[n_etabins];
     1675  TGraphErrors *gr_trkmu_res_eta = new TGraphErrors[n_ptbins];
     1676  TGraphErrors *gr_trkmu_eff_eta = new TGraphErrors[n_ptbins];
     1677
    16661678  TH1D* h_trkmu_eff_pt, *h_trkmu_eff_eta;
    16671679
    1668   std::vector<resolPlot> plots_trkmu_res_pt[n_etabins], plots_trkmu_res_eta[n_ptbins];
     1680  std::vector<resolPlot> *plots_trkmu_res_pt   = new std::vector<resolPlot>[n_etabins];
     1681  std::vector<resolPlot> *plots_trkmu_res_eta  = new std::vector<resolPlot>[n_ptbins];
    16691682
    16701683  // loop over eta bins
     
    17641777  TLegend *leg_ecal_res_eta = new TLegend(0.60,0.59,0.95,0.90);
    17651778
    1766   TGraphErrors gr_ecal_res_e[n_etabins], gr_ecal_res_eta[n_ptbins];
    1767 
    1768   std::vector<resolPlot> plots_ecal_res_e[n_etabins], plots_ecal_res_eta[n_ptbins];
     1779  TGraphErrors *gr_ecal_res_e    = new TGraphErrors[n_etabins];
     1780  TGraphErrors *gr_ecal_res_eta  = new TGraphErrors[n_ptbins];
     1781
     1782  std::vector<resolPlot> *plots_ecal_res_e   = new std::vector<resolPlot>[n_etabins];
     1783  std::vector<resolPlot> *plots_ecal_res_eta = new std::vector<resolPlot>[n_ptbins];
    17691784
    17701785  // loop over eta bins
     
    18331848  TLegend *leg_hcal_res_eta = new TLegend(0.60,0.59,0.95,0.90);
    18341849
    1835   TGraphErrors gr_hcal_res_e[n_etabins], gr_hcal_res_eta[n_ptbins];
    1836 
    1837   std::vector<resolPlot> plots_hcal_res_e[n_etabins], plots_hcal_res_eta[n_ptbins];
     1850  TGraphErrors *gr_hcal_res_e   = new TGraphErrors[n_etabins];
     1851  TGraphErrors *gr_hcal_res_eta = new TGraphErrors[n_ptbins];
     1852
     1853  std::vector<resolPlot> *plots_hcal_res_e   = new std::vector<resolPlot>[n_etabins];
     1854  std::vector<resolPlot> *plots_hcal_res_eta = new std::vector<resolPlot>[n_ptbins];
    18381855
    18391856  // loop over eta bins
     
    19031920  TLegend *leg_pfele_res_eta[n_ptbins];
    19041921
    1905   TGraphErrors gr_pfele_res_e[n_etabins];
    1906   TGraphErrors gr_pfele_res_eta[n_ptbins];
    1907 
    1908   TGraphErrors gr_trkele_res_e[n_etabins];
    1909   TGraphErrors gr_trkele_res_eeta[n_ptbins];
    1910 
    1911   std::vector<resolPlot> plots_pfele_res_e[n_etabins], plots_pfele_res_eta[n_ptbins];
    1912   std::vector<resolPlot> plots_trkele_res_e[n_etabins], plots_trkele_res_eeta[n_ptbins];
     1922  TGraphErrors *gr_pfele_res_e = new TGraphErrors[n_etabins];
     1923  TGraphErrors *gr_pfele_res_eta = new TGraphErrors[n_ptbins];
     1924  TGraphErrors *gr_trkele_res_e = new TGraphErrors[n_etabins];
     1925  TGraphErrors *gr_trkele_res_eeta = new TGraphErrors[n_ptbins];
     1926
     1927  std::vector<resolPlot> *plots_pfele_res_e     = new std::vector<resolPlot>[n_etabins];
     1928  std::vector<resolPlot> *plots_pfele_res_eta   = new std::vector<resolPlot>[n_ptbins];
     1929  std::vector<resolPlot> *plots_trkele_res_e    = new std::vector<resolPlot>[n_etabins];
     1930  std::vector<resolPlot> *plots_trkele_res_eeta = new std::vector<resolPlot>[n_ptbins];
    19131931
    19141932  TCanvas *c_pfele_res_e[n_etabins];
     
    20102028  TLegend *leg_pfpi_res_eta[n_ptbins];
    20112029
    2012   TGraphErrors gr_pfpi_res_e[n_etabins];
    2013   TGraphErrors gr_pfpi_res_eta[n_ptbins];
    2014 
    2015   TGraphErrors gr_trkpi_res_e[n_etabins];
    2016   TGraphErrors gr_trkpi_res_eeta[n_ptbins];
    2017 
    2018   std::vector<resolPlot> plots_pfpi_res_e[n_etabins], plots_pfpi_res_eta[n_ptbins];
    2019   std::vector<resolPlot> plots_trkpi_res_e[n_etabins], plots_trkpi_res_eeta[n_ptbins];
     2030  TGraphErrors *gr_pfpi_res_e     = new TGraphErrors[n_etabins];
     2031  TGraphErrors *gr_pfpi_res_eta   = new TGraphErrors[n_ptbins];
     2032
     2033  TGraphErrors *gr_trkpi_res_e    = new TGraphErrors[n_etabins];
     2034  TGraphErrors *gr_trkpi_res_eeta = new TGraphErrors[n_ptbins];
     2035
     2036  std::vector<resolPlot> *plots_pfpi_res_e     = new std::vector<resolPlot>[n_etabins];
     2037  std::vector<resolPlot> *plots_pfpi_res_eta   = new std::vector<resolPlot>[n_ptbins];
     2038  std::vector<resolPlot> *plots_trkpi_res_e    = new std::vector<resolPlot>[n_etabins];
     2039  std::vector<resolPlot> *plots_trkpi_res_eeta = new std::vector<resolPlot>[n_ptbins];
    20202040
    20212041  TCanvas *c_pfpi_res_e[n_etabins];
     
    21192139  TLegend *leg_pfjet_res_eta[n_ptbins];
    21202140
    2121   TGraphErrors gr_pfjet_res_e[n_etabins];
    2122   TGraphErrors gr_pfjet_res_eta[n_ptbins];
    2123 
    2124   TGraphErrors gr_cajet_res_e[n_etabins];
    2125   TGraphErrors gr_cajet_res_eta[n_ptbins];
    2126 
    2127   std::vector<resolPlot> plots_pfjet_res_e[n_etabins], plots_pfjet_res_eta[n_ptbins];
    2128   std::vector<resolPlot> plots_cajet_res_e[n_etabins], plots_cajet_res_eta[n_ptbins];
     2141  TGraphErrors *gr_pfjet_res_e   = new TGraphErrors[n_etabins];
     2142  TGraphErrors *gr_pfjet_res_eta = new TGraphErrors[n_ptbins];
     2143
     2144  TGraphErrors *gr_cajet_res_e   = new TGraphErrors[n_etabins];
     2145  TGraphErrors *gr_cajet_res_eta = new TGraphErrors[n_ptbins];
     2146
     2147  std::vector<resolPlot> *plots_pfjet_res_e   = new std::vector<resolPlot>[n_etabins];
     2148  std::vector<resolPlot> *plots_pfjet_res_eta = new std::vector<resolPlot>[n_ptbins];
     2149  std::vector<resolPlot> *plots_cajet_res_e   = new std::vector<resolPlot>[n_etabins];
     2150  std::vector<resolPlot> *plots_cajet_res_eta = new std::vector<resolPlot>[n_ptbins];
    21292151
    21302152  TCanvas *c_pfjet_res_e[n_etabins];
     
    22602282    TLegend *leg_recele_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
    22612283
    2262     TGraphErrors gr_recele_eff_pt[n_etabins], gr_recele_eff_eta[n_ptbins];
     2284    TGraphErrors *gr_recele_eff_pt  = new TGraphErrors[n_etabins];
     2285    TGraphErrors *gr_recele_eff_eta = new TGraphErrors[n_ptbins];
    22632286    TH1D* h_recele_eff_pt, *h_recele_eff_eta;
    22642287
     
    23252348    TLegend *leg_recmu_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
    23262349
    2327     TGraphErrors gr_recmu_eff_pt[n_etabins], gr_recmu_eff_eta[n_ptbins];
     2350    TGraphErrors *gr_recmu_eff_pt  = new TGraphErrors[n_etabins];
     2351    TGraphErrors *gr_recmu_eff_eta = new TGraphErrors[n_ptbins];
    23282352    TH1D* h_recmu_eff_pt, *h_recmu_eff_eta;
    23292353
     
    23902414    TLegend *leg_recpho_eff_eta = new TLegend(0.55,0.22,0.90,0.48);
    23912415
    2392     TGraphErrors gr_recpho_eff_pt[n_etabins], gr_recpho_eff_eta[n_ptbins];
     2416    TGraphErrors *gr_recpho_eff_pt  = new TGraphErrors[n_etabins];
     2417    TGraphErrors *gr_recpho_eff_eta = new TGraphErrors[n_ptbins];
    23932418    TH1D* h_recpho_eff_pt, *h_recpho_eff_eta;
    23942419
     
    24552480    TLegend *leg_recbjet_eff_eta = new TLegend(0.50,0.22,0.90,0.48);
    24562481
    2457     TGraphErrors gr_recbjet_eff_pt[n_etabins], gr_recbjet_eff_eta[n_ptbins];
     2482    TGraphErrors *gr_recbjet_eff_pt  = new TGraphErrors[n_etabins];
     2483    TGraphErrors *gr_recbjet_eff_eta = new TGraphErrors[n_ptbins];
    24582484    TH1D* h_recbjet_eff_pt, *h_recbjet_eff_eta;
    24592485
     
    25172543    TLegend *leg_recbjet_cmis_eta = new TLegend(0.50,0.64,0.90,0.90);
    25182544
    2519     TGraphErrors gr_recbjet_cmis_pt[n_etabins], gr_recbjet_cmis_eta[n_ptbins];
     2545    TGraphErrors *gr_recbjet_cmis_pt  = new TGraphErrors[n_etabins];
     2546    TGraphErrors *gr_recbjet_cmis_eta = new TGraphErrors[n_ptbins];
    25202547    TH1D* h_recbjet_cmis_pt, *h_recbjet_cmis_eta;
    25212548
     
    25792606    TLegend *leg_recbjet_lmis_eta = new TLegend(0.50,0.64,0.90,0.90);
    25802607
    2581     TGraphErrors gr_recbjet_lmis_pt[n_etabins], gr_recbjet_lmis_eta[n_ptbins];
     2608    TGraphErrors *gr_recbjet_lmis_pt  = new TGraphErrors[n_etabins];
     2609    TGraphErrors *gr_recbjet_lmis_eta = new TGraphErrors[n_ptbins];
    25822610    TH1D* h_recbjet_lmis_pt, *h_recbjet_lmis_eta;
    25832611
     
    26442672    TLegend *leg_rectaujet_eff_eta = new TLegend(0.50,0.22,0.90,0.48);
    26452673
    2646     TGraphErrors gr_rectaujet_eff_pt[n_etabins], gr_rectaujet_eff_eta[n_ptbins];
     2674    TGraphErrors *gr_rectaujet_eff_pt  = new TGraphErrors[n_etabins];
     2675    TGraphErrors *gr_rectaujet_eff_eta = new TGraphErrors[n_ptbins];
    26472676    TH1D* h_rectaujet_eff_pt, *h_rectaujet_eff_eta;
    26482677
     
    27082737    TLegend *leg_rectaujet_mis_eta = new TLegend(0.50,0.64,0.90,0.90);
    27092738
    2710     TGraphErrors gr_rectaujet_mis_pt[n_etabins], gr_rectaujet_mis_eta[n_ptbins];
     2739    TGraphErrors *gr_rectaujet_mis_pt  = new TGraphErrors[n_etabins];
     2740    TGraphErrors *gr_rectaujet_mis_eta = new TGraphErrors[n_ptbins];
    27112741    TH1D* h_rectaujet_mis_pt, *h_rectaujet_mis_eta;
    27122742
Note: See TracChangeset for help on using the changeset viewer.