33 #include <boost/format.hpp> 37 #include "TDirectory.h" 40 #include <Math/VectorUtil.h> 115 consumes<std::vector<reco::SuperCluster>>(
edm::InputTag(
"correctedMulti5x5SuperClustersWithPreshower"));
133 std::vector<edm::ParameterSet>
filters = pset.
getParameter<std::vector<edm::ParameterSet>>(
"filters");
136 for (std::vector<edm::ParameterSet>::iterator filterconf = filters.begin(); filterconf != filters.end();
145 std::vector<double> bounds = filterconf->getParameter<std::vector<double>>(
"PlotBounds");
147 assert(bounds.size() == 2);
148 plotBounds.push_back(std::pair<double, double>(bounds[0], bounds[1]));
149 isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag>>(
"IsoCollections"));
151 for (
unsigned int i = 0; i <
isoNames.back().size(); i++) {
178 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]");
184 if (
isoNames.back().at(0).label() ==
"none") {
200 bool isHltConfigChanged =
false;
229 histName =
"total_eff_RECO_matched";
230 histTitle =
"total events passing (Reco matched)";
232 histName.c_str(), histTitle.c_str(), numOfHLTCollectionLabels + 2, 0, numOfHLTCollectionLabels + 2);
248 pdgIdString =
"Electron";
251 pdgIdString =
"Photon";
254 pdgIdString =
"Particle";
264 "%s of " + pdgIdString +
"s"));
272 "%s of " + pdgIdString +
"s monpath"));
281 "Final %s Monpath"));
290 std::vector<std::string> HltHistTitle;
329 HltHistTitle[
i] +
" %s (ALL)" 360 HltHistTitle[
i] +
" %s (RECO matched)" 394 HltHistTitle[
i] +
" %s (RECO matched, monpath)" 426 HltHistTitle[
i] +
" %s (reco)" 452 histTitle = HltHistTitle[
i] +
" isolation vs #eta (all)";
453 tmpiso = iBooker.
book2D(histName.c_str(),
465 histTitle = HltHistTitle[
i] +
" isolation vs Et (all)";
466 tmpiso = iBooker.
book2D(histName.c_str(),
478 histTitle = HltHistTitle[
i] +
" isolation vs #phi (all)";
479 tmpiso = iBooker.
book2D(histName.c_str(),
495 histTitle = HltHistTitle[
i] +
" isolation vs #eta (reco matched)";
496 tmpiso = iBooker.
book2D(histName.c_str(),
508 histTitle = HltHistTitle[
i] +
" isolation vs Et (reco matched)";
509 tmpiso = iBooker.
book2D(histName.c_str(),
521 histTitle = HltHistTitle[
i] +
" isolation vs #phi (reco matched)";
522 tmpiso = iBooker.
book2D(histName.c_str(),
539 histTitle = HltHistTitle[
i] +
" isolation vs #eta (reco)";
540 tmpiso = iBooker.
book2D(histName.c_str(),
552 histTitle = HltHistTitle[
i] +
" isolation vs Et (reco)";
553 tmpiso = iBooker.
book2D(histName.c_str(),
565 histTitle = HltHistTitle[
i] +
" isolation vs #phi (reco)";
566 tmpiso = iBooker.
book2D(histName.c_str(),
595 bool plotMonpath =
false;
596 bool plotReco =
true;
605 if (recoObjects->size() < (
unsigned int)
recocut_) {
611 }
else if (
pdgGen == 22) {
615 if (recoObjectsEB->size() + recoObjectsEE->size() < (
unsigned int)
recocut_) {
641 unsigned int triggerIndex;
645 bool isFired =
false;
646 if (triggerIndex < HLTR->
size()) {
647 isFired = HLTR->
accept(triggerIndex);
656 edm::LogWarning(
"EmDQMReco") <<
"RAW-type HLT results not found, skipping event";
680 std::vector<reco::Particle> sortedReco;
681 if (plotReco ==
true) {
686 recopart->charge(), recopart->p4(), recopart->vertex(), recopart->pdgId(), recopart->status());
687 sortedReco.push_back(tmpcand);
689 }
else if (
pdgGen == 22) {
690 for (std::vector<reco::SuperCluster>::const_iterator recopart2 = recoObjectsEB->begin();
691 recopart2 != recoObjectsEB->end();
693 float en = recopart2->
energy();
694 float er =
sqrt(
pow(recopart2->x(), 2) +
pow(recopart2->y(), 2) +
pow(recopart2->z(), 2));
695 float px = recopart2->energy() * recopart2->x() / er;
696 float py = recopart2->energy() * recopart2->y() / er;
697 float pz = recopart2->energy() * recopart2->z() / er;
700 sortedReco.push_back(tmpcand);
702 for (std::vector<reco::SuperCluster>::const_iterator recopart2 = recoObjectsEE->begin();
703 recopart2 != recoObjectsEE->end();
705 float en = recopart2->energy();
706 float er =
sqrt(
pow(recopart2->x(), 2) +
pow(recopart2->y(), 2) +
pow(recopart2->z(), 2));
707 float px = recopart2->energy() * recopart2->x() / er;
708 float py = recopart2->energy() * recopart2->y() / er;
709 float pz = recopart2->energy() * recopart2->z() / er;
712 sortedReco.push_back(tmpcand);
716 std::sort(sortedReco.begin(), sortedReco.end(),
pTComparator_);
722 sortedReco.erase(sortedReco.begin() +
recocut_, sortedReco.end());
768 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]");
781 std::vector<reco::Particle> &sortedReco,
784 std::vector<edm::Ref<T>> recoecalcands;
785 if ((triggerObj->
filterIndex(
dqm->theHLTCollectionLabels[n]) >= triggerObj->
size())) {
793 triggerObj->
filterIndex(
dqm->theHLTCollectionLabels[n]),
dqm->theHLTOutputTypes[
n], recoecalcands);
797 std::vector<edm::Ref<T>> isocands;
799 if (!isocands.empty()) {
800 for (
unsigned int i = 0;
i < isocands.size();
i++)
801 recoecalcands.push_back(isocands[
i]);
805 if (recoecalcands.empty()) {
809 if (recoecalcands.size() >=
dqm->reqNum)
810 dqm->totalreco->Fill(n + 0.5);
816 for (
unsigned int j = 0; j < recoecalcands.size(); j++) {
817 if (!(recoecalcands.at(j).isAvailable())) {
818 edm::LogError(
"EmDQMReco") <<
"Event content inconsistent: TriggerEventWithRefs contains " 821 <<
"invalid refs for: " <<
dqm->theHLTCollectionLabels[
n].label();
832 for (
unsigned int i = 0;
i < recoecalcands.size();
i++) {
833 dqm->standardHist[
n].fill(recoecalcands[
i]->
p4());
839 if (n + 1 <
dqm->numOfHLTCollectionLabels) {
840 if (
dqm->plotiso[n + 1]) {
847 depMap->find(recoecalcands[
i]);
848 if (mapi != depMap->end()) {
849 dqm->etahistiso[n + 1]->Fill(recoecalcands[i]->
eta(), mapi->val);
850 dqm->ethistiso[n + 1]->Fill(recoecalcands[i]->
et(), mapi->val);
851 dqm->phiHistIso[n + 1]->Fill(recoecalcands[i]->
phi(), mapi->val);
863 if (plotReco ==
true) {
864 for (
unsigned int i = 0;
i <
dqm->recocut_;
i++) {
868 float closestRecoDeltaR = 1000.;
869 int closestRecoEcalCandIndex = -1;
870 for (
unsigned int j = 0; j < recoecalcands.size(); j++) {
871 float deltaR =
DeltaR(recoecalcands[j]->momentum(), currentRecoParticleMomentum);
873 if (deltaR < closestRecoDeltaR) {
874 closestRecoDeltaR =
deltaR;
875 closestRecoEcalCandIndex = j;
881 if (closestRecoEcalCandIndex >= 0) {
889 dqm->histHltObjMatchToReco[
n].fill(recoecalcands[closestRecoEcalCandIndex]->
p4());
892 if (n + 1 <
dqm->numOfHLTCollectionLabels) {
893 if (
dqm->plotiso[n + 1]) {
900 depMap->find(recoecalcands[closestRecoEcalCandIndex]);
901 if (mapi != depMap->end()) {
902 dqm->histEtaIsoOfHltObjMatchToReco[n + 1]->Fill(recoecalcands[closestRecoEcalCandIndex]->
eta(),
904 dqm->histEtIsoOfHltObjMatchToReco[n + 1]->Fill(recoecalcands[closestRecoEcalCandIndex]->
et(),
906 dqm->histPhiIsoOfHltObjMatchToReco[n + 1]->Fill(recoecalcands[closestRecoEcalCandIndex]->
phi(),
919 unsigned int mtachedRecoParts = 0;
920 float minrecodist = 0.3;
923 for (
unsigned int i = 0;
i <
dqm->recocut_;
i++) {
925 bool matchThis =
false;
927 unsigned int closest = 0;
928 double closestDr = 1000.;
929 for (
unsigned int trigOb = 0; trigOb < recoecalcands.size(); trigOb++) {
930 double dr =
DeltaR(recoecalcands[trigOb]->momentum(), candDir);
931 if (dr < closestDr) {
935 if (closestDr > minrecodist) {
948 dqm->histMatchReco[
n].fill(sortedReco[
i].
p4());
954 dqm->histMatchRecoMonPath[
n].fill(sortedReco[
i].
p4());
960 if (n + 1 <
dqm->numOfHLTCollectionLabels) {
961 if (
dqm->plotiso[n + 1]) {
968 depMapReco->find(recoecalcands[closest]);
969 if (mapi != depMapReco->end()) {
970 dqm->etahistisomatchreco[n + 1]->Fill(sortedReco[
i].
eta(), mapi->val);
971 dqm->ethistisomatchreco[n + 1]->Fill(sortedReco[
i].
et(), mapi->val);
972 dqm->phiHistIsoMatchReco[n + 1]->Fill(sortedReco[
i].
eta(), mapi->val);
980 if (mtachedRecoParts >=
dqm->reqNum)
981 dqm->totalmatchreco->Fill(n + 0.5);
std::vector< MonitorElement * > histEtIsoOfHltObjMatchToReco
void fill(const math::XYZTLorentzVector &momentum)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
boost::ptr_vector< FourVectorMonitorElements > standardHist
std::vector< std::vector< edm::InputTag > > isoNames
double energy() const
energy
std::vector< MonitorElement * > etahistisomatchreco
HistoFillerReco< reco::RecoEcalCandidateCollection > * histoFillerPho
HistoFillerReco< reco::ElectronCollection > * histoFillerEle
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
boost::ptr_vector< FourVectorMonitorElements > histMatchReco
bool accept() const
Has at least one path accepted the event?
std::vector< MonitorElement * > etahistiso
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)
EmDQMReco(const edm::ParameterSet &pset)
Constructor.
def setup(process, global_tag, zero_tesla=False)
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_
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)
unsigned int triggerIndex(const std::string &triggerName) const
slot position of trigger path in trigger table (0 to size-1)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
boost::ptr_vector< FourVectorMonitorElements > histMatchRecoMonPath
std::vector< MonitorElement * > ethistiso
GreaterByPt< reco::Particle > pTComparator_
#define DEFINE_FWK_MODULE(type)
std::vector< std::string > theHLTCollectionHumanNames
void setCurrentFolder(std::string const &fullpath)
unsigned int numOfHLTCollectionLabels
HistoFillerReco< l1extra::L1EmParticleCollection > * histoFillerL1Iso
MonitorElement * totalreco
MonitorElement * etaMonitorElement
edm::EDGetTokenT< std::vector< reco::SuperCluster > > recoObjectsEBT
MonitorElement * book1D(Args &&...args)
void analyze(const edm::Event &event, const edm::EventSetup &) override
MonitorElement * totalmatchreco
format
Some error handling for the usage.
std::vector< MonitorElement * > histPhiIsoOfHltObjMatchToReco
std::vector< MonitorElement * > phiHistIso
std::string triggerNameRecoMonPath
std::vector< bool > plotiso
edm::EDGetTokenT< reco::GsfElectronCollection > recoElectronsInput
bool useHumanReadableHistTitles
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
edm::EDGetTokenT< trigger::TriggerEventWithRefs > triggerObjT
HistoFillerReco< l1extra::L1EmParticleCollection > * histoFillerL1NonIso
MonitorElement * phiMonitorElement
boost::scoped_ptr< FourVectorMonitorElements > histRecoMonpath
boost::scoped_ptr< FourVectorMonitorElements > histMonpath
MonitorElement * book2D(Args &&...args)
std::vector< MonitorElement * > ethistisomatchreco
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
size_type size() const
number of filters
std::vector< edm::InputTag > theHLTCollectionLabels
et
define resolution functions of each parameter
math::XYZTLorentzVector LorentzVector
Lorentz vector.
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
boost::ptr_vector< FourVectorMonitorElements > histHltObjMatchToReco
~EmDQMReco() override
Destructor.
std::string processNameRecoMonPath
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
boost::scoped_ptr< FourVectorMonitorElements > histReco
Power< A, B >::type pow(const A &a, const B &b)
HistoFillerReco< reco::RecoEcalCandidateCollection > * histoFillerClu