CMS 3D CMS Logo

InvMatrixUtils.h
Go to the documentation of this file.
1 
7 #ifndef InvMatrixUtils_h
8 #define InvMatrixUtils_h
9 
10 #include <string>
11 #include <map>
12 #include "TObject.h"
13 #include "TF1.h"
14 #include "TH2.h"
15 #include "TProfile.h"
16 #include "TCanvas.h"
17 #include "CLHEP/Geometry/Point3D.h"
18 #include "CLHEP/Matrix/GenMatrix.h"
19 #include "CLHEP/Matrix/Matrix.h"
20 #include "CLHEP/Matrix/Vector.h"
21 #include "TFile.h"
22 
23 //#include "ConfigParser.h"
25 
27 void setStyle();
28 
31 TCanvas* getGlobalCanvas(std::string name = "Inv MatrixCanvas");
32 
35 TFile* getGlobalTFile(std::string name = "Inv MatrixTFile.root");
36 //TFile * getGlobalTFile (const char* name) ;
37 
40 int saveGlobalTFile(std::string name = "Inv MatrixFile.root");
41 
45 CLHEP::HepMatrix* getSavedMatrix(const std::string& name);
46 
48 HepGeom::Point3D<Float_t> TBposition(const Float_t amplit[7][7],
49  const Float_t beamEne,
50  const Float_t w0 = 4.0,
51  const Float_t x0 = 8.9, //mm
52  const Float_t a0 = 6.2,
53  const Float_t sideX = 24.06, //mm
54  const Float_t sideY = 22.02); //mm
55 
58 double get5x5(const Float_t energy[7][7]);
59 
62 double get3x3(const Float_t energy[7][7]);
63 
65 int parseConfigFile(const TString& config);
66 
68 int xtalFromEtaPhi(const int& myEta, const int& myPhi);
69 
74 int xtalFromiEtaiPhi(const int& iEta, const int& iPhi);
75 
77 int etaFromXtal(const int& xtal);
78 
80 int phiFromXtal(const int& xtal);
81 
83 int ietaFromXtal(const int& xtal);
84 
86 int iphiFromXtal(const int& xtal);
87 
90 int extract(std::vector<int>* output, const std::string& dati);
91 
93 int writeCalibTxt(const CLHEP::HepMatrix& AmplitudeMatrix,
94  const CLHEP::HepMatrix& SigmaMatrix,
95  const CLHEP::HepMatrix& StatisticMatrix,
96  std::string fileName = "calibOutput.txt");
97 
99 int writeCMSSWCoeff(const CLHEP::HepMatrix& amplMatrix,
100  double calibThres,
101  float ERef,
102  const CLHEP::HepMatrix& sigmaMatrix,
103  const CLHEP::HepMatrix& statisticMatrix,
104  std::string fileName = "calibOutput.txt",
105  std::string genTag = "CAL_GENTAG",
106  std::string method = "CAL_METHOD",
107  std::string version = "CAL_VERSION",
108  std::string type = "CAL_TYPE");
109 
112 int writeCMSSWCoeff(const CLHEP::HepMatrix& amplMatrix,
113  double calibThres,
114  int etaRef,
115  int phiRef,
116  const CLHEP::HepMatrix& sigmaMatrix,
117  const CLHEP::HepMatrix& statisticMatrix,
118  std::string fileName = "calibOutput.txt",
119  std::string genTag = "CAL_GENTAG",
120  std::string method = "CAL_METHOD",
121  std::string version = "CAL_VERSION",
122  std::string type = "CAL_TYPE");
123 
126 int translateCoeff(const CLHEP::HepMatrix& calibcoeff,
127  const CLHEP::HepMatrix& sigmaMatrix,
128  const CLHEP::HepMatrix& statisticMatrix,
129  std::string SMnumber = "1",
130  double calibThres = 0.01,
131  std::string fileName = "calibOutput.txt",
132  std::string genTag = "CAL_GENTAG",
133  std::string method = "CAL_METHOD",
134  std::string version = "CAL_VERSION",
135  std::string type = "CAL_TYPE");
136 
139 int readCMSSWcoeff(CLHEP::HepMatrix& calibcoeff, const std::string& inputFileName, double defaultVal = 1.);
140 
143 int readCMSSWcoeffForComparison(CLHEP::HepMatrix& calibcoeff, const std::string& inputFileName);
144 
146 TH1D* smartProfile(TH2F* strip, double width);
147 
150 TH1D* smartGausProfile(TH2F* strip, double width);
151 
154 TH1D* smartError(TH1D* strip);
155 
160 double effectiveSigma(TH1F& histogram, int vSteps = 100);
161 
166 std::pair<int, int> findSupport(TH1F& histogram, double thres = 0.);
167 
172 void mtrTransfer(double output[SCMaxEta][SCMaxPhi], CLHEP::HepMatrix* input, double Default);
173 
177 template <class Type>
178 void mtrReset(Type superModules[SCMaxEta][SCMaxPhi], const Type val) {
179  for (int e = 0; e < SCMaxEta; ++e)
180  for (int p = 0; p < SCMaxPhi; ++p) {
181  superModules[e][p] = val;
182  }
183 }
184 
187 double etaCorrE1E9(int eta);
190 double etaCorrE1E49(int eta);
193 double etaCorrE1E25(int eta);
194 
195 #endif
TH1D * smartError(TH1D *strip)
#define SCMaxEta
int xtalFromiEtaiPhi(const int &iEta, const int &iPhi)
std::pair< int, int > findSupport(TH1F &histogram, double thres=0.)
int readCMSSWcoeff(CLHEP::HepMatrix &calibcoeff, const std::string &inputFileName, double defaultVal=1.)
#define SCMaxPhi
double etaCorrE1E49(int eta)
void mtrReset(Type superModules[85][20], const Type val)
void mtrTransfer(double output[85][20], CLHEP::HepMatrix *input, double Default)
int readCMSSWcoeffForComparison(CLHEP::HepMatrix &calibcoeff, const std::string &inputFileName)
double effectiveSigma(TH1F &histogram, int vSteps=100)
Definition: config.py:1
void setStyle()
Definition: offsetStack.cc:165
static std::string const input
Definition: EdmProvDump.cc:50
int iphiFromXtal(const int &xtal)
int writeCMSSWCoeff(const CLHEP::HepMatrix &amplMatrix, double calibThres, float ERef, const CLHEP::HepMatrix &sigmaMatrix, const CLHEP::HepMatrix &statisticMatrix, std::string fileName="calibOutput.txt", std::string genTag="CAL_GENTAG", std::string method="CAL_METHOD", std::string version="CAL_VERSION", std::string type="CAL_TYPE")
TH1D * smartProfile(TH2F *strip, double width)
int phiFromXtal(const int &xtal)
TH1D * smartGausProfile(TH2F *strip, double width)
int writeCalibTxt(const CLHEP::HepMatrix &AmplitudeMatrix, const CLHEP::HepMatrix &SigmaMatrix, const CLHEP::HepMatrix &StatisticMatrix, std::string fileName="calibOutput.txt")
TFile * getGlobalTFile(std::string name="Inv MatrixTFile.root")
TCanvas * getGlobalCanvas(std::string name="Inv MatrixCanvas")
int translateCoeff(const CLHEP::HepMatrix &calibcoeff, const CLHEP::HepMatrix &sigmaMatrix, const CLHEP::HepMatrix &statisticMatrix, std::string SMnumber="1", double calibThres=0.01, std::string fileName="calibOutput.txt", std::string genTag="CAL_GENTAG", std::string method="CAL_METHOD", std::string version="CAL_VERSION", std::string type="CAL_TYPE")
int saveGlobalTFile(std::string name="Inv MatrixFile.root")
int extract(std::vector< int > *output, const std::string &dati)
double get3x3(const Float_t energy[7][7])
int ietaFromXtal(const int &xtal)
static constexpr float a0
constexpr bool Default
Definition: SoACommon.h:73
double get5x5(const Float_t energy[7][7])
double etaCorrE1E9(int eta)
CLHEP::HepMatrix * getSavedMatrix(const std::string &name)
int xtalFromEtaPhi(const int &myEta, const int &myPhi)
int parseConfigFile(const TString &config)
double etaCorrE1E25(int eta)
HepGeom::Point3D< Float_t > TBposition(const Float_t amplit[7][7], const Float_t beamEne, const Float_t w0=4.0, const Float_t x0=8.9, const Float_t a0=6.2, const Float_t sideX=24.06, const Float_t sideY=22.02)
int etaFromXtal(const int &xtal)