46 std::string newHistName =
m_name +
"/" +
h->GetName();
47 h->SetName(newHistName.c_str());
58 std::string newHistName =
m_name +
"/" +
h->GetName();
59 h->SetName(newHistName.c_str());
78 void fillHist2D(
const std::string & histName,
double x,
double y) {
235 TCS_EXCEPTION(
"Algorithm configuration failed for " <<
name() <<
"! Caught exception: " << e.what());
259 m_impl->setL1TopoHistSvc(std::move(histSvc));
273 std::string newTitle = title;
274 std::string newName =
name;
276 newTitle = xmin_str+title+xmax_str;
277 newName =
name+
"_"+xmin_str+title+xmax_str;
278 std::replace( newName.begin(), newName.end(),
'-',
'n');
279 std::replace( newName.begin(), newName.end(),
' ',
'_');
281 regName.push_back(
m_name+
"/"+newName);
284 std::string xTitle = title;
286 if (title ==
"ETA" || title ==
"DETA" || title ==
"PHI" || title ==
"DPHI" || title ==
"DR") { xTitle = title+
"#times10"; }
287 if (title ==
"PT" || title ==
"ET" || title ==
"HT" || title ==
"INVM" || title ==
"MT") { xTitle = title+
" [GeV]"; }
290 if (title ==
"ETA" || title ==
"DETA" || title ==
"DR") { xTitle = title+
"#times40"; }
291 if (title ==
"PHI" || title ==
"DPHI") { xTitle = title+
"#times20"; }
292 if (title ==
"PT" || title ==
"ET" || title ==
"HT" || title ==
"INVM" || title ==
"MT") { xTitle = title+
" [100 MeV]"; }
295 int xmin_new,xmax_new,binx_new=binx;
299 { xmin_new=1.5*
xmin; }
308 else {xmax_new = 1.5*
xmax;}
320 if ( title.find(
"ETA") != std::string::npos ){
324 if ( title.find(
"PHI") != std::string::npos || title.find(
"DPHI") != std::string::npos ){
328 if ( title.find(
"DETA") != std::string::npos || title.find(
"DR") != std::string::npos ){
333 TH1 *
h =
new TH1F(newName.c_str(), newTitle.c_str(), binx_new, xmin_new, xmax_new);
334 h->GetXaxis()->SetTitle(xTitle.c_str());
342 TH1 *
h =
new TH1F(
name.c_str(), title.c_str(), binx,
xmin,
xmax);
343 h->GetXaxis()->SetTitle(xtitle.c_str());
348 auto usPos = title.find(
" vs ");
349 std::string xName = title.substr(0,usPos);
350 std::string yName = title.substr(usPos+4);
355 std::string newTitle = title;
356 std::string newName =
name;
358 newTitle = xmin_str+xName+xmax_str+
" vs "+ymin_str+yName+ymax_str;
359 newName =
name+
"_"+xmin_str+xName+xmax_str+
"_"+ymin_str+yName+ymax_str;
360 std::replace( newName.begin(), newName.end(),
'-',
'n');
361 std::replace( newName.begin(), newName.end(),
' ',
'_');
363 regName.push_back(
m_name+
"/"+newName);
366 std::string xTitle = xName;
367 std::string yTitle = yName;
369 if (xName ==
"ETA" || xName ==
"DETA" || xName ==
"PHI" || xName ==
"DPHI" || xName ==
"DR") { xTitle = xName+
"#times10"; }
370 if (xName ==
"PT" || xName ==
"ET" || xName ==
"HT" || xName ==
"INVM" || xName ==
"MT") { xTitle = xName+
" [GeV]"; }
372 if (yName ==
"ETA" || yName ==
"DETA" || yName ==
"PHI" || yName ==
"DPHI" || yName ==
"DR") { yTitle = yName+
"#times10"; }
373 if (yName ==
"PT" || yName ==
"ET" || yName ==
"HT" || yName ==
"INVM" || yName ==
"MT") { yTitle = yName+
" [GeV]"; }
376 if (xName ==
"ETA" || xName ==
"DETA" || xName ==
"DR") { xTitle = xName+
"#times40"; }
377 if (xName ==
"PHI" || xName ==
"DPHI") { xTitle = xName+
"#times20"; }
378 if (xName ==
"PT" || xName ==
"ET" || xName ==
"HT" || xName ==
"INVM" || xName ==
"MT") { xTitle = xName+
" [100 MeV]"; }
380 if (yName ==
"ETA" || yName ==
"DETA" || yName ==
"DR") { yTitle = yName+
"#times40"; }
381 if (yName ==
"PHI" || yName ==
"DPHI") { yTitle = yName+
"#times20"; }
382 if (yName ==
"PT" || yName ==
"ET" || yName ==
"HT" || yName ==
"INVM" || yName ==
"MT") { yTitle = yName+
" [100 MeV]"; }
385 int xmin_new,xmax_new,binx_new=binx;
389 { xmin_new=1.5*
xmin; }
398 else {xmax_new = 1.5*
xmax;}
400 int ymin_new,ymax_new,biny_new=biny;
404 { ymin_new=1.5*
ymin; }
413 else {ymax_new = 1.5*
ymax;}
426 if ( xName.find(
"ETA") != std::string::npos ){
430 if ( yName.find(
"ETA") != std::string::npos ){
434 if ( xName.find(
"PHI") != std::string::npos || xName.find(
"DPHI") != std::string::npos ){
438 if ( yName.find(
"PHI") != std::string::npos || yName.find(
"DPHI") != std::string::npos ){
442 if ( xName.find(
"DETA") != std::string::npos || xName.find(
"DR") != std::string::npos ){
446 if ( yName.find(
"DETA") != std::string::npos || yName.find(
"DR") != std::string::npos ){
451 TH2 *
h =
new TH2F(newName.c_str(), newTitle.c_str(), binx_new, xmin_new, xmax_new, biny_new, ymin_new, ymax_new);
452 h->GetXaxis()->SetTitle(xTitle.c_str());
453 h->GetYaxis()->SetTitle(yTitle.c_str());
457 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) {
462 h->GetXaxis()->SetTitle(xtitle.c_str());
463 h->GetYaxis()->SetTitle(ytitle.c_str());
468 m_impl->fillHist1D(histName,
x);
477 const int val_int =
static_cast<int>(val);
478 std::ostringstream
temp;
485 unsigned int value = 0;
487 else if (
threshold ==
"Loose") {value = 1;}
488 else if (
threshold ==
"Medium") {value = 2;}
489 else if (
threshold ==
"HadMedium") {value = 2;}
490 else if (
threshold ==
"Tight") {value = 3;}
495 if (bit >= value) {
return true;}
510 o <<
"algorithm '" << alg.fullname() <<
"'" << std::endl;
511 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)