File indexing completed on 2024-09-11 04:32:51
0001 #ifndef HLTInclusiveVBFSource_H
0002 #define HLTInclusiveVBFSource_H
0003
0004
0005 #include <memory>
0006 #include <unistd.h>
0007
0008
0009 #include "FWCore/Common/interface/TriggerNames.h"
0010 #include "FWCore/Framework/interface/Frameworkfwd.h"
0011 #include "FWCore/Framework/interface/Event.h"
0012 #include "FWCore/Framework/interface/MakerMacros.h"
0013 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015
0016 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0017
0018 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0019 #include "DQMServices/Core/interface/DQMStore.h"
0020
0021 #include "DataFormats/Common/interface/TriggerResults.h"
0022 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0023 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0024 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
0025 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
0026 #include "DataFormats/METReco/interface/CaloMETCollection.h"
0027 #include "DataFormats/METReco/interface/CaloMET.h"
0028 #include "DataFormats/JetReco/interface/CaloJet.h"
0029 #include "DataFormats/JetReco/interface/Jet.h"
0030 #include "DataFormats/JetReco/interface/PFJetCollection.h"
0031 #include "DataFormats/JetReco/interface/PFJet.h"
0032 #include "DataFormats/METReco/interface/PFMETCollection.h"
0033 #include "DataFormats/METReco/interface/PFMET.h"
0034 #include "DataFormats/Math/interface/deltaR.h"
0035 #include "DataFormats/Math/interface/deltaPhi.h"
0036 #include "DataFormats/VertexReco/interface/Vertex.h"
0037 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0038
0039
0040
0041 #include <iostream>
0042 #include <fstream>
0043 #include <utility>
0044 #include <vector>
0045 #include <string>
0046
0047 class HLTInclusiveVBFSource : public DQMEDAnalyzer {
0048 public:
0049 explicit HLTInclusiveVBFSource(const edm::ParameterSet&);
0050 ~HLTInclusiveVBFSource() override;
0051
0052 void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0053 void analyze(const edm::Event&, const edm::EventSetup&) override;
0054
0055 private:
0056 virtual bool isBarrel(double eta);
0057 virtual bool isEndCap(double eta);
0058 virtual bool isForward(double eta);
0059 virtual bool validPathHLT(std::string path);
0060 virtual bool isHLTPathAccepted(std::string pathName);
0061 virtual bool isTriggerObjectFound(std::string objectName);
0062
0063
0064
0065 int nCount_;
0066
0067 std::vector<int> prescUsed_;
0068
0069 std::string dirname_;
0070 std::string processname_;
0071
0072 std::vector<std::string> path_;
0073
0074 bool debug_;
0075
0076 double minPtHigh_;
0077 double minPtLow_;
0078 double minDeltaEta_;
0079 double minInvMass_;
0080 double deltaRMatch_;
0081 bool etaOpposite_;
0082
0083 edm::InputTag triggerSummaryLabel_;
0084 edm::Handle<trigger::TriggerEvent> triggerObj_;
0085 edm::InputTag triggerResultsLabel_;
0086 edm::Handle<edm::TriggerResults> triggerResults_;
0087 edm::TriggerNames triggerNames_;
0088
0089 edm::EDGetTokenT<edm::TriggerResults> triggerResultsToken;
0090 edm::EDGetTokenT<edm::TriggerResults> triggerResultsFUToken;
0091 edm::EDGetTokenT<trigger::TriggerEvent> triggerSummaryToken;
0092 edm::EDGetTokenT<trigger::TriggerEvent> triggerSummaryFUToken;
0093
0094 edm::EDGetTokenT<edm::View<reco::PFJet> > pfJetsToken;
0095 edm::EDGetTokenT<edm::View<reco::PFMET> > pfMetToken;
0096 edm::EDGetTokenT<reco::CaloJetCollection> caloJetsToken;
0097 edm::EDGetTokenT<reco::CaloMETCollection> caloMetToken;
0098
0099 edm::Handle<reco::CaloJetCollection> calojetColl_;
0100 edm::Handle<reco::CaloMETCollection> calometColl_;
0101 edm::Handle<reco::PFJetCollection> pfjetColl_;
0102 edm::Handle<reco::PFMETCollection> pfmetColl_;
0103
0104 reco::CaloJetCollection calojet;
0105 reco::PFJetCollection pfjet;
0106 HLTConfigProvider hltConfig_;
0107
0108 bool check_mjj650_Pt35_DEta3p5;
0109 bool check_mjj700_Pt35_DEta3p5;
0110 bool check_mjj750_Pt35_DEta3p5;
0111 bool check_mjj800_Pt35_DEta3p5;
0112 bool check_mjj650_Pt40_DEta3p5;
0113 bool check_mjj700_Pt40_DEta3p5;
0114 bool check_mjj750_Pt40_DEta3p5;
0115 bool check_mjj800_Pt40_DEta3p5;
0116
0117 std::string pathname;
0118 std::string filtername;
0119
0120 double reco_ejet1;
0121
0122 double reco_pxjet1;
0123 double reco_pyjet1;
0124 double reco_pzjet1;
0125 double reco_ptjet1;
0126 double reco_etajet1;
0127 double reco_phijet1;
0128
0129 double reco_ejet2;
0130
0131 double reco_pxjet2;
0132 double reco_pyjet2;
0133 double reco_pzjet2;
0134 double reco_ptjet2;
0135 double reco_etajet2;
0136 double reco_phijet2;
0137
0138 double hlt_ejet1;
0139
0140 double hlt_pxjet1;
0141 double hlt_pyjet1;
0142 double hlt_pzjet1;
0143 double hlt_ptjet1;
0144 double hlt_etajet1;
0145 double hlt_phijet1;
0146
0147 double hlt_ejet2;
0148
0149 double hlt_pxjet2;
0150 double hlt_pyjet2;
0151 double hlt_pzjet2;
0152 double hlt_ptjet2;
0153 double hlt_etajet2;
0154 double hlt_phijet2;
0155
0156 bool checkOffline;
0157 bool checkHLT;
0158 bool checkHLTIndex;
0159
0160 float dR_HLT_RECO_11;
0161 float dR_HLT_RECO_22;
0162 float dR_HLT_RECO_12;
0163 float dR_HLT_RECO_21;
0164 bool checkdR_sameOrder;
0165 bool checkdR_crossOrder;
0166
0167 double reco_deltaetajet;
0168 double reco_deltaphijet;
0169 double reco_invmassjet;
0170 double hlt_deltaetajet;
0171 double hlt_deltaphijet;
0172 double hlt_invmassjet;
0173
0174
0175
0176 class PathInfo {
0177 PathInfo()
0178 : prescaleUsed_(-1),
0179 pathName_("unset"),
0180 filterName_("unset"),
0181 processName_("unset"),
0182 objectType_(-1),
0183 triggerType_("unset") {}
0184
0185 public:
0186
0187 void setHistos(MonitorElement* const RECO_deltaEta_DiJet,
0188 MonitorElement* const RECO_deltaPhi_DiJet,
0189 MonitorElement* const RECO_invMass_DiJet,
0190 MonitorElement* const HLT_deltaEta_DiJet,
0191 MonitorElement* const HLT_deltaPhi_DiJet,
0192 MonitorElement* const HLT_invMass_DiJet,
0193 MonitorElement* const RECO_deltaEta_DiJet_Match,
0194 MonitorElement* const RECO_deltaPhi_DiJet_Match,
0195 MonitorElement* const RECO_invMass_DiJet_Match,
0196 MonitorElement* const RECOHLT_deltaEta,
0197 MonitorElement* const RECOHLT_deltaPhi,
0198 MonitorElement* const RECOHLT_invMass,
0199 MonitorElement* const NumberOfMatches,
0200 MonitorElement* const NumberOfEvents) {
0201 RECO_deltaEta_DiJet_ = RECO_deltaEta_DiJet;
0202 RECO_deltaPhi_DiJet_ = RECO_deltaPhi_DiJet;
0203 RECO_invMass_DiJet_ = RECO_invMass_DiJet;
0204 HLT_deltaEta_DiJet_ = HLT_deltaEta_DiJet;
0205 HLT_deltaPhi_DiJet_ = HLT_deltaPhi_DiJet;
0206 HLT_invMass_DiJet_ = HLT_invMass_DiJet;
0207 RECO_deltaEta_DiJet_Match_ = RECO_deltaEta_DiJet_Match;
0208 RECO_deltaPhi_DiJet_Match_ = RECO_deltaPhi_DiJet_Match;
0209 RECO_invMass_DiJet_Match_ = RECO_invMass_DiJet_Match;
0210 RECOHLT_deltaEta_ = RECOHLT_deltaEta;
0211 RECOHLT_deltaPhi_ = RECOHLT_deltaPhi;
0212 RECOHLT_invMass_ = RECOHLT_invMass;
0213 NumberOfMatches_ = NumberOfMatches;
0214 NumberOfEvents_ = NumberOfEvents;
0215 };
0216 ~PathInfo() = default;
0217 ;
0218 PathInfo(int prescaleUsed,
0219 std::string pathName,
0220 std::string filterName,
0221 std::string processName,
0222 size_t type,
0223 std::string triggerType)
0224 : prescaleUsed_(prescaleUsed),
0225 pathName_(std::move(pathName)),
0226 filterName_(std::move(filterName)),
0227 processName_(std::move(processName)),
0228 objectType_(type),
0229 triggerType_(std::move(triggerType)) {}
0230
0231 MonitorElement* getMEhisto_RECO_deltaEta_DiJet() { return RECO_deltaEta_DiJet_; }
0232 MonitorElement* getMEhisto_RECO_deltaPhi_DiJet() { return RECO_deltaPhi_DiJet_; }
0233 MonitorElement* getMEhisto_RECO_invMass_DiJet() { return RECO_invMass_DiJet_; }
0234 MonitorElement* getMEhisto_HLT_deltaEta_DiJet() { return HLT_deltaEta_DiJet_; }
0235 MonitorElement* getMEhisto_HLT_deltaPhi_DiJet() { return HLT_deltaPhi_DiJet_; }
0236 MonitorElement* getMEhisto_HLT_invMass_DiJet() { return HLT_invMass_DiJet_; }
0237 MonitorElement* getMEhisto_RECO_deltaEta_DiJet_Match() { return RECO_deltaEta_DiJet_Match_; }
0238 MonitorElement* getMEhisto_RECO_deltaPhi_DiJet_Match() { return RECO_deltaPhi_DiJet_Match_; }
0239 MonitorElement* getMEhisto_RECO_invMass_DiJet_Match() { return RECO_invMass_DiJet_Match_; }
0240 MonitorElement* getMEhisto_RECOHLT_deltaEta() { return RECOHLT_deltaEta_; }
0241 MonitorElement* getMEhisto_RECOHLT_deltaPhi() { return RECOHLT_deltaPhi_; }
0242 MonitorElement* getMEhisto_RECOHLT_invMass() { return RECOHLT_invMass_; }
0243 MonitorElement* getMEhisto_NumberOfMatches() { return NumberOfMatches_; }
0244 MonitorElement* getMEhisto_NumberOfEvents() { return NumberOfEvents_; }
0245
0246 const std::string getLabel() const { return filterName_; }
0247 void setLabel(std::string labelName) {
0248 filterName_ = std::move(labelName);
0249 return;
0250 }
0251 const std::string getPath() const { return pathName_; }
0252 const int getprescaleUsed() const { return prescaleUsed_; }
0253 const std::string getProcess() const { return processName_; }
0254 const int getObjectType() const { return objectType_; }
0255 const std::string getTriggerType() const { return triggerType_; }
0256 const edm::InputTag getTag() const {
0257 edm::InputTag tagName(filterName_, "", processName_);
0258 return tagName;
0259 }
0260 bool operator==(const std::string& v) { return v == pathName_; }
0261
0262 private:
0263 int prescaleUsed_;
0264 std::string pathName_;
0265 std::string filterName_;
0266 std::string processName_;
0267 int objectType_;
0268 std::string triggerType_;
0269
0270 MonitorElement* RECO_deltaEta_DiJet_;
0271 MonitorElement* RECO_deltaPhi_DiJet_;
0272 MonitorElement* RECO_invMass_DiJet_;
0273 MonitorElement* HLT_deltaEta_DiJet_;
0274 MonitorElement* HLT_deltaPhi_DiJet_;
0275 MonitorElement* HLT_invMass_DiJet_;
0276 MonitorElement* RECO_deltaEta_DiJet_Match_;
0277 MonitorElement* RECO_deltaPhi_DiJet_Match_;
0278 MonitorElement* RECO_invMass_DiJet_Match_;
0279 MonitorElement* RECOHLT_deltaEta_;
0280 MonitorElement* RECOHLT_deltaPhi_;
0281 MonitorElement* RECOHLT_invMass_;
0282 MonitorElement* NumberOfMatches_;
0283 MonitorElement* NumberOfEvents_;
0284 };
0285
0286
0287 class PathInfoCollection : public std::vector<PathInfo> {
0288 public:
0289 PathInfoCollection() : std::vector<PathInfo>() {}
0290 std::vector<PathInfo>::iterator find(const std::string& pathName) { return std::find(begin(), end(), pathName); }
0291 };
0292 PathInfoCollection hltPathsAll_;
0293 };
0294 #endif