Fork me on GitHub

Changeset 85ad2b9 in git for examples


Ignore:
Timestamp:
Sep 29, 2016, 2:50:28 PM (8 years ago)
Author:
Michele Selvaggi <michele.selvaggi@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
933e560
Parents:
5348ed9
Message:

added CaloGrid plots to val sequence and added Delphes version in plots

Location:
examples
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • examples/Validation.cpp

    r5348ed9 r85ad2b9  
    12651265  if(logy) gPad->SetLogy();
    12661266
     1267
    12671268  //gPad->SetGridx();
    12681269  //gPad->SetGridy();
     
    12751276
    12761277
    1277 void Validation(const char *inputFilePion, const char *inputFileElectron, const char *inputFileMuon, const char *inputFilePhoton, const char *inputFileNeutralHadron, const char *inputFileJet, const char *inputFileBJet, const char *inputFileCJet, const char *inputFileTauJet, const char *outputFile)
     1278void Validation(const char *inputFilePion,
     1279                const char *inputFileElectron,
     1280                const char *inputFileMuon,
     1281                const char *inputFilePhoton,
     1282                const char *inputFileNeutralHadron,
     1283                const char *inputFileJet,
     1284                const char *inputFileBJet,
     1285                const char *inputFileCJet,
     1286                const char *inputFileTauJet,
     1287                const char *outputFile,
     1288                const char *version)
    12781289{
    12791290
     
    13791390  figPath.Remove(lastSlash+1,sizePath);
    13801391
     1392  TString header = pdfOutput;
     1393  header.ReplaceAll(".pdf", "");
     1394  header.ReplaceAll("validation_", "");
     1395  lastSlash = header.Last('/');
     1396  sizePath = header.Length();
     1397  header.Remove(0,lastSlash+1);
     1398
     1399  TString vrs(version);
     1400
     1401  TPaveText *pave = new TPaveText(0.0, 0.89, 0.94, 0.94,"NDC");
     1402  pave->SetTextAlign(kHAlignRight);
     1403  pave->SetTextFont(132);
     1404  pave->SetBorderSize(0);
     1405  pave->SetShadowColor(0);
     1406  pave->SetFillColor(0);
     1407  pave->SetFillStyle(0);
     1408  pave->AddText("Delphes "+vrs+" - "+header);
     1409
    13811410  TString s_etaMin, s_etaMax, s_eta, s_pt, s_e;
    13821411
     
    14741503  DrawAxis(mg_trkpi_res_pt, leg_trkpi_res_pt, ptMin, ptMax, 0.01, 100, "p_{T} [GeV]", "(track resolution in p_{T})/p_{T} (%)", true, true);
    14751504  leg_trkpi_res_pt->Draw();
     1505  pave->Draw();
    14761506
    14771507  c_trkpi_res_pt->Print(pdfOutput+"(","pdf");
     
    14841514  DrawAxis(mg_trkpi_res_eta, leg_trkpi_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
    14851515  leg_trkpi_res_eta->Draw();
     1516  pave->Draw();
    14861517
    14871518  c_trkpi_res_eta->Print(pdfOutput,"pdf");
     
    14941525  DrawAxis(mg_trkpi_eff_pt, leg_trkpi_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
    14951526  leg_trkpi_eff_pt->Draw();
     1527  pave->Draw();
    14961528
    14971529  c_trkpi_eff_pt->Print(pdfOutput,"pdf");
     
    15041536  DrawAxis(mg_trkpi_eff_eta, leg_trkpi_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
    15051537  leg_trkpi_eff_eta->Draw();
     1538  pave->Draw();
     1539
    15061540
    15071541  c_trkpi_eff_eta->Print(pdfOutput,"pdf");
     
    15711605  DrawAxis(mg_trkele_res_pt, leg_trkele_res_pt, ptMin, ptMax, 0.01, 100, "p_{T} [GeV]", "(track resolution in p_{T})/p_{T} (%)", true, true);
    15721606  leg_trkele_res_pt->Draw();
     1607  pave->Draw();
    15731608
    15741609  c_trkele_res_pt->Print(pdfOutput,"pdf");
     
    15811616  DrawAxis(mg_trkele_res_eta, leg_trkele_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
    15821617  leg_trkele_res_eta->Draw();
     1618  pave->Draw();
    15831619
    15841620  c_trkele_res_eta->Print(pdfOutput,"pdf");
     
    15911627  DrawAxis(mg_trkele_eff_pt, leg_trkele_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
    15921628  leg_trkele_eff_pt->Draw();
     1629  pave->Draw();
    15931630
    15941631  c_trkele_eff_pt->Print(pdfOutput,"pdf");
     
    16011638  DrawAxis(mg_trkele_eff_eta, leg_trkele_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
    16021639  leg_trkele_eff_eta->Draw();
     1640  pave->Draw();
    16031641
    16041642  c_trkele_eff_eta->Print(pdfOutput,"pdf");
     
    16711709  DrawAxis(mg_trkmu_res_pt, leg_trkmu_res_pt, ptMin, ptMax, 0.01, 100, "p_{T} [GeV]", "(track resolution in p_{T})/p_{T} (%)", true, true);
    16721710  leg_trkmu_res_pt->Draw();
     1711  pave->Draw();
    16731712
    16741713  c_trkmu_res_pt->Print(pdfOutput,"pdf");
     
    16811720  DrawAxis(mg_trkmu_res_eta, leg_trkmu_res_eta, etaMin, etaMax, 0.01, 100, " #eta ", "(track resolution in p_{T})/p_{T} (%)", false, true);
    16821721  leg_trkmu_res_eta->Draw();
     1722  pave->Draw();
    16831723
    16841724  c_trkmu_res_eta->Print(pdfOutput,"pdf");
     
    16911731  DrawAxis(mg_trkmu_eff_pt, leg_trkmu_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "tracking efficiency (%)", true, false);
    16921732  leg_trkmu_eff_pt->Draw();
     1733  pave->Draw();
    16931734
    16941735  c_trkmu_eff_pt->Print(pdfOutput,"pdf");
     
    17011742  DrawAxis(mg_trkmu_eff_eta, leg_trkmu_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "tracking efficiency (%)", false, false);
    17021743  leg_trkmu_eff_eta->Draw();
     1744  pave->Draw();
    17031745
    17041746  c_trkmu_eff_eta->Print(pdfOutput,"pdf");
     
    17581800  DrawAxis(mg_ecal_res_e, leg_ecal_res_e, ptMin, ptMax, 0.0, 20, "E [GeV]", "(ECAL resolution in E)/E (%)", true, false);
    17591801  leg_ecal_res_e->Draw();
     1802  pave->Draw();
    17601803
    17611804  c_ecal_res_e->Print(pdfOutput,"pdf");
     
    17691812  DrawAxis(mg_ecal_res_eta, leg_ecal_res_eta, etaMin, etaMax, 0.0, 20, " #eta ", "(ECAL resolution in E)/E (%)", false, false);
    17701813  leg_ecal_res_eta->Draw();
     1814  pave->Draw();
    17711815
    17721816  c_ecal_res_eta->Print(pdfOutput,"pdf");
     
    18271871  DrawAxis(mg_hcal_res_e, leg_hcal_res_e, ptMin, ptMax, 0.0, 50, "E [GeV]", "(HCAL resolution in E)/E (%)", true, false);
    18281872  leg_hcal_res_e->Draw();
     1873  pave->Draw();
    18291874
    18301875  c_hcal_res_e->Print(pdfOutput,"pdf");
     
    18381883  DrawAxis(mg_hcal_res_eta, leg_hcal_res_eta, etaMin, etaMax, 0.0, 50, " #eta ", "(HCAL resolution in E)/E (%)", false, false);
    18391884  leg_hcal_res_eta->Draw();
     1885  pave->Draw();
    18401886
    18411887  c_hcal_res_eta->Print(pdfOutput,"pdf");
     
    18891935     DrawAxis(mg_pfele_res_e[k], leg_pfele_res_e[k], ptMin, ptMax, 0.0, 20, "E [GeV]", "(resolution in E)/E (%)", true, false);
    18901936     leg_pfele_res_e[k]->Draw();
     1937     pave->Draw();
    18911938
    18921939     TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
     
    19271974     DrawAxis(mg_pfele_res_eta[k], leg_pfele_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
    19281975     leg_pfele_res_eta[k]->Draw();
     1976     pave->Draw();
    19291977
    19301978     TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
     
    19822030     DrawAxis(mg_pfpi_res_e[k], leg_pfpi_res_e[k], ptMin, ptMax, 0.1, 50, "E [GeV]", "(resolution in E)/E (%)", true, false);
    19832031     leg_pfpi_res_e[k]->Draw();
     2032     pave->Draw();
    19842033
    19852034     TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
     
    20192068     DrawAxis(mg_pfpi_res_eta[k], leg_pfpi_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
    20202069     leg_pfpi_res_eta[k]->Draw();
     2070     pave->Draw();
    20212071
    20222072     TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
     
    20842134     DrawAxis(mg_pfjet_res_e[k], leg_pfjet_res_e[k], 10, ptMax, 0.0, 30, "E [GeV]", "(resolution in E)/E (%)", true, false);
    20852135     leg_pfjet_res_e[k]->Draw();
     2136     pave->Draw();
    20862137
    20872138     TString s_etarange = "eta_"+s_etaMin+"_"+s_etaMax+"_";
     
    21252176     DrawAxis(mg_pfjet_res_eta[k], leg_pfjet_res_eta[k], etaMin, etaMax, 0.0, 50, "#eta", "(resolution in E)/E (%)", false, false);
    21262177     leg_pfjet_res_eta[k]->Draw();
     2178     pave->Draw();
    21272179
    21282180     TString s_ptrange = Form("pt_%.0f_",ptVals.at(k));
     
    21622214
    21632215    leg_met_res_ht->Draw();
    2164 
     2216    pave->Draw();
    21652217    c_met_res_ht->Print(pdfOutput,"pdf");
    21662218    c_met_res_ht->Print(figPath+"img_met_res_ht.pdf","pdf");
     
    22152267    DrawAxis(mg_recele_eff_pt, leg_recele_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
    22162268    leg_recele_eff_pt->Draw();
     2269    pave->Draw();
    22172270
    22182271    c_recele_eff_pt->Print(pdfOutput,"pdf");
     
    22252278    DrawAxis(mg_recele_eff_eta, leg_recele_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
    22262279    leg_recele_eff_eta->Draw();
     2280    pave->Draw();
    22272281
    22282282    c_recele_eff_eta->Print(pdfOutput,"pdf");
     
    22782332    DrawAxis(mg_recmu_eff_pt, leg_recmu_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
    22792333    leg_recmu_eff_pt->Draw();
     2334    pave->Draw();
    22802335
    22812336    c_recmu_eff_pt->Print(pdfOutput,"pdf");
     
    22882343    DrawAxis(mg_recmu_eff_eta, leg_recmu_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
    22892344    leg_recmu_eff_eta->Draw();
     2345    pave->Draw();
    22902346
    22912347    c_recmu_eff_eta->Print(pdfOutput,"pdf");
     
    23412397    DrawAxis(mg_recpho_eff_pt, leg_recpho_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "reconstruction efficiency (%)", true, false);
    23422398    leg_recpho_eff_pt->Draw();
     2399    pave->Draw();
    23432400
    23442401    c_recpho_eff_pt->Print(pdfOutput,"pdf");
     
    23512408    DrawAxis(mg_recpho_eff_eta, leg_recpho_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "reconstruction efficiency (%)", false, false);
    23522409    leg_recpho_eff_eta->Draw();
     2410    pave->Draw();
    23532411
    23542412    c_recpho_eff_eta->Print(pdfOutput,"pdf");
     
    24032461    DrawAxis(mg_recbjet_eff_pt, leg_recbjet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "b - tag efficiency (%)", true, false);
    24042462    leg_recbjet_eff_pt->Draw();
     2463    pave->Draw();
    24052464
    24062465    c_recbjet_eff_pt->Print(pdfOutput,"pdf");
     
    24132472    DrawAxis(mg_recbjet_eff_eta, leg_recbjet_eff_eta, etaMin, etaMax, 0.0, 100, " #eta ", "b - tag efficiency (%)", false, false);
    24142473    leg_recbjet_eff_eta->Draw();
     2474    pave->Draw();
    24152475
    24162476    c_recbjet_eff_eta->Print(pdfOutput,"pdf");
     
    24652525    DrawAxis(mg_recbjet_cmis_pt, leg_recbjet_cmis_pt, ptMin, ptMax, 0.0, 20, "p_{T} [GeV]", "c - mistag rate (%)", true, false);
    24662526    leg_recbjet_cmis_pt->Draw();
     2527    pave->Draw();
    24672528
    24682529    c_recbjet_cmis_pt->Print(pdfOutput,"pdf");
     
    24752536    DrawAxis(mg_recbjet_cmis_eta, leg_recbjet_cmis_eta, etaMin, etaMax, 0.0, 20, " #eta ", "c - mistag rate (%)", false, false);
    24762537    leg_recbjet_cmis_eta->Draw();
     2538    pave->Draw();
    24772539
    24782540    c_recbjet_cmis_eta->Print(pdfOutput,"pdf");
     
    25252587    DrawAxis(mg_recbjet_lmis_pt, leg_recbjet_lmis_pt, ptMin, ptMax, 0.0, 0.1, "p_{T} [GeV]", "light - mistag rate (%)", true, false);
    25262588    leg_recbjet_lmis_pt->Draw();
     2589    pave->Draw();
    25272590
    25282591    c_recbjet_lmis_pt->Print(pdfOutput,"pdf");
     
    25352598    DrawAxis(mg_recbjet_lmis_eta, leg_recbjet_lmis_eta, etaMin, etaMax, 0.0, 0.1, " #eta ", "light - mistag rate (%)", false, false);
    25362599    leg_recbjet_lmis_eta->Draw();
     2600    pave->Draw();
    25372601
    25382602    c_recbjet_lmis_eta->Print(pdfOutput,"pdf");
     
    25892653    DrawAxis(mg_rectaujet_eff_pt, leg_rectaujet_eff_pt, ptMin, ptMax, 0.0, 100, "p_{T} [GeV]", "#tau - tag efficiency (%)", true, false);
    25902654    leg_rectaujet_eff_pt->Draw();
     2655    pave->Draw();
    25912656
    25922657    c_rectaujet_eff_pt->Print(pdfOutput,"pdf");
     
    25992664    DrawAxis(mg_rectaujet_eff_eta, leg_rectaujet_eff_eta, etaMin, etaMax, 0.0000001, 100, " #eta ", "#tau - tag efficiency (%)", false, true);
    26002665    leg_rectaujet_eff_eta->Draw();
     2666    pave->Draw();
    26012667
    26022668    c_rectaujet_eff_eta->Print(pdfOutput,"pdf");
     
    26502716    DrawAxis(mg_rectaujet_mis_pt, leg_rectaujet_mis_pt, ptMin, ptMax, 0.0, 10., "p_{T} [GeV]", "#tau - mistag(%)", true, false);
    26512717    leg_rectaujet_mis_pt->Draw();
     2718    pave->Draw();
    26522719
    26532720    c_rectaujet_mis_pt->Print(pdfOutput,"pdf");
     
    26602727    DrawAxis(mg_rectaujet_mis_eta, leg_rectaujet_mis_eta, etaMin, etaMax, 0.0, 5., " #eta ", "#tau - mistag (%)", false, false);
    26612728    leg_rectaujet_mis_eta->Draw();
     2729    pave->Draw();
    26622730
    26632731    c_rectaujet_mis_eta->Print(pdfOutput+")","pdf");
     
    27312799  char *appName = "Validation";
    27322800
    2733   if(argc != 11)
     2801  if(argc != 12)
    27342802  {
    27352803    cout << " Usage: " << appName << " input_file_electron input_file_muon input_file_photon input_file_jet input_file_bjet input_file_taujet output_file" << endl;
     
    27442812    cout << " input_file_taujet - input file in ROOT format ('Delphes' tree)," << endl;
    27452813    cout << " output_file - output file in ROOT format" << endl;
     2814    cout << " delphes version" << endl;
     2815
    27462816    return 1;
    27472817  }
     
    27532823  TApplication app(appName, &appargc, appargv);
    27542824
    2755   Validation(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10]);
     2825  Validation(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11]);
    27562826}
    27572827
  • examples/validation.sh

    r5348ed9 r85ad2b9  
    1616#
    1717# Note that the more events you specify, the more accurate the controls plots will be ...
     18# This said, 500k events should be ok for most cases.
    1819#
    1920############################################################################################
     
    3132fi
    3233
    33 card=$(basename $1)
     34cardbase=$(basename $1)
     35carddir=$(dirname $1)
    3436nEvents=$2
    35 validationCard=cards/validation_$card
    36 output=validation_${card%.*}.root
    37 mainoutputdir=report_${card%.*}
    38 outputroot=report_${card%.*}/root
    39 cardlabel=${card%.*}
     37validationCard=$carddir/validation_$cardbase
     38output=validation_${cardbase%.*}.root
     39mainoutputdir=report_${cardbase%.*}
     40outputroot=report_${cardbase%.*}/root
     41cardlabel=${cardbase%.*}
     42version=$(cat VERSION)
     43outpdf=$mainoutputdir/${output%.*}.pdf
     44
    4045
    4146mkdir -p $outputroot
    4247mkdir -p $mainoutputdir/www/fig
    4348
    44 sed 's/delphes_card_CMS.tcl/'$card'/g' cards/validation_card.tcl  > $validationCard
     49sed 's/delphes_card_CMS.tcl/'$cardbase'/g' cards/validation_card.tcl  > $validationCard
    4550
    4651function runParticleGun {
     
    6570runParticleGun taujet 15
    6671
    67 ./Validation $outputroot/particleGun_pion_$cardlabel.root $outputroot/particleGun_electron_$cardlabel.root $outputroot/particleGun_muon_$cardlabel.root $outputroot/particleGun_photon_$cardlabel.root $outputroot/particleGun_neutron_$cardlabel.root $outputroot/particleGun_jet_$cardlabel.root $outputroot/particleGun_bjet_$cardlabel.root $outputroot/particleGun_cjet_$cardlabel.root $outputroot/particleGun_taujet_$cardlabel.root $mainoutputdir/$output
     72./Validation $outputroot/particleGun_pion_$cardlabel.root $outputroot/particleGun_electron_$cardlabel.root $outputroot/particleGun_muon_$cardlabel.root $outputroot/particleGun_photon_$cardlabel.root $outputroot/particleGun_neutron_$cardlabel.root $outputroot/particleGun_jet_$cardlabel.root $outputroot/particleGun_bjet_$cardlabel.root $outputroot/particleGun_cjet_$cardlabel.root $outputroot/particleGun_taujet_$cardlabel.root $mainoutputdir/$output $version
     73
     74echo $outpdf
     75if grep -q SimpleCalorimeter "$1"; then
     76  ./CaloGrid $1 ECal
     77  ./CaloGrid $1 HCal
     78  gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=tmp/tmp1.pdf $outpdf ECal.pdf 
     79  gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$outpdf tmp/tmp1.pdf HCal.pdf
     80  mv ECal.pdf $mainoutputdir/www/fig/img_ecal.pdf
     81  mv ECal.png $mainoutputdir/www/fig/img_ecal.png
     82  mv HCal.pdf $mainoutputdir/www/fig/img_hcal.pdf
     83  mv HCal.png $mainoutputdir/www/fig/img_hcal.png
     84else
     85  ./CaloGrid $1 Calorimeter
     86  gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=tmp/tmp1.pdf $outpdf Calorimeter.pdf
     87  mv Calorimeter.pdf $mainoutputdir/www/fig/img_ecal.pdf
     88  mv Calorimeter.png $mainoutputdir/www/fig/img_ecal.png
     89fi
     90
     91
     92
     93
Note: See TracChangeset for help on using the changeset viewer.