Skip to content

Commit

Permalink
Merge pull request #30859 from fwyzard/migrate_boost_format_to_fmt_HL…
Browse files Browse the repository at this point in the history
…TriggerOffline

Migrate HLTrigerOffline from boost::format to {fmt}
  • Loading branch information
cmsbuild committed Jul 22, 2020
2 parents 0fd56e0 + 628940d commit bcc7dbb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 35 deletions.
4 changes: 2 additions & 2 deletions HLTriggerOffline/Egamma/interface/EmDQMReco.h
Expand Up @@ -52,8 +52,8 @@ class EmDQMReco : public DQMEDAnalyzer {
class FourVectorMonitorElements {
public:
/** @param histogramNameTemplate should be a format string (like used in
* printf(..) or boost::format(..) for the histogram NAME where the first %s
* is replaced with et,eta or phi.
* printf(..) for the histogram NAME where the first %s is replaced with
* et,eta or phi.
*
* @param histogramTitleTemplate should be a format string (see
* histogramNameTemplate) for the histogram TITLE where the first %s is
Expand Down
65 changes: 32 additions & 33 deletions HLTriggerOffline/Egamma/src/EmDQMReco.cc
@@ -1,45 +1,44 @@
////////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>

#include <fmt/printf.h>

////////////////////////////////////////////////////////////////////////////////
// Root include files //
////////////////////////////////////////////////////////////////////////////////
#include <TDirectory.h>
#include <TFile.h>
#include <TH1F.h>
#include <Math/VectorUtil.h>

////////////////////////////////////////////////////////////////////////////////
// Header file for this //
////////////////////////////////////////////////////////////////////////////////
#include "HLTriggerOffline/Egamma/interface/EmDQMReco.h"

////////////////////////////////////////////////////////////////////////////////
// Collaborating Class Header //
////////////////////////////////////////////////////////////////////////////////
#include "DataFormats/EgammaCandidates/interface/Electron.h"
#include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
//#include "DataFormats/EgammaCandidates/interface/PhotonFwd.h"
//#include "DataFormats/EgammaCandidates/interface/Photon.h"
#include "DataFormats/L1Trigger/interface/L1EmParticle.h"
#include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
//#include "SimDataFormats/HepMCProduct/interface/HepMCProduct.h"
#include "DataFormats/Common/interface/AssociationMap.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"

#include "DataFormats/Common/interface/Handle.h"
#include "DataFormats/Common/interface/RefToBase.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
//#include "PhysicsTools/UtilAlgos/interface/TFileService.h"
#include "DataFormats/Common/interface/TriggerResults.h"
#include "DataFormats/EgammaCandidates/interface/Electron.h"
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
#include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
#include "DataFormats/HLTReco/interface/TriggerObject.h"
#include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
#include "DataFormats/L1Trigger/interface/L1EmParticle.h"
#include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
#include "DataFormats/RecoCandidate/interface/RecoEcalCandidate.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/interface/Exception.h"
#include <boost/format.hpp>
////////////////////////////////////////////////////////////////////////////////
// Root include files //
////////////////////////////////////////////////////////////////////////////////
#include "TDirectory.h"
#include "TFile.h"
#include "TH1F.h"
#include <Math/VectorUtil.h>
#include <iostream>
#include <string>
#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h"

using namespace ROOT::Math::VectorUtil;

//----------------------------------------------------------------------
Expand All @@ -55,20 +54,20 @@ EmDQMReco::FourVectorMonitorElements::FourVectorMonitorElements(EmDQMReco *_pare
std::string histTitle;

// et
histName = boost::str(boost::format(histogramNameTemplate) % "et");
histTitle = boost::str(boost::format(histogramTitleTemplate) % "E_{T}");
histName = fmt::sprintf(histogramNameTemplate, "et");
histTitle = fmt::sprintf(histogramTitleTemplate, "E_{T}");
etMonitorElement =
iBooker.book1D(histName.c_str(), histTitle.c_str(), parent->plotBins, parent->plotPtMin, parent->plotPtMax);

// eta
histName = boost::str(boost::format(histogramNameTemplate) % "eta");
histTitle = boost::str(boost::format(histogramTitleTemplate) % "#eta");
histName = fmt::sprintf(histogramNameTemplate, "eta");
histTitle = fmt::sprintf(histogramTitleTemplate, "#eta");
etaMonitorElement =
iBooker.book1D(histName.c_str(), histTitle.c_str(), parent->plotBins, -parent->plotEtaMax, parent->plotEtaMax);

// phi
histName = boost::str(boost::format(histogramNameTemplate) % "phi");
histTitle = boost::str(boost::format(histogramTitleTemplate) % "#phi");
histName = fmt::sprintf(histogramNameTemplate, "phi");
histTitle = fmt::sprintf(histogramTitleTemplate, "#phi");
phiMonitorElement =
iBooker.book1D(histName.c_str(), histTitle.c_str(), parent->plotBins, -parent->plotPhiMax, parent->plotPhiMax);
}
Expand Down

0 comments on commit bcc7dbb

Please sign in to comment.