CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/Calibration/Tools/interface/InvMatrixUtils.h

Go to the documentation of this file.
00001 
00011 #ifndef InvMatrixUtils_h
00012 #define InvMatrixUtils_h
00013 
00014 #include <string>
00015 #include <map>
00016 #include "TObject.h"
00017 #include "TF1.h"
00018 #include "TH2.h"
00019 #include "TProfile.h"
00020 #include "TCanvas.h"
00021 #include "CLHEP/Geometry/Point3D.h"
00022 #include "CLHEP/Matrix/GenMatrix.h"
00023 #include "CLHEP/Matrix/Matrix.h"
00024 #include "CLHEP/Matrix/Vector.h"
00025 #include "TFile.h"
00026  
00027 //#include "ConfigParser.h"
00028 #include "Calibration/Tools/interface/InvMatrixCommonDefs.h"
00029 
00031 void setStyle () ;
00032 
00035 TCanvas * getGlobalCanvas (std::string name = "Inv MatrixCanvas") ;
00036 
00039 TFile * getGlobalTFile (std::string name = "Inv MatrixTFile.root") ;
00040 //TFile * getGlobalTFile (const char* name) ;
00041 
00044 int saveGlobalTFile (std::string name = "Inv MatrixFile.root") ;
00045 
00049 CLHEP::HepMatrix * getSavedMatrix (const std::string & name) ;
00050 
00052 HepGeom::Point3D<Float_t>  TBposition (const Float_t amplit[7][7], 
00053                                        const Float_t beamEne,
00054                                        const Float_t w0 = 4.0,
00055                                        const Float_t x0 = 8.9, //mm
00056                                        const Float_t a0 = 6.2,
00057                                        const Float_t sideX = 24.06, //mm
00058                                        const Float_t sideY = 22.02) ; //mm
00059 
00062 double get5x5 (const Float_t energy[7][7]) ;
00063 
00066 double get3x3 (const Float_t energy[7][7]) ;
00067 
00069 int parseConfigFile (const TString& config) ;
00070 
00072 int xtalFromEtaPhi (const int & myEta, const int & myPhi) ;
00073 
00078 int xtalFromiEtaiPhi (const int & iEta, const int & iPhi) ;
00079 
00081 int etaFromXtal (const int & xtal) ;
00082 
00084 int phiFromXtal (const int & xtal) ;
00085 
00087 int ietaFromXtal (const int & xtal) ;
00088 
00090 int iphiFromXtal (const int & xtal) ;
00091 
00094 int extract (std::vector<int> * output , const std::string & dati) ;
00095 
00097 int writeCalibTxt (const CLHEP::HepMatrix & AmplitudeMatrix,
00098                    const CLHEP::HepMatrix & SigmaMatrix,
00099                    const CLHEP::HepMatrix & StatisticMatrix,
00100                    std::string fileName = "calibOutput.txt") ;
00101 
00103 int writeCMSSWCoeff (const CLHEP::HepMatrix & amplMatrix,
00104                      double calibThres,
00105                      float ERef,
00106                      const CLHEP::HepMatrix & sigmaMatrix,
00107                      const CLHEP::HepMatrix & statisticMatrix,
00108                      std::string fileName = "calibOutput.txt",
00109                      std::string genTag = "CAL_GENTAG",
00110                      std::string method = "CAL_METHOD",
00111                      std::string version = "CAL_VERSION",
00112                      std::string type = "CAL_TYPE") ;
00113 
00116 int writeCMSSWCoeff (const CLHEP::HepMatrix & amplMatrix,
00117                      double calibThres,
00118                      int etaRef, int phiRef,
00119                      const CLHEP::HepMatrix & sigmaMatrix,
00120                      const CLHEP::HepMatrix & statisticMatrix,
00121                      std::string fileName = "calibOutput.txt",
00122                      std::string genTag = "CAL_GENTAG",
00123                      std::string method = "CAL_METHOD",
00124                      std::string version = "CAL_VERSION",
00125                      std::string type = "CAL_TYPE") ;
00126 
00129 int translateCoeff (const CLHEP::HepMatrix & calibcoeff,
00130                     const CLHEP::HepMatrix & sigmaMatrix,
00131                     const CLHEP::HepMatrix & statisticMatrix,
00132                     std::string SMnumber = "1",
00133                     double calibThres = 0.01,
00134                     std::string fileName = "calibOutput.txt",
00135                     std::string genTag = "CAL_GENTAG",
00136                     std::string method = "CAL_METHOD",
00137                     std::string version = "CAL_VERSION",
00138                     std::string type = "CAL_TYPE") ;
00139 
00142 int readCMSSWcoeff (CLHEP::HepMatrix & calibcoeff,
00143                     const std::string & inputFileName,
00144                     double defaultVal = 1.) ;
00145 
00148 int readCMSSWcoeffForComparison (CLHEP::HepMatrix & calibcoeff,
00149                                const std::string & inputFileName) ;
00150 
00152 TH1D * smartProfile (TH2F * strip, double width) ; 
00153 
00156 TH1D * smartGausProfile (TH2F * strip, double width) ; 
00157 
00160 TH1D * smartError (TH1D * strip) ;
00161 
00166 double effectiveSigma (TH1F & histogram, int vSteps = 100) ;
00167 
00172 std::pair<int,int> findSupport (TH1F & histogram, double thres = 0.) ;
00173 
00178 void mtrTransfer (double output[SCMaxEta][SCMaxPhi], 
00179                   CLHEP::HepMatrix * input, 
00180                   double Default) ;
00181 
00185 template <class Type>
00186 void
00187 mtrReset (Type superModules[SCMaxEta][SCMaxPhi], const Type val)
00188   {
00189     for (int e = 0 ; e < SCMaxEta ; ++e)
00190       for (int p = 0 ; p < SCMaxPhi ; ++p)
00191         {         
00192           superModules[e][p] = val ;
00193         }
00194   }
00195 
00198 double etaCorrE1E9 (int eta) ;
00201 double etaCorrE1E49 (int eta) ;
00204 double etaCorrE1E25 (int eta) ;
00205 
00206 #endif
00207