File indexing completed on 2024-04-06 11:59:28
0001
0002
0003
0004
0005
0006
0007 #ifndef InvMatrixUtils_h
0008 #define InvMatrixUtils_h
0009
0010 #include <string>
0011 #include <map>
0012 #include "TObject.h"
0013 #include "TF1.h"
0014 #include "TH2.h"
0015 #include "TProfile.h"
0016 #include "TCanvas.h"
0017 #include "CLHEP/Geometry/Point3D.h"
0018 #include "CLHEP/Matrix/GenMatrix.h"
0019 #include "CLHEP/Matrix/Matrix.h"
0020 #include "CLHEP/Matrix/Vector.h"
0021 #include "TFile.h"
0022
0023
0024 #include "Calibration/Tools/interface/InvMatrixCommonDefs.h"
0025
0026
0027 void setStyle();
0028
0029
0030
0031 TCanvas* getGlobalCanvas(std::string name = "Inv MatrixCanvas");
0032
0033
0034
0035 TFile* getGlobalTFile(std::string name = "Inv MatrixTFile.root");
0036
0037
0038
0039
0040 int saveGlobalTFile(std::string name = "Inv MatrixFile.root");
0041
0042
0043
0044
0045 CLHEP::HepMatrix* getSavedMatrix(const std::string& name);
0046
0047
0048 HepGeom::Point3D<Float_t> TBposition(const Float_t amplit[7][7],
0049 const Float_t beamEne,
0050 const Float_t w0 = 4.0,
0051 const Float_t x0 = 8.9,
0052 const Float_t a0 = 6.2,
0053 const Float_t sideX = 24.06,
0054 const Float_t sideY = 22.02);
0055
0056
0057
0058 double get5x5(const Float_t energy[7][7]);
0059
0060
0061
0062 double get3x3(const Float_t energy[7][7]);
0063
0064
0065 int parseConfigFile(const TString& config);
0066
0067
0068 int xtalFromEtaPhi(const int& myEta, const int& myPhi);
0069
0070
0071
0072
0073
0074 int xtalFromiEtaiPhi(const int& iEta, const int& iPhi);
0075
0076
0077 int etaFromXtal(const int& xtal);
0078
0079
0080 int phiFromXtal(const int& xtal);
0081
0082
0083 int ietaFromXtal(const int& xtal);
0084
0085
0086 int iphiFromXtal(const int& xtal);
0087
0088
0089
0090 int extract(std::vector<int>* output, const std::string& dati);
0091
0092
0093 int writeCalibTxt(const CLHEP::HepMatrix& AmplitudeMatrix,
0094 const CLHEP::HepMatrix& SigmaMatrix,
0095 const CLHEP::HepMatrix& StatisticMatrix,
0096 std::string fileName = "calibOutput.txt");
0097
0098
0099 int writeCMSSWCoeff(const CLHEP::HepMatrix& amplMatrix,
0100 double calibThres,
0101 float ERef,
0102 const CLHEP::HepMatrix& sigmaMatrix,
0103 const CLHEP::HepMatrix& statisticMatrix,
0104 std::string fileName = "calibOutput.txt",
0105 std::string genTag = "CAL_GENTAG",
0106 std::string method = "CAL_METHOD",
0107 std::string version = "CAL_VERSION",
0108 std::string type = "CAL_TYPE");
0109
0110
0111
0112 int writeCMSSWCoeff(const CLHEP::HepMatrix& amplMatrix,
0113 double calibThres,
0114 int etaRef,
0115 int phiRef,
0116 const CLHEP::HepMatrix& sigmaMatrix,
0117 const CLHEP::HepMatrix& statisticMatrix,
0118 std::string fileName = "calibOutput.txt",
0119 std::string genTag = "CAL_GENTAG",
0120 std::string method = "CAL_METHOD",
0121 std::string version = "CAL_VERSION",
0122 std::string type = "CAL_TYPE");
0123
0124
0125
0126 int translateCoeff(const CLHEP::HepMatrix& calibcoeff,
0127 const CLHEP::HepMatrix& sigmaMatrix,
0128 const CLHEP::HepMatrix& statisticMatrix,
0129 std::string SMnumber = "1",
0130 double calibThres = 0.01,
0131 std::string fileName = "calibOutput.txt",
0132 std::string genTag = "CAL_GENTAG",
0133 std::string method = "CAL_METHOD",
0134 std::string version = "CAL_VERSION",
0135 std::string type = "CAL_TYPE");
0136
0137
0138
0139 int readCMSSWcoeff(CLHEP::HepMatrix& calibcoeff, const std::string& inputFileName, double defaultVal = 1.);
0140
0141
0142
0143 int readCMSSWcoeffForComparison(CLHEP::HepMatrix& calibcoeff, const std::string& inputFileName);
0144
0145
0146 TH1D* smartProfile(TH2F* strip, double width);
0147
0148
0149
0150 TH1D* smartGausProfile(TH2F* strip, double width);
0151
0152
0153
0154 TH1D* smartError(TH1D* strip);
0155
0156
0157
0158
0159
0160 double effectiveSigma(TH1F& histogram, int vSteps = 100);
0161
0162
0163
0164
0165
0166 std::pair<int, int> findSupport(TH1F& histogram, double thres = 0.);
0167
0168
0169
0170
0171
0172 void mtrTransfer(double output[SCMaxEta][SCMaxPhi], CLHEP::HepMatrix* input, double Default);
0173
0174
0175
0176
0177 template <class Type>
0178 void mtrReset(Type superModules[SCMaxEta][SCMaxPhi], const Type val) {
0179 for (int e = 0; e < SCMaxEta; ++e)
0180 for (int p = 0; p < SCMaxPhi; ++p) {
0181 superModules[e][p] = val;
0182 }
0183 }
0184
0185
0186
0187 double etaCorrE1E9(int eta);
0188
0189
0190 double etaCorrE1E49(int eta);
0191
0192
0193 double etaCorrE1E25(int eta);
0194
0195 #endif