270 if (htoFit->GetEntries()!=0) {
271 edm::LogInfo(
"fitUtility")<<
"Fitting "<< htoFit->GetTitle() <<std::endl;
274 double sv[4], pllo[4], plhi[4];
275 fr[0]=0.5*htoFit->GetMean();
276 fr[1]=3.0*htoFit->GetMean();
279 int32_t imax=htoFit->GetMaximumBin();
280 double xmax=htoFit->GetBinCenter(imax);
281 double ymax=htoFit->GetBinContent(imax);
285 i[0]=htoFit->GetXaxis()->FindBin(fr[0]);
286 i[1]=htoFit->GetXaxis()->FindBin(fr[1]);
288 iArea[0]=htoFit->GetXaxis()->FindBin(fr[0]);
289 iArea[1]=htoFit->GetXaxis()->FindBin(fr[1]);
290 double AreaFWHM=htoFit->Integral(iArea[0],iArea[1],
"width");
293 sv[2]=htoFit->Integral(i[0],i[1],
"width");
294 sv[3]=AreaFWHM/(4*ymax);
297 plhi[0]=25.0; plhi[1]=200.0; plhi[2]=1000000.0; plhi[3]=50.0;
298 pllo[0]=1.5 ; pllo[1]=10.0 ; pllo[2]=1.0 ; pllo[3]= 1.0;
301 sprintf(FunName,
"FitfcnLG_%s",htoFit->GetName());
304 langausFit->SetParameters(sv);
305 langausFit->SetParNames(
"Width",
"MP",
"Area",
"GSigma");
307 for (int32_t i=0; i<4; i++) {
308 langausFit->SetParLimits(i,pllo[i],plhi[i]);
312 htoFit->Fit(langausFit,
"R0");
314 langausFit->SetRange(fr[0],fr[1]);
316 std::memcpy((
void*)
epLanGausS, (
void*) langausFit->GetParErrors(), 4*
sizeof(double));
325 edm::LogInfo(
"fitUtility") <<
"langaupro: max " << sPeak << std::endl;
326 edm::LogInfo(
"fitUtility") <<
"langaupro: FWHM " << sFWHM << std::endl;
329 edm::LogError(
"fitUtility") <<
"problem in fitting " << htoFit->GetTitle() <<
" \n\tDefault values of the parameters will be used";
343 return htoFit->GetEntries();
int32_t langaupro(double *params, double &maxx, double &FWHM)
Double_t langaufun(Double_t *x, Double_t *par)