5 #include <fmt/printf.h> 10 #include <TDirectory.h> 13 #include <Math/VectorUtil.h> 57 histName = fmt::sprintf(histogramNameTemplate,
"et");
58 histTitle = fmt::sprintf(histogramTitleTemplate,
"E_{T}");
63 histName = fmt::sprintf(histogramNameTemplate,
"eta");
64 histTitle = fmt::sprintf(histogramTitleTemplate,
"#eta");
69 histName = fmt::sprintf(histogramNameTemplate,
"phi");
70 histTitle = fmt::sprintf(histogramTitleTemplate,
"#phi");
78 etMonitorElement->Fill(momentum.Et());
79 etaMonitorElement->Fill(momentum.eta());
80 phiMonitorElement->Fill(momentum.phi());
95 reqNum =
pset.getParameter<
unsigned int>(
"reqNum");
101 plotPtMax =
pset.getUntrackedParameter<
double>(
"PtMax", 1000.);
104 plotBins =
pset.getUntrackedParameter<
unsigned int>(
"Nbins", 50);
114 consumes<std::vector<reco::SuperCluster>>(
edm::InputTag(
"correctedMulti5x5SuperClustersWithPreshower"));
132 std::vector<edm::ParameterSet>
filters =
pset.getParameter<std::vector<edm::ParameterSet>>(
"filters");
135 for (std::vector<edm::ParameterSet>::iterator filterconf =
filters.begin(); filterconf !=
filters.end();
144 std::vector<double>
bounds = filterconf->getParameter<std::vector<double>>(
"PlotBounds");
148 isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag>>(
"IsoCollections"));
150 for (
unsigned int i = 0;
i <
isoNames.back().size();
i++) {
177 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]");
183 if (
isoNames.back().at(0).label() ==
"none") {
199 bool isHltConfigChanged =
false;
227 histName =
"total_eff_RECO_matched";
228 histTitle =
"total events passing (Reco matched)";
246 pdgIdString =
"Electron";
249 pdgIdString =
"Photon";
252 pdgIdString =
"Particle";
259 histReco = std::make_unique<FourVectorMonitorElements>(
this,
262 "%s of " + pdgIdString +
"s");
270 "%s of " + pdgIdString +
"s monpath");
276 histMonpath = std::make_unique<FourVectorMonitorElements>(
this,
288 std::vector<std::string> HltHistTitle;
323 standardHist.push_back(std::make_unique<FourVectorMonitorElements>(
327 HltHistTitle[
i] +
" %s (ALL)" 354 histMatchReco.push_back(std::make_unique<FourVectorMonitorElements>(
358 HltHistTitle[
i] +
" %s (RECO matched)" 392 HltHistTitle[
i] +
" %s (RECO matched, monpath)" 424 HltHistTitle[
i] +
" %s (reco)" 450 histTitle = HltHistTitle[
i] +
" isolation vs #eta (all)";
451 tmpiso = iBooker.book2D(histName.c_str(),
463 histTitle = HltHistTitle[
i] +
" isolation vs Et (all)";
464 tmpiso = iBooker.book2D(histName.c_str(),
476 histTitle = HltHistTitle[
i] +
" isolation vs #phi (all)";
477 tmpiso = iBooker.book2D(histName.c_str(),
493 histTitle = HltHistTitle[
i] +
" isolation vs #eta (reco matched)";
494 tmpiso = iBooker.book2D(histName.c_str(),
506 histTitle = HltHistTitle[
i] +
" isolation vs Et (reco matched)";
507 tmpiso = iBooker.book2D(histName.c_str(),
519 histTitle = HltHistTitle[
i] +
" isolation vs #phi (reco matched)";
520 tmpiso = iBooker.book2D(histName.c_str(),
537 histTitle = HltHistTitle[
i] +
" isolation vs #eta (reco)";
538 tmpiso = iBooker.book2D(histName.c_str(),
550 histTitle = HltHistTitle[
i] +
" isolation vs Et (reco)";
551 tmpiso = iBooker.book2D(histName.c_str(),
563 histTitle = HltHistTitle[
i] +
" isolation vs #phi (reco)";
564 tmpiso = iBooker.book2D(histName.c_str(),
593 bool plotMonpath =
false;
594 bool plotReco =
true;
603 if (recoObjects->size() < (
unsigned int)
recocut_) {
609 }
else if (
pdgGen == 22) {
613 if (recoObjectsEB->size() + recoObjectsEE->size() < (
unsigned int)
recocut_) {
639 unsigned int triggerIndex;
643 bool isFired =
false;
644 if (triggerIndex < HLTR->
size()) {
645 isFired = HLTR->
accept(triggerIndex);
654 edm::LogWarning(
"EmDQMReco") <<
"RAW-type HLT results not found, skipping event";
678 std::vector<reco::Particle> sortedReco;
679 if (plotReco ==
true) {
684 recopart->charge(), recopart->p4(), recopart->vertex(), recopart->pdgId(), recopart->status());
685 sortedReco.push_back(tmpcand);
687 }
else if (
pdgGen == 22) {
688 for (std::vector<reco::SuperCluster>::const_iterator recopart2 = recoObjectsEB->begin();
689 recopart2 != recoObjectsEB->end();
691 float en = recopart2->
energy();
692 float er =
sqrt(
pow(recopart2->x(), 2) +
pow(recopart2->y(), 2) +
pow(recopart2->z(), 2));
693 float px = recopart2->energy() * recopart2->x() / er;
694 float py = recopart2->energy() * recopart2->y() / er;
695 float pz = recopart2->energy() * recopart2->z() / er;
698 sortedReco.push_back(tmpcand);
700 for (std::vector<reco::SuperCluster>::const_iterator recopart2 = recoObjectsEE->begin();
701 recopart2 != recoObjectsEE->end();
703 float en = recopart2->energy();
704 float er =
sqrt(
pow(recopart2->x(), 2) +
pow(recopart2->y(), 2) +
pow(recopart2->z(), 2));
705 float px = recopart2->energy() * recopart2->x() / er;
706 float py = recopart2->energy() * recopart2->y() / er;
707 float pz = recopart2->energy() * recopart2->z() / er;
710 sortedReco.push_back(tmpcand);
720 sortedReco.erase(sortedReco.begin() +
recocut_, sortedReco.end());
766 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]");
779 std::vector<reco::Particle> &sortedReco,
782 std::vector<edm::Ref<T>> recoecalcands;
791 triggerObj->
filterIndex(
dqm->theHLTCollectionLabels[
n]),
dqm->theHLTOutputTypes[
n], recoecalcands);
795 std::vector<edm::Ref<T>> isocands;
797 if (!isocands.empty()) {
798 for (
unsigned int i = 0;
i < isocands.size();
i++)
799 recoecalcands.push_back(isocands[
i]);
803 if (recoecalcands.empty()) {
807 if (recoecalcands.size() >=
dqm->reqNum)
808 dqm->totalreco->Fill(
n + 0.5);
814 for (
unsigned int j = 0;
j < recoecalcands.size();
j++) {
815 if (!(recoecalcands.at(
j).isAvailable())) {
816 edm::LogError(
"EmDQMReco") <<
"Event content inconsistent: TriggerEventWithRefs contains " 819 <<
"invalid refs for: " <<
dqm->theHLTCollectionLabels[
n].label();
830 for (
unsigned int i = 0;
i < recoecalcands.size();
i++) {
831 dqm->standardHist[
n]->fill(recoecalcands[
i]->p4());
837 if (
n + 1 <
dqm->numOfHLTCollectionLabels) {
838 if (
dqm->plotiso[
n + 1]) {
845 depMap->find(recoecalcands[
i]);
846 if (mapi != depMap->end()) {
847 dqm->etahistiso[
n + 1]->Fill(recoecalcands[
i]->
eta(), mapi->val);
848 dqm->ethistiso[
n + 1]->Fill(recoecalcands[
i]->
et(), mapi->val);
849 dqm->phiHistIso[
n + 1]->Fill(recoecalcands[
i]->
phi(), mapi->val);
861 if (plotReco ==
true) {
862 for (
unsigned int i = 0;
i <
dqm->recocut_;
i++) {
866 float closestRecoDeltaR = 1000.;
867 int closestRecoEcalCandIndex = -1;
868 for (
unsigned int j = 0;
j < recoecalcands.size();
j++) {
869 float deltaR =
DeltaR(recoecalcands[
j]->momentum(), currentRecoParticleMomentum);
871 if (
deltaR < closestRecoDeltaR) {
872 closestRecoDeltaR =
deltaR;
873 closestRecoEcalCandIndex =
j;
879 if (closestRecoEcalCandIndex >= 0) {
887 dqm->histHltObjMatchToReco[
n]->fill(recoecalcands[closestRecoEcalCandIndex]->p4());
890 if (
n + 1 <
dqm->numOfHLTCollectionLabels) {
891 if (
dqm->plotiso[
n + 1]) {
898 depMap->find(recoecalcands[closestRecoEcalCandIndex]);
899 if (mapi != depMap->end()) {
900 dqm->histEtaIsoOfHltObjMatchToReco[
n + 1]->Fill(recoecalcands[closestRecoEcalCandIndex]->
eta(),
902 dqm->histEtIsoOfHltObjMatchToReco[
n + 1]->Fill(recoecalcands[closestRecoEcalCandIndex]->
et(),
904 dqm->histPhiIsoOfHltObjMatchToReco[
n + 1]->Fill(recoecalcands[closestRecoEcalCandIndex]->
phi(),
917 unsigned int mtachedRecoParts = 0;
918 float minrecodist = 0.3;
921 for (
unsigned int i = 0;
i <
dqm->recocut_;
i++) {
923 bool matchThis =
false;
925 unsigned int closest = 0;
926 double closestDr = 1000.;
927 for (
unsigned int trigOb = 0; trigOb < recoecalcands.size(); trigOb++) {
928 double dr =
DeltaR(recoecalcands[trigOb]->momentum(), candDir);
929 if (
dr < closestDr) {
933 if (closestDr > minrecodist) {
946 dqm->histMatchReco[
n]->fill(sortedReco[
i].p4());
952 dqm->histMatchRecoMonPath[
n]->fill(sortedReco[
i].p4());
958 if (
n + 1 <
dqm->numOfHLTCollectionLabels) {
959 if (
dqm->plotiso[
n + 1]) {
966 depMapReco->find(recoecalcands[closest]);
967 if (mapi != depMapReco->end()) {
968 dqm->etahistisomatchreco[
n + 1]->Fill(sortedReco[
i].
eta(), mapi->val);
969 dqm->ethistisomatchreco[
n + 1]->Fill(sortedReco[
i].
et(), mapi->val);
970 dqm->phiHistIsoMatchReco[
n + 1]->Fill(sortedReco[
i].
eta(), mapi->val);
978 if (mtachedRecoParts >=
dqm->reqNum)
979 dqm->totalmatchreco->Fill(
n + 0.5);
std::vector< MonitorElement * > histEtIsoOfHltObjMatchToReco
bool accept() const
Has at least one path accepted the event?
void fill(const math::XYZTLorentzVector &momentum)
std::vector< std::unique_ptr< FourVectorMonitorElements > > histMatchReco
std::vector< std::vector< edm::InputTag > > isoNames
double energy() const
energy
std::vector< std::unique_ptr< FourVectorMonitorElements > > standardHist
std::unique_ptr< FourVectorMonitorElements > histReco
std::vector< MonitorElement * > etahistisomatchreco
HistoFillerReco< reco::RecoEcalCandidateCollection > * histoFillerPho
HistoFillerReco< reco::ElectronCollection > * histoFillerEle
virtual void setCurrentFolder(std::string const &fullpath)
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
std::vector< MonitorElement * > etahistiso
EmDQMReco(const edm::ParameterSet &pset)
Constructor.
std::vector< int > theHLTOutputTypes
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &triggerObj, const edm::Event &iEvent, unsigned int n, std::vector< reco::Particle > &sortedReco, bool plotReco, bool plotMonpath)
std::vector< edm::EDGetTokenT< edm::AssociationMap< edm::OneToValue< T, float > > > > isoNameTokens_
Log< level::Error, false > LogError
edm::EDGetTokenT< std::vector< reco::SuperCluster > > recoObjectsEET
std::vector< MonitorElement * > phiHistIsoMatchReco
std::vector< TPRegexp > filters
bool isHltConfigInitialized_
HLTConfigProvider hltConfig_
FourVectorMonitorElements(EmDQMReco *_parent, DQMStore::IBooker &iBooker, const std::string &histogramNameTemplate, const std::string &histogramTitleTemplate)
std::unique_ptr< FourVectorMonitorElements > histRecoMonpath
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::vector< std::unique_ptr< FourVectorMonitorElements > > histMatchRecoMonPath
std::vector< MonitorElement * > ethistiso
GreaterByPt< reco::Particle > pTComparator_
std::vector< std::string > theHLTCollectionHumanNames
unsigned int numOfHLTCollectionLabels
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
HistoFillerReco< l1extra::L1EmParticleCollection > * histoFillerL1Iso
MonitorElement * totalreco
std::vector< std::unique_ptr< FourVectorMonitorElements > > histHltObjMatchToReco
MonitorElement * etaMonitorElement
edm::EDGetTokenT< std::vector< reco::SuperCluster > > recoObjectsEBT
void analyze(const edm::Event &event, const edm::EventSetup &) override
MonitorElement * totalmatchreco
#define DEFINE_FWK_MODULE(type)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
std::vector< MonitorElement * > histPhiIsoOfHltObjMatchToReco
std::vector< MonitorElement * > phiHistIso
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
std::string triggerNameRecoMonPath
std::vector< bool > plotiso
edm::EDGetTokenT< reco::GsfElectronCollection > recoElectronsInput
bool useHumanReadableHistTitles
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerObjT
HistoFillerReco< l1extra::L1EmParticleCollection > * histoFillerL1NonIso
MonitorElement * phiMonitorElement
std::vector< MonitorElement * > ethistisomatchreco
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
std::vector< edm::InputTag > theHLTCollectionLabels
math::XYZTLorentzVector LorentzVector
Lorentz vector.
size_type size() const
number of filters
MonitorElement * etMonitorElement
std::vector< std::pair< double, double > > plotBounds
edm::EDGetTokenT< edm::TriggerResults > hltResultsT
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
std::vector< MonitorElement * > histEtaIsoOfHltObjMatchToReco
~EmDQMReco() override
Destructor.
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::string processNameRecoMonPath
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Power< A, B >::type pow(const A &a, const B &b)
std::unique_ptr< FourVectorMonitorElements > histMonpath
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
HistoFillerReco< reco::RecoEcalCandidateCollection > * histoFillerClu