225 {
227 std::vector<double> probDensityPerEventClassAllVariables;
228 probDensityPerEventClassAllVariables.resize(
m_hypotheses.size());
230 probDensityPerEventClassAllVariables[
i]=1.;
231 }
232 ATH_MSG_VERBOSE(
"#BTAG# -- lhVarVal size= " << lhVariableValues.size());
233
234 for (const auto& value : lhVariableValues) {
236 int ncompo =
value.composites.size();
238 << " has " << ncompo << " composites." );
239
240
241 for (
const auto& compo :
value.composites) {
243 std::vector<double> tmpVector;
245 int idim = compo.atoms.size();
247 << histName << " dim= " << idim );
250 if(tmpHisto) {
251 if(1==idim) {
252 double valuex = compo.atoms[0].value;
253 int binx = (tmpHisto->GetXaxis())->FindBin(valuex);
254 if(valuex >= tmpHisto->GetXaxis()->GetXmax()) binx = tmpHisto->GetXaxis()->GetNbins();
255 if(valuex <= tmpHisto->GetXaxis()->GetXmin()) binx = 1;
256 double tmp = tmpHisto->GetBinContent(binx);
257 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
"#BTAG# For hypothesis= " << hypo
258 << " (1D) actual value= " << valuex
259 <<
" --> bin= " << binx <<
" f = " <<
tmp;
261 TH1* dc_tmp = dynamic_cast<TH1*>(tmpHisto);
262 if (dc_tmp) {
264 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" interpolated f = " <<
tmp;
265 }
266 }
268 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" (normalized)" <<
endmsg;
269 } else {
270 double binw = tmpHisto->GetBinWidth(binx);
271 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" binw= " << binw;
272 if(0==binw) {
273 msg(MSG::ERROR) <<
"bin width is 0" <<
endmsg;
274 } else {
276 }
278 }
279 tmpVector.push_back(tmp);
281 }
282 if(2==idim) {
283 double valuex = compo.atoms[0].value;
284 double valuey = compo.atoms[1].value;
285 int binx = (tmpHisto->GetXaxis())->FindBin(valuex);
286 int biny = (tmpHisto->GetYaxis())->FindBin(valuey);
287 if(valuex >= tmpHisto->GetXaxis()->GetXmax()) binx = tmpHisto->GetXaxis()->GetNbins();
288 if(valuex <= tmpHisto->GetXaxis()->GetXmin()) binx = 1;
289 if(valuey >= tmpHisto->GetYaxis()->GetXmax()) biny = tmpHisto->GetYaxis()->GetNbins();
290 if(valuey <= tmpHisto->GetYaxis()->GetXmin()) biny = 1;
291 double tmp = tmpHisto->GetBinContent(binx, biny);
292 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
"#BTAG# For hypothesis= " << hypo
293 << " (2D) actual value= " << valuex << " " << valuey
294 <<
" --> bin= " << binx <<
" " << biny <<
" f = " <<
tmp;
296 TH2* dc_tmp = dynamic_cast<TH2*>(tmpHisto);
297 if (dc_tmp) {
299 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" interpolated f = " <<
tmp;
300 }
301 }
303 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" (normalized)" <<
endmsg;
304 } else {
305 double binw = tmpHisto->GetXaxis()->GetBinWidth(binx)
306 * tmpHisto->GetYaxis()->GetBinWidth(biny);
307 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" binw= " << binw;
308 if(0==binw) {
309 msg(MSG::ERROR) <<
"bin width is 0" <<
endmsg;
310 } else {
312 }
314 }
315 tmpVector.push_back(tmp);
317 }
318 if(3==idim) {
319 double valuex = compo.atoms[0].value;
320 double valuey = compo.atoms[1].value;
321 double valuez = compo.atoms[2].value;
322 int binx = (tmpHisto->GetXaxis())->FindBin(valuex);
323 int biny = (tmpHisto->GetYaxis())->FindBin(valuey);
324 int binz = (tmpHisto->GetZaxis())->FindBin(valuez);
325 if(valuex >= tmpHisto->GetXaxis()->GetXmax()) binx = tmpHisto->GetXaxis()->GetNbins();
326 if(valuex <= tmpHisto->GetXaxis()->GetXmin()) binx = 1;
327 if(valuey >= tmpHisto->GetYaxis()->GetXmax()) biny = tmpHisto->GetYaxis()->GetNbins();
328 if(valuey <= tmpHisto->GetYaxis()->GetXmin()) biny = 1;
329 if(valuez >= tmpHisto->GetZaxis()->GetXmax()) binz = tmpHisto->GetZaxis()->GetNbins();
330 if(valuez <= tmpHisto->GetZaxis()->GetXmin()) binz = 1;
331 double tmp = tmpHisto->GetBinContent(binx, biny, binz);
332 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
"#BTAG# For hypothesis= " << hypo
333 << " (3D) actual value= " << valuex
334 << " " << valuey << " " << valuez
335 << " --> bin= " << binx << " " << biny
336 <<
" " << binz <<
" f = " <<
tmp;
338 TH3* dc_tmp = dynamic_cast<TH3*>(tmpHisto);
339 if (dc_tmp) {
341 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" interpolated f = " <<
tmp;
342 }
343 }
345 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" (normalized)" <<
endmsg;
346 } else {
347 double binw = tmpHisto->GetXaxis()->GetBinWidth(binx)
348 * tmpHisto->GetYaxis()->GetBinWidth(biny)
349 * tmpHisto->GetZaxis()->GetBinWidth(binz);
350 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" binw= " << binw;
351 if(0==binw) {
352 msg(MSG::ERROR) <<
"bin width is 0" <<
endmsg;
353 } else {
355 }
357 }
358 tmpVector.push_back(tmp);
360 }
361 if(idim>3 || idim<1 )
msg(MSG::DEBUG) <<
"#BTAG# " << idim
362 << " is not a correct dimensionality for pdfs !"
364 }
365 }
366 unsigned int classCount(0);
367 for (const auto& f : tmpVector) {
368 if(sum != 0.) {
372 probDensityPerEventClassAllVariables[classCount] *=
p;
373 } else {
374 msg(MSG::DEBUG) <<
"#BTAG# Empty bins for all hypothesis... "
375 << "The discriminating variables are not taken into "
376 <<
"account in this jet." <<
endmsg;
377 msg(MSG::DEBUG) <<
"#BTAG# Please check your inputs" <<
endmsg;
378 }
379 if(
msgLvl(MSG::DEBUG) )
msg(MSG::DEBUG) <<
"#BTAG# probDensity= "
380 << probDensityPerEventClassAllVariables[classCount]
381 <<
" ic= " << classCount <<
endmsg;
382 classCount++;
383 }
384 if(
msgLvl(MSG::DEBUG) )
msg(MSG::DEBUG) <<
"#BTAG# Final probDensity= "
385 << probDensityPerEventClassAllVariables
387 }
388 }
389 if(
msgLvl(MSG::DEBUG) )
msg(MSG::DEBUG) <<
"#BTAG# Ending ..." <<
endmsg;
390 return probDensityPerEventClassAllVariables;
391 }
#define ATH_MSG_VERBOSE(x)
static double Interpol3d(double, double, double, TH3 *)
static double Interpol1d(double, TH1 *)
static double Interpol2d(double, double, TH2 *)
bool msgLvl(const MSG::Level lvl) const