CMS 3D CMS Logo

HFLightCalRand.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/HFLightCalRand.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 Fit3Peak (Double_t *x, Double_t *par)
void HistSpec (TH1F *hist, Double_t &mean, Double_t &rms, Double_t range=4)

Variables

Int_t EventN = 0
Int_t NEvents
Int_t runNumb = 0
bool verbose = false


Function Documentation

Double_t Fit3Peak ( Double_t *  x,
Double_t *  par 
)

Definition at line 141 of file HFLightCalRand.cc.

References reco::ParticleMasses::k0, NEvents, r1, r2, funct::sqrt(), and sum().

Referenced by HFLightCalRand::endJob().

00141                                               { 
00142 // Spectra fit function: Pedestal Gaussian + asymmetric 1PE and 2PE peaks
00143 
00144   Double_t sum,xx,A0,C0,r0,sigma0,mean1,sigma1,A1,C1,r1,mean2,sigma2,A2,C2,r2;
00145   const Double_t k0=2.0,k1=1.0, k2=1.2;
00146 
00147   xx=x[0];
00148   sigma0 = par[2];
00149   A0 = 2*NEvents/(2+2*par[0]+par[0]*par[0]);
00150   r0 = ((xx-par[1])/sigma0);
00151   C0 = 1/(sigma0* TMath::Exp(-k0*k0/2)/k0 +
00152           sigma0*sqrt(2*3.14159)*0.5*(1+TMath::Erf(k0/1.41421)));
00153   //sum = 1/(sqrt(2*3.14159)*par[2])*A0*TMath::Exp(-0.5*r0*r0);
00154   if(r0 < k0) sum = C0*A0*TMath::Exp(-0.5*r0*r0);
00155   else sum = C0*A0*TMath::Exp(0.5*k0*k0-k0*r0);
00156 
00157   mean1 = par[1]+par[3];
00158   //sigma1 = par[4];
00159   sigma1 = 1.547+0.125*par[3]+0.004042*par[3]*par[3];
00160   sigma1 = (sigma1+(9.1347e-3+3.845e-2*par[3])*par[4]*1.0)*par[2];
00161   A1 = A0*par[0];
00162   C1 = 1/(sigma1* TMath::Exp(-k1*k1/2)/k1 +
00163           sigma1*sqrt(2*3.14159)*0.5*(1+TMath::Erf(k1/1.41421)));
00164   r1 = ((xx-mean1)/sigma1);
00165   if(r1 < k1) sum += C1*A1*TMath::Exp(-0.5*r1*r1);
00166   else sum += C1*A1*TMath::Exp(0.5*k1*k1-k1*r1);
00167 
00168   mean2 = 2*par[3]+par[1];
00169   sigma2 = sqrt(2*sigma1*sigma1 - par[2]*par[2]);
00170   A2 = A0*par[0]*par[0]/2;
00171   C2 = 1/(sigma2* TMath::Exp(-k2*k2/2)/k2 +
00172           sigma2*sqrt(2*3.14159)*0.5*(1+TMath::Erf(k2/1.41421)));
00173   r2 = ((xx-mean2)/sigma2);
00174   if(r2 < k2) sum += C2*A2*TMath::Exp(-0.5*r2*r2);
00175   else sum += C2*A2*TMath::Exp(0.5*k2*k2-k2*r2);
00176 
00177   return sum;
00178 }

void HistSpec ( TH1F *  hist,
Double_t &  mean,
Double_t &  rms,
Double_t  range = 4 
)

Definition at line 125 of file HFLightCalRand.cc.

References range.

Referenced by HFLightCalRand::endJob().

00125                                                                            {
00126   Double_t xmin,xmax;
00127   mean=hist->GetMean();
00128   rms=hist->GetRMS();
00129   xmin=hist->GetXaxis()->GetXmin();
00130   xmax=hist->GetXaxis()->GetXmax();
00131   hist->SetAxisRange(mean-range*rms-100,mean+range*rms+100);
00132   mean=hist->GetMean();
00133   rms=hist->GetRMS();
00134   hist->SetAxisRange(mean-range*rms-100,mean+range*rms+100);
00135   mean=hist->GetMean();
00136   rms=hist->GetRMS();
00137   hist->SetAxisRange(xmin,xmax);
00138   return;
00139 }


Variable Documentation

Int_t EventN = 0

Definition at line 35 of file HFLightCalRand.cc.

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

Int_t NEvents

Definition at line 35 of file HFLightCalRand.cc.

Referenced by HFLightCalRand::endJob(), and Fit3Peak().

Int_t runNumb = 0

Definition at line 35 of file HFLightCalRand.cc.

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

bool verbose = false [static]

Definition at line 39 of file HFLightCalRand.cc.


Generated on Tue Jun 9 17:51:04 2009 for CMSSW by  doxygen 1.5.4