ATLAS Offline Software
TMinuit_LHMM.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #ifdef FAKEBKGTOOLS_ATLAS_ENVIRONMENT
9 #endif
10 
11 void TMinuit_LHMM::mnrazz(Double_t ynew, Double_t *pnew, Double_t *y, Int_t &jh, Int_t &jl)
12 {
13 //*-*-*-*-*Called only by MNSIMP (and MNIMPR) to add a new point*-*-*-*-*-*-*
14 //*-* =====================================================
15 //*-* and remove an old one from the current simplex, and get the
16 //*-* estimated distance to minimum.
17 //
18 //*-* This is a verbatim copy of the base class function, except that
19 //*-* printf's about the function not appearing to depend on the
20 //*-* fit parameters now are invoked only when DEBUG-level output
21 //*-* is requested by the user.
22 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
23 
24  /* Local variables */
25  Double_t pbig, plit;
26  Int_t i, j, nparp1;
27 
28  /* Function Body */
29  for (i = 1; i <= fNpar; ++i) { fP[i + jh*fMaxpar - fMaxpar-1] = pnew[i-1]; }
30  y[jh-1] = ynew;
31  if (ynew < fAmin) {
32  for (i = 1; i <= fNpar; ++i) { fX[i-1] = pnew[i-1]; }
33  mninex(fX);
34  fAmin = ynew;
35  fCstatu = "PROGRESS ";
36  jl = jh;
37  }
38  jh = 1;
39  nparp1 = fNpar + 1;
40  for (j = 2; j <= nparp1; ++j) { if (y[j-1] > y[jh-1]) jh = j; }
41  fEDM = y[jh-1] - y[jl-1];
42  if (fEDM <= 0) goto L45;
43  for (i = 1; i <= fNpar; ++i) {
44  pbig = fP[i-1];
45  plit = pbig;
46  for (j = 2; j <= nparp1; ++j) {
47  if (fP[i + j*fMaxpar - fMaxpar-1] > pbig) pbig = fP[i + j*fMaxpar - fMaxpar-1];
48  if (fP[i + j*fMaxpar - fMaxpar-1] < plit) plit = fP[i + j*fMaxpar - fMaxpar-1];
49  }
50  fDirin[i-1] = pbig - plit;
51  }
52 L40:
53  return;
54 L45:
55  if (fISW[4] >= 0) {
56  Printf(" FUNCTION VALUE DOES NOT SEEM TO DEPEND ON ANY OF THE %d VARIABLE PARAMETERS.",fNpar);
57  Printf(" VERIFY THAT STEP SIZES ARE BIG ENOUGH AND CHECK FCN LOGIC.");
58  Printf(" *******************************************************************************");
59  Printf(" *******************************************************************************");
60  }
61  goto L40;
62 } /* mnrazz_ */
63 
65 {
66 //*-*-*-*-*-*-*-*-*-*-*Performs a MINOS error analysis*-*-*-*-*-*-*-*-*-*-*-*
67 //*-* ===============================
68 //*-* Performs a MINOS error analysis on those parameters for
69 //*-* which it is requested on the MINOS command by calling
70 //*-* MNMNOT for each parameter requested.
71 //
72 //*-* This is a verbatim copy of the base class function, except that
73 //*-* printf's about a new minimum being found are now invoked only
74 //*-* when DEBUG-level output
75 //*-* is requested by the user.
76 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
77 
78  /* Local variables */
79  Double_t val2mi, val2pl;
80  Int_t nbad, ilax, ilax2, ngood, nfcnmi, iin, knt;
81 
82  if (fNpar <= 0) goto L700;
83  ngood = 0;
84  nbad = 0;
85  nfcnmi = fNfcn;
86 //*-*- . loop over parameters requested
87  for (knt = 1; knt <= fNpar; ++knt) {
88  if (Int_t(fWord7[1]) == 0) {
89  ilax = fNexofi[knt-1];
90  } else {
91  if (knt >= 7) break;
92  ilax = Int_t(fWord7[knt]);
93  if (ilax == 0) break;
94  if (ilax > 0 && ilax <= fNu) {
95  if (fNiofex[ilax-1] > 0) goto L565;
96  }
97  Printf(" PARAMETER NUMBER %3d NOT A VARIABLE. IGNORED.",ilax);
98  continue;
99  }
100 L565:
101 //*-*- calculate one pair of M E s
102  ilax2 = 0;
103  mnmnot(ilax, ilax2, val2pl, val2mi);
104  if (fLnewmn) goto L650;
105 //*-*- update NGOOD and NBAD
106  iin = fNiofex[ilax-1];
107  if (fErp[iin-1] > 0) ++ngood;
108  else ++nbad;
109  if (fErn[iin-1] < 0) ++ngood;
110  else ++nbad;
111  }
112 //*-*- end of loop . . . . . . .
113 //*-*- . . . . printout final values .
114  fCfrom = "MINOS ";
115  fNfcnfr = nfcnmi;
116  fCstatu = "UNCHANGED ";
117  if (ngood == 0 && nbad == 0) goto L700;
118  if (ngood > 0 && nbad == 0) fCstatu = "SUCCESSFUL";
119  if (ngood == 0 && nbad > 0) fCstatu = "FAILURE ";
120  if (ngood > 0 && nbad > 0) fCstatu = "PROBLEMS ";
121  if (fISW[4] >= 0) mnprin(4, fAmin);
122  if (fISW[4] >= 2) mnmatu(0);
123  return;
124 //*-*- . . . new minimum found . . . .
125 L650:
126  fCfrom = "MINOS ";
127  fNfcnfr = nfcnmi;
128  fCstatu = "NEW MINIMU";
129  if (fISW[4] >= 0) {
130  mnprin(4, fAmin);
131  Printf(" NEW MINIMUM FOUND. GO BACK TO MINIMIZATION STEP.");
132  Printf(" =================================================");
133  Printf(" V");
134  Printf(" V");
135  Printf(" V");
136  Printf(" VVVVVVV");
137  Printf(" VVVVV");
138  Printf(" VVV");
139  Printf(" V");
140  Printf(" ");
141  }
142  return;
143 L700:
144  Printf(" THERE ARE NO MINOS ERRORS TO CALCULATE.");
145 } /* mnmnos_ */
146 
148 {
149 //*-*-*-*-*-*-*-*Makes sure that the current point is a local minimum*-*-*-*-*
150 //*-* ====================================================
151 //*-* Makes sure that the current point is a local
152 //*-* minimum and that the error matrix exists,
153 //*-* or at least something good enough for MINOS and MNCONT
154 //*-*
155 //*-* Modified so that printout ("FUNCTION MUST BE MINIMIZED...")
156 //*-* only appears if verbose output is requested
157 //*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
158 
159  /* Local variables */
160  Double_t dxdi, wint;
161  Int_t ndex, iext, i, j;
162 
163  if (fISW[3] < 1) {
164  if (fISW[4] >= 0) {
165  Printf(" FUNCTION MUST BE MINIMIZED BEFORE CALLING %s",(const char*)fCfrom);
166  }
167  fApsi = fEpsi;
168  mnmigr();
169  }
170  if (fISW[1] < 3) {
171  mnhess();
172  if (fISW[1] < 1) {
173  mnwarn("W", fCfrom, "NO ERROR MATRIX. WILL IMPROVISE.");
174  for (i = 1; i <= fNpar; ++i) {
175  ndex = i*(i-1) / 2;
176  for (j = 1; j <= i-1; ++j) {
177  ++ndex;
178  fVhmat[ndex-1] = 0;
179  }
180  ++ndex;
181  if (fG2[i-1] <= 0) {
182  wint = fWerr[i-1];
183  iext = fNexofi[i-1];
184  if (fNvarl[iext-1] > 1) {
185  mndxdi(fX[i-1], i-1, dxdi);
186  if (TMath::Abs(dxdi) < .001) wint = .01;
187  else wint /= TMath::Abs(dxdi);
188  }
189  fG2[i-1] = fUp / (wint*wint);
190  }
191  fVhmat[ndex-1] = 2 / fG2[i-1];
192  }
193  fISW[1] = 1;
194  fDcovar = 1;
195  } else mnwerr();
196  }
197 } /* mncuve_ */
TMinuit_LHMM.h
ClassImp
ClassImp(xAOD::TFileChecker) namespace xAOD
Definition: TFileChecker.cxx:28
TMinuit_LHMM::mnrazz
void mnrazz(Double_t ynew, Double_t *pnew, Double_t *y, Int_t &jh, Int_t &jl) override
Definition: TMinuit_LHMM.cxx:11
lumiFormat.i
int i
Definition: lumiFormat.py:85
TMinuit_LHMM::mncuve
void mncuve() override
Definition: TMinuit_LHMM.cxx:147
TMinuit_LHMM::mnmnos
void mnmnos() override
Definition: TMinuit_LHMM.cxx:64
y
#define y
TMinuit_LHMM
Definition: TMinuit_LHMM.h:12