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, int phiRef,
115  const CLHEP::HepMatrix & sigmaMatrix,
116  const CLHEP::HepMatrix & statisticMatrix,
117  std::string fileName = "calibOutput.txt",
118  std::string genTag = "CAL_GENTAG",
119  std::string method = "CAL_METHOD",
120  std::string version = "CAL_VERSION",
121  std::string type = "CAL_TYPE") ;
122 
125 int translateCoeff (const CLHEP::HepMatrix & calibcoeff,
126  const CLHEP::HepMatrix & sigmaMatrix,
127  const CLHEP::HepMatrix & statisticMatrix,
128  std::string SMnumber = "1",
129  double calibThres = 0.01,
130  std::string fileName = "calibOutput.txt",
131  std::string genTag = "CAL_GENTAG",
132  std::string method = "CAL_METHOD",
133  std::string version = "CAL_VERSION",
134  std::string type = "CAL_TYPE") ;
135 
138 int readCMSSWcoeff (CLHEP::HepMatrix & calibcoeff,
139  const std::string & inputFileName,
140  double defaultVal = 1.) ;
141 
144 int readCMSSWcoeffForComparison (CLHEP::HepMatrix & calibcoeff,
145  const std::string & inputFileName) ;
146 
148 TH1D * smartProfile (TH2F * strip, double width) ;
149 
152 TH1D * smartGausProfile (TH2F * strip, double width) ;
153 
156 TH1D * smartError (TH1D * strip) ;
157 
162 double effectiveSigma (TH1F & histogram, int vSteps = 100) ;
163 
168 std::pair<int,int> findSupport (TH1F & histogram, double thres = 0.) ;
169 
174 void mtrTransfer (double output[SCMaxEta][SCMaxPhi],
175  CLHEP::HepMatrix * input,
176  double Default) ;
177 
181 template <class Type>
182 void
183 mtrReset (Type superModules[SCMaxEta][SCMaxPhi], const Type val)
184  {
185  for (int e = 0 ; e < SCMaxEta ; ++e)
186  for (int p = 0 ; p < SCMaxPhi ; ++p)
187  {
188  superModules[e][p] = val ;
189  }
190  }
191 
194 double etaCorrE1E9 (int eta) ;
197 double etaCorrE1E49 (int eta) ;
200 double etaCorrE1E25 (int eta) ;
201 
202 #endif
203 
type
Definition: HCALResponse.h:21
TH1D * smartError(TH1D *strip)
#define SCMaxEta
#define Default
Definition: vmac.h:110
int xtalFromiEtaiPhi(const int &iEta, const int &iPhi)
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()
static std::string const input
Definition: EdmProvDump.cc:45
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)
double get5x5(const Float_t energy[7][7])
std::pair< int, int > findSupport(TH1F &histogram, double thres=0.)
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)