File indexing completed on 2024-04-06 12:09:26
0001 #ifndef METAnalyzer_H
0002 #define METAnalyzer_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #include <memory>
0019 #include <fstream>
0020 #include "TMath.h"
0021 #include "FWCore/Framework/interface/Frameworkfwd.h"
0022 #include "FWCore/Framework/interface/ConsumesCollector.h"
0023 #include "FWCore/Framework/interface/Event.h"
0024 #include "FWCore/Framework/interface/MakerMacros.h"
0025 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0026 #include "DQMServices/Core/interface/DQMStore.h"
0027
0028 #include "CommonTools/TriggerUtils/interface/GenericTriggerEventFlag.h"
0029
0030 #include "DataFormats/JetReco/interface/Jet.h"
0031 #include "DataFormats/JetReco/interface/CaloJet.h"
0032 #include "DataFormats/JetReco/interface/JPTJet.h"
0033 #include "DataFormats/JetReco/interface/PFJet.h"
0034 #include "DataFormats/HLTReco/interface/TriggerObject.h"
0035 #include "DataFormats/Common/interface/TriggerResults.h"
0036 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
0037 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
0038
0039 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
0040
0041 #include "RecoMET/METAlgorithms/interface/HcalNoiseRBXArray.h"
0042 #include "DataFormats/METReco/interface/BeamHaloSummary.h"
0043 #include "RecoJets/JetProducers/interface/JetIDHelper.h"
0044
0045 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
0046 #include "DataFormats/Common/interface/ValueMap.h"
0047 #include "DataFormats/MuonReco/interface/Muon.h"
0048 #include "DataFormats/MuonReco/interface/MuonFwd.h"
0049 #include "DataFormats/MuonReco/interface/MuonMETCorrectionData.h"
0050 #include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
0051 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0052 #include "DataFormats/TrackReco/interface/Track.h"
0053 #include "DataFormats/JetReco/interface/PFJet.h"
0054 #include "DataFormats/ParticleFlowReco/interface/PFBlock.h"
0055 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h"
0056 #include "DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h"
0057 #include "DataFormats/ParticleFlowReco/interface/PFCluster.h"
0058
0059 #include "DataFormats/METReco/interface/MET.h"
0060 #include "DataFormats/METReco/interface/METFwd.h"
0061 #include "DataFormats/METReco/interface/PFMET.h"
0062 #include "DataFormats/METReco/interface/PFMETCollection.h"
0063 #include "DataFormats/METReco/interface/CaloMETCollection.h"
0064 #include "DataFormats/METReco/interface/METCollection.h"
0065 #include "DataFormats/PatCandidates/interface/MET.h"
0066 #include "DataFormats/PatCandidates/interface/Jet.h"
0067
0068 #include "DataFormats/VertexReco/interface/Vertex.h"
0069 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0070
0071 #include "DQMOffline/JetMET/interface/JetMETDQMDCSFilter.h"
0072 #include "PhysicsTools/SelectorUtils/interface/JetIDSelectionFunctor.h"
0073 #include "PhysicsTools/SelectorUtils/interface/PFJetIDSelectionFunctor.h"
0074 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0075 #include "DataFormats/MuonReco/interface/Muon.h"
0076
0077 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenuFwd.h"
0078 #include "CondFormats/L1TObjects/interface/L1GtTriggerMenu.h"
0079 #include "CondFormats/DataRecord/interface/L1GtTriggerMenuRcd.h"
0080 #include "FWCore/Framework/interface/ESHandle.h"
0081 #include "JetMETCorrections/JetCorrector/interface/JetCorrector.h"
0082 #include "DataFormats/PatCandidates/interface/PackedCandidate.h"
0083
0084 #include <map>
0085 #include <string>
0086
0087 class METAnalyzer : public DQMOneEDAnalyzer<> {
0088 public:
0089
0090 METAnalyzer(const edm::ParameterSet&);
0091
0092
0093 ~METAnalyzer() override;
0094
0095
0096
0097 void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0098
0099
0100
0101
0102
0103
0104 void analyze(const edm::Event&, const edm::EventSetup&) override;
0105
0106
0107 void dqmBeginRun(const edm::Run&, const edm::EventSetup&) override;
0108
0109
0110 void dqmEndRun(const edm::Run& iRun, const edm::EventSetup& iSetup) override;
0111
0112
0113 void fillMESet(const edm::Event&,
0114 std::string,
0115 const reco::MET&,
0116 const pat::MET*,
0117 const reco::PFMET*,
0118 const reco::CaloMET*,
0119 const reco::Candidate::PolarLorentzVector&,
0120 std::map<std::string, MonitorElement*>&,
0121 std::vector<bool>,
0122 std::vector<bool>);
0123 void fillMonitorElement(const edm::Event&,
0124 std::string,
0125 std::string,
0126 const reco::MET&,
0127 const pat::MET*,
0128 const reco::PFMET*,
0129 const reco::CaloMET*,
0130 const reco::Candidate::PolarLorentzVector&,
0131 std::map<std::string, MonitorElement*>&,
0132 bool,
0133 bool,
0134 std::vector<bool>,
0135 std::vector<bool>);
0136 void makeRatePlot(std::string, double);
0137
0138
0139
0140
0141
0142
0143 private:
0144
0145 void bookMESet(std::string, DQMStore::IBooker&, std::map<std::string, MonitorElement*>&);
0146
0147 void bookMonitorElement(std::string, DQMStore::IBooker&, std::map<std::string, MonitorElement*>&, bool, bool, bool);
0148
0149
0150 edm::ParameterSet parameters;
0151
0152 int verbose_;
0153
0154 std::string MetType_;
0155 std::string FolderName_;
0156
0157 edm::InputTag metCollectionLabel_;
0158 edm::InputTag hcalNoiseRBXCollectionTag_;
0159 edm::InputTag jetCollectionLabel_;
0160 edm::InputTag vertexTag_;
0161 edm::InputTag gtTag_;
0162
0163 edm::EDGetTokenT<std::vector<reco::Vertex>> vertexToken_;
0164 edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> gtToken_;
0165 edm::EDGetTokenT<reco::CaloJetCollection> caloJetsToken_;
0166 edm::EDGetTokenT<reco::PFJetCollection> pfJetsToken_;
0167 edm::EDGetTokenT<pat::JetCollection> patJetsToken_;
0168 edm::EDGetTokenT<reco::MuonCollection> MuonsToken_;
0169
0170 edm::InputTag METFilterMiniAODLabel_;
0171 edm::EDGetTokenT<edm::TriggerResults> METFilterMiniAODToken_;
0172 edm::InputTag METFilterMiniAODLabel2_;
0173 edm::EDGetTokenT<edm::TriggerResults> METFilterMiniAODToken2_;
0174
0175 std::vector<int> miniaodFilterIndex_;
0176 int miniaodfilterdec;
0177
0178 edm::InputTag hbheNoiseFilterResultTag_;
0179 edm::EDGetTokenT<bool> hbheNoiseFilterResultToken_;
0180 edm::InputTag hbheNoiseIsoFilterResultTag_;
0181 edm::EDGetTokenT<bool> hbheIsoNoiseFilterResultToken_;
0182 edm::InputTag CSCHaloResultTag_;
0183 edm::EDGetTokenT<bool> CSCHaloResultToken_;
0184 edm::InputTag CSCHalo2015ResultTag_;
0185 edm::EDGetTokenT<bool> CSCHalo2015ResultToken_;
0186 edm::InputTag EcalDeadCellTriggerTag_;
0187 edm::EDGetTokenT<bool> EcalDeadCellTriggerToken_;
0188 edm::InputTag eeBadScFilterTag_;
0189 edm::EDGetTokenT<bool> eeBadScFilterToken_;
0190 edm::InputTag EcalDeadCellBoundaryTag_;
0191 edm::EDGetTokenT<bool> EcalDeadCellBoundaryToken_;
0192 edm::InputTag HcalStripHaloTag_;
0193 edm::EDGetTokenT<bool> HcalStripHaloToken_;
0194
0195 edm::EDGetTokenT<pat::METCollection> patMetToken_;
0196 edm::EDGetTokenT<reco::PFMETCollection> pfMetToken_;
0197 edm::EDGetTokenT<reco::CaloMETCollection> caloMetToken_;
0198
0199 edm::InputTag inputJetIDValueMap;
0200 edm::EDGetTokenT<edm::ValueMap<reco::JetID>> jetID_ValueMapToken_;
0201
0202 edm::ESGetToken<L1GtTriggerMenu, L1GtTriggerMenuRcd> l1gtTrigMenuToken_;
0203
0204 JetIDSelectionFunctor jetIDFunctorLoose;
0205 PFJetIDSelectionFunctor pfjetIDFunctorLoose;
0206
0207 std::string m_l1algoname_;
0208 int m_bitAlgTechTrig_;
0209
0210 double ptThreshold_;
0211
0212 HLTConfigProvider hltConfig_;
0213 HLTConfigProvider FilterhltConfig_;
0214 edm::InputTag triggerResultsLabel_;
0215 edm::EDGetTokenT<edm::TriggerResults> triggerResultsToken_;
0216
0217 std::string HBHENoiseStringMiniAOD;
0218 std::string HBHEIsoNoiseStringMiniAOD;
0219
0220 edm::EDGetTokenT<reco::JetCorrector> jetCorrectorToken_;
0221
0222 edm::VParameterSet triggerSelectedSubFolders_;
0223 std::vector<GenericTriggerEventFlag*> triggerFolderEventFlag_;
0224 std::vector<std::vector<std::string>> triggerFolderExpr_;
0225 std::vector<std::string> triggerFolderLabels_;
0226 std::vector<int> triggerFolderDecisions_;
0227
0228
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251 MonitorElement* hMETRate;
0252
0253 edm::ParameterSet cleaningParameters_;
0254 std::vector<edm::ParameterSet> diagnosticsParameters_;
0255
0256 std::string hltPhysDec_;
0257
0258 int nbinsPV_;
0259 double nPVMin_;
0260 double nPVMax_;
0261
0262 int LSBegin_;
0263 int LSEnd_;
0264
0265 bool bypassAllPVChecks_;
0266 bool bypassAllDCSChecks_;
0267 bool runcosmics_;
0268 bool onlyCleaned_;
0269
0270
0271
0272
0273
0274
0275
0276
0277
0278
0279
0280
0281
0282
0283
0284 int numPV_;
0285
0286
0287
0288
0289
0290 double hfCalibFactor_;
0291
0292
0293 JetMETDQMDCSFilter* DCSFilter_;
0294
0295 std::vector<std::string> folderNames_;
0296
0297 math::XYZPoint beamSpot_;
0298
0299
0300
0301
0302
0303
0304 MonitorElement* lumisecME;
0305
0306 MonitorElement* hMEx;
0307 MonitorElement* hMEy;
0308
0309 MonitorElement* hMETSig;
0310 MonitorElement* hMET;
0311 MonitorElement* hMET_2;
0312
0313 MonitorElement* hMET_HBHENoiseFilter;
0314 MonitorElement* hMET_CSCTightHaloFilter;
0315 MonitorElement* hMET_eeBadScFilter;
0316 MonitorElement* hMET_EcalDeadCellTriggerFilter;
0317 MonitorElement* hMET_EcalDeadCellBoundaryFilter;
0318 MonitorElement* hMET_HBHEIsoNoiseFilter;
0319 MonitorElement* hMET_CSCTightHalo2015Filter;
0320 MonitorElement* hMET_HcalStripHaloFilter;
0321
0322 MonitorElement* hMETPhi;
0323 MonitorElement* hSumET;
0324
0325 MonitorElement* hMExLS;
0326 MonitorElement* hMEyLS;
0327
0328 MonitorElement* hMET_logx;
0329 MonitorElement* hSumET_logx;
0330
0331
0332 MonitorElement* hCaloMETPhi020;
0333 MonitorElement* hCaloEtFractionHadronic;
0334 MonitorElement* hCaloEmEtFraction;
0335
0336
0337
0338 MonitorElement* hCaloEmEtFraction020;
0339
0340 MonitorElement* hCaloHadEtInHB;
0341 MonitorElement* hCaloHadEtInHO;
0342 MonitorElement* hCaloHadEtInHE;
0343 MonitorElement* hCaloHadEtInHF;
0344 MonitorElement* hCaloEmEtInHF;
0345 MonitorElement* hCaloEmEtInEE;
0346 MonitorElement* hCaloEmEtInEB;
0347
0348 MonitorElement* hCaloEmMEx;
0349 MonitorElement* hCaloEmMEy;
0350
0351 MonitorElement* hCaloEmMET;
0352 MonitorElement* hCaloEmMETPhi;
0353
0354
0355 MonitorElement* hCaloHaMEx;
0356 MonitorElement* hCaloHaMEy;
0357
0358 MonitorElement* hCaloHaMET;
0359 MonitorElement* hCaloHaMETPhi;
0360
0361
0362
0363 MonitorElement* mePhotonEtFraction;
0364 MonitorElement* mePhotonEt;
0365 MonitorElement* meNeutralHadronEtFraction;
0366 MonitorElement* meNeutralHadronEt;
0367 MonitorElement* meElectronEt;
0368 MonitorElement* meChargedHadronEtFraction;
0369 MonitorElement* meChargedHadronEt;
0370 MonitorElement* meMuonEt;
0371 MonitorElement* meHFHadronEtFraction;
0372 MonitorElement* meHFHadronEt;
0373 MonitorElement* meHFEMEtFraction;
0374 MonitorElement* meHFEMEt;
0375
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388
0389
0390
0391
0392
0393
0394
0395
0396
0397
0398 MonitorElement* mePhotonEtFraction_BXm1Empty;
0399 MonitorElement* meNeutralHadronEtFraction_BXm1Empty;
0400 MonitorElement* meChargedHadronEtFraction_BXm1Empty;
0401 MonitorElement* meMET_BXm1Empty;
0402 MonitorElement* meSumET_BXm1Empty;
0403
0404 MonitorElement* meMETPhiChargedHadronsBarrel_BXm1Empty;
0405 MonitorElement* meMETPhiChargedHadronsEndcapPlus_BXm1Empty;
0406 MonitorElement* meMETPhiChargedHadronsEndcapMinus_BXm1Empty;
0407 MonitorElement* meMETPhiNeutralHadronsBarrel_BXm1Empty;
0408 MonitorElement* meMETPhiNeutralHadronsEndcapPlus_BXm1Empty;
0409 MonitorElement* meMETPhiNeutralHadronsEndcapMinus_BXm1Empty;
0410 MonitorElement* meMETPhiPhotonsBarrel_BXm1Empty;
0411 MonitorElement* meMETPhiPhotonsEndcapPlus_BXm1Empty;
0412 MonitorElement* meMETPhiPhotonsEndcapMinus_BXm1Empty;
0413 MonitorElement* meMETPhiHFHadronsPlus_BXm1Empty;
0414 MonitorElement* meMETPhiHFHadronsMinus_BXm1Empty;
0415 MonitorElement* meMETPhiHFEGammasPlus_BXm1Empty;
0416 MonitorElement* meMETPhiHFEGammasMinus_BXm1Empty;
0417
0418
0419 MonitorElement* mePhotonEtFraction_BXm1Filled;
0420 MonitorElement* meNeutralHadronEtFraction_BXm1Filled;
0421 MonitorElement* meChargedHadronEtFraction_BXm1Filled;
0422 MonitorElement* meMET_BXm1Filled;
0423 MonitorElement* meSumET_BXm1Filled;
0424
0425 MonitorElement* meMETPhiChargedHadronsBarrel_BXm1Filled;
0426 MonitorElement* meMETPhiChargedHadronsEndcapPlus_BXm1Filled;
0427 MonitorElement* meMETPhiChargedHadronsEndcapMinus_BXm1Filled;
0428 MonitorElement* meMETPhiNeutralHadronsBarrel_BXm1Filled;
0429 MonitorElement* meMETPhiNeutralHadronsEndcapPlus_BXm1Filled;
0430 MonitorElement* meMETPhiNeutralHadronsEndcapMinus_BXm1Filled;
0431 MonitorElement* meMETPhiPhotonsBarrel_BXm1Filled;
0432 MonitorElement* meMETPhiPhotonsEndcapPlus_BXm1Filled;
0433 MonitorElement* meMETPhiPhotonsEndcapMinus_BXm1Filled;
0434 MonitorElement* meMETPhiHFHadronsPlus_BXm1Filled;
0435 MonitorElement* meMETPhiHFHadronsMinus_BXm1Filled;
0436 MonitorElement* meMETPhiHFEGammasPlus_BXm1Filled;
0437 MonitorElement* meMETPhiHFEGammasMinus_BXm1Filled;
0438
0439
0440
0441
0442
0443
0444
0445
0446
0447 MonitorElement* meCHF_Barrel;
0448 MonitorElement* meCHF_EndcapPlus;
0449 MonitorElement* meCHF_EndcapMinus;
0450 MonitorElement* meCHF_Barrel_BXm1Empty;
0451 MonitorElement* meCHF_EndcapPlus_BXm1Empty;
0452 MonitorElement* meCHF_EndcapMinus_BXm1Empty;
0453
0454
0455
0456 MonitorElement* meCHF_Barrel_BXm1Filled;
0457 MonitorElement* meCHF_EndcapPlus_BXm1Filled;
0458 MonitorElement* meCHF_EndcapMinus_BXm1Filled;
0459
0460
0461
0462
0463 MonitorElement* meNHF_Barrel;
0464 MonitorElement* meNHF_EndcapPlus;
0465 MonitorElement* meNHF_EndcapMinus;
0466 MonitorElement* meNHF_Barrel_BXm1Empty;
0467 MonitorElement* meNHF_EndcapPlus_BXm1Empty;
0468 MonitorElement* meNHF_EndcapMinus_BXm1Empty;
0469
0470
0471
0472 MonitorElement* meNHF_Barrel_BXm1Filled;
0473 MonitorElement* meNHF_EndcapPlus_BXm1Filled;
0474 MonitorElement* meNHF_EndcapMinus_BXm1Filled;
0475
0476
0477
0478
0479 MonitorElement* mePhF_Barrel;
0480 MonitorElement* mePhF_EndcapPlus;
0481 MonitorElement* mePhF_EndcapMinus;
0482 MonitorElement* mePhF_Barrel_BXm1Empty;
0483 MonitorElement* mePhF_EndcapPlus_BXm1Empty;
0484 MonitorElement* mePhF_EndcapMinus_BXm1Empty;
0485
0486
0487
0488 MonitorElement* mePhF_Barrel_BXm1Filled;
0489 MonitorElement* mePhF_EndcapPlus_BXm1Filled;
0490 MonitorElement* mePhF_EndcapMinus_BXm1Filled;
0491
0492
0493
0494
0495 MonitorElement* meHFHadF_Plus;
0496 MonitorElement* meHFHadF_Minus;
0497 MonitorElement* meHFHadF_Plus_BXm1Empty;
0498 MonitorElement* meHFHadF_Minus_BXm1Empty;
0499
0500
0501 MonitorElement* meHFHadF_Plus_BXm1Filled;
0502 MonitorElement* meHFHadF_Minus_BXm1Filled;
0503
0504
0505
0506 MonitorElement* meHFEMF_Plus;
0507 MonitorElement* meHFEMF_Minus;
0508 MonitorElement* meHFEMF_Plus_BXm1Empty;
0509 MonitorElement* meHFEMF_Minus_BXm1Empty;
0510
0511
0512 MonitorElement* meHFEMF_Plus_BXm1Filled;
0513 MonitorElement* meHFEMF_Minus_BXm1Filled;
0514
0515
0516
0517
0518
0519
0520
0521
0522
0523
0524
0525
0526
0527
0528
0529
0530
0531 double ptMinCand_;
0532
0533
0534 std::vector<MonitorElement*> profilePFCand_x_, profilePFCand_y_;
0535 std::vector<std::string> profilePFCand_x_name_, profilePFCand_y_name_;
0536 std::vector<double> etaMinPFCand_, etaMaxPFCand_, MExPFCand_, MEyPFCand_;
0537 std::vector<int> typePFCand_, countsPFCand_, etaNBinsPFCand_;
0538
0539 MonitorElement* meMETPhiChargedHadronsBarrel;
0540 MonitorElement* meMETPhiChargedHadronsEndcapPlus;
0541 MonitorElement* meMETPhiChargedHadronsEndcapMinus;
0542 MonitorElement* meMETPhiNeutralHadronsBarrel;
0543 MonitorElement* meMETPhiNeutralHadronsEndcapPlus;
0544 MonitorElement* meMETPhiNeutralHadronsEndcapMinus;
0545 MonitorElement* meMETPhiPhotonsBarrel;
0546 MonitorElement* meMETPhiPhotonsEndcapPlus;
0547 MonitorElement* meMETPhiPhotonsEndcapMinus;
0548 MonitorElement* meMETPhiHFHadronsPlus;
0549 MonitorElement* meMETPhiHFHadronsMinus;
0550 MonitorElement* meMETPhiHFEGammasPlus;
0551 MonitorElement* meMETPhiHFEGammasMinus;
0552
0553 edm::EDGetTokenT<std::vector<reco::PFCandidate>> pflowToken_;
0554 edm::EDGetTokenT<std::vector<pat::PackedCandidate>> pflowPackedToken_;
0555
0556
0557
0558 MonitorElement* meMEx_profile;
0559 MonitorElement* meMEy_profile;
0560 MonitorElement* meMET_profile;
0561 MonitorElement* meSumET_profile;
0562
0563 MonitorElement* mePhotonEtFraction_profile;
0564 MonitorElement* mePhotonEt_profile;
0565 MonitorElement* meNeutralHadronEtFraction_profile;
0566 MonitorElement* meNeutralHadronEt_profile;
0567 MonitorElement* meChargedHadronEtFraction_profile;
0568 MonitorElement* meChargedHadronEt_profile;
0569 MonitorElement* meHFHadronEtFraction_profile;
0570 MonitorElement* meHFHadronEt_profile;
0571 MonitorElement* meHFEMEtFraction_profile;
0572 MonitorElement* meHFEMEt_profile;
0573
0574 MonitorElement* meZJets_u_par;
0575 MonitorElement* meZJets_u_par_ZPt_0_15;
0576 MonitorElement* meZJets_u_par_ZPt_15_30;
0577 MonitorElement* meZJets_u_par_ZPt_30_55;
0578 MonitorElement* meZJets_u_par_ZPt_55_75;
0579 MonitorElement* meZJets_u_par_ZPt_75_150;
0580 MonitorElement* meZJets_u_par_ZPt_150_290;
0581 MonitorElement* meZJets_u_par_ZPt_290;
0582
0583 MonitorElement* meZJets_u_perp;
0584 MonitorElement* meZJets_u_perp_ZPt_0_15;
0585 MonitorElement* meZJets_u_perp_ZPt_15_30;
0586 MonitorElement* meZJets_u_perp_ZPt_30_55;
0587 MonitorElement* meZJets_u_perp_ZPt_55_75;
0588 MonitorElement* meZJets_u_perp_ZPt_75_150;
0589 MonitorElement* meZJets_u_perp_ZPt_150_290;
0590 MonitorElement* meZJets_u_perp_ZPt_290;
0591
0592 std::map<std::string, MonitorElement*> map_dijet_MEs;
0593
0594 bool isCaloMet_;
0595 bool isPFMet_;
0596 bool isMiniAODMet_;
0597
0598 bool fill_met_high_level_histo;
0599 bool fillCandidateMap_histos;
0600 };
0601 #endif