CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions | Variables
HFLightCal.cc File Reference
#include <memory>
#include <string>
#include <iostream>
#include "TH1F.h"
#include "TH2F.h"
#include "TFile.h"
#include "math.h"
#include "TMath.h"
#include "TF1.h"
#include "CalibCalorimetry/HcalStandardModules/interface/HFLightCal.h"
#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "CalibFormats/HcalObjects/interface/HcalDbService.h"
#include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
#include "CondFormats/HcalObjects/interface/HcalQIEShape.h"
#include "CondFormats/HcalObjects/interface/HcalQIECoder.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"

Go to the source code of this file.

Functions

Double_t FitFun (Double_t *x, Double_t *par)
 
void HistSpecs (TH1F *hist, Double_t &mean, Double_t &rms, Double_t range=4)
 

Variables

Int_t eventN =0
 
Int_t itsmax [26][36][2]
 
Int_t itspinmax [8][3]
 
Int_t Nev
 
Int_t runN =0
 

Function Documentation

Double_t FitFun ( Double_t *  x,
Double_t *  par 
)

Definition at line 188 of file HFLightCal.cc.

References SiStripMonitorClusterAlca_cfi::k0, Nev, funct::pow(), diffTwoXMLs::r1, diffTwoXMLs::r2, and mathSSE::sqrt().

Referenced by HFLightCal::endJob().

188  {
189 // Spectra fit function: Pedestal Gaussian + asymmetric 1PE + 2PE +3PE peaks
190 
191  Double_t sum,xx,A0,C0,r0,sigma0,mean1,sigma1,A1,C1,r1,mean2,sigma2,A2,C2,r2,mean3,sigma3,A3,C3,r3;
192 
193  const Double_t k0=2.0, k1=1.6, k2=2.0;
194 
195  xx=x[0];
196  sigma0 = par[2];
197  A0 = 2*Nev/(2+2*par[0]+par[0]*par[0]+pow(par[0],3)/3+pow(par[0],4)/12+
198  pow(par[0],5)/60+pow(par[0],6)/360);
199  r0 = ((xx-par[1])/sigma0);
200  C0 = 1/(sigma0* TMath::Exp(-k0*k0/2)/k0 +
201  sigma0*sqrt(2*3.14159)*0.5*(1+TMath::Erf(k0/1.41421)));
202  //sum = 1/(sqrt(2*3.14159)*par[2])*A0*TMath::Exp(-0.5*r0*r0);
203  if(r0 < k0) sum = C0*A0*TMath::Exp(-0.5*r0*r0);
204  else sum = C0*A0*TMath::Exp(0.5*k0*k0-k0*r0);
205 
206  mean1 = par[1]+par[3];
207  sigma1 = par[4];
208  //sigma1 = 1.547+0.125*par[3]+0.004042*par[3]*par[3];
209  //sigma1 = (sigma1+(9.1347e-3+3.845e-2*par[3])*par[4]*2.0)*par[2];
210  A1 = A0*par[0];
211  C1 = 1/(sigma1* TMath::Exp(-k1*k1/2)/k1 +
212  sigma1*sqrt(2*3.14159)*0.5*(1+TMath::Erf(k1/1.41421)));
213  r1 = ((xx-mean1)/sigma1);
214  if(r1 < k1) sum += C1*A1*TMath::Exp(-0.5*r1*r1);
215  else sum += C1*A1*TMath::Exp(0.5*k1*k1-k1*r1);
216 
217  mean2 = 2*par[3]+par[1];
218  sigma2 = sqrt(2*sigma1*sigma1 - pow(par[2],2));
219  //A2 = A0*par[5]*par[0]*par[0]/2;
220  A2 = A0*par[0]*par[0]/2;
221  C2 = 1/(sigma2* TMath::Exp(-k2*k2/2)/k2 +
222  sigma2*sqrt(2*3.14159)*0.5*(1+TMath::Erf(k2/1.41421)));
223  r2 = ((xx-mean2)/sigma2);
224  if(r2 < k2) sum += C2*A2*TMath::Exp(-0.5*r2*r2);
225  else sum += C2*A2*TMath::Exp(0.5*k2*k2-k2*r2);
226 
227  mean3 = 3*par[3]+par[1];
228  sigma3 = sqrt(3*sigma1*sigma1 - 2*pow(par[2],2));
229  A3 = A0*par[0]*par[0]*par[0]/6;
230  C3 = 1/(sigma3*sqrt(2*3.14159));
231  r3 = ((xx-mean3)/sigma3);
232  sum += C3*A3*TMath::Exp(-0.5*r3*r3);
233 
234  return sum;
235 }
T sqrt(T t)
Definition: SSEVec.h:48
Int_t Nev
Definition: HFLightCal.cc:35
Definition: DDAxes.h:10
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void HistSpecs ( TH1F *  hist,
Double_t &  mean,
Double_t &  rms,
Double_t  range = 4 
)

Definition at line 172 of file HFLightCal.cc.

References SiStripMonitorClusterAlca_cfi::xmax, and SiStripMonitorClusterAlca_cfi::xmin.

Referenced by HFLightCal::endJob().

172  {
173  Double_t xmin,xmax;
174  mean=hist->GetMean();
175  rms=hist->GetRMS();
176  xmin=hist->GetXaxis()->GetXmin();
177  xmax=hist->GetXaxis()->GetXmax();
178  hist->SetAxisRange(mean-range*rms-100,mean+range*rms+100);
179  mean=hist->GetMean();
180  rms=hist->GetRMS();
181  hist->SetAxisRange(mean-range*rms-100,mean+range*rms+100);
182  mean=hist->GetMean();
183  rms=hist->GetRMS();
184  hist->SetAxisRange(xmin,xmax);
185  return;
186 }

Variable Documentation

Int_t eventN =0

Definition at line 35 of file HFLightCal.cc.

Referenced by HFLightCal::analyze(), and HFLightCal::endJob().

Int_t itsmax[26][36][2]

Definition at line 36 of file HFLightCal.cc.

Referenced by HFLightCal::analyze(), and HFLightCal::beginJob().

Int_t itspinmax[8][3]

Definition at line 37 of file HFLightCal.cc.

Referenced by HFLightCal::beginJob().

Int_t Nev

Definition at line 35 of file HFLightCal.cc.

Referenced by HFLightCal::endJob(), and FitFun().

Int_t runN =0

Definition at line 35 of file HFLightCal.cc.

Referenced by HFLightCal::analyze(), and HFLightCal::endJob().