1 #include "../Support/StEStructMinimizeNegative.h"
3 static void minimizeNegative(
int &npar,
double *gin,
double &f,
double *par,
int iflag) {
12 const char* spaceName[]={
"SYtDYt",
"YtYt"};
13 TH2D **localHists = minData.mSupport->buildChargeTypes(spaceName[minData.mCorrType],5,sf);
24 if (0 == minData.mCorrType) {
26 for(
int ix=1;ix<=localHists[minData.mChargeType]->GetNbinsX();ix++){
27 for(
int iy=1;iy<=localHists[minData.mChargeType]->GetNbinsY();iy++){
37 double testVal = (double) localHists[minData.mChargeType]->GetBinContent(ix,iy);
38 double testErr = fabs((
double) localHists[minData.mChargeType]->GetBinError(ix,iy));
42 double val = pow(testVal/testErr,2);
53 }
else if (1 ==minData.mCorrType) {
55 for(
int ix=1;ix<=localHists[minData.mChargeType]->GetNbinsX();ix++){
56 for(
int iy=ix+1;iy<=localHists[minData.mChargeType]->GetNbinsY();iy++){
63 double testVal = (double) localHists[minData.mChargeType]->GetBinContent(ix,iy);
64 double testErr = fabs((
double) localHists[minData.mChargeType]->GetBinError(ix,iy));
68 double val = pow(testVal/testErr,2);
80 for (
int iType=0;iType<4;iType++) {
81 delete localHists[iType];
86 posVal = (posVal/numPos);
89 negVal = (1.+minData.mLambda)*(negVal/numNeg);