File indexing completed on 2024-09-11 04:33:06
0001 #ifndef HLTriggerOffline_Egamma_EmDQMReco_H
0002 #define HLTriggerOffline_Egamma_EmDQMReco_H
0003
0004
0005 #include "CommonTools/Utils/interface/PtComparator.h"
0006 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0007 #include "DQMServices/Core/interface/DQMStore.h"
0008 #include "DataFormats/Common/interface/AssociationMap.h"
0009 #include "DataFormats/Common/interface/Handle.h"
0010 #include "DataFormats/Common/interface/RefToBase.h"
0011 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0012 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h"
0013 #include "DataFormats/HepMCCandidate/interface/GenParticle.h"
0014 #include "FWCore/Framework/interface/Event.h"
0015 #include "FWCore/Framework/interface/Frameworkfwd.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 #include "FWCore/Utilities/interface/InputTag.h"
0018 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0019 #include "HepMC/GenParticle.h"
0020 #include "TDirectory.h"
0021
0022 #include <memory>
0023 #include <vector>
0024
0025 class EmDQMReco;
0026
0027 template <class T>
0028 class HistoFillerReco {
0029 public:
0030 HistoFillerReco(EmDQMReco *d) : dqm(d) {}
0031 ~HistoFillerReco() {}
0032
0033 void fillHistos(edm::Handle<trigger::TriggerEventWithRefs> &triggerObj,
0034 const edm::Event &iEvent,
0035 unsigned int n,
0036 std::vector<reco::Particle> &sortedReco,
0037 bool plotReco,
0038 bool plotMonpath);
0039 std::vector<edm::EDGetTokenT<edm::AssociationMap<edm::OneToValue<T, float>>>> isoNameTokens_;
0040
0041 private:
0042 EmDQMReco *dqm;
0043 };
0044
0045 class EmDQMReco : public DQMEDAnalyzer {
0046
0047
0048
0049
0050
0051 class FourVectorMonitorElements {
0052 public:
0053
0054
0055
0056
0057
0058
0059
0060
0061 FourVectorMonitorElements(EmDQMReco *_parent,
0062 DQMStore::IBooker &iBooker,
0063 const std::string &histogramNameTemplate,
0064 const std::string &histogramTitleTemplate);
0065
0066 void fill(const math::XYZTLorentzVector &momentum);
0067
0068 private:
0069
0070 EmDQMReco *parent;
0071
0072
0073 MonitorElement *etMonitorElement;
0074 MonitorElement *etaMonitorElement;
0075 MonitorElement *phiMonitorElement;
0076 };
0077
0078
0079 public:
0080 friend class HistoFillerReco<reco::ElectronCollection>;
0081 friend class HistoFillerReco<reco::RecoEcalCandidateCollection>;
0082 friend class HistoFillerReco<l1extra::L1EmParticleCollection>;
0083
0084
0085 explicit EmDQMReco(const edm::ParameterSet &pset);
0086
0087
0088 ~EmDQMReco() override;
0089
0090
0091 void analyze(const edm::Event &event, const edm::EventSetup &) override;
0092 void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override;
0093 void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0094
0095 private:
0096
0097
0098
0099 std::vector<edm::InputTag> theHLTCollectionLabels;
0100
0101 unsigned int numOfHLTCollectionLabels;
0102
0103 bool useHumanReadableHistTitles;
0104 std::vector<std::string> theHLTCollectionHumanNames;
0105
0106 std::vector<int> theHLTOutputTypes;
0107 std::vector<bool> plotiso;
0108 std::vector<std::vector<edm::InputTag>> isoNames;
0109 std::vector<std::pair<double, double>> plotBounds;
0110 std::string theHltName;
0111 HLTConfigProvider hltConfig_;
0112 bool isHltConfigInitialized_;
0113
0114
0115
0116
0117
0118 unsigned int reqNum;
0119 int pdgGen;
0120 double recoEtaAcc;
0121 double recoEtAcc;
0122
0123 double plotEtaMax;
0124 double plotPtMin;
0125 double plotPtMax;
0126 double plotPhiMax;
0127
0128
0129 unsigned int plotBins;
0130
0131
0132
0133 unsigned int recocut_;
0134
0135
0136
0137 std::string triggerNameRecoMonPath;
0138
0139
0140
0141
0142 std::string processNameRecoMonPath;
0143
0144
0145
0146
0147 edm::EDGetTokenT<reco::GsfElectronCollection> recoElectronsInput;
0148 edm::EDGetTokenT<std::vector<reco::SuperCluster>> recoObjectsEBT;
0149 edm::EDGetTokenT<std::vector<reco::SuperCluster>> recoObjectsEET;
0150 edm::EDGetTokenT<edm::TriggerResults> hltResultsT;
0151 edm::EDGetTokenT<trigger::TriggerEventWithRefs> triggerObjT;
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162 std::vector<std::unique_ptr<FourVectorMonitorElements>> standardHist;
0163
0164
0165
0166
0167 std::vector<std::unique_ptr<FourVectorMonitorElements>> histMatchReco;
0168
0169
0170
0171
0172 std::vector<std::unique_ptr<FourVectorMonitorElements>> histMatchRecoMonPath;
0173
0174
0175
0176
0177 std::vector<std::unique_ptr<FourVectorMonitorElements>> histHltObjMatchToReco;
0178
0179
0180
0181
0182
0183 std::vector<MonitorElement *> etahistiso;
0184 std::vector<MonitorElement *> ethistiso;
0185 std::vector<MonitorElement *> phiHistIso;
0186
0187 std::vector<MonitorElement *> etahistisomatchreco;
0188 std::vector<MonitorElement *> ethistisomatchreco;
0189 std::vector<MonitorElement *> phiHistIsoMatchReco;
0190
0191 std::vector<MonitorElement *> histEtIsoOfHltObjMatchToReco;
0192 std::vector<MonitorElement *> histEtaIsoOfHltObjMatchToReco;
0193 std::vector<MonitorElement *> histPhiIsoOfHltObjMatchToReco;
0194
0195
0196
0197
0198 MonitorElement *totalreco;
0199 MonitorElement *totalmatchreco;
0200
0201
0202
0203
0204
0205
0206 std::unique_ptr<FourVectorMonitorElements> histReco;
0207
0208
0209
0210
0211 std::unique_ptr<FourVectorMonitorElements> histRecoMonpath;
0212
0213
0214
0215
0216 std::unique_ptr<FourVectorMonitorElements> histMonpath;
0217
0218
0219 int eventnum;
0220
0221
0222
0223 std::string dirname_;
0224
0225 HistoFillerReco<reco::ElectronCollection> *histoFillerEle;
0226 HistoFillerReco<reco::RecoEcalCandidateCollection> *histoFillerClu;
0227 HistoFillerReco<l1extra::L1EmParticleCollection> *histoFillerL1NonIso;
0228 HistoFillerReco<reco::RecoEcalCandidateCollection> *histoFillerPho;
0229 HistoFillerReco<l1extra::L1EmParticleCollection> *histoFillerL1Iso;
0230
0231
0232
0233
0234 GreaterByPt<reco::Particle> pTComparator_;
0235 GreaterByPt<reco::GsfElectron> pTRecoComparator_;
0236
0237
0238 };
0239 #endif