Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:56:55

0001 #ifndef ALIGNMENT_OFFLINEVALIDATION_OUTPVTRENDS_H_
0002 #define ALIGNMENT_OFFLINEVALIDATION_OUTPVTRENDS_H_
0003 
0004 #include "TArrow.h"
0005 #include "TAxis.h"
0006 #include "TCanvas.h"
0007 #include "TF1.h"
0008 #include "TFile.h"
0009 #include "TGaxis.h"
0010 #include "TGraph.h"
0011 #include "TGraphAsymmErrors.h"
0012 #include "TGraphErrors.h"
0013 #include "TH1F.h"
0014 #include "TH2F.h"
0015 #include "TLatex.h"
0016 #include "TLegend.h"
0017 #include "TList.h"
0018 #include "TMath.h"
0019 #include "TObjArray.h"
0020 #include "TObjString.h"
0021 #include "TPad.h"
0022 #include "TPaveText.h"
0023 #include "TProcPool.h"
0024 #include "TProfile.h"
0025 #include "TROOT.h"
0026 #include "TStyle.h"
0027 #include "TSystem.h"
0028 #include "TSystemDirectory.h"
0029 #include "TSystemFile.h"
0030 #include <TStopwatch.h>
0031 #include <algorithm>
0032 #include <bitset>
0033 #include <fstream>
0034 #include <functional>
0035 #include <iostream>
0036 #include <iterator>
0037 #include <map>
0038 #include <sstream>
0039 #include <vector>
0040 
0041 /*!
0042  * \def basically the y-values of a TGraph
0043  */
0044 typedef std::map<TString, std::vector<double> > alignmentTrend;
0045 
0046 // auxilliary struct to store
0047 // histogram features
0048 struct unrolledHisto {
0049   double m_y_min;
0050   double m_y_max;
0051   unsigned int m_n_bins;
0052   std::vector<double> m_bincontents;
0053 
0054   unrolledHisto() {
0055     m_y_min = 0.;
0056     m_y_max = 0.;
0057     m_n_bins = 0;
0058     m_bincontents.clear();
0059   }  // first constructor empty
0060 
0061   unrolledHisto(const double &y_min,
0062                 const double &y_max,
0063                 const unsigned int &n_bins,
0064                 const std::vector<double> &bincontents) {
0065     m_y_min = y_min;
0066     m_y_max = y_max;
0067     m_n_bins = n_bins;
0068     m_bincontents = bincontents;
0069   }  //look, a constructor
0070 
0071   double get_y_min() { return m_y_min; }
0072 
0073   double get_y_max() { return m_y_max; }
0074 
0075   unsigned int get_n_bins() { return m_n_bins; }
0076 
0077   std::vector<double> get_bin_contents() { return m_bincontents; }
0078 
0079   double get_integral() {
0080     double ret(0.);
0081     for (const auto &binc : m_bincontents) {
0082       ret += binc;
0083     }
0084     return ret;
0085   }
0086 };
0087 
0088 struct outPVtrends {
0089   /*! \struct outPVtrends
0090   *  \brief Structure outPVtrends
0091   *         Contains the ensemble of all the alignmentTrends built by the functor
0092   *
0093   * @param m_index                     int, to keep track of which chunk of data has been processed
0094   * @param m_runs                      std::vector, list of the run processed in this section
0095   * @param m_dxyPhiMeans               alignmentTrend of the mean values of the profile dxy vs phi
0096   * @param m_dxyPhiChi2                alignmentTrend of chi2 of the linear fit per profile dxy vs phi
0097   * @param m_dxyPhiKS                  alignmentTrend of Kolmogorow-Smirnov score of comparison of dxy vs phi profile with flat line
0098   * @param m_dxyPhiHi                  alignmentTrend of the highest value of the profile dxy vs phi
0099   * @param m_dxyPhiLo                  alignmentTrend of the lowest value of the profile dxy vs phi
0100   * @param m_dxyEtaMeans               alignmentTrend of the mean values of the profile dxy vs eta
0101   * @param m_dxyEtaChi2                alignmentTrend of chi2 of the linear fit per profile dxy vs eta
0102   * @param m_dxyEtaKS                  alignmentTrend of Kolmogorow-Smirnov score of comparison of dxy vs eta profile with flat line
0103   * @param m_dxyEtaHi                  alignmentTrend of the highest value of the profile dxy vs eta
0104   * @param m_dxyEtaLo                  alignmentTrend of the lowest value of the profile dxy vs eta
0105   * @param m_dzPhiMeans                alignmentTrend of the mean values of the profile dz vs phi
0106   * @param m_dzPhiChi2                 alignmentTrend of chi2 of the linear fit per profile dz vs phi
0107   * @param m_dzPhiKS                   alignmentTrend of Kolmogorow-Smirnov score of comparison of dz vs phi profile with flat line
0108   * @param m_dzPhiHi                   alignmentTrend of the highest value of the profile dz vs phi
0109   * @param m_dzPhiLo                   alignmentTrend of the lowest value of the profile dz vs phi
0110   * @param m_dzEtaMeans                alignmentTrend of the mean values of the profile dz vs eta
0111   * @param m_dzEtaChi2                 alignmentTrend of chi2 of the linear fit per profile dz vs eta
0112   * @param m_dzEtaKS                   alignmentTrend of Kolmogorow-Smirnov score of comparison of dz vs eta profile with flat line
0113   * @param m_dzEtaHi                   alignmentTrend of the highest value of the profile dz vs eta
0114   * @param m_dzEtaLo                   alignmentTrend of the lowest value of the profile dz vs eta
0115   * @param m_dxyVect                   map of the unrolled histograms for dxy residuals
0116   * @param m_dzVect                    map of the unrolled histograms for dz residulas
0117   */
0118 
0119   // empty constructor
0120   outPVtrends() { init(); }
0121 
0122   int m_index;
0123   std::vector<double> m_runs;
0124   alignmentTrend m_dxyPhiMeans;
0125   alignmentTrend m_dxyPhiChi2;
0126   alignmentTrend m_dxyPhiKS;
0127   alignmentTrend m_dxyPhiHi;
0128   alignmentTrend m_dxyPhiLo;
0129   alignmentTrend m_dxyEtaMeans;
0130   alignmentTrend m_dxyEtaChi2;
0131   alignmentTrend m_dxyEtaKS;
0132   alignmentTrend m_dxyEtaHi;
0133   alignmentTrend m_dxyEtaLo;
0134   alignmentTrend m_dzPhiMeans;
0135   alignmentTrend m_dzPhiChi2;
0136   alignmentTrend m_dzPhiKS;
0137   alignmentTrend m_dzPhiHi;
0138   alignmentTrend m_dzPhiLo;
0139   alignmentTrend m_dzEtaMeans;
0140   alignmentTrend m_dzEtaChi2;
0141   alignmentTrend m_dzEtaKS;
0142   alignmentTrend m_dzEtaHi;
0143   alignmentTrend m_dzEtaLo;
0144   std::map<TString, std::vector<unrolledHisto> > m_dxyVect;
0145   std::map<TString, std::vector<unrolledHisto> > m_dzVect;
0146 
0147   void init() {
0148     m_index = -1;
0149     m_runs.clear();
0150 
0151     m_dxyPhiMeans.clear();
0152     m_dxyPhiChi2.clear();
0153     m_dxyPhiKS.clear();
0154     m_dxyPhiHi.clear();
0155     m_dxyPhiLo.clear();
0156 
0157     m_dxyEtaMeans.clear();
0158     m_dxyEtaChi2.clear();
0159     m_dxyEtaKS.clear();
0160     m_dxyEtaHi.clear();
0161     m_dxyEtaLo.clear();
0162 
0163     m_dzPhiMeans.clear();
0164     m_dzPhiChi2.clear();
0165     m_dzPhiKS.clear();
0166     m_dzPhiHi.clear();
0167     m_dzPhiLo.clear();
0168 
0169     m_dzEtaMeans.clear();
0170     m_dzEtaChi2.clear();
0171     m_dzEtaKS.clear();
0172     m_dzEtaHi.clear();
0173     m_dzEtaLo.clear();
0174 
0175     m_dxyVect.clear();
0176     m_dzVect.clear();
0177   }
0178 };
0179 
0180 #if defined(__ROOTCLING__)
0181 #pragma link C++ class std::map < TString, std::vector < double>> + ;
0182 #pragma link C++ class std::map < TString, std::vector < unrolledHisto>> + ;
0183 #pragma link C++ class outPVtrends + ;
0184 #pragma link C++ class unrolledHisto + ;
0185 
0186 #endif
0187 
0188 #endif  // ALIGNMENT_OFFLINEVALIDATION_OUTPVTRENDS_H_