All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
CrtCal.cc File Reference
#include "icaruscode/CRT/CRTDecoder/CrtCal.h"

Go to the source code of this file.

Macros

#define CRT_CAL_CC
 

Functions

Double_t langaufun (Double_t *x, Double_t *par)
 

Macro Definition Documentation

#define CRT_CAL_CC

Definition at line 2 of file CrtCal.cc.

Function Documentation

Double_t langaufun ( Double_t *  x,
Double_t *  par 
)

Definition at line 835 of file CrtCal.cc.

835  {
836 
837  //Fit parameters:
838  //par[0]=Width (scale) parameter of Landau density
839  //par[1]=Most Probable (MP, location) parameter of Landau density
840  //par[2]=Total area (integral -inf to inf, normalization constant)
841  //par[3]=Width (sigma) of convoluted Gaussian function
842  //
843  //In the Landau distribution (represented by the CERNLIB approximation),
844  //the maximum is located at x=-0.22278298 with the location parameter=0.
845  //This shift is corrected within this function, so that the actual
846  //maximum is identical to the MP parameter.
847 
848  // Numeric constants
849  Double_t invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
850  Double_t mpshift = -0.22278298; // Landau maximum location
851 
852  // Control constants
853  Double_t np = 100.0; // number of convolution steps
854  Double_t sc = 5.0; // convolution extends to +-sc Gaussian sigmas
855 
856  // Variables
857  Double_t xx;
858  Double_t mpc;
859  Double_t fland;
860  Double_t sum = 0.0;
861  Double_t xlow,xupp;
862  Double_t step;
863  Double_t i;
864 
865 
866  // MP shift correction
867  mpc = par[1] - mpshift * par[0];
868 
869  // Range of convolution integral
870  xlow = x[0] - sc * par[3];
871  xupp = x[0] + sc * par[3];
872 
873  step = (xupp-xlow) / np;
874 
875  // Convolution integral of Landau and Gaussian by sum
876  for(i=1.0; i<=np/2; i++) {
877  xx = xlow + (i-.5) * step;
878  fland = TMath::Landau(xx,mpc,par[0]) / par[0];
879  sum += fland * TMath::Gaus(x[0],xx,par[3]);
880 
881  xx = xupp - (i-.5) * step;
882  fland = TMath::Landau(xx,mpc,par[0]) / par[0];
883  sum += fland * TMath::Gaus(x[0],xx,par[3]);
884  }
885 
886  return (par[2] * step * sum * invsq2pi / par[3]);
887  }
process_name opflash particleana ie x