Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:10

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <array>
0010 #include <string>
0011 #include <vector>
0012 #include <iostream>
0013 
0014 #include <TCanvas.h>
0015 #include <TEfficiency.h>
0016 #include <TProfile.h>
0017 #include <TFile.h>
0018 
0019 #include "CommonUtils.h"
0020 
0021 /// This script allows a fast reading and replotting of the existing performance plots, e.g. 'trackeff_vs_*' and 'nMeasurements_vs_*',
0022 /// from the root file 'performance_track_fitter.root' or 'performance_ckf.root'.
0023 /// Note that redefinition of the tracking efficiency etc. is not possible with this script.
0024 /// If you want to define your own efficiency etc., please refer to 'defineReconstructionPerformance.C'.
0025 ///
0026 void reconstructionPerformance(std::vector<std::string> inputFileNames) {
0027   std::array<TCanvas*, 3> emho = {nullptr, nullptr, nullptr};
0028   std::vector<std::string> tags = {"eta", "pT"};
0029   std::vector<std::string> params = {"trackeff", "nMeasurements", "nHoles",
0030                                     "nOutliers", "nStates"};
0031 
0032   // Create the Canvae
0033   unsigned int itag = 0;
0034   for (const auto& t : tags) {
0035     std::string name = "efd_" + t;
0036     std::string label = "Efficiency, Fakes, Duplicate vs. " + t;
0037     emho[itag] =
0038         new TCanvas(name.c_str(), label.c_str(), itag * 10, 10, 1800, 300);
0039     emho[itag]->Divide(5, 1);
0040     ++itag;
0041   }
0042 
0043   unsigned int imode = 1;
0044   for (auto fileName : inputFileNames) {
0045     // The appropriate file
0046     auto file = TFile::Open(fileName.c_str(), "read");
0047     unsigned int itag = 0;
0048     for (const auto& t : tags) {
0049       unsigned int ipar = 0;
0050       for (const auto& p : params) {
0051         std::string hName = p + std::string("_vs_") + t;
0052         emho[itag]->cd(ipar+1);
0053         auto h = file->Get(hName.c_str());
0054         auto heff = dynamic_cast<TEfficiency*>(h);
0055         if (heff != nullptr){
0056           setEffStyle(heff, imode);
0057         } else {
0058           auto hprof = dynamic_cast<TProfile*>(h);
0059           if (hprof != nullptr){
0060             setHistStyle(hprof, imode);
0061           }
0062         }
0063         std::string dOpt = imode == 1 ? "" : "same";
0064         h->Draw(dOpt.c_str());
0065         ++ipar;
0066       }
0067       ++itag;
0068     }
0069     ++imode;
0070   }
0071 }
0072 
0073 /**
0074 TFile**     performance_track_fitter.root
0075  TFile*     performance_track_fitter.root
0076   KEY: TH1F res_d0;1    Residual of d0
0077   KEY: TH2F res_d0_vs_eta;1 Residual of d0 vs eta
0078   KEY: TH1F resmean_d0_vs_eta;1 Residual mean of d0
0079   KEY: TH1F reswidth_d0_vs_eta;1    Residual width of d0
0080   KEY: TH2F res_d0_vs_pT;1  Residual of d0 vs pT
0081   KEY: TH1F resmean_d0_vs_pT;1  Residual mean of d0
0082   KEY: TH1F reswidth_d0_vs_pT;1 Residual width of d0
0083   KEY: TH1F pull_d0;1   Pull of d0
0084   KEY: TH2F pull_d0_vs_eta;1    Pull of d0 vs eta
0085   KEY: TH1F pullmean_d0_vs_eta;1    Pull mean of d0
0086   KEY: TH1F pullwidth_d0_vs_eta;1   Pull width of d0
0087   KEY: TH2F pull_d0_vs_pT;1 Pull of d0 vs pT
0088   KEY: TH1F pullmean_d0_vs_pT;1 Pull mean of d0
0089   KEY: TH1F pullwidth_d0_vs_pT;1    Pull width of d0
0090   KEY: TH1F res_z0;1    Residual of z0
0091   KEY: TH2F res_z0_vs_eta;1 Residual of z0 vs eta
0092   KEY: TH1F resmean_z0_vs_eta;1 Residual mean of z0
0093   KEY: TH1F reswidth_z0_vs_eta;1    Residual width of z0
0094   KEY: TH2F res_z0_vs_pT;1  Residual of z0 vs pT
0095   KEY: TH1F resmean_z0_vs_pT;1  Residual mean of z0
0096   KEY: TH1F reswidth_z0_vs_pT;1 Residual width of z0
0097   KEY: TH1F pull_z0;1   Pull of z0
0098   KEY: TH2F pull_z0_vs_eta;1    Pull of z0 vs eta
0099   KEY: TH1F pullmean_z0_vs_eta;1    Pull mean of z0
0100   KEY: TH1F pullwidth_z0_vs_eta;1   Pull width of z0
0101   KEY: TH2F pull_z0_vs_pT;1 Pull of z0 vs pT
0102   KEY: TH1F pullmean_z0_vs_pT;1 Pull mean of z0
0103   KEY: TH1F pullwidth_z0_vs_pT;1    Pull width of z0
0104   KEY: TH1F res_phi;1   Residual of phi
0105   KEY: TH2F res_phi_vs_eta;1    Residual of phi vs eta
0106   KEY: TH1F resmean_phi_vs_eta;1    Residual mean of phi
0107   KEY: TH1F reswidth_phi_vs_eta;1   Residual width of phi
0108   KEY: TH2F res_phi_vs_pT;1 Residual of phi vs pT
0109   KEY: TH1F resmean_phi_vs_pT;1 Residual mean of phi
0110   KEY: TH1F reswidth_phi_vs_pT;1    Residual width of phi
0111   KEY: TH1F pull_phi;1  Pull of phi
0112   KEY: TH2F pull_phi_vs_eta;1   Pull of phi vs eta
0113   KEY: TH1F pullmean_phi_vs_eta;1   Pull mean of phi
0114   KEY: TH1F pullwidth_phi_vs_eta;1  Pull width of phi
0115   KEY: TH2F pull_phi_vs_pT;1    Pull of phi vs pT
0116   KEY: TH1F pullmean_phi_vs_pT;1    Pull mean of phi
0117   KEY: TH1F pullwidth_phi_vs_pT;1   Pull width of phi
0118   KEY: TH1F res_theta;1 Residual of theta
0119   KEY: TH2F res_theta_vs_eta;1  Residual of theta vs eta
0120   KEY: TH1F resmean_theta_vs_eta;1  Residual mean of theta
0121   KEY: TH1F reswidth_theta_vs_eta;1 Residual width of theta
0122   KEY: TH2F res_theta_vs_pT;1   Residual of theta vs pT
0123   KEY: TH1F resmean_theta_vs_pT;1   Residual mean of theta
0124   KEY: TH1F reswidth_theta_vs_pT;1  Residual width of theta
0125   KEY: TH1F pull_theta;1    Pull of theta
0126   KEY: TH2F pull_theta_vs_eta;1 Pull of theta vs eta
0127   KEY: TH1F pullmean_theta_vs_eta;1 Pull mean of theta
0128   KEY: TH1F pullwidth_theta_vs_eta;1    Pull width of theta
0129   KEY: TH2F pull_theta_vs_pT;1  Pull of theta vs pT
0130   KEY: TH1F pullmean_theta_vs_pT;1  Pull mean of theta
0131   KEY: TH1F pullwidth_theta_vs_pT;1 Pull width of theta
0132   KEY: TH1F res_qop;1   Residual of qop
0133   KEY: TH2F res_qop_vs_eta;1    Residual of qop vs eta
0134   KEY: TH1F resmean_qop_vs_eta;1    Residual mean of qop
0135   KEY: TH1F reswidth_qop_vs_eta;1   Residual width of qop
0136   KEY: TH2F res_qop_vs_pT;1 Residual of qop vs pT
0137   KEY: TH1F resmean_qop_vs_pT;1 Residual mean of qop
0138   KEY: TH1F reswidth_qop_vs_pT;1    Residual width of qop
0139   KEY: TH1F pull_qop;1  Pull of qop
0140   KEY: TH2F pull_qop_vs_eta;1   Pull of qop vs eta
0141   KEY: TH1F pullmean_qop_vs_eta;1   Pull mean of qop
0142   KEY: TH1F pullwidth_qop_vs_eta;1  Pull width of qop
0143   KEY: TH2F pull_qop_vs_pT;1    Pull of qop vs pT
0144   KEY: TH1F pullmean_qop_vs_pT;1    Pull mean of qop
0145   KEY: TH1F pullwidth_qop_vs_pT;1   Pull width of qop
0146   KEY: TH1F res_t;1 Residual of t
0147   KEY: TH2F res_t_vs_eta;1  Residual of t vs eta
0148   KEY: TH1F resmean_t_vs_eta;1  Residual mean of t
0149   KEY: TH1F reswidth_t_vs_eta;1 Residual width of t
0150   KEY: TH2F res_t_vs_pT;1   Residual of t vs pT
0151   KEY: TH1F resmean_t_vs_pT;1   Residual mean of t
0152   KEY: TH1F reswidth_t_vs_pT;1  Residual width of t
0153   KEY: TH1F pull_t;1    Pull of t
0154   KEY: TH2F pull_t_vs_eta;1 Pull of t vs eta
0155   KEY: TH1F pullmean_t_vs_eta;1 Pull mean of t
0156   KEY: TH1F pullwidth_t_vs_eta;1    Pull width of t
0157   KEY: TH2F pull_t_vs_pT;1  Pull of t vs pT
0158   KEY: TH1F pullmean_t_vs_pT;1  Pull mean of t
0159   KEY: TH1F pullwidth_t_vs_pT;1 Pull width of t
0160   KEY: TEfficiency  trackeff_vs_pT;1    Tracking efficiency
0161   KEY: TEfficiency  trackeff_vs_eta;1   Tracking efficiency
0162   KEY: TEfficiency  trackeff_vs_phi;1   Tracking efficiency
0163   KEY: TProfile nStates_vs_eta;1    Number of total states vs. #eta
0164   KEY: TProfile nMeasurements_vs_eta;1  Number of measurements vs. #eta
0165   KEY: TProfile nOutliers_vs_eta;1  Number of outliers vs. #eta
0166   KEY: TProfile nHoles_vs_eta;1 Number of holes vs. #eta
0167   KEY: TProfile nStates_vs_pT;1 Number of total states vs. pT
0168   KEY: TProfile nMeasurements_vs_pT;1   Number of measurements vs. pT
0169   KEY: TProfile nOutliers_vs_pT;1   Number of outliers vs. pT
0170   KEY: TProfile nHoles_vs_pT;1  Number of holes vs. pT
0171   */