138 auto tm = *std::localtime(&
t);
141 std::ostringstream timeStringStream;
142 timeStringStream << std::put_time(&tm,
"%d-%m-%Y %H-%M-%S");
143 auto timeString = timeStringStream.str();
144 infoString_ +=
"\"date & time\":\"" + timeString +
"\",";
154 edm::LogError(
"HLTGenValSource") <<
"Initialization of HLTConfigProvider failed!";
165 std::vector<std::string> notFoundPaths;
171 if (pathToCheck.find(
':') != std::string::npos) {
173 std::stringstream hltPathToCheckInputStream(pathToCheck);
175 std::vector<std::string> hltPathToCheckInputSeglist;
176 while (std::getline(hltPathToCheckInputStream, hltPathToCheckInputSegment,
':')) {
177 hltPathToCheckInputSeglist.push_back(hltPathToCheckInputSegment);
181 if (hltPathToCheckInputSeglist.size() != 2)
183 <<
"Path string can not be properly split into path and cuts: please use exactly one colon!.\n";
186 cleanedPathToCheck = hltPathToCheckInputSeglist.at(0);
189 pathSpecificCuts = hltPathToCheckInputSeglist.at(1);
192 cleanedPathToCheck = pathToCheck;
195 bool pathfound =
false;
197 if (pathFromConfig.find(cleanedPathToCheck) != std::string::npos) {
210 notFoundPaths.push_back(cleanedPathToCheck);
212 if (!notFoundPaths.empty()) {
215 for (
const auto&
path : notFoundPaths)
216 notFoundPathsMessage +=
"- " +
path +
"\n";
217 edm::LogError(
"HLTGenValSource") <<
"The following paths could not be found and will not be used: \n" 218 << notFoundPathsMessage << std::endl;
248 for (
const auto&
object :
objects) {
269 histConfig.addParameter<std::vector<edm::ParameterSet>>(
"binnings",
284 desc.add<std::vector<std::string>>(
288 desc.add<
double>(
"dR2limit", 0.1);
289 desc.add<
bool>(
"doOnlyLastFilter",
false);
306 histConfig.add<std::vector<double>>(
"binLowEdges");
311 std::vector<edm::ParameterSet> histConfigDefaults;
315 std::vector<double> defaultPtBinning{0, 5, 10, 12.5, 15, 17.5, 20, 22.5, 25, 30, 35, 40,
316 45, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400};
317 histConfigDefault0.
addParameter<std::vector<double>>(
"binLowEdges", defaultPtBinning);
318 histConfigDefaults.push_back(histConfigDefault0);
322 std::vector<double> defaultetaBinning{-10, -8, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 8, 10};
323 histConfigDefault1.
addParameter<std::vector<double>>(
"binLowEdges", defaultetaBinning);
324 histConfigDefaults.push_back(histConfigDefault1);
326 desc.addVPSet(
"histConfigs", histConfig, histConfigDefaults);
332 histConfig2D.
add<std::vector<double>>(
"binLowEdgesX");
333 histConfig2D.
add<std::vector<double>>(
"binLowEdgesY");
336 std::vector<edm::ParameterSet> histConfigDefaults2D;
341 histConfigDefault2D0.
addParameter<std::vector<double>>(
"binLowEdgesX", defaultPtBinning);
342 histConfigDefault2D0.
addParameter<std::vector<double>>(
"binLowEdgesY", defaultetaBinning);
343 histConfigDefaults2D.push_back(histConfigDefault2D0);
345 desc.addVPSet(
"histConfigs2D", histConfig2D, histConfigDefaults2D);
352 binningConfig.
add<std::vector<double>>(
"binLowEdges");
355 std::vector<edm::ParameterSet> binningConfigDefaults;
357 desc.addVPSet(
"binnings", binningConfig, binningConfigDefaults);
364 std::vector<HLTGenValObject>
objects;
367 std::vector<std::string> implementedGenParticles = {
"ele",
"pho",
"mu",
"tau"};
368 if (
std::find(implementedGenParticles.begin(), implementedGenParticles.end(),
objType_) !=
369 implementedGenParticles.end()) {
373 for (
size_t i = 0;
i <
genJets->size();
i++) {
379 for (
size_t i = 0;
i <
genJets->size();
i++) {
387 for (
const auto& genJet : *
genJets) {
388 if (genJet.pt() > 30 &&
std::abs(genJet.eta()) < 2.5)
389 HTsum += genJet.pt();
398 for (
const auto& genJet : *
genJets) {
399 if (genJet.pt() > 200 &&
std::abs(genJet.eta()) < 2.5)
400 HTsum += genJet.pt();
407 if (!genMET->empty()) {
408 auto genMETpt = (*genMET)[0].pt();
412 throw cms::Exception(
"InputError") <<
"Generator-level validation is not available for type " <<
objType_ <<
".\n" 413 <<
"Please check for a potential spelling error.\n";
420 std::vector<HLTGenValObject>
objects;
444 if (
p.isHardProcess()) {
467 for (
const auto& daughter :
part.daughterRefVector()) {
468 if (daughter->pdgId() ==
part.pdgId())
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
T getParameter(std::string const &) const
std::string hltProcessName_
virtual void setCurrentFolder(std::string const &fullpath)
reco::GenParticle getLastCopy(reco::GenParticle part)
const std::string & globalTag() const
global tag
std::vector< GenJet > GenJetCollection
collection of GenJet objects
std::vector< std::string > hltPaths
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
static std::string to_string(const XMLCh *ch)
std::vector< edm::ParameterSet > binnings_
MonitorElement * bookString(TString const &name, TString const &value, FUNC onbooking=NOOP())
const edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
void addDefault(ParameterSetDescription const &psetDescription)
std::vector< HLTGenValObject > getObjectCollection(const edm::Event &)
void addParameter(std::string const &name, T const &value)
HLTGenValSource(const edm::ParameterSet &)
Abs< T >::type abs(const T &t)
Jets made from MC generator particles.
const edm::EDGetTokenT< reco::GenJetCollection > ak8genJetToken_
#define DEFINE_FWK_MODULE(type)
std::vector< std::string > hltPathsToCheck_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< trigger::TriggerEvent > trigEventToken_
const edm::EDGetTokenT< reco::GenJetCollection > ak4genJetToken_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< edm::ParameterSet > histConfigs_
std::vector< HLTGenValObject > getGenParticles(const edm::Event &)
HLTConfigProvider hltConfig_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
std::vector< edm::ParameterSet > histConfigs2D_
std::vector< std::string > hltPathSpecificCuts
const std::vector< std::string > & triggerNames() const
names of trigger paths
ParameterSet const & getParameterSet(ParameterSetID const &id)
const std::string & tableName() const
HLT ConfDB table name.
VParameterSet const & getParameterSetVector(std::string const &name) const
~HLTGenValSource() override=default
const edm::EDGetTokenT< reco::GenMETCollection > genMETToken_
void bookHistograms(DQMStore::IBooker &, edm::Run const &run, edm::EventSetup const &c) override
void analyze(const edm::Event &, const edm::EventSetup &) override
HLTGenValSource & operator=(const HLTGenValSource &)=delete
reco::GenParticle getLastCopyPreFSR(reco::GenParticle part)
std::vector< HLTGenValHistCollPath > collectionPath_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.