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;
278 newTitle = xmin_str+title+xmax_str;
279 newName =
name+
"_"+xmin_str+title+xmax_str;
280 std::replace( newName.begin(), newName.end(),
'-',
'n');
281 std::replace( newName.begin(), newName.end(),
' ',
'_');
283 regName.push_back(
m_name+
"/"+newName);
286 std::string xTitle = title;
288 if (title ==
"ETA" || title ==
"DETA" || title ==
"PHI" || title ==
"DPHI" || title ==
"DR") { xTitle = title+
"#times10"; }
289 if (title ==
"PT" || title ==
"ET" || title ==
"HT" || title ==
"INVM" || title ==
"MT") { xTitle = title+
" [GeV]"; }
292 if (title ==
"ETA" || title ==
"DETA" || title ==
"DR") { xTitle = title+
"#times40"; }
293 if (title ==
"PHI" || title ==
"DPHI") { xTitle = title+
"#times20"; }
294 if (title ==
"PT" || title ==
"ET" || title ==
"HT" || title ==
"INVM" || title ==
"MT") { xTitle = title+
" [100 MeV]"; }
297 int xmin_new,xmax_new,binx_new=binx;
301 { xmin_new=1.5*
xmin; }
310 else {xmax_new = 1.5*
xmax;}
322 if ( title.find(
"ETA") != std::string::npos ){
326 if ( title.find(
"PHI") != std::string::npos || title.find(
"DPHI") != std::string::npos ){
330 if ( title.find(
"DETA") != std::string::npos || title.find(
"DR") != std::string::npos ){
335 TH1 *
h =
new TH1F(newName.c_str(), newTitle.c_str(), binx_new, xmin_new, xmax_new);
336 h->GetXaxis()->SetTitle(xTitle.c_str());
344 TH1 *
h =
new TH1F(
name.c_str(), title.c_str(), binx,
xmin,
xmax);
345 h->GetXaxis()->SetTitle(xtitle.c_str());
350 auto usPos = title.find(
" vs ");
351 std::string xName = title.substr(0,usPos);
352 std::string yName = title.substr(usPos+4);
357 std::string newTitle = title;
358 std::string newName =
name;
360 newTitle = xmin_str+xName+xmax_str+
" vs "+ymin_str+yName+ymax_str;
361 newName =
name+
"_"+xmin_str+xName+xmax_str+
"_"+ymin_str+yName+ymax_str;
362 std::replace( newName.begin(), newName.end(),
'-',
'n');
363 std::replace( newName.begin(), newName.end(),
' ',
'_');
365 regName.push_back(
m_name+
"/"+newName);
368 std::string xTitle = xName;
369 std::string yTitle = yName;
371 if (xName ==
"ETA" || xName ==
"DETA" || xName ==
"PHI" || xName ==
"DPHI" || xName ==
"DR") { xTitle = xName+
"#times10"; }
372 if (xName ==
"PT" || xName ==
"ET" || xName ==
"HT" || xName ==
"INVM" || xName ==
"MT") { xTitle = xName+
" [GeV]"; }
374 if (yName ==
"ETA" || yName ==
"DETA" || yName ==
"PHI" || yName ==
"DPHI" || yName ==
"DR") { yTitle = yName+
"#times10"; }
375 if (yName ==
"PT" || yName ==
"ET" || yName ==
"HT" || yName ==
"INVM" || yName ==
"MT") { yTitle = yName+
" [GeV]"; }
378 if (xName ==
"ETA" || xName ==
"DETA" || xName ==
"DR") { xTitle = xName+
"#times40"; }
379 if (xName ==
"PHI" || xName ==
"DPHI") { xTitle = xName+
"#times20"; }
380 if (xName ==
"PT" || xName ==
"ET" || xName ==
"HT" || xName ==
"INVM" || xName ==
"MT") { xTitle = xName+
" [100 MeV]"; }
382 if (yName ==
"ETA" || yName ==
"DETA" || yName ==
"DR") { yTitle = yName+
"#times40"; }
383 if (yName ==
"PHI" || yName ==
"DPHI") { yTitle = yName+
"#times20"; }
384 if (yName ==
"PT" || yName ==
"ET" || yName ==
"HT" || yName ==
"INVM" || yName ==
"MT") { yTitle = yName+
" [100 MeV]"; }
387 int xmin_new,xmax_new,binx_new=binx;
391 { xmin_new=1.5*
xmin; }
400 else {xmax_new = 1.5*
xmax;}
402 int ymin_new,ymax_new,biny_new=biny;
406 { ymin_new=1.5*
ymin; }
415 else {ymax_new = 1.5*
ymax;}
428 if ( xName.find(
"ETA") != std::string::npos ){
432 if ( yName.find(
"ETA") != std::string::npos ){
436 if ( xName.find(
"PHI") != std::string::npos || xName.find(
"DPHI") != std::string::npos ){
440 if ( yName.find(
"PHI") != std::string::npos || yName.find(
"DPHI") != std::string::npos ){
444 if ( xName.find(
"DETA") != std::string::npos || xName.find(
"DR") != std::string::npos ){
448 if ( yName.find(
"DETA") != std::string::npos || yName.find(
"DR") != std::string::npos ){
453 TH2 *
h =
new TH2F(newName.c_str(), newTitle.c_str(), binx_new, xmin_new, xmax_new, biny_new, ymin_new, ymax_new);
454 h->GetXaxis()->SetTitle(xTitle.c_str());
455 h->GetYaxis()->SetTitle(yTitle.c_str());
459 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) {
464 h->GetXaxis()->SetTitle(xtitle.c_str());
465 h->GetYaxis()->SetTitle(ytitle.c_str());
470 m_impl->fillHist1D(histName,
x);
479 const int val_int =
static_cast<int>(val);
480 std::ostringstream
temp;
487 unsigned int value = 0;
489 else if (
threshold ==
"Loose") {value = 1;}
490 else if (
threshold ==
"Medium") {value = 2;}
491 else if (
threshold ==
"HadMedium") {value = 2;}
492 else if (
threshold ==
"Tight") {value = 3;}
497 if (bit >= value) {
return true;}
512 o <<
"algorithm '" << alg.fullname() <<
"'" << std::endl;
513 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)
const Parameter & parameter(const std::string ¶meterName) const
unsigned int calcTMass(const TCS::GenericTOB *tob1, const TCS::GenericTOB *tob2)
const std::string & name() const
bool isocut(const std::string &threshold, const unsigned int bit) const
void bookHist(std::vector< std::string > ®Name, const std::string &name, const std::string &title, const int binx, const int xmin, const int xmax)
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(const std::string &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(const std::string ¶meterName) 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)