CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InvMatrixUtils.h
Go to the documentation of this file.
1 
11 #ifndef InvMatrixUtils_h
12 #define InvMatrixUtils_h
13 
14 #include <string>
15 #include <map>
16 #include "TObject.h"
17 #include "TF1.h"
18 #include "TH2.h"
19 #include "TProfile.h"
20 #include "TCanvas.h"
21 #include "CLHEP/Geometry/Point3D.h"
22 #include "CLHEP/Matrix/GenMatrix.h"
23 #include "CLHEP/Matrix/Matrix.h"
24 #include "CLHEP/Matrix/Vector.h"
25 #include "TFile.h"
26 
27 //#include "ConfigParser.h"
29 
31 void setStyle () ;
32 
35 TCanvas * getGlobalCanvas (std::string name = "Inv MatrixCanvas") ;
36 
39 TFile * getGlobalTFile (std::string name = "Inv MatrixTFile.root") ;
40 //TFile * getGlobalTFile (const char* name) ;
41 
44 int saveGlobalTFile (std::string name = "Inv MatrixFile.root") ;
45 
49 CLHEP::HepMatrix * getSavedMatrix (const std::string & name) ;
50 
52 HepGeom::Point3D<Float_t> TBposition (const Float_t amplit[7][7],
53  const Float_t beamEne,
54  const Float_t w0 = 4.0,
55  const Float_t x0 = 8.9, //mm
56  const Float_t a0 = 6.2,
57  const Float_t sideX = 24.06, //mm
58  const Float_t sideY = 22.02) ; //mm
59 
62 double get5x5 (const Float_t energy[7][7]) ;
63 
66 double get3x3 (const Float_t energy[7][7]) ;
67 
69 int parseConfigFile (const TString& config) ;
70 
72 int xtalFromEtaPhi (const int & myEta, const int & myPhi) ;
73 
78 int xtalFromiEtaiPhi (const int & iEta, const int & iPhi) ;
79 
81 int etaFromXtal (const int & xtal) ;
82 
84 int phiFromXtal (const int & xtal) ;
85 
87 int ietaFromXtal (const int & xtal) ;
88 
90 int iphiFromXtal (const int & xtal) ;
91 
94 int extract (std::vector<int> * output , const std::string & dati) ;
95 
97 int writeCalibTxt (const CLHEP::HepMatrix & AmplitudeMatrix,
98  const CLHEP::HepMatrix & SigmaMatrix,
99  const CLHEP::HepMatrix & StatisticMatrix,
100  std::string fileName = "calibOutput.txt") ;
101 
103 int writeCMSSWCoeff (const CLHEP::HepMatrix & amplMatrix,
104  double calibThres,
105  float ERef,
106  const CLHEP::HepMatrix & sigmaMatrix,
107  const CLHEP::HepMatrix & statisticMatrix,
108  std::string fileName = "calibOutput.txt",
109  std::string genTag = "CAL_GENTAG",
110  std::string method = "CAL_METHOD",
111  std::string version = "CAL_VERSION",
112  std::string type = "CAL_TYPE") ;
113 
116 int writeCMSSWCoeff (const CLHEP::HepMatrix & amplMatrix,
117  double calibThres,
118  int etaRef, int phiRef,
119  const CLHEP::HepMatrix & sigmaMatrix,
120  const CLHEP::HepMatrix & statisticMatrix,
121  std::string fileName = "calibOutput.txt",
122  std::string genTag = "CAL_GENTAG",
123  std::string method = "CAL_METHOD",
124  std::string version = "CAL_VERSION",
125  std::string type = "CAL_TYPE") ;
126 
129 int translateCoeff (const CLHEP::HepMatrix & calibcoeff,
130  const CLHEP::HepMatrix & sigmaMatrix,
131  const CLHEP::HepMatrix & statisticMatrix,
132  std::string SMnumber = "1",
133  double calibThres = 0.01,
134  std::string fileName = "calibOutput.txt",
135  std::string genTag = "CAL_GENTAG",
136  std::string method = "CAL_METHOD",
137  std::string version = "CAL_VERSION",
138  std::string type = "CAL_TYPE") ;
139 
142 int readCMSSWcoeff (CLHEP::HepMatrix & calibcoeff,
143  const std::string & inputFileName,
144  double defaultVal = 1.) ;
145 
148 int readCMSSWcoeffForComparison (CLHEP::HepMatrix & calibcoeff,
149  const std::string & inputFileName) ;
150 
152 TH1D * smartProfile (TH2F * strip, double width) ;
153 
156 TH1D * smartGausProfile (TH2F * strip, double width) ;
157 
160 TH1D * smartError (TH1D * strip) ;
161 
166 double effectiveSigma (TH1F & histogram, int vSteps = 100) ;
167 
172 std::pair<int,int> findSupport (TH1F & histogram, double thres = 0.) ;
173 
178 void mtrTransfer (double output[SCMaxEta][SCMaxPhi],
179  CLHEP::HepMatrix * input,
180  double Default) ;
181 
185 template <class Type>
186 void
187 mtrReset (Type superModules[SCMaxEta][SCMaxPhi], const Type val)
188  {
189  for (int e = 0 ; e < SCMaxEta ; ++e)
190  for (int p = 0 ; p < SCMaxPhi ; ++p)
191  {
192  superModules[e][p] = val ;
193  }
194  }
195 
198 double etaCorrE1E9 (int eta) ;
201 double etaCorrE1E49 (int eta) ;
204 double etaCorrE1E25 (int eta) ;
205 
206 #endif
207 
type
Definition: HCALResponse.h:21
TH1D * smartError(TH1D *strip)
#define SCMaxEta
#define Default
Definition: vmac.h:109
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 mtrTransfer(double output[SCMaxEta][SCMaxPhi], CLHEP::HepMatrix *input, double Default)
int readCMSSWcoeffForComparison(CLHEP::HepMatrix &calibcoeff, const std::string &inputFileName)
double effectiveSigma(TH1F &histogram, int vSteps=100)
T eta() const
void setStyle()
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)
void mtrReset(Type superModules[SCMaxEta][SCMaxPhi], const Type val)