64 const std::string delimSlash(
"/");
66 unsigned int nSlash = 0;
67 std::string::size_type slashPos;
68 for(
unsigned int i = 0;
69 (slashPos = histoName.find(delimSlash, i)) != std::string::npos;
70 i = slashPos + 1) nSlash++;
72 slashPos = histoName.find_first_of(delimSlash);
73 std::string newName = histoName.substr(slashPos+1);
74 slashPos = newName.find_first_of(delimSlash);
75 std::string grades = newName.substr(0,slashPos);
76 std::string hhname = newName.substr(slashPos+1);
77 if(nSlash<2) grades =
"";
83 const std::string delimUds(
"_");
84 std::string::size_type sPos, sEnd, sLen;
85 sPos = grades.find_first_not_of(delimUds);
86 while ( sPos != std::string::npos ) {
87 sEnd = grades.find_first_of(delimUds, sPos);
88 if(sEnd==std::string::npos) sEnd = grades.length();
90 std::string word = grades.substr(sPos,sLen);
93 sPos = grades.find_first_not_of(delimUds, sEnd);
160 double norm =
h->Integral();
165 if(hname.find(v)!=std::string::npos) {
177 if(2==
h->GetDimension()) {
181 TH2 * dc_tmp =
dynamic_cast<TH2*
>(
h);
187 if(3==
h->GetDimension()) {
191 TH3 * dc_tmp =
dynamic_cast<TH3*
>(
h);
193 int Nx=dc_tmp->GetNbinsX();
194 int Ny=dc_tmp->GetNbinsY();
195 int Nz=dc_tmp->GetNbinsZ();
199 double total=dc_tmp->Integral(1,Nx,1,Ny,1,Nz,
"");
200 for(
int iz=1; iz<=Nz; iz++){
201 double content=dc_tmp->Integral(1,Nx,1,Ny,iz,iz,
"");
if(content==0.)content=Nz;
202 double dnorm=total/content/Nz;
203 for(
int ix=1; ix<=Nx; ix++){
204 for(
int iy=1; iy<=Ny; iy++){
205 double cbin=dc_tmp->GetBinContent(ix,iy,iz)*dnorm; cbin= cbin>0. ? cbin : 0.1;
206 dc_tmp->SetBinContent(ix,iy,iz, cbin);
216 norm =
h->Integral();
227 std::vector<double> probDensityPerEventClassAllVariables;
228 probDensityPerEventClassAllVariables.resize(
m_hypotheses.size());
229 for (
unsigned int i = 0 ; i <
m_hypotheses.size(); ++i) {
230 probDensityPerEventClassAllVariables[i]=1.;
232 ATH_MSG_VERBOSE(
"#BTAG# -- lhVarVal size= " << lhVariableValues.size());
234 for (
const auto& value : lhVariableValues) {
236 int ncompo = value.composites.size();
238 <<
" has " << ncompo <<
" composites." );
241 for (
const auto& compo : value.composites) {
243 std::vector<double> tmpVector;
244 std::string histName = compo.name;
245 int idim = compo.atoms.size();
247 << histName <<
" dim= " << 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);
264 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" interpolated f = " << tmp;
268 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" (normalized)" <<
endmsg;
270 double binw = tmpHisto->GetBinWidth(binx);
271 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" binw= " << binw;
273 msg(MSG::ERROR) <<
"bin width is 0" <<
endmsg;
277 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" normalized f = " << tmp <<
endmsg;
279 tmpVector.push_back(tmp);
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);
299 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" interpolated f = " << tmp;
303 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" (normalized)" <<
endmsg;
305 double binw = tmpHisto->GetXaxis()->GetBinWidth(binx)
306 * tmpHisto->GetYaxis()->GetBinWidth(biny);
307 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" binw= " << binw;
309 msg(MSG::ERROR) <<
"bin width is 0" <<
endmsg;
313 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" normalized f = " << tmp <<
endmsg;
315 tmpVector.push_back(tmp);
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);
341 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" interpolated f = " << tmp;
345 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" (normalized)" <<
endmsg;
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;
352 msg(MSG::ERROR) <<
"bin width is 0" <<
endmsg;
356 if(
msgLvl(MSG::VERBOSE) )
msg(MSG::VERBOSE) <<
" normalized f = " << tmp <<
endmsg;
358 tmpVector.push_back(tmp);
361 if(idim>3 || idim<1 )
msg(MSG::DEBUG) <<
"#BTAG# " << idim
362 <<
" is not a correct dimensionality for pdfs !"
366 unsigned int classCount(0);
367 for (
const auto& f : tmpVector) {
369 if(
msgLvl(MSG::DEBUG) )
msg(MSG::DEBUG) <<
"#BTAG# sum of pX = " << sum <<
endmsg;
372 probDensityPerEventClassAllVariables[classCount] *= p;
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;
379 if(
msgLvl(MSG::DEBUG) )
msg(MSG::DEBUG) <<
"#BTAG# probDensity= "
380 << probDensityPerEventClassAllVariables[classCount]
381 <<
" ic= " << classCount <<
endmsg;
384 if(
msgLvl(MSG::DEBUG) )
msg(MSG::DEBUG) <<
"#BTAG# Final probDensity= "
385 << probDensityPerEventClassAllVariables
389 if(
msgLvl(MSG::DEBUG) )
msg(MSG::DEBUG) <<
"#BTAG# Ending ..." <<
endmsg;
390 return probDensityPerEventClassAllVariables;