#include <memory>
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDAnalyzer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/HcalCalibObjects/interface/HOCalibVariables.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "PhysicsTools/UtilAlgos/interface/TFileService.h"
#include "TMath.h"
#include "TFile.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TTree.h"
#include "TProfile.h"
#include "TPostScript.h"
#include "TCanvas.h"
#include "TF1.h"
#include "TStyle.h"
#include "TMinuit.h"
#include <string>
#include <iostream>
#include <fstream>
#include <iomanip>
Go to the source code of this file.
Classes | |
class | HOCalibAnalyzer |
Description: <one line="" class="" summary>="">. More... | |
Functions | |
DEFINE_FWK_MODULE (HOCalibAnalyzer) | |
void | fcnbg (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t flag) |
void | fcnsg (Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t flag) |
Double_t | gausX (Double_t *x, Double_t *par) |
Double_t | langaufun (Double_t *x, Double_t *par) |
void | set_mean (double &x, bool mdigi) |
void | set_sigma (double &x, bool mdigi) |
Double_t | totalfunc (Double_t *x, Double_t *par) |
Variables | |
vector< float > | cro_ssg [netamx][nphimx+1] |
static const int | etamap [4][21] |
int | ietafit |
int | iphifit |
static const int | mapx0m [9][2] = {{17,19}, {14,15}, {13,16}, {9,11}, {0,0}, {8,12}, {5,6}, {4,7}, {1,3}} |
static const int | mapx0p [9][2] = {{3,1}, {7,4}, {6,5}, {12,8}, {0,0}, {11,9}, {16,13}, {15,14}, {19,17}} |
static const int | mapx1 [6][3] = {{1,4,8}, {12,7,3}, {5,9,13}, {11,6,2}, {16,15,14}, {19,18,17}} |
static const int | mapx2 [6][3] = {{1,4,8}, {12,7,3}, {5,9,13}, {11,6,2}, {16,15,14}, {-1,-1,-1}} |
const int | nbgpr = 3 |
static const int | netamx = 30 |
static const int | nphimx = 72 |
static const int | npixlebt [21] = {0, 0, 0, 0, 0, 1, 2, 3, 0, 4, 0, 6, 7, 8, 9, 0,11,13,14,15,0} |
static const int | npixleft [21] = {0, 0, 1, 2, 0, 4, 5, 6, 0, 8, 0, 0,11, 0,13,14,15, 0,17,18,0} |
static const int | npixleup [21] = {0, 4, 5, 6, 8, 9, 0,11, 0,13, 0,15,16, 0,17,18,19, 0, 0, 0,0} |
static const int | npixribt [21] = {0, 0, 0, 0, 1, 2, 3, 0, 4, 5, 0, 7, 0, 9, 0,11,12,14,15,16,0} |
static const int | npixrigh [21] = {0, 2, 3, 0, 5, 6, 7, 0, 9, 0, 0,12, 0,14,15,16, 0,18,19, 0,0} |
static const int | npixriup [21] = {0, 5, 6, 7, 9, 0,11,12,13,14, 0,16, 0,17,18,19, 0, 0, 0, 0,0} |
const int | nsgpr = 7 |
static const int | phimap [4][21] |
vector< float > | sig_reg [netamx][nphimx+1] |
DEFINE_FWK_MODULE | ( | HOCalibAnalyzer | ) |
void fcnbg | ( | Int_t & | npar, | |
Double_t * | gin, | |||
Double_t & | f, | |||
Double_t * | par, | |||
Int_t | flag | |||
) |
Definition at line 174 of file HOCalibAnalyzer.cc.
References cro_ssg, e, i, ietafit, iphifit, funct::log(), and max.
Referenced by HOCalibAnalyzer::endJob().
00174 { 00175 00176 double fval = -par[0]; 00177 for (unsigned i=0; i<cro_ssg[ietafit][iphifit].size(); i++) { 00178 double xval = (double)cro_ssg[ietafit][iphifit][i]; 00179 fval +=log(max(1.e-30,par[0]*TMath::Gaus(xval, par[1], par[2], 1))); 00180 // fval +=log(par[0]*TMath::Gaus(xval, par[1], par[2], 1)); 00181 } 00182 f = -fval; 00183 }
void fcnsg | ( | Int_t & | npar, | |
Double_t * | gin, | |||
Double_t & | f, | |||
Double_t * | par, | |||
Int_t | flag | |||
) |
Definition at line 185 of file HOCalibAnalyzer.cc.
References i, ietafit, iphifit, funct::log(), sig_reg, and totalfunc().
Referenced by HOCalibAnalyzer::endJob().
00185 { 00186 00187 double xval[2]; 00188 double fval = -(par[0]+par[5]); 00189 for (unsigned i=0; i<sig_reg[ietafit][iphifit].size(); i++) { 00190 xval[0] = (double)sig_reg[ietafit][iphifit][i]; 00191 fval +=log(totalfunc(xval, par)); 00192 } 00193 f = -fval; 00194 }
Double_t gausX | ( | Double_t * | x, | |
Double_t * | par | |||
) |
Definition at line 113 of file HOCalibAnalyzer.cc.
Referenced by HOCalibAnalyzer::endJob(), and totalfunc().
00113 { 00114 return par[0]*(TMath::Gaus(x[0], par[1], par[2], kTRUE)); 00115 }
Double_t langaufun | ( | Double_t * | x, | |
Double_t * | par | |||
) |
Definition at line 117 of file HOCalibAnalyzer.cc.
References i, np, cmsRelvalreportInput::step, and sum().
Referenced by HOCalibAnalyzer::endJob(), and totalfunc().
00117 { 00118 00119 //Fit parameters: 00120 //par[0]*par[1]=Width (scale) parameter of Landau density 00121 //par[1]=Most Probable (MP, location) parameter of Landau density 00122 //par[2]=Total area (integral -inf to inf, normalization constant) 00123 //par[3]=Width (sigma) of convoluted Gaussian function 00124 // 00125 //In the Landau distribution (represented by the CERNLIB approximation), 00126 //the maximum is located at x=-0.22278298 with the location parameter=0. 00127 //This shift is corrected within this function, so that the actual 00128 //maximum is identical to the MP parameter. 00129 // /* 00130 // Numeric constants 00131 Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2) 00132 Double_t mpshift = -0.22278298; // Landau maximum location 00133 00134 // Control constants 00135 Double_t np = 100.0; // number of convolution steps 00136 Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas 00137 00138 // Variables 00139 Double_t xx; 00140 Double_t mpc; 00141 Double_t fland; 00142 Double_t sum = 0.0; 00143 Double_t xlow,xupp; 00144 Double_t step; 00145 Double_t i; 00146 00147 00148 // MP shift correction 00149 mpc = par[1] - mpshift * par[0]*par[1]; 00150 00151 // Range of convolution integral 00152 xlow = x[0] - sc * par[3]; 00153 xupp = x[0] + sc * par[3]; 00154 00155 step = (xupp-xlow) / np; 00156 00157 // Convolution integral of Landau and Gaussian by sum 00158 for(i=1.0; i<=np/2; i++) { 00159 xx = xlow + (i-.5) * step; 00160 fland = TMath::Landau(xx,mpc,par[0]*par[1], kTRUE); // / par[0]; 00161 sum += fland * TMath::Gaus(x[0],xx,par[3]); 00162 xx = xupp - (i-.5) * step; 00163 fland = TMath::Landau(xx,mpc,par[0]*par[1], kTRUE); // / par[0]; 00164 sum += fland * TMath::Gaus(x[0],xx,par[3]); 00165 } 00166 00167 return (par[2] * step * sum * invsq2pi / par[3]); 00168 }
Double_t totalfunc | ( | Double_t * | x, | |
Double_t * | par | |||
) |
Definition at line 170 of file HOCalibAnalyzer.cc.
References gausX(), and langaufun().
Referenced by HOCalibAnalyzer::endJob(), and fcnsg().
Definition at line 105 of file HOCalibAnalyzer.cc.
Referenced by HOCalibAnalyzer::analyze(), and fcnbg().
Initial value:
{{-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, -1,-1,-1, -1}, {-1, 0,3,1, 0,2,3, 1,0,2, -1, 3,1,2, 4,4,4, 5,5,5, -1}, {-1, 0,-1,0, 1,2,2, 1,3,5, -1, 5,3,6, 7,7,6, 8,-1,8, -1}, {-1, 8,-1,8, 7,6,6, 7,5,3, -1, 3,5,2, 1,1,2, 0,-1,0, -1}}
Definition at line 79 of file HOCalibAnalyzer.cc.
Referenced by HOCalibAnalyzer::analyze().
Definition at line 102 of file HOCalibAnalyzer.cc.
Referenced by HOCalibAnalyzer::endJob(), fcnbg(), and fcnsg().
Definition at line 103 of file HOCalibAnalyzer.cc.
Referenced by HOCalibAnalyzer::endJob(), fcnbg(), and fcnsg().
Definition at line 97 of file HOCalibAnalyzer.cc.
Definition at line 98 of file HOCalibAnalyzer.cc.
Initial value:
{{-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0, -1}, {-1, 0,2,2, 1,0,1, 1,2,1, -1, 0,0,2, 2,1,0, 2,1,0, -1}, {-1, 1,-1,0, 1,1,0, 0,1,1, -1, 0,0,1, 1,0,0, 1,-1,0, -1}, {-1, 0,-1,1, 0,0,1, 1,0,0, -1, 1,1,0, 0,1,1, 0,-1,1, -1}}
Definition at line 84 of file HOCalibAnalyzer.cc.
Referenced by HOCalibAnalyzer::analyze().
Definition at line 104 of file HOCalibAnalyzer.cc.
Referenced by HOCalibAnalyzer::analyze(), HOCalibAnalyzer::endJob(), and fcnsg().