46 std::string newHistName =
m_name +
"/" +
h->GetName();
47 h->SetName(newHistName.c_str());
52 h->SetDirectory(
nullptr);
59 std::string newHistName =
m_name +
"/" +
h->GetName();
60 h->SetName(newHistName.c_str());
65 h->SetDirectory(
nullptr);
80 void fillHist2D(
const std::string & histName,
double x,
double y) {
237 TCS_EXCEPTION(
"Algorithm configuration failed for " <<
name() <<
"! Caught exception: " << e.what());
261 m_impl->setL1TopoHistSvc(std::move(histSvc));
275 std::string newTitle{title};
276 std::string newName{
name};
279 newName = newName+
"_"+xmin_str+newTitle+xmax_str;
280 newTitle = xmin_str+newTitle+xmax_str;
281 std::replace( newName.begin(), newName.end(),
'-',
'n');
282 std::replace( newName.begin(), newName.end(),
' ',
'_');
284 regName.push_back(
m_name+
"/"+newName);
287 std::string xTitle{title};
289 if (title ==
"ETA" || title ==
"DETA" || title ==
"PHI" || title ==
"DPHI" || title ==
"DR") { xTitle +=
"#times10"; }
290 if (title ==
"PT" || title ==
"ET" || title ==
"HT" || title ==
"INVM" || title ==
"MT") { xTitle +=
" [GeV]"; }
293 if (title ==
"ETA" || title ==
"DETA" || title ==
"DR") { xTitle +=
"#times40"; }
294 if (title ==
"PHI" || title ==
"DPHI") { xTitle +=
"#times20"; }
295 if (title ==
"PT" || title ==
"ET" || title ==
"HT" || title ==
"INVM" || title ==
"MT") { xTitle +=
" [100 MeV]"; }
298 int xmin_new,xmax_new,binx_new=binx;
302 { xmin_new=1.5*
xmin; }
311 else {xmax_new = 1.5*
xmax;}
323 if ( title.find(
"ETA") != std::string_view::npos ){
327 if ( title.find(
"PHI") != std::string_view::npos || title.find(
"DPHI") != std::string_view::npos ){
331 if ( title.find(
"DETA") != std::string_view::npos || title.find(
"DR") != std::string_view::npos ){
336 TH1 *
h =
new TH1F(newName.c_str(), newTitle.c_str(), binx_new, xmin_new, xmax_new);
337 h->GetXaxis()->SetTitle(xTitle.c_str());
345 TH1 *
h =
new TH1F(
name.c_str(), title.c_str(), binx,
xmin,
xmax);
346 h->GetXaxis()->SetTitle(xtitle.c_str());
351 auto usPos = title.find(
" vs ");
352 std::string xName{title.substr(0,usPos)};
353 std::string yName{title.substr(usPos+4)};
358 std::string newTitle{title};
359 std::string newName{
name};
361 newTitle = xmin_str+xName+xmax_str+
" vs "+ymin_str+yName+ymax_str;
362 newName = newName+
"_"+xmin_str+xName+xmax_str+
"_"+ymin_str+yName+ymax_str;
363 std::replace( newName.begin(), newName.end(),
'-',
'n');
364 std::replace( newName.begin(), newName.end(),
' ',
'_');
366 regName.push_back(
m_name+
"/"+newName);
369 std::string xTitle = xName;
370 std::string yTitle = yName;
372 if (xName ==
"ETA" || xName ==
"DETA" || xName ==
"PHI" || xName ==
"DPHI" || xName ==
"DR") { xTitle = xName+
"#times10"; }
373 if (xName ==
"PT" || xName ==
"ET" || xName ==
"HT" || xName ==
"INVM" || xName ==
"MT") { xTitle = xName+
" [GeV]"; }
375 if (yName ==
"ETA" || yName ==
"DETA" || yName ==
"PHI" || yName ==
"DPHI" || yName ==
"DR") { yTitle = yName+
"#times10"; }
376 if (yName ==
"PT" || yName ==
"ET" || yName ==
"HT" || yName ==
"INVM" || yName ==
"MT") { yTitle = yName+
" [GeV]"; }
379 if (xName ==
"ETA" || xName ==
"DETA" || xName ==
"DR") { xTitle = xName+
"#times40"; }
380 if (xName ==
"PHI" || xName ==
"DPHI") { xTitle = xName+
"#times20"; }
381 if (xName ==
"PT" || xName ==
"ET" || xName ==
"HT" || xName ==
"INVM" || xName ==
"MT") { xTitle = xName+
" [100 MeV]"; }
383 if (yName ==
"ETA" || yName ==
"DETA" || yName ==
"DR") { yTitle = yName+
"#times40"; }
384 if (yName ==
"PHI" || yName ==
"DPHI") { yTitle = yName+
"#times20"; }
385 if (yName ==
"PT" || yName ==
"ET" || yName ==
"HT" || yName ==
"INVM" || yName ==
"MT") { yTitle = yName+
" [100 MeV]"; }
388 int xmin_new,xmax_new,binx_new=binx;
392 { xmin_new=1.5*
xmin; }
401 else {xmax_new = 1.5*
xmax;}
403 int ymin_new,ymax_new,biny_new=biny;
407 { ymin_new=1.5*
ymin; }
416 else {ymax_new = 1.5*
ymax;}
429 if ( xName.find(
"ETA") != std::string::npos ){
433 if ( yName.find(
"ETA") != std::string::npos ){
437 if ( xName.find(
"PHI") != std::string::npos || xName.find(
"DPHI") != std::string::npos ){
441 if ( yName.find(
"PHI") != std::string::npos || yName.find(
"DPHI") != std::string::npos ){
445 if ( xName.find(
"DETA") != std::string::npos || xName.find(
"DR") != std::string::npos ){
449 if ( yName.find(
"DETA") != std::string::npos || yName.find(
"DR") != std::string::npos ){
454 TH2 *
h =
new TH2F(newName.c_str(), newTitle.c_str(), binx_new, xmin_new, xmax_new, biny_new, ymin_new, ymax_new);
455 h->GetXaxis()->SetTitle(xTitle.c_str());
456 h->GetYaxis()->SetTitle(yTitle.c_str());
460 void ConfigurableAlg::bookHistMult(std::vector<std::string> ®Name,
const std::string&
name,
const std::string& title,
const std::string& xtitle,
const std::string& ytitle,
const int binx,
const int xmin,
const int xmax,
const int biny,
const int ymin,
const int ymax) {
465 h->GetXaxis()->SetTitle(xtitle.c_str());
466 h->GetYaxis()->SetTitle(ytitle.c_str());
471 m_impl->fillHist1D(histName,
x);
480 const int val_int =
static_cast<int>(val);
481 std::ostringstream
temp;
488 unsigned int value = 0;
490 else if (
threshold ==
"Loose") {value = 1;}
491 else if (
threshold ==
"Medium") {value = 2;}
492 else if (
threshold ==
"HadMedium") {value = 2;}
493 else if (
threshold ==
"Tight") {value = 3;}
498 if (bit >= value) {
return true;}
513 o <<
"algorithm '" << alg.fullname() <<
"'" << std::endl;
514 o << alg.parameters();
#define TRG_MSG_WARNING(x)
#define TCS_EXCEPTION(MSG)
The implementation class.
std::vector< TH1 * > m_localHistStore
void fillHist2D(const std::string &histName, double x, double y)
void fillHist1D(const std::string &histName, double x)
void registerHist(TH2 *h)
std::shared_ptr< IL1TopoHistSvc > m_histSvc
ConfigurableAlgImpl(const std::string &name)
void setL1TopoHistSvc(std::shared_ptr< IL1TopoHistSvc > histSvc)
void registerHist(TH1 *h)
const ParameterSpace & parameters() const
ConfigurableAlg(const std::string &name, AlgType algType)
unsigned int calcTMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
const std::string & name() const
void bookHist(std::vector< std::string > ®Name, std::string_view name, std::string_view title, const int binx, const int xmin, const int xmax)
const Parameter & parameter(std::string_view parameterName) const
bool isocut(const std::string &threshold, const unsigned int bit) const
void fillHist1D(const std::string &histName, double x)
unsigned int calcDeltaR2BW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned int calcDeltaPhiBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void setL1TopoHistSvc(std::shared_ptr< IL1TopoHistSvc >)
sets the external hist service
unsigned int calcInvMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned long quadraticSumBW(int i1, int i2)
unsigned int calcDeltaEta(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
std::string ToString(const int val)
void setParameters(const ParameterSpace &)
std::unique_ptr< ConfigurableAlgImpl > m_impl
void bookHistMult(std::vector< std::string > ®Name, const std::string &name, const std::string &title, const std::string &xtitle, const int binx, const int xmin, const int xmax)
ParameterSpace m_parameters
unsigned int calcDeltaEtaBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void defineParameter(std::string_view name, TCS::parType_t value)
unsigned int calcDeltaR2(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned int calcTMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
unsigned int calcDeltaPhi(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
virtual ~ConfigurableAlg()
unsigned int calcInvMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
void fillHist2D(const std::string &histName, double x, double y)
const Parameter & parameter(std::string_view parameterName) const
TrigConfMessaging(const std::string &name)
Constructor with parameters.
const std::string selection
bool contains(const std::string &s, const std::string ®x)
does a string contain the substring
std::ostream & operator<<(std::ostream &os, const TCS::Bin &bin)
static unsigned int calcDeltaEtaBWLegacy(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaEtaBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcTMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaR2Legacy(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcInvMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaPhiBWLegacy(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaPhi(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaPhiLegacy(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaEta(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcInvMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaR2BW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcTMassBWLegacy(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaPhiBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcTMassBW(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaEtaLegacy(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcInvMassBWLegacy(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned long quadraticSumBW(int i1, int i2)
compute the sum in quadrature of two ints
static unsigned int calcDeltaR2(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
static unsigned int calcDeltaR2BWLegacy(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)