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 +
"\",";
153 edm::LogError(
"HLTGenValSource") <<
"Initialization of HLTConfigProvider failed!";
164 std::vector<std::string> notFoundPaths;
170 if (pathToCheck.find(
':') != std::string::npos) {
172 std::stringstream hltPathToCheckInputStream(pathToCheck);
174 std::vector<std::string> hltPathToCheckInputSeglist;
175 while (std::getline(hltPathToCheckInputStream, hltPathToCheckInputSegment,
':')) {
176 hltPathToCheckInputSeglist.push_back(hltPathToCheckInputSegment);
180 if (hltPathToCheckInputSeglist.size() != 2)
182 <<
"Path string can not be properly split into path and cuts: please use exactly one colon!.\n";
185 cleanedPathToCheck = hltPathToCheckInputSeglist.at(0);
188 pathSpecificCuts = hltPathToCheckInputSeglist.at(1);
191 cleanedPathToCheck = pathToCheck;
194 bool pathfound =
false;
196 if (pathFromConfig.find(cleanedPathToCheck) != std::string::npos) {
209 notFoundPaths.push_back(cleanedPathToCheck);
211 if (!notFoundPaths.empty()) {
214 for (
const auto&
path : notFoundPaths)
215 notFoundPathsMessage +=
"- " +
path +
"\n";
216 edm::LogError(
"HLTGenValSource") <<
"The following paths could not be found and will not be used: \n" 217 << notFoundPathsMessage << std::endl;
247 for (
const auto&
object :
objects) {
268 histConfig.addParameter<std::vector<edm::ParameterSet>>(
"binnings",
283 desc.add<std::vector<std::string>>(
287 desc.add<
double>(
"dR2limit", 0.1);
288 desc.add<
bool>(
"doOnlyLastFilter",
false);
305 histConfig.add<std::vector<double>>(
"binLowEdges");
310 std::vector<edm::ParameterSet> histConfigDefaults;
314 std::vector<double> defaultPtBinning{0, 5, 10, 12.5, 15, 17.5, 20, 22.5, 25, 30, 35, 40,
315 45, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400};
316 histConfigDefault0.
addParameter<std::vector<double>>(
"binLowEdges", defaultPtBinning);
317 histConfigDefaults.push_back(histConfigDefault0);
321 std::vector<double> defaultetaBinning{-10, -8, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 8, 10};
322 histConfigDefault1.
addParameter<std::vector<double>>(
"binLowEdges", defaultetaBinning);
323 histConfigDefaults.push_back(histConfigDefault1);
325 desc.addVPSet(
"histConfigs", histConfig, histConfigDefaults);
331 histConfig2D.
add<std::vector<double>>(
"binLowEdgesX");
332 histConfig2D.
add<std::vector<double>>(
"binLowEdgesY");
335 std::vector<edm::ParameterSet> histConfigDefaults2D;
340 histConfigDefault2D0.
addParameter<std::vector<double>>(
"binLowEdgesX", defaultPtBinning);
341 histConfigDefault2D0.
addParameter<std::vector<double>>(
"binLowEdgesY", defaultetaBinning);
342 histConfigDefaults2D.push_back(histConfigDefault2D0);
344 desc.addVPSet(
"histConfigs2D", histConfig2D, histConfigDefaults2D);
351 binningConfig.
add<std::vector<double>>(
"binLowEdges");
354 std::vector<edm::ParameterSet> binningConfigDefaults;
356 desc.addVPSet(
"binnings", binningConfig, binningConfigDefaults);
363 std::vector<HLTGenValObject>
objects;
366 std::vector<std::string> implementedGenParticles = {
"ele",
"pho",
"mu",
"tau"};
367 if (
std::find(implementedGenParticles.begin(), implementedGenParticles.end(),
objType_) !=
368 implementedGenParticles.end()) {
372 for (
size_t i = 0;
i <
genJets->size();
i++) {
378 for (
size_t i = 0;
i <
genJets->size();
i++) {
386 for (
const auto& genJet : *
genJets) {
387 if (genJet.pt() > 30 &&
std::abs(genJet.eta()) < 2.5)
388 HTsum += genJet.pt();
397 for (
const auto& genJet : *
genJets) {
398 if (genJet.pt() > 200 &&
std::abs(genJet.eta()) < 2.5)
399 HTsum += genJet.pt();
406 if (!genMET->empty()) {
407 auto genMETpt = (*genMET)[0].pt();
411 throw cms::Exception(
"InputError") <<
"Generator-level validation is not available for type " <<
objType_ <<
".\n" 412 <<
"Please check for a potential spelling error.\n";
419 std::vector<HLTGenValObject>
objects;
443 if (
p.isHardProcess()) {
466 for (
const auto& daughter :
part.daughterRefVector()) {
467 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.